Hi, I'm doing a project in which interchange packets between sensors, but I don't know how I can take the data from a packet with the interface ReceiveMsg.
I get the package so:
Code:
event TOS_MsgPtr ReceiveMsg.receive(TOS_MsgPtr msg){
call Leds.redToggle();
return msg;
}
The struct of the packet is this:
Code:
typedef struct XSensorHeader{
uint8_t board_id;
uint8_t packet_id; // 3
uint8_t node_id;
uint8_t rsvd;
}__attribute__ ((packed)) XSensorHeader;
typedef struct PData1 {
uint16_t vref;
uint16_t thermistor;
uint16_t light;
uint16_t mic;
uint16_t accelX;
uint16_t accelY;
uint16_t magX;
uint16_t magY;
uint16_t constante;
} __attribute__ ((packed)) PData1;
typedef struct XDataMsg {
XSensorHeader xSensorHeader;
union {
PData1 datap1;
}xData;
} __attribute__ ((packed)) XDataMsg;
I have to do, for example, if I want take the data of light of the message I get.
Thanks.