Look at an existing example, e.g., Oscilloscope.
Basically you want to create a method like you have:
event TOS_MsgPtr ReceiveMsg.receive(TOS_MsgPtr m)
and in the config file you connect it up to the message type
that you have created for it:
components GenericComm as Comm (...)
YourModuleName.ReceiveMsg->Comm.ReceiveMsg[AM_RecieveMsgID];
Actually I'm not sure that reusing ReceiveMsg as a name is a good idea...
See the tutorial for details.
MS
sankar s wrote:
I have written a module for receiving the TOSMsg
but i could not receive the msg.
what i have to do.
the module is given below
//includes sensorboardApp;
includes AM;
includes mouse;
module MouseM {
provides {
interface StdControl;
}
uses {
interface StdControl as Control;
interface Leds;
interface ReceiveMsg;
}
}
implementation {
TOS_MsgPtr buffer,r;
MOUSE_MSG *msg;
uint8_t length,i;
command result_t StdControl.init()
{
call Leds.init();
outp(0X01,UBRR0H);
outp(0X74,UBRR0L);
outp(((0<<FE0)|(0<<DOR0)|(0<<U2X)),UCSR0A);
outp(((0<<UPM01)|(0<<UPM00)|(1<<USBS0)|(1 << UCSZ1) | (0 << UCSZ0)) ,
UCSR0C);
outp(((1 << RXCIE) | (1 << TXCIE) | (1 << RXEN) | (1 << TXEN))
,UCSR0B);
return SUCCESS;
}
command result_t StdControl.start()
{
//buffer=signal ReceiveMsg.receive(r);
return SUCCESS;
}
event TOS_MsgPtr ReceiveMsg.receive(TOS_MsgPtr m) {
call Leds.greenToggle();
msg=(MOUSE_MSG*)&(m->data);
//length=sizeof(msg->data);
if(msg->data>=0 && msg->data<128)
{
outp(msg->data, UDR0);
sbi(UCSR0A, TXC);
call Leds.redToggle();
}
return m;
}
command result_t StdControl.stop()
{
outp(0x00, UCSR0A);
outp(0x00, UCSR0B);
outp(0x00, UCSR0C);
}
}
------------------------------------------------------------------------
Inbox full of spam?
<http://us.rd.yahoo.com/mail/uk/taglines/default/nowyoucan/spam_1gb/*http://us.rd.yahoo.com/evt=40565/*http://uk.docs.yahoo.com/nowyoucan.html>
Get leading spam protection and 1GB storage with All New Yahoo! Mail.
------------------------------------------------------------------------
_______________________________________________
Tinyos-help mailing list
[email protected]
https://mail.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
_______________________________________________
Tinyos-help mailing list
[email protected]
https://mail.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help