That looks like it should work. You do know that there is another
yellowToggle() call in the standard TOSBase, right? Maybe they are
competing with each other...

Also by printing out messages, does this mean you are running a
simulator? Perhaps you can debug in and look at what's actually
happening...

MS

antonio gonga wrote:

Hey MS,
I'm using Micaz and I changed TOSBase to work with Micaz->
           //CC1000RadioIntM as RMac,    /* mica2 */
             CC2420RadioM as RMac,    /* micaz */
It's really a bit strange, I'm correctly receiving messages from Motes in the Java Application, but whenever I send messages to the motes I have problems. all expected behavior is ok. The red led is toggling it means that the messages are being forwarded by the TOSBase... but the typecast to querMsg it's not working.
my query Structure is:
typedef struct queryMsg{
    uint16_t msgType;  //
    uint16_t destID;
    uint16_t upperth;
    uint16_t  lowerth;
}

I send this values in a Java Application(I used MIG to generates the queryMsg.java file.):
queryMsg query = new queryMsg();
     query.set_destID(11);
     query.set_msgType(03);
     query.set_upperth(123);
     query.set_lowerth(120);

I use  MoteIF.send to send the messages
try{
        mote.send(MoteIF.TOS_BCAST_ADDR, query);
   }catch(Exception ex){ ex.printStackTrace(); }

and in the TOSBase I do  this:
event TOS_MsgPtr UARTTokenReceive.receive(TOS_MsgPtr Msg, uint8_t Token) {
    TOS_MsgPtr  pBuf;
    queryMsg *p;
p =(queryMsg*)Msg->data;
    if(p->msgType == 3)
call Leds.yellowToggle(); // as I set msgType= 3I expect the yellow led to toggle... but it's not working.
 //rest of the code suppressed..
} // end of UARTTokenReceive.receive

I printed the messages inside of the Sender.send method and what is being printed is like this:
sent: 8 0 0 0 0 0 -1 -1 10 125 3 0 11 0 123 0 120 0  and decoding it is:
8 0 0 0 0 0 -1 -1 TOS_BCAST_ADDR
10 -> AMType
125 -> TOS_AM_GROUP
3 0 ->msgType
11 0 ->destID
123 0 ->upperth
120 0 ->lowerth.
I don't understand what is wrong... maybe what is missing is the length of the message but I also printed it ans it's equal to 18
please help me...

thanks in advance
-antonio gonga





See what you’re getting into…before you go there. Check it out! <http://newlivehotmail.com>


------------------------------------------------------------------------

_______________________________________________
Tinyos-help mailing list
Tinyos-help@Millennium.Berkeley.EDU
https://mail.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
_______________________________________________
Tinyos-help mailing list
Tinyos-help@Millennium.Berkeley.EDU
https://mail.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help

Reply via email to