interface Resource as Token;
interface ResourceTransferred as TokenTransferred;
interface ResourceRequested as TokenRequested;
+ interface ResourceTransfer as TokenToBeaconTransmit;
+ interface GetNow<bool> as IsTrackingBeacons;
interface GetNow<uint32_t> as CfpEnd;
interface GetNow<ieee154_reftime_t*> as CapStartRefTime;
interface GetNow<uint8_t*> as GtsField;
return IEEE154_INVALID_HANDLE;
}
- event void TokenTransferred.transferred()
+ async event void TokenTransferred.transferred()
{
// the CFP has started, this component now owns the token -
// because GTS is not implemented we release the token
- // immediately; the general rule is: as long as a component
- // owns the token it has exclusive access to the radio
- call Token.release();
+ // (or pass it back to BeaconTransmitP if
+ // we are not tracking beacons)
+ if (call IsTrackingBeacons.getNow())
+ call Token.release();
+ else
+ call TokenToBeaconTransmit.transfer();
}
- async event void CfpEndAlarm.fired() { }
+ async event void CfpEndAlarm.fired() {}
async event void CfpSlotAlarm.fired() {}
- async event void RadioOff.offDone()
- {
- call Token.release();
- }
+ async event void RadioOff.offDone() {}
command uint8_t GtsInfoWrite.write(uint8_t *gtsSpecField, uint8_t maxlen)
{