LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

backslash message

Hi

 

I need to read a BSON message, when I show the string in a indicator(backslash notation) it is like this:

 

\03position\00\13\00\00\00\10x\00@\01\00\00\10y\00\00\01\00\00

 

I don't know how to get the U32 values (in bold)  after x and y position, any idea?

 

Thanks a lot

0 Kudos
Message 1 of 5
(1,154 Views)

Break those 4 bytes out of the string,  use typecast with a U32 constant wired in to convert that to a U32 value.

0 Kudos
Message 2 of 5
(1,136 Views)

Than you.

 

After breaking in 4 bytes, I had to convert it to byte array (U8), then a typecast to u32 to get the value.

0 Kudos
Message 3 of 5
(1,062 Views)

Hi Pau,

 

you don't need to convert to U8 array, just typecast your string (of 4 chars) to U32…

Best regards,
GerdW
CLAD expired, using LV2011SP1 + LV2017 (+LV2019 sometimes) on Win7+cRIO
Kudos are welcome Smiley Wink

0 Kudos
Message 4 of 5
(1,054 Views)

@GerdW wrote:

Hi Pau,

 

you don't need to convert to U8 array, just typecast your string (of 4 chars) to U32…


Or use Unflatten From String.  I prefer the Unflatten just in case the data decides to be Little Endian instead of Big Endian.  The Type Cast assumes Big Endian.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
0 Kudos
Message 5 of 5
(1,042 Views)