10-16-2019 08:29 AM
Hello all
I need to read incoming data using UDP and then convert read UDP_string data to Typedef Cluster of U16 U8 U16 and U16[]. i tried using Unflatten from string pallete to wire type def cluster to Type terminal and then wire UDP Read string to binary string and passing "true" constant to terminal "Data Includes Array". I am getting error 74. Not sure what could be the reason for this error. Please help me with a best way to deal with this.
10-16-2019 08:33 AM
Hi Vive,
@VivekaSheregar wrote:
i tried using Unflatten from string pallete to wire type def cluster to Type terminal and then wire UDP Read string to binary string and passing "true" constant to terminal "Data Includes Array". I am getting error 74.
So you create a VI, which is not working. And you need help to improve this VI.
But you hesitate to attach that VI? How should we improve it then?
When you attach your VI: don't forget to include some useful default data in your "UDP read string" indicator!
10-16-2019 08:54 AM
I see a couple of possible issues:
1. Your type def cluster does not match what is being sent
2. The sent data does not include the array size in the flattened data
We definitely need some example data to proceed any further. If you have the sender code as well, that would be helpful.
10-16-2019 10:04 AM
From your description it sounds like you shouldn't use "Data includes Array" as i assume it indicates that it'd mean an array of said cluster. But i might be wrong.
/Y
10-16-2019 10:21 AM
@Yamaeda wrote:
From your description it sounds like you shouldn't use "Data includes Array" as i assume it indicates that it'd mean an array of said cluster. But i might be wrong.
The actual input is "Data Includes Array Or String Size". But regardless, if you have an array or string inside of a cluster, that input is ignored and it is assumed the sizes are in the data. It kind of has to otherwise you don't know where the next element in the cluster begins. Do note that the same rules applies to the Flatten Into String.
10-16-2019 10:45 AM
Aside from attaching your VI, who wrote that data? Another LabVIEW program of some other software? How did it write it? You have any description of the format or can show the relevant code.
It's in all cases doable but the correct answer depends on the answers to these questions. If it was not written by LabVIEW you may need to have to split the parsing into multiple Unflatten functions to get it working.
10-16-2019 11:42 AM
Here is the attached screenshot of a vi..
10-16-2019 01:08 PM - edited 10-16-2019 01:11 PM
Please attach actual VI as requested, and not a picture of a VI.
Problems I think I see from the picture.
1. You unflatten from string and say the data has the array size, but your raw data does not have the bytes that would indicate the array size.
2. You wire a U16 to your case structure, but the selector consists of 4 bytes and not 2.
10-16-2019 01:20 PM
@RavensFan wrote:
2. You wire a U16 to your case structure, but the selector consists of 4 bytes and not 2.
So we assume the Message ID is actually an U32. That still makes the U16 message length 0x0085 = 133 (bytes? samples?). We are nowhere close to reaching that length. The rest would make sense though since there are 6 bytes left for, I assume based on the constant display, 3 U16 values.
So we are back to these questions:
1. Where did this data come from?
2. What is the EXACT protocol for the data?
10-16-2019 03:50 PM
This data is coming from the Unit Under Test which has code written in C. I am not really sure if C code uses flatten to string method to transmit UDP Packets.
I am trying to figure out the best way to parse this data.
Instead of using split string pallet and String to Byte Array Function, i want to follow Unflatten from String method. Please suggest the best method.