interface Alarm<TSymbolIEEE802154,uint32_t> as BLEAlarm;
interface Alarm<TSymbolIEEE802154,uint32_t> as RxWaitAlarm;
interface TransferableResource as RadioToken;
+ interface ResourceRequested as RadioTokenRequested;
interface SuperframeStructure;
interface GetNow<token_requested_t> as IsRadioTokenRequested;
interface GetNow<bool> as IsRxEnableActive;
command error_t WasRxEnabled.enable() {return FAIL;}
command error_t WasRxEnabled.disable() {return FAIL;}
+ async event void RadioTokenRequested.requested(){ updateState(); }
+ async event void RadioTokenRequested.immediateRequested(){ updateState(); }
}
{
interface Timer<TSymbolIEEE802154> as IndirectTxWaitTimer;
interface TransferableResource as RadioToken;
+ interface ResourceRequested as RadioTokenRequested;
interface GetNow<token_requested_t> as IsRadioTokenRequested;
interface GetNow<bool> as IsRxEnableActive;
interface Set<ieee154_macSuperframeOrder_t> as SetMacSuperframeOrder;
else if (call IsRadioTokenRequested.getNow()) {
if (call RadioOff.isOff()) {
// nothing more to do... just release the Token
- m_lock = FALSE; // unlock
dbg_serial("DispatchUnslottedCsmaP", "Token requested: releasing it.\n");
+ call RadioToken.request(); // we want it back afterwards ...
+ m_lock = FALSE; // unlock
call RadioToken.release();
return;
} else
command error_t WasRxEnabled.disable() {return FAIL;}
default event void MLME_START.confirm(ieee154_status_t status) {}
async event void RadioToken.transferredFrom(uint8_t fromClientID) {ASSERT(0);}
+ async event void RadioTokenRequested.requested(){ updateState(); }
+ async event void RadioTokenRequested.immediateRequested(){ updateState(); }
}
interface SlottedCsmaCa;
interface UnslottedCsmaCa;
interface TransferableResource as RadioToken;
+ interface ResourceRequested as RadioTokenRequested;
}
}
implementation
SlottedCsmaCa = RadioControlP.SlottedCsmaCa[clientID];
UnslottedCsmaCa = RadioControlP.UnslottedCsmaCa[clientID];
RadioToken = RadioControlP.TransferableResource[clientID];
+ RadioTokenRequested = RadioControlP.ResourceRequested[clientID];
}
DeviceCap.BLEAlarm = Alarm4;
DeviceCap.RxWaitAlarm = Alarm5;
DeviceCap.RadioToken -> DeviceCapRadioClient;
+ DeviceCap.RadioTokenRequested -> DeviceCapRadioClient;
DeviceCap.SuperframeStructure -> BeaconSynchronizeP.IncomingSF;
DeviceCap.IsRxEnableActive -> RxEnableP.IsRxEnableActive;
DeviceCap.IsRadioTokenRequested -> PibP.IsRadioTokenRequested; // fan out...
CoordCap.CapEndAlarm = Alarm6;
CoordCap.BLEAlarm = Alarm7;
CoordCap.RadioToken -> CoordCapRadioClient;
+ CoordCap.RadioTokenRequested -> CoordCapRadioClient;
CoordCap.SuperframeStructure -> BeaconTransmitP.OutgoingSF;
CoordCap.IsRxEnableActive -> RxEnableP.IsRxEnableActive;
CoordCap.IsRadioTokenRequested -> PibP.IsRadioTokenRequested; // fan out...
DispatchP.SetMacSuperframeOrder -> PibP.SetMacSuperframeOrder;
DispatchP.SetMacPanCoordinator -> PibP.SetMacPanCoordinator;
DispatchP.IsRxEnableActive -> RxEnableP.IsRxEnableActive;
+ DispatchP.RadioTokenRequested -> DispatchRadioClient;
DispatchP.IsRadioTokenRequested -> PibP.IsRadioTokenRequested; // fan out...
DispatchP.IsRadioTokenRequested -> PromiscuousModeP.IsRadioTokenRequested;
DispatchP.IsRadioTokenRequested -> ScanP.IsRadioTokenRequested;
typedef bool token_requested_t __attribute__((combine(rcombine)));
token_requested_t rcombine(token_requested_t r1, token_requested_t r2)
{
- return r1 && r2;
+ return r1 || r2;
}
#ifdef TKN154_DEBUG
interface Alarm<TSymbolIEEE802154,uint32_t> as RxWaitAlarm;
interface GetNow<token_requested_t> as IsRadioTokenRequested;
interface TransferableResource as RadioToken;
+ interface ResourceRequested as RadioTokenRequested;
interface SuperframeStructure;
interface GetNow<bool> as IsRxEnableActive;
interface Get<ieee154_txframe_t*> as GetIndirectTxFrame;
command error_t WasRxEnabled.enable(){return FAIL;}
command error_t WasRxEnabled.disable(){return FAIL;}
event void PIBUpdateMacRxOnWhenIdle.notify( const void* val ) {}
+ async event void RadioTokenRequested.requested(){ }
+ async event void RadioTokenRequested.immediateRequested(){ }
}