[Tinyos-beta-commits] CVS: tinyos-1.x/beta/Drip DripSendM.nc, 1.2,
1.3
Gilman Tolle
gtolle at users.sourceforge.net
Wed Jun 22 11:06:13 PDT 2005
Update of /cvsroot/tinyos/tinyos-1.x/beta/Drip
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21396
Modified Files:
DripSendM.nc
Log Message:
Updated the DripSend interfaces to include one mode for bridged messages with address headers, and one for sent messages without address headers
Index: DripSendM.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-1.x/beta/Drip/DripSendM.nc,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** DripSendM.nc 14 Jun 2005 18:19:35 -0000 1.2
--- DripSendM.nc 22 Jun 2005 18:06:09 -0000 1.3
***************
*** 23,26 ****
--- 23,27 ----
task void sendDoneTask();
+ task void sendMsgDoneTask();
command result_t StdControl.init() {
***************
*** 34,53 ****
command void* Send.getBuffer(TOS_MsgPtr pMsg, uint16_t* length) {
DripMsg* dripMsg = (DripMsg*) &pMsg->data[0];
-
- /* taken out for bridging
AddressMsg* addressMsg = (AddressMsg*) &dripMsg->data[0];
*length = TOSH_DATA_LENGTH -
offsetof(DripMsg,data) - offsetof(AddressMsg, data);
! */
!
! *length = TOSH_DATA_LENGTH - offsetof(DripMsg,data);
!
! return &dripMsg->data[0];
}
command result_t Send.send(TOS_MsgPtr msg, uint16_t length) {
! // Does nothing.
! return FAIL;
}
--- 35,71 ----
command void* Send.getBuffer(TOS_MsgPtr pMsg, uint16_t* length) {
DripMsg* dripMsg = (DripMsg*) &pMsg->data[0];
AddressMsg* addressMsg = (AddressMsg*) &dripMsg->data[0];
*length = TOSH_DATA_LENGTH -
offsetof(DripMsg,data) - offsetof(AddressMsg, data);
!
! return &addressMsg->data[0];
}
command result_t Send.send(TOS_MsgPtr msg, uint16_t length) {
!
! DripMsg* dripMsgIn = (DripMsg*) &msg->data[0];
! AddressMsg* addressMsgIn = (AddressMsg*) &dripMsgIn->data[0];
! AddressMsg* addressMsgOut = (AddressMsg*) &outBuf[0];
!
! if (outBufBusy) {
! return FAIL;
! }
!
! memcpy(addressMsgOut, addressMsgIn, length);
!
! outLength = length;
! msgHolder = msg;
!
! dbg(DBG_USR1, "Addrmsg = %x, addrIn->dest=%d\n", &dripMsgIn->data[0],
! addressMsgIn->dest);
!
! dbg(DBG_USR1, "DripSendM: Bridge-sending a message to group %d, length=%d\n",
! addressMsgOut->dest, length);
!
! call Drip.change();
!
! post sendDoneTask();
! return SUCCESS;
}
***************
*** 56,81 ****
DripMsg* dripMsgIn = (DripMsg*) &msg->data[0];
AddressMsg* addressMsgIn = (AddressMsg*) &dripMsgIn->data[0];
-
AddressMsg* addressMsgOut = (AddressMsg*) &outBuf[0];
! /* taken out for bridging
! AddressMsg* addressMsgOut = (AddressMsg*) &outBuf[0];
- DripMsg* dripMsgIn = (DripMsg*) &msg->data[0];
- AddressMsg* addressMsgIn = (AddressMsg*) &dripMsgIn->data[0];
-
addressMsgOut->source = TOS_LOCAL_ADDRESS;
addressMsgOut->dest = dest;
memcpy(&addressMsgOut->data[0], &addressMsgIn->data[0], length);
- */
-
- // dbg(DBG_USR1, "Addrmsg = %x, addrIn->dest=%d\n", &dripMsgIn->data[0],
- // addressMsgIn->dest);
-
- memcpy(addressMsgOut, addressMsgIn, length);
! outLength = length;
msgHolder = msg;
--- 74,92 ----
DripMsg* dripMsgIn = (DripMsg*) &msg->data[0];
AddressMsg* addressMsgIn = (AddressMsg*) &dripMsgIn->data[0];
AddressMsg* addressMsgOut = (AddressMsg*) &outBuf[0];
! if (outBufBusy) {
! return FAIL;
! }
addressMsgOut->source = TOS_LOCAL_ADDRESS;
addressMsgOut->dest = dest;
memcpy(&addressMsgOut->data[0], &addressMsgIn->data[0], length);
! dbg(DBG_USR1, "Addrmsg = %x, addrIn->dest=%d\n", &dripMsgIn->data[0],
! addressMsgIn->dest);
+ outLength = offsetof(AddressMsg,data) + length;
msgHolder = msg;
***************
*** 85,94 ****
call Drip.change();
! post sendDoneTask();
return SUCCESS;
}
task void sendDoneTask() {
signal SendMsg.sendDone(msgHolder, SUCCESS);
}
--- 96,111 ----
call Drip.change();
! post sendMsgDoneTask();
return SUCCESS;
}
task void sendDoneTask() {
+ signal Send.sendDone(msgHolder, SUCCESS);
+ outBufBusy = FALSE;
+ }
+
+ task void sendMsgDoneTask() {
signal SendMsg.sendDone(msgHolder, SUCCESS);
+ outBufBusy = FALSE;
}
***************
*** 101,108 ****
addressMsgOut->dest);
! memcpy(pData, &outBuf[0],
! offsetof(AddressMsg,data) + outLength);
! call Drip.rebroadcast(msg, pData, offsetof(AddressMsg,data) + outLength);
return SUCCESS;
--- 118,124 ----
addressMsgOut->dest);
! memcpy(pData, &outBuf[0], outLength);
! call Drip.rebroadcast(msg, pData, outLength);
return SUCCESS;
More information about the Tinyos-beta-commits
mailing list