Hi,
I have some problems with the SendMsg.sendDone() as it's not signaled. My
files/modules are as follows:
Makefile:
COMPONENT=IkExp01
PFLAGS += -I%T/platform/pc/CC1000Radio
include ../Makerules
IkTestMsg.h:
enum {
AM_IKTESTMSG = 38
};
typedef struct IkTestMsg
{
uint16_t addr; // Address of receiving mote
uint16_t cnt; // Counter
uint16_t src; // Source address
} IkTestMsg;
IkTest01.nc:
includes IkTestMsg;
configuration IkExp01 {
}
implementation {
components Main, IkExp01M, GenericComm as Comm, TimerC;
Main.StdControl -> IkExp01M.StdControl;
Main.StdControl -> TimerC.StdControl;
IkExp01M.SendMsg -> Comm.SendMsg[AM_IKTESTMSG];
// Starts with sending message only
// IkExp01M.ReceiveMsg -> Comm.ReceiveMsg[AM_IKTESTMSG]; // Commentted
21 Aug 2007
IkExp01M.Timer -> TimerC.Timer[unique("Timer")];
}
IkTest01M.nc:
includes IkTestMsg;
module IkExp01M {
provides interface StdControl;
uses {
interface SendMsg;
// interface ReceiveMsg; // Start with sending first
interface Timer;
}
}
implementation {
bool pending;
TOS_Msg local_msg;
uint16_t counter;
task void SendPacket() {
IkTestMsg *message = (IkTestMsg *)local_msg.data;
if (!pending)
{
pending = TRUE;
message->addr = TOS_BCAST_ADDR;
message->cnt = counter;
atomic {
message->src = TOS_LOCAL_ADDRESS;
}
if (call SendMsg.send(TOS_BCAST_ADDR, sizeof(IkTestMsg), &local_msg))
{
dbg(DBG_USR1, "Sending Message\n");
dbg(DBG_USR1, "Source address = %d\n", message->src);
dbg(DBG_USR1, "Value = %d\n", counter);
}
pending = FALSE;
}
dbg(DBG_USR1, "Pending message in buffer!\n");
}
command result_t StdControl.init() {
pending = FALSE;
return SUCCESS;
}
command result_t StdControl.start() {
call Timer.start(TIMER_REPEAT, 1000);
return SUCCESS;
}
command result_t StdControl.stop() {
call Timer.stop();
return SUCCESS;
}
event result_t Timer.fired() {
post SendPacket();
return SUCCESS;
}
event result_t SendMsg.sendDone(TOS_MsgPtr msg, result_t success) {
if (pending && msg == &local_msg)
{
pending = FALSE;
dbg(DBG_USR1, "Message Sending Done\n");
counter++;
}
return SUCCESS;
}
}
I am running my modules in TOSSIM (TinyOS 1.x) and Cygwin. Seems to me that
after the first sending, there is a message pending in the buffer.
Any suggestions would be appreciated.
Many thanks,
Ittipong
_______________________________________________
Tinyos-help mailing list
[email protected]
https://mail.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help