06-10-2013 06:45 PM
I have a server (PC.vi) and client (xbee.vi) and have set up a simple TCP connection.
The server (PC) sends a flattened array of doubles to the client (xbee). When the client attempts to unflatten it and print out the values they look different from what the server is sending.
I'm not able to understand why.
I have attached both files (and 1 dependency file: createsetuppacket.vi).
Solved! Go to Solution.
06-10-2013 06:48 PM
Please note I am sending non-zero values like (1,2,3.5,etc...).
I feel like the server code is correct (flattening) but I'm skeptical about my client code (unflattening).
The client receives the data but I'm thinking I am not casting it correctly.
06-10-2013 07:05 PM
The Type Cast isn't quite going to work for you. The reason is that the length of the array is being prepended to the data in the array when you flatten to string. You need to recover in the same fashion that you are encoding. So you can either use the Type Cast with the PC or you can use the Unflatten from String on the xbee. To reduce the amount of data sent over the ethernet bus (if you care about the extra 4 bytes) I would use the Type Cast on both sides.
06-11-2013 03:48 PM
crossruiz -
I have uploaded a simple example of an array of 3 double values. I flatten it and then immediately attempt to unflatten it, however I am still not successful.
I would greatly appreciate it if you, or anyone, could please modify the program to yeild the same array of 3 dbl values after unflattening.
I feel like there is something I am not understanding.
I will definitely award points.
06-11-2013 04:00 PM - edited 06-11-2013 04:01 PM
You need to provide the actual data type to the type input. So you need to wire a 1D array of doubles to the Unflatten String.