Quantcast
Channel: LabVIEW topics
Viewing all articles
Browse latest Browse all 66767

Cluster to C style struct formatting (Named pipes (Windows), OpenG implementation), best/correct approach?

$
0
0

Greetings, 

 

I am attempting to send commands to 3rd party software through named pipes (Windows). The 3rd party software sets up the named pipes for me so this approach must be used. The 3rd party software subsequently returns data to me through a separate set of named pipes. The command pipe accepts the following structure as an input:

 

typedef struct _pipe_CMD

{

WORD wCMD

BYTE bYte[2]

} PIPE_CMD;

 

An example command has the following values:

 

wCMD = PIPE_CMD_EXAMPLE 

bYte[0] = 0x0001

bYte[1] = 0

 

Similarly, the output pipe returns the following structure:

 

typedef struct _PIPE_OUT_PUT

{

double x

double y

double z

} PIPE_OUT_PUT

 

Question:

What is the best/correct way to imitate the typedef structure above in/from LabVIEW? Note that the named pipe (OpenG implementation) for Windows takes string as input (and similarly returns a string output). 

 

In the below attempts, I am using a named pipe created by LabVIEW to test what can be read after I write my command to the named pipe. At this point in time, I have not been able to get the 3rd party software to respond to any of these commands, when I address the command named pipe and listen on the output named pipe, but I can successfully tap a named pipe providing house-keeping information (read-only). 

 

Attempt 1: Typecasting

See Screenie 1. I cast each of the values to a string and concatenate it for sending through the named pipe. One of the problems here is that I believe type casting 0 creates a NULL character, which is not the intention. The other problem is that I can't actually get the 3rd party software to acknowledge I sent a command!

 

Attempt 2: Flatten cluster to string

See Screenie 2: I create a cluster and flatten it to a string to send it through the named pipe. Here a number of unrepresented characters are apparent in the output. Again, I fear that these are not representative of what I seek to send (i.e. wCmd and bYte[2]). Again, no acknowledgement from the 3rd party software that I sent a command.

 

Thoughts:

Do I need to modify the named pipe call library function node to accept clusters/structs to send what I want? Will this break something else down the line? My attempt returned "gibberish" (Screenie 3), but the same "gibberish" regardless of whether I used method 1 or 2 from above, indicating that perhaps I just don't know how to read what is returned? (Could be saying "You fool, stop that")

 

Many thanks in advance for any feedback!

 

Nicolai


Viewing all articles
Browse latest Browse all 66767

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>