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
(2,751 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
(2,733 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
(2,659 Views)

Hi Pau,

 

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

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 4 of 5
(2,651 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
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 5 of 5
(2,639 Views)