Hello all,

I am attempting to send some information from my computer to some Tmote Sky
sensor nodes (using a program created in C, the program succesfully receives
information from the network), using the nx_struct below that is contained
in a header file gatewaySensor.h to store the information.

    enum
    {
         AM_AUTOMATIONUPDATEMSG = 6,
    };

    typedef nx_struct AutomationUpdateMsg
    {
      nx_uint8_t nodeid;
      nx_uint8_t actionUpdate[5];
    }AutomationUpdateMsg;

 I have used MIG to generate the functions needed to set/get the information
once the struct is created. However I am struggling to understand exactly
how to create the an instantiation of the struct in the C program so that I
can send it over the network. I have looked at the TestSerial.java file in
the /apps/test/ directory to see if it helped but either due to my lack of
understanding of Java or that the process to do the same thing in C is very
different it hasn't helped much.

Amongst other things I have tried:

1) Creating a tmsg_t* to and then assigning the values as follows:


tmsg_t updateMsg;

AutomationUpdateMsg_actionUpdate_set(updateMsg, 0, 5);
AutomationUpdateMsg_actionUpdate_set(updateMsg, 1, 10);
.
.
.
etc where AutomationUpdateMsg_actionUpdate_set is the function created by
MIG for setting the values of the array nx_uint8_t actionUpdate[5];. This
perhaps understandably didn't work very well as program has no idea how big
updateMsg should is and so when trying to set anything but the first value
of the array an error occurs and the program exits.

2) Including the gatewaySensor.h header file into the program that will be
doing the sending so that I can create a version of the struct and then
assign the values manually before sending it over the serial forwarder, but
this doesn't work as the compiler gives me an error along the lines of:

In file gatewaySensor.h error: expected '=', ',', ';', 'asm', or
__attribute__ before 'Automation' as soon as I include the header file.

So my questions are:

1) Are either of the methods I have tried even remotly correct? If so what
am I doing wrong?
2) If they aren't correct could anyone suggest what should be done, or point
me towards an example that may help?

I have Googled until my fingers fell off to no avail, so any
advice/suggestions would be appreciated.

Thanks Derek
_______________________________________________
Tinyos-help mailing list
[email protected]
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help

Reply via email to