Hi,
We have made a custom message for messages that our computer send for our motes
( MoteAppCmdMsg ).
This message is defined by this struct :
**************************************************************************************************************
typedef struct MoteAppCmdMsg {
uint8_t type;
union {
// FOR MOTEAPP_TYPE_SETRATE
uint32_t newrate;
// FOR MOTEAPP_TYPE_SLEEP
uint16_t sleepaddr;
uint16_t thresaddr;
struct
{
uint16_t thres_light;
uint16_t thres_temp;
}threshold;
// pour MOTEAPP_TYPE_SETPOSITION
struct
{
uint16_t X_pos;
uint16_t Y_pos;
uint16_t Z_pos;
}position;
} args;
} __attribute__ ((packed)) MoteAppCmdMsg;
enum {
AM_MOTEAPPCMDMSG = 0x21 //33
};
**************************************************************************************************************
So on our computer application, we fill the differents field of the
message, and so the type field of our message with the lines :
**************************************************************************************************************
moteAppCmdMsg = new MoteAppCmdMsg();
moteAppCmdMsg.set_type(MOTEAPP_TYPE_GETTHRESHOLD); //0x6
mote.send(net.tinyos.message.MoteIF.TOS_BCAST_ADDR, moteAppCmdMsg);
**************************************************************************************************************
All motes receive the message, and create a Bcast.receive event on our nesC
application with the line :
**************************************************************************************************************
event TOS_MsgPtr Bcast.receive(TOS_MsgPtr pMsg, void* payload, uint16_t
payloadLen)
{
MoteAppCmdMsg *pCmdMsg = (MoteAppCmdMsg *)payload;
call Leds.greenToggle();
dbg(Debug, "MoteAppM: Bcast 0x%02x\n", pCmdMsg->type);
if (pCmdMsg->type == MOTEAPP_TYPE_GETTHRESHOLD) // 0x6
{
}
**************************************************************************************************************
So
the problem is that we don't enter on the " if structure ", even we
have previously sent a moteAppCmdMsg with type field filled with 0x6
(MOTEAPP_TYPE_GETTHRESHOLD).
We don't know where is the problem,
Can you help us ?
Best regards,
Tony GOMES and Ahmed
DEHBI
____________________________________________________________________________________
Sick sense of humor? Visit Yahoo! TV's
Comedy with an Edge to see what's on, when.
http://tv.yahoo.com/collections/222_______________________________________________
Tinyos-help mailing list
[email protected]
https://mail.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help