X-Git-Url: https://oss.titaniummirror.com/gitweb/?a=blobdiff_plain;f=apps%2FAntiTheft%2FRoot%2FAntiTheftRootC.nc;h=ada387b5ec1a9ba6750b5d8bf5b3b3c0c67996de;hb=e9bfab607e051bae6afb47b44892ce37541d1b44;hp=c86b240395221cf558e2686ee5b9d1ec08f3f198;hpb=b24c2797f60e5a4d9e565dd4c13122fb68d6dcdf;p=tinyos-2.x.git diff --git a/apps/AntiTheft/Root/AntiTheftRootC.nc b/apps/AntiTheft/Root/AntiTheftRootC.nc index c86b2403..ada387b5 100644 --- a/apps/AntiTheft/Root/AntiTheftRootC.nc +++ b/apps/AntiTheft/Root/AntiTheftRootC.nc @@ -29,6 +29,7 @@ module AntiTheftRootC interface Receive as SettingsReceive; interface StdControl as CollectionControl; + interface StdControl as DisseminationControl; interface RootControl; interface Receive as AlertsReceive; interface AMSend as AlertsForward; @@ -54,7 +55,8 @@ implementation tree */ if (error == SUCCESS) { - call LowPowerListening.setLocalDutyCycle(200); + call LowPowerListening.setLocalWakeupInterval(512); + call DisseminationControl.start(); call CollectionControl.start(); call RootControl.setRoot(); } @@ -91,11 +93,12 @@ implementation { /* Copy payload (newAlert) from collection system to our serial message buffer (fwdAlert), then send our serial message */ - alert_t *fwdAlert = call AlertsForward.getPayload(&fwdMsg); - - *fwdAlert = *newAlert; - if (call AlertsForward.send(AM_BROADCAST_ADDR, &fwdMsg, sizeof *fwdAlert) == SUCCESS) - fwdBusy = TRUE; + alert_t *fwdAlert = call AlertsForward.getPayload(&fwdMsg, sizeof(alert_t)); + if (fwdAlert != NULL) { + *fwdAlert = *newAlert; + if (call AlertsForward.send(AM_BROADCAST_ADDR, &fwdMsg, sizeof *fwdAlert) == SUCCESS) + fwdBusy = TRUE; + } } return msg; }