PFLAGS += -DIEEE154_BEACON_TX_DISABLED -DIEEE154_BEACON_SYNC_DISABLED -DIEEE154_SCAN_DISABLED
PFLAGS += -DPRINTF_BUFFER_SIZE=1000
CFLAGS += -I$(TOSDIR)/lib/printf
+CFLAGS += -DIEEE154_SCAN_DISABLED -DIEEE154_BEACON_SYNC_DISABLED -DIEEE154_BEACON_TX_DISABLED -DIEEE154_RXENABLE_DISABLED -DIEEE154_ASSOCIATION_DISABLED -DIEEE154_DISASSOCIATION_DISABLED -DIEEE154_COORD_REALIGNMENT_DISABLED -DIEEE154_COORD_BROADCAST_DISABLED
include ../Makefile.include
{
interface Init;
interface MLME_ASSOCIATE;
- interface MLME_DISASSOCIATE;
interface MLME_COMM_STATUS;
}
uses
interface FrameExtracted as AssociationResponseExtracted;
interface FrameTx as AssociationResponseTx;
- interface FrameTx as DisassociationIndirectTx;
- interface FrameTx as DisassociationDirectTx;
- interface FrameTx as DisassociationToCoord;
-
- interface FrameRx as DisassociationDirectRxFromCoord;
- interface FrameExtracted as DisassociationExtractedFromCoord;
- interface FrameRx as DisassociationRxFromDevice;
-
interface DataRequest;
interface Timer<TSymbolIEEE802154> as ResponseTimeout;
interface Pool<ieee154_txframe_t> as TxFramePool;
interface MLME_SET;
interface FrameUtility;
interface IEEE154Frame as Frame;
- interface Leds;
interface Get<uint64_t> as LocalExtendedAddress;
interface Ieee802154Debug as Debug;
}
S_IDLE = 0xFF,
};
uint8_t m_payloadAssocRequest[2];
- uint8_t m_payloadDisassocRequest[2];
uint8_t m_payloadAssocResponse[MAX_PENDING_ASSOC_RESPONSES][4];
uint8_t m_coordAddrMode;
uint8_t m_assocRespStatus;
uint16_t m_shortAddress;
bool m_associationOngoing;
- bool m_disAssociationOngoing;
command error_t Init.init()
{
uint8_t i;
call ResponseTimeout.stop();
m_payloadAssocRequest[0] = S_IDLE;
- m_payloadDisassocRequest[0] = S_IDLE;
m_coordAddrMode = 0;
m_associationOngoing = FALSE;
- m_disAssociationOngoing = FALSE;
for (i=0; i<MAX_PENDING_ASSOC_RESPONSES; i++)
m_payloadAssocResponse[i][0] = S_IDLE;
return SUCCESS;
status, 0);
}
-
-/* ------------------- MLME_DISASSOCIATE (initiating) ------------------- */
-
- command ieee154_status_t MLME_DISASSOCIATE.request (
- uint8_t DeviceAddrMode,
- uint16_t DevicePANID,
- ieee154_address_t DeviceAddress,
- ieee154_disassociation_reason_t DisassociateReason,
- bool TxIndirect,
- ieee154_security_t *security
- )
- {
- ieee154_status_t status = IEEE154_SUCCESS;
- ieee154_txframe_t *txFrame=0;
- ieee154_txcontrol_t *txControl=0;
- ieee154_address_t srcAddress;
-
- if (security && security->SecurityLevel)
- status = IEEE154_UNSUPPORTED_SECURITY;
- else if (call MLME_GET.macPANId() != DevicePANID ||
- (DeviceAddrMode != ADDR_MODE_SHORT_ADDRESS && DeviceAddrMode != ADDR_MODE_EXTENDED_ADDRESS))
- status = IEEE154_INVALID_PARAMETER;
- else if (m_disAssociationOngoing || !(txFrame = call TxFramePool.get()))
- status = IEEE154_TRANSACTION_OVERFLOW;
- else if (!(txControl = call TxControlPool.get())){
- call TxFramePool.put(txFrame);
- status = IEEE154_TRANSACTION_OVERFLOW;
- }
- if (status == IEEE154_SUCCESS){
- txFrame->header = &txControl->header;
- txFrame->metadata = &txControl->metadata;
- srcAddress.extendedAddress = call LocalExtendedAddress.get();
- txFrame->headerLen = call FrameUtility.writeHeader(
- txFrame->header->mhr,
- DeviceAddrMode,
- call MLME_GET.macPANId(),
- &DeviceAddress,
- ADDR_MODE_EXTENDED_ADDRESS,
- call MLME_GET.macPANId(),
- &srcAddress,
- TRUE);
- txFrame->header->mhr[MHR_INDEX_FC1] = FC1_ACK_REQUEST | FC1_FRAMETYPE_CMD | FC1_PAN_ID_COMPRESSION;
- txFrame->header->mhr[MHR_INDEX_FC2] = FC2_SRC_MODE_EXTENDED |
- (DeviceAddrMode == ADDR_MODE_SHORT_ADDRESS ? FC2_DEST_MODE_SHORT : FC2_DEST_MODE_EXTENDED);
- m_payloadDisassocRequest[0] = CMD_FRAME_DISASSOCIATION_NOTIFICATION;
- m_payloadDisassocRequest[1] = DisassociateReason;
- txFrame->payload = m_payloadDisassocRequest;
- txFrame->payloadLen = 2;
- m_disAssociationOngoing = TRUE;
- if ((DeviceAddrMode == ADDR_MODE_SHORT_ADDRESS &&
- DeviceAddress.shortAddress == call MLME_GET.macCoordShortAddress()) ||
- (DeviceAddrMode == ADDR_MODE_EXTENDED_ADDRESS &&
- DeviceAddress.extendedAddress == call MLME_GET.macCoordExtendedAddress())){
- status = call DisassociationToCoord.transmit(txFrame);
- } else if (TxIndirect) {
- status = call DisassociationIndirectTx.transmit(txFrame);
- } else {
- status = call DisassociationDirectTx.transmit(txFrame);
- }
- if (status != IEEE154_SUCCESS){
- m_disAssociationOngoing = FALSE;
- call TxFramePool.put(txFrame);
- call TxControlPool.put(txControl);
- }
- }
- call Debug.log(LEVEL_INFO, DISSASSOCIATE_REQUEST, status, 0, 0);
- return status;
- }
-
- event void DisassociationToCoord.transmitDone(ieee154_txframe_t *data, ieee154_status_t status)
- {
- // transmitted a disassociation notification to our coordinator
- uint8_t *mhr = MHR(data), srcAddrOffset = 7;
- uint8_t DeviceAddrMode = (mhr[MHR_INDEX_FC2] & FC2_SRC_MODE_MASK) >> FC2_SRC_MODE_OFFSET;
- uint16_t DevicePANID = *((nxle_uint16_t*) (&(mhr[MHR_INDEX_ADDRESS])));
- ieee154_address_t DeviceAddress;
- if ((mhr[MHR_INDEX_FC2] & FC2_DEST_MODE_MASK) == FC2_DEST_MODE_EXTENDED)
- srcAddrOffset += 6;
- call FrameUtility.convertToNative(&DeviceAddress.extendedAddress, &mhr[srcAddrOffset]);
- call TxControlPool.put((ieee154_txcontrol_t*) ((uint8_t*) data->header - offsetof(ieee154_txcontrol_t, header)));
- call TxFramePool.put(data);
- call Debug.log(LEVEL_INFO, DISSASSOCIATE_TXDONE, status, 2, 0);
- m_disAssociationOngoing = FALSE;
- signal MLME_DISASSOCIATE.confirm(status, DeviceAddrMode, DevicePANID, DeviceAddress);
- }
-
- event void DisassociationIndirectTx.transmitDone(ieee154_txframe_t *data, ieee154_status_t status)
- {
- signal DisassociationDirectTx.transmitDone(data, status);
- }
-
- event void DisassociationDirectTx.transmitDone(ieee154_txframe_t *data, ieee154_status_t status)
- {
- // transmitted a disassociation notification to a device
- uint8_t *mhr = MHR(data), dstAddrOffset = 5;
- uint8_t DeviceAddrMode = (mhr[1] & FC2_DEST_MODE_MASK) >> FC2_DEST_MODE_OFFSET;
- uint16_t DevicePANID = *((nxle_uint16_t*) (&(mhr[MHR_INDEX_ADDRESS])));
- ieee154_address_t DeviceAddress;
- call FrameUtility.convertToNative(&DeviceAddress.extendedAddress, &mhr[dstAddrOffset]);
- call Debug.log(LEVEL_INFO, DISSASSOCIATE_TXDONE, status, 1, 0);
- call TxControlPool.put((ieee154_txcontrol_t*) ((uint8_t*) data->header - offsetof(ieee154_txcontrol_t, header)));
- call TxFramePool.put(data);
- call Debug.log(LEVEL_INFO, DISSASSOCIATE_TXDONE, status, 2, 0);
- m_disAssociationOngoing = FALSE;
- signal MLME_DISASSOCIATE.confirm(status, DeviceAddrMode, DevicePANID, DeviceAddress);
- }
-
-/* ------------------- MLME_DISASSOCIATE (receiving) ------------------- */
-
- event message_t* DisassociationDirectRxFromCoord.received(message_t* frame)
- {
- // received a disassociation notification from the coordinator (direct tx)
- ieee154_address_t address;
- address.extendedAddress = call LocalExtendedAddress.get();
- signal MLME_DISASSOCIATE.indication(address.extendedAddress, frame->data[1], NULL);
- return frame;
- }
-
- event message_t* DisassociationExtractedFromCoord.received(message_t* frame, ieee154_txframe_t *txFrame)
- {
- // received a disassociation notification from the coordinator (indirect transmission)
- return signal DisassociationDirectRxFromCoord.received(frame);
- }
-
- event message_t* DisassociationRxFromDevice.received(message_t* frame)
- {
- // received a disassociation notification from the device
- ieee154_address_t address;
- call Debug.log(LEVEL_INFO, DISSASSOCIATE_RX, 0, 0, 0);
- if (call Frame.getSrcAddrMode(frame) == ADDR_MODE_EXTENDED_ADDRESS &&
- call Frame.getSrcAddr(frame, &address) == SUCCESS)
- signal MLME_DISASSOCIATE.indication(address.extendedAddress, frame->data[1], NULL);
- return frame;
- }
-
/* ------------------- Defaults ------------------- */
- default event void MLME_DISASSOCIATE.indication (
- uint64_t DeviceAddress,
- ieee154_disassociation_reason_t DisassociateReason,
- ieee154_security_t *security
- ){}
- default event void MLME_DISASSOCIATE.confirm (
- ieee154_status_t status,
- uint8_t DeviceAddrMode,
- uint16_t DevicePANID,
- ieee154_address_t DeviceAddress
- ){}
default event void MLME_ASSOCIATE.indication (
uint64_t DeviceAddress,
ieee154_CapabilityInformation_t CapabilityInformation,
interface DataRequest;
interface FrameRx as CoordRealignmentRx;
interface Resource as Token;
+ interface ResourceTransferred as TokenTransferred;
interface ResourceTransfer as TokenToCap;
interface TimeCalc;
interface IEEE154Frame as Frame;
};
norace bool m_tracking = FALSE;
- bool m_updatePending = FALSE;
+ norace bool m_updatePending = FALSE;
uint8_t m_updateLogicalChannel;
bool m_updateTrackBeacon;
bool m_stopTracking = FALSE;
bool m_internalRequest = FALSE;
- uint8_t m_numBeaconsLost;
+ norace uint8_t m_numBeaconsLost;
uint8_t m_coordAddress[8];
message_t m_beaconBuffer;
norace message_t *m_beaconBufferPtr = &m_beaconBuffer;
norace uint16_t m_BLELen;
norace bool m_broadcastPending;
uint8_t m_gtsField[1+1+3*7];
+
task void processBeaconTask();
+ void getNextBeacon();
+ task void signalGrantedTask();
command error_t Reset.init()
{
m_stopTracking = FALSE;
m_updateLogicalChannel = logicalChannel;
m_updateTrackBeacon = trackBeacon;
- m_updatePending = TRUE;
m_internalRequest = FALSE;
+ m_updatePending = TRUE;
call Debug.log(LEVEL_INFO,SyncP_RESOURCE_REQUEST, 0, 0, 0);
call Token.request();
}
event void Token.granted()
{
- bool missed = FALSE;
call Debug.flush();
call Debug.log(LEVEL_INFO,SyncP_GOT_RESOURCE, m_lastBeaconRxTime+m_beaconInterval,
m_beaconInterval, (m_updatePending<<1)+m_tracking);
m_numBeaconsLost = IEEE154_aMaxLostBeacons; // will be reset when beacon is received
call Debug.log(LEVEL_INFO,SyncP_UPDATING, call MLME_GET.macCoordShortAddress(),
call MLME_GET.macPANId(), m_updateLogicalChannel);
- } else {
+ }
+ getNextBeacon();
+ }
+
+ void getNextBeacon()
+ {
+ bool missed = FALSE;
+ if (m_state != S_FIRST_SCAN){
+ // we have received at least one previous beacon
m_state = S_PREPARE;
if (!m_tracking){
call Debug.log(LEVEL_INFO,SyncP_RELEASE_RESOURCE, 0, 0, 0);
return;
}
while (call TimeCalc.hasExpired(m_lastBeaconRxTime, m_dt)){ // missed a beacon
+ missed = TRUE;
call Debug.log(LEVEL_INFO,SyncP_BEACON_MISSED_1, m_lastBeaconRxTime, m_dt, missed);
m_dt += m_beaconInterval;
m_numBeaconsLost++;
- missed = TRUE;
}
if (m_numBeaconsLost >= IEEE154_aMaxLostBeacons){
post processBeaconTask();
signal RadioOff.offDone();
}
+ async event void TokenTransferred.transferred()
+ {
+ if (m_updatePending)
+ post signalGrantedTask();
+ else
+ getNextBeacon();
+ }
+
+ task void signalGrantedTask()
+ {
+ signal Token.granted();
+ }
+
async event void TrackAlarm.fired()
{
call Debug.log(LEVEL_IMPORTANT,SyncP_TRACK_ALARM, m_state,m_lastBeaconRxTime,m_dt);
interface Init as Reset;
interface MLME_START;
interface WriteBeaconField as SuperframeSpecWrite;
- interface Get<bool> as IsSendingBeacons;
+ interface GetNow<bool> as IsSendingBeacons;
interface GetNow<uint32_t> as CapStart;
interface GetNow<ieee154_reftime_t*> as CapStartRefTime;
interface GetNow<uint32_t> as CapLen;
interface MLME_GET;
interface MLME_SET;
interface Resource as Token;
+ interface ResourceTransferred as TokenTransferred;
interface ResourceTransfer as TokenToBroadcast;
interface FrameTx as RealignmentBeaconEnabledTx;
interface FrameTx as RealignmentNonBeaconEnabledTx;
uint16_t m_updatePANId;
uint8_t m_updateLogicalChannel;
uint32_t m_updateStartTime;
- uint8_t m_updateBeaconOrder;
+ norace uint8_t m_updateBeaconOrder;
uint8_t m_updateSuperframeOrder;
bool m_updatePANCoordinator;
bool m_updateBatteryLifeExtension;
m_requests = (REQUEST_CONFIRM_PENDING | REQUEST_UPDATE_SF); // lock
if (coordRealignment)
m_requests |= REQUEST_REALIGNMENT;
- if (!call IsSendingBeacons.get())
- call Token.request();
+ if (m_beaconOrder == 15) // only request token if we're not already transmitting beacons
+ call Token.request();
}
return status;
}
*((nxle_uint16_t*) &realignmentFrame->payload[6]) = 0xFFFF;
realignmentFrame->payloadLen = 8;
- if (call IsSendingBeacons.get()){
+ if (m_beaconOrder < 15){
// we're already transmitting beacons; the realignment frame
// must be sent (broadcast) after the next beacon
if (call RealignmentBeaconEnabledTx.transmit(realignmentFrame) != IEEE154_SUCCESS){
call RadioOff.off();
}
+ async event void TokenTransferred.transferred()
+ {
+ post grantedTask();
+ }
+
async event void RadioOff.offDone()
{
prepareNextBeaconTransmission();
event message_t* BeaconRequestRx.received(message_t* frame)
{
- if (!call IsSendingBeacons.get()){
+ if (m_beaconOrder == 15){
// transmit the beacon frame using unslotted CSMA-CA
// TODO
}
signal MLME_START.confirm(SUCCESS);
}
- command bool IsSendingBeacons.get(){ return m_beaconOrder < 15;}
+ async command bool IsSendingBeacons.getNow()
+ {
+ return (m_beaconOrder < 15) || ((m_requests & REQUEST_CONFIRM_PENDING) && m_updateBeaconOrder < 15);
+ }
async command uint32_t BeaconInterval.getNow() { return m_beaconInterval; }
async command uint32_t CapStart.getNow() { return m_lastBeaconTxTime; }
return (m_realignmentFrame != NULL || m_queueHead != NULL);
}
- event void TokenTransferred.transferred()
+ async event void TokenTransferred.transferred()
{
// CAP has started - are there any broadcast frames to be transmitted?
if (call BeaconFramePendingBit.getNow()){
return SUCCESS;
}
- event void TokenTransferred.transferred()
+ async event void TokenTransferred.transferred()
{
// we got the token, i.e. CAP has just started
uint32_t actualCapLen = call CapLen.getNow();
// and didn't find a beacon for aBaseSuperframeDuration*(2n+1) symbols
// -> transmit current frame using unslotted CSMA-CA
m_numCCA = 1;
- signal Token.granted();
- return;
- }
- else if (actualCapLen < IEEE154_RADIO_GUARD_TIME){
+ } else if (actualCapLen < IEEE154_RADIO_GUARD_TIME){
call Debug.log(LEVEL_IMPORTANT, CapP_TOO_SHORT, superframeDirection, actualCapLen, IEEE154_RADIO_GUARD_TIME);
call TokenToCfp.transfer();
return;
actualCapLen, call CapStart.getNow()+ actualCapLen);
}
updateState();
- call Debug.flush();
}
command ieee154_status_t FrameTx.transmit(ieee154_txframe_t *frame)
event void Token.granted()
{
- // the current frame should be transmitted using unslotted CSMA-CA
- updateState();
+ // will not happen
}
task void tokenRequestedTask()
async event void TokenRequested.requested()
{
+ // TODO: this event can be generated by the BeaconTransmitP or
+ // BeaconSynchronizeP component - in this case the Token should
+ // probably not be released!
atomic {
if (call Token.isOwner()){
if (!m_lock && !(DEVICE_ROLE && m_indirectTxPending) && !(COORD_ROLE && m_bcastFrame))
interface MCPS_DATA;
interface MCPS_PURGE;
} uses {
- interface Get<bool> as IsSendingBeacons;
+ interface GetNow<bool> as IsSendingBeacons;
interface FrameRx as CoordCapRx;
interface FrameTx as DeviceCapTx;
interface FrameTx as CoordCapTx;
// indirect transmission?
} else if ((txOptions & TX_OPTIONS_INDIRECT) &&
- call IsSendingBeacons.get() &&
+ call IsSendingBeacons.getNow() &&
(dstAddrMode >= ADDR_MODE_SHORT_ADDRESS)){
if (dstAddrMode == ADDR_MODE_SHORT_ADDRESS && dstAddr.shortAddress == 0xFFFF){
mhr[MHR_INDEX_FC1] &= ~FC1_ACK_REQUEST;
--- /dev/null
+/*
+ * Copyright (c) 2008, Technische Universitaet Berlin
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * - Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * - Neither the name of the Technische Universitaet Berlin nor the names
+ * of its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
+ * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
+ * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
+ * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * - Revision -------------------------------------------------------------
+ * $Revision$
+ * $Date$
+ * @author Jan Hauer <hauer@tkn.tu-berlin.de>
+ * ========================================================================
+ */
+
+
+#include "TKN154_MAC.h"
+
+module DisassociateP
+{
+ provides
+ {
+ interface Init;
+ interface MLME_DISASSOCIATE;
+ } uses {
+
+ interface FrameTx as DisassociationIndirectTx;
+ interface FrameTx as DisassociationDirectTx;
+ interface FrameTx as DisassociationToCoord;
+
+ interface FrameRx as DisassociationDirectRxFromCoord;
+ interface FrameExtracted as DisassociationExtractedFromCoord;
+ interface FrameRx as DisassociationRxFromDevice;
+
+ interface Pool<ieee154_txframe_t> as TxFramePool;
+ interface Pool<ieee154_txcontrol_t> as TxControlPool;
+ interface MLME_GET;
+ interface FrameUtility;
+ interface IEEE154Frame as Frame;
+ interface Get<uint64_t> as LocalExtendedAddress;
+ interface Ieee802154Debug as Debug;
+ }
+}
+implementation
+{
+ enum {
+ S_IDLE = 0xFF,
+ };
+ uint8_t m_payloadDisassocRequest[2];
+ uint8_t m_coordAddrMode;
+ bool m_disAssociationOngoing;
+
+ command error_t Init.init()
+ {
+ m_payloadDisassocRequest[0] = S_IDLE;
+ m_coordAddrMode = 0;
+ m_disAssociationOngoing = FALSE;
+ return SUCCESS;
+ }
+
+/* ------------------- MLME_DISASSOCIATE (initiating) ------------------- */
+
+ command ieee154_status_t MLME_DISASSOCIATE.request (
+ uint8_t DeviceAddrMode,
+ uint16_t DevicePANID,
+ ieee154_address_t DeviceAddress,
+ ieee154_disassociation_reason_t DisassociateReason,
+ bool TxIndirect,
+ ieee154_security_t *security
+ )
+ {
+ ieee154_status_t status = IEEE154_SUCCESS;
+ ieee154_txframe_t *txFrame=0;
+ ieee154_txcontrol_t *txControl=0;
+ ieee154_address_t srcAddress;
+
+ if (security && security->SecurityLevel)
+ status = IEEE154_UNSUPPORTED_SECURITY;
+ else if (call MLME_GET.macPANId() != DevicePANID ||
+ (DeviceAddrMode != ADDR_MODE_SHORT_ADDRESS && DeviceAddrMode != ADDR_MODE_EXTENDED_ADDRESS))
+ status = IEEE154_INVALID_PARAMETER;
+ else if (m_disAssociationOngoing || !(txFrame = call TxFramePool.get()))
+ status = IEEE154_TRANSACTION_OVERFLOW;
+ else if (!(txControl = call TxControlPool.get())){
+ call TxFramePool.put(txFrame);
+ status = IEEE154_TRANSACTION_OVERFLOW;
+ }
+ if (status == IEEE154_SUCCESS){
+ txFrame->header = &txControl->header;
+ txFrame->metadata = &txControl->metadata;
+ srcAddress.extendedAddress = call LocalExtendedAddress.get();
+ txFrame->headerLen = call FrameUtility.writeHeader(
+ txFrame->header->mhr,
+ DeviceAddrMode,
+ call MLME_GET.macPANId(),
+ &DeviceAddress,
+ ADDR_MODE_EXTENDED_ADDRESS,
+ call MLME_GET.macPANId(),
+ &srcAddress,
+ TRUE);
+ txFrame->header->mhr[MHR_INDEX_FC1] = FC1_ACK_REQUEST | FC1_FRAMETYPE_CMD | FC1_PAN_ID_COMPRESSION;
+ txFrame->header->mhr[MHR_INDEX_FC2] = FC2_SRC_MODE_EXTENDED |
+ (DeviceAddrMode == ADDR_MODE_SHORT_ADDRESS ? FC2_DEST_MODE_SHORT : FC2_DEST_MODE_EXTENDED);
+ m_payloadDisassocRequest[0] = CMD_FRAME_DISASSOCIATION_NOTIFICATION;
+ m_payloadDisassocRequest[1] = DisassociateReason;
+ txFrame->payload = m_payloadDisassocRequest;
+ txFrame->payloadLen = 2;
+ m_disAssociationOngoing = TRUE;
+ if ((DeviceAddrMode == ADDR_MODE_SHORT_ADDRESS &&
+ DeviceAddress.shortAddress == call MLME_GET.macCoordShortAddress()) ||
+ (DeviceAddrMode == ADDR_MODE_EXTENDED_ADDRESS &&
+ DeviceAddress.extendedAddress == call MLME_GET.macCoordExtendedAddress())){
+ status = call DisassociationToCoord.transmit(txFrame);
+ } else if (TxIndirect) {
+ status = call DisassociationIndirectTx.transmit(txFrame);
+ } else {
+ status = call DisassociationDirectTx.transmit(txFrame);
+ }
+ if (status != IEEE154_SUCCESS){
+ m_disAssociationOngoing = FALSE;
+ call TxFramePool.put(txFrame);
+ call TxControlPool.put(txControl);
+ }
+ }
+ call Debug.log(LEVEL_INFO, DISSASSOCIATE_REQUEST, status, 0, 0);
+ return status;
+ }
+
+ event void DisassociationToCoord.transmitDone(ieee154_txframe_t *data, ieee154_status_t status)
+ {
+ // transmitted a disassociation notification to our coordinator
+ uint8_t *mhr = MHR(data), srcAddrOffset = 7;
+ uint8_t DeviceAddrMode = (mhr[MHR_INDEX_FC2] & FC2_SRC_MODE_MASK) >> FC2_SRC_MODE_OFFSET;
+ uint16_t DevicePANID = *((nxle_uint16_t*) (&(mhr[MHR_INDEX_ADDRESS])));
+ ieee154_address_t DeviceAddress;
+ if ((mhr[MHR_INDEX_FC2] & FC2_DEST_MODE_MASK) == FC2_DEST_MODE_EXTENDED)
+ srcAddrOffset += 6;
+ call FrameUtility.convertToNative(&DeviceAddress.extendedAddress, &mhr[srcAddrOffset]);
+ call TxControlPool.put((ieee154_txcontrol_t*) ((uint8_t*) data->header - offsetof(ieee154_txcontrol_t, header)));
+ call TxFramePool.put(data);
+ call Debug.log(LEVEL_INFO, DISSASSOCIATE_TXDONE, status, 2, 0);
+ m_disAssociationOngoing = FALSE;
+ signal MLME_DISASSOCIATE.confirm(status, DeviceAddrMode, DevicePANID, DeviceAddress);
+ }
+
+ event void DisassociationIndirectTx.transmitDone(ieee154_txframe_t *data, ieee154_status_t status)
+ {
+ signal DisassociationDirectTx.transmitDone(data, status);
+ }
+
+ event void DisassociationDirectTx.transmitDone(ieee154_txframe_t *data, ieee154_status_t status)
+ {
+ // transmitted a disassociation notification to a device
+ uint8_t *mhr = MHR(data), dstAddrOffset = 5;
+ uint8_t DeviceAddrMode = (mhr[1] & FC2_DEST_MODE_MASK) >> FC2_DEST_MODE_OFFSET;
+ uint16_t DevicePANID = *((nxle_uint16_t*) (&(mhr[MHR_INDEX_ADDRESS])));
+ ieee154_address_t DeviceAddress;
+ call FrameUtility.convertToNative(&DeviceAddress.extendedAddress, &mhr[dstAddrOffset]);
+ call Debug.log(LEVEL_INFO, DISSASSOCIATE_TXDONE, status, 1, 0);
+ call TxControlPool.put((ieee154_txcontrol_t*) ((uint8_t*) data->header - offsetof(ieee154_txcontrol_t, header)));
+ call TxFramePool.put(data);
+ call Debug.log(LEVEL_INFO, DISSASSOCIATE_TXDONE, status, 2, 0);
+ m_disAssociationOngoing = FALSE;
+ signal MLME_DISASSOCIATE.confirm(status, DeviceAddrMode, DevicePANID, DeviceAddress);
+ }
+
+/* ------------------- MLME_DISASSOCIATE (receiving) ------------------- */
+
+ event message_t* DisassociationDirectRxFromCoord.received(message_t* frame)
+ {
+ // received a disassociation notification from the coordinator (direct tx)
+ ieee154_address_t address;
+ address.extendedAddress = call LocalExtendedAddress.get();
+ signal MLME_DISASSOCIATE.indication(address.extendedAddress, frame->data[1], NULL);
+ return frame;
+ }
+
+ event message_t* DisassociationExtractedFromCoord.received(message_t* frame, ieee154_txframe_t *txFrame)
+ {
+ // received a disassociation notification from the coordinator (indirect transmission)
+ return signal DisassociationDirectRxFromCoord.received(frame);
+ }
+
+ event message_t* DisassociationRxFromDevice.received(message_t* frame)
+ {
+ // received a disassociation notification from the device
+ ieee154_address_t address;
+ call Debug.log(LEVEL_INFO, DISSASSOCIATE_RX, 0, 0, 0);
+ if (call Frame.getSrcAddrMode(frame) == ADDR_MODE_EXTENDED_ADDRESS &&
+ call Frame.getSrcAddr(frame, &address) == SUCCESS)
+ signal MLME_DISASSOCIATE.indication(address.extendedAddress, frame->data[1], NULL);
+ return frame;
+ }
+
+/* ------------------- Defaults ------------------- */
+
+ default event void MLME_DISASSOCIATE.indication (
+ uint64_t DeviceAddress,
+ ieee154_disassociation_reason_t DisassociateReason,
+ ieee154_security_t *security
+ ){}
+ default event void MLME_DISASSOCIATE.confirm (
+ ieee154_status_t status,
+ uint8_t DeviceAddrMode,
+ uint16_t DevicePANID,
+ ieee154_address_t DeviceAddress
+ ){}
+
+}
command void Packet.clear(message_t* msg)
{
- uint8_t i;
memset(msg->header, 0, sizeof(message_header_t));
memset(msg->metadata, 0, sizeof(message_metadata_t));
}
--- /dev/null
+/*
+ * Copyright (c) 2008, Technische Universitaet Berlin
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * - Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * - Neither the name of the Technische Universitaet Berlin nor the names
+ * of its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
+ * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
+ * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
+ * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * - Revision -------------------------------------------------------------
+ * $Revision$
+ * $Date$
+ * @author Jan Hauer <hauer@tkn.tu-berlin.de>
+ * ========================================================================
+ */
+
+#include "TKN154_PHY.h"
+#include "TKN154_MAC.h"
+module PromiscuousModeP
+{
+ provides {
+ interface Init;
+ interface SplitControl as PromiscuousMode;
+ interface Get<bool> as PromiscuousModeGet;
+ interface FrameRx;
+ } uses {
+ interface Resource as Token;
+ interface RadioRx as PromiscuousRx;
+ interface RadioOff;
+ interface Set<bool> as RadioPromiscuousMode;
+ interface Ieee802154Debug as Debug;
+ }
+}
+implementation
+{
+ enum promiscuous_state {
+ S_IDLE,
+ S_STARTING,
+ S_STARTED,
+ S_STOPPING,
+ } m_promiscuousState;
+
+ task void prepareDoneTask();
+ task void radioOffDoneTask();
+
+ command error_t Init.init()
+ {
+ m_promiscuousState = S_IDLE;
+ return SUCCESS;
+ }
+
+/* ----------------------- Promiscuous Mode ----------------------- */
+
+ command bool PromiscuousModeGet.get()
+ {
+ return (m_promiscuousState == S_STARTED);
+ }
+
+ command error_t PromiscuousMode.start()
+ {
+ if (m_promiscuousState != S_IDLE)
+ return FAIL;
+ m_promiscuousState = S_STARTING;
+ call Token.request();
+ call Debug.log(LEVEL_INFO, EnableRxP_PROMISCUOUS_REQUEST, m_promiscuousState, 0, 0);
+ call Debug.flush();
+ return SUCCESS;
+ }
+
+ event void Token.granted()
+ {
+ if (m_promiscuousState != S_STARTING){
+ call Token.release();
+ return;
+ }
+ call RadioPromiscuousMode.set(TRUE);
+ if (call PromiscuousRx.prepare() != IEEE154_SUCCESS){
+ m_promiscuousState = S_IDLE;
+ call Token.release();
+ call Debug.log(LEVEL_IMPORTANT, EnableRxP_RADIORX_ERROR, 0, 0, 0);
+ signal PromiscuousMode.startDone(FAIL);
+ }
+ }
+
+ async event void PromiscuousRx.prepareDone()
+ {
+ post prepareDoneTask();
+ }
+
+ task void prepareDoneTask()
+ {
+ if (m_promiscuousState != S_STARTING){
+ call Token.release();
+ return;
+ }
+ m_promiscuousState = S_STARTED;
+ call PromiscuousRx.receive(NULL, 0);
+ signal PromiscuousMode.startDone(SUCCESS);
+ call Debug.log(LEVEL_INFO, EnableRxP_PROMISCUOUS_ON, m_promiscuousState, 0, 0);
+ }
+
+ event message_t* PromiscuousRx.received(message_t *frame, ieee154_reftime_t *timestamp)
+ {
+ if (m_promiscuousState == S_STARTED){
+ ((ieee154_header_t*) frame->header)->length |= FRAMECTL_PROMISCUOUS;
+ return signal FrameRx.received(frame);
+ } else
+ return frame;
+ }
+
+ command error_t PromiscuousMode.stop()
+ {
+ if (m_promiscuousState != S_STARTED)
+ return FAIL;
+ m_promiscuousState = S_STOPPING;
+ call RadioOff.off();
+ return SUCCESS;
+ }
+
+ async event void RadioOff.offDone()
+ {
+ post radioOffDoneTask();
+ }
+
+ task void radioOffDoneTask()
+ {
+ if (m_promiscuousState != S_STOPPING){
+ call Token.release();
+ return;
+ }
+ m_promiscuousState = S_IDLE;
+ call RadioPromiscuousMode.set(FALSE);
+ call Token.release();
+ signal PromiscuousMode.stopDone(SUCCESS);
+ call Debug.log(LEVEL_INFO, EnableRxP_PROMISCUOUS_OFF, m_promiscuousState, 0, 0);
+ }
+
+ default event void PromiscuousMode.startDone(error_t error){}
+ default event void PromiscuousMode.stopDone(error_t error){}
+}
{
interface Init;
interface MLME_RX_ENABLE;
- interface SplitControl as PromiscuousMode;
- interface FrameRx;
- interface Get<bool> as PromiscuousModeGet;
interface GetNow<bool> as IsRxEnableActive;
interface Notify<bool> as RxEnableStateChange;
}
uses
{
- interface Resource as Token;
- interface RadioRx as PromiscuousRx;
- interface RadioOff;
- interface Set<bool> as RadioPromiscuousMode;
interface Ieee802154Debug as Debug;
interface Timer<TSymbolIEEE802154> as RxEnableTimer;
interface Get<bool> as IsBeaconEnabledPAN;
interface GetNow<bool> as IsTrackingBeacons;
interface GetNow<uint32_t> as IncomingSfStart;
interface GetNow<uint32_t> as IncomingBeaconInterval;
- interface Get<bool> as IsSendingBeacons;
+ interface GetNow<bool> as IsSendingBeacons;
interface GetNow<uint32_t> as OutgoingSfStart;
interface GetNow<uint32_t> as OutgoingBeaconInterval;
interface Notify<bool> as WasRxEnabled;
}
implementation
{
- enum promiscuous_state {
- S_IDLE,
- S_STARTING,
- S_STARTED,
- S_STOPPING,
- } m_promiscuousState;
uint32_t m_rxOnDuration;
uint32_t m_rxOnOffset;
norace bool m_isRxEnabled;
bool m_isRxEnableConfirmPending;
- task void prepareDoneTask();
- task void radioOffDoneTask();
-
command error_t Init.init()
{
if (m_isRxEnableConfirmPending){
if (RxOnTime > 0xFFFFFF || RxOnDuration > 0xFFFFFF)
return IEEE154_INVALID_PARAMETER;
if (call IsBeaconEnabledPAN.get()){
- if (call IsSendingBeacons.get() && call IsMacPanCoordinator.get()){
+ if (call IsSendingBeacons.getNow() && call IsMacPanCoordinator.get()){
// for OUTGOING SUPERFRAME
lastBeaconTime = call OutgoingSfStart.getNow();
beaconInterval = call OutgoingBeaconInterval.getNow();
command error_t RxEnableStateChange.enable(){return FAIL;}
command error_t RxEnableStateChange.disable(){return FAIL;}
-
-/* ----------------------- Promiscuous Mode ----------------------- */
-
- command bool PromiscuousModeGet.get()
- {
- return (m_promiscuousState == S_STARTED);
- }
-
- command error_t PromiscuousMode.start()
- {
- if (m_promiscuousState != S_IDLE)
- return FAIL;
- m_promiscuousState = S_STARTING;
- call Token.request();
- call Debug.log(LEVEL_INFO, EnableRxP_PROMISCUOUS_REQUEST, m_promiscuousState, 0, 0);
- call Debug.flush();
- return SUCCESS;
- }
-
- event void Token.granted()
- {
- if (m_promiscuousState != S_STARTING){
- call Token.release();
- return;
- }
- call RadioPromiscuousMode.set(TRUE);
- if (call PromiscuousRx.prepare() != IEEE154_SUCCESS){
- m_promiscuousState = S_IDLE;
- call Token.release();
- call Debug.log(LEVEL_IMPORTANT, EnableRxP_RADIORX_ERROR, 0, 0, 0);
- signal PromiscuousMode.startDone(FAIL);
- }
- }
-
- async event void PromiscuousRx.prepareDone()
- {
- post prepareDoneTask();
- }
-
- task void prepareDoneTask()
- {
- if (m_promiscuousState != S_STARTING){
- call Token.release();
- return;
- }
- m_promiscuousState = S_STARTED;
- call PromiscuousRx.receive(NULL, 0);
- signal PromiscuousMode.startDone(SUCCESS);
- call Debug.log(LEVEL_INFO, EnableRxP_PROMISCUOUS_ON, m_promiscuousState, 0, 0);
- }
-
- event message_t* PromiscuousRx.received(message_t *frame, ieee154_reftime_t *timestamp)
- {
- if (m_promiscuousState == S_STARTED){
- ((ieee154_header_t*) frame->header)->length |= FRAMECTL_PROMISCUOUS;
- return signal FrameRx.received(frame);
- } else
- return frame;
- }
-
- command error_t PromiscuousMode.stop()
- {
- if (m_promiscuousState != S_STARTED)
- return FAIL;
- m_promiscuousState = S_STOPPING;
- call RadioOff.off();
- return SUCCESS;
- }
-
- async event void RadioOff.offDone()
- {
- post radioOffDoneTask();
- }
-
- task void radioOffDoneTask()
- {
- if (m_promiscuousState != S_STOPPING){
- call Token.release();
- return;
- }
- m_promiscuousState = S_IDLE;
- call RadioPromiscuousMode.set(FALSE);
- call Token.release();
- signal PromiscuousMode.stopDone(SUCCESS);
- call Debug.log(LEVEL_INFO, EnableRxP_PROMISCUOUS_OFF, m_promiscuousState, 0, 0);
- }
-
- default event void PromiscuousMode.startDone(error_t error){}
- default event void PromiscuousMode.stopDone(error_t error){}
default event void MLME_RX_ENABLE.confirm(ieee154_status_t status){}
}
#ifndef __TKN154_H
#define __TKN154_H
-
/****************************************************
* IEEE 802.15.4 Enumerations
*/
// When security is implemented the following line should be commented out
#define IEEE154_SECURITY_DISABLED
+/****************************************************
+ * Flags for disabling MAC functionality (to save program memory)
+ */
+
+// Disable scanning (MLME_SCAN will not work):
+// #define IEEE154_SCAN_DISABLED
+//
+// Disable beacon tracking (MLME_SYNC will not work):
+// #define IEEE154_BEACON_SYNC_DISABLED
+//
+// Disable beacon transmission (MLME_START will not work):
+// #define IEEE154_BEACON_TX_DISABLED
+//
+// Disable promiscuous mode (PromiscuousMode.start() will not work):
+// #define IEEE154_PROMISCUOUS_MODE_DISABLED
+//
+// Disallow next higher layer to switch to receive mode (MLME_RX_ENABLE will not work):
+// #define IEEE154_RXENABLE_DISABLED
+//
+// Disable association (MLME_ASSOCIATE will not work):
+// #define IEEE154_ASSOCIATION_DISABLED
+//
+// Disable association (MLME_DISASSOCIATE will not work):
+// #define IEEE154_DISASSOCIATION_DISABLED
+//
+// Disable coordinator realignment (MLME_ORPHAN will not work):
+// #define IEEE154_COORD_REALIGNMENT_DISABLED
+//
+// Disable transmission of broadcasts from coordinator to devices:
+// #define IEEE154_COORD_BROADCAST_DISABLED
+
/****************************************************
* Static memory allocation for Queue/Pool
*/
}
implementation
{
- components
+ components DataP,
+ PibP,
+ RadioControlP,
+ IndirectTxP,
+ PollP,
+
#ifndef IEEE154_SCAN_DISABLED
ScanP,
#else
NoScanP as ScanP,
#endif
- DataP,
+
+#ifndef IEEE154_ASSOCIATION_DISABLED
AssociateP,
- PollP,
- RxEnableP,
- IndirectTxP,
- PibP,
- RadioControlP,
+#else
+ NoAssociateP as AssociateP,
+#endif
+
+#ifndef IEEE154_DISASSOCIATION_DISABLED
+ DisassociateP,
+#else
+ NoDisassociateP as DisassociateP,
+#endif
#ifndef IEEE154_BEACON_SYNC_DISABLED
BeaconSynchronizeP,
#endif
NoCoordCfpP as CoordCfp,
+#ifndef IEEE154_RXENABLE_DISABLED
+ RxEnableP,
+#else
+ NoRxEnableP as RxEnableP,
+#endif
+
+
+#ifndef IEEE154_PROMISCUOUS_MODE_DISABLED
+ PromiscuousModeP,
+#else
+ NoPromiscuousModeP as PromiscuousModeP,
+#endif
+
+#ifndef IEEE154_COORD_REALIGNMENT_DISABLED
CoordRealignmentP,
+#else
+ NoCoordRealignmentP as CoordRealignmentP,
+#endif
+
+#ifndef IEEE154_COORD_BROADCAST_DISABLED
CoordBroadcastP,
+#else
+ NoCoordBroadcastP as CoordBroadcastP,
+#endif
+
new PoolC(ieee154_txframe_t, TXFRAME_POOL_SIZE) as TxFramePoolP,
new PoolC(ieee154_txcontrol_t, TXCONTROL_POOL_SIZE) as TxControlPoolP,
new QueueC(ieee154_txframe_t*, CAP_TX_QUEUE_SIZE) as DeviceCapQueueC,
//MLME
MLME_START = BeaconTransmitP;
MLME_ASSOCIATE = AssociateP;
+ MLME_DISASSOCIATE = DisassociateP;
MLME_BEACON_NOTIFY = BeaconSynchronizeP;
MLME_BEACON_NOTIFY = ScanP;
MLME_COMM_STATUS = AssociateP;
MLME_COMM_STATUS = CoordRealignmentP;
- MLME_DISASSOCIATE = AssociateP;
MLME_GET = PibP;
MLME_ORPHAN = CoordRealignmentP;
/* MLME_GTS = CfpTransmitP;*/
MLME_SYNC_LOSS = BeaconSynchronizeP;
IEEE154Frame = PibP;
IEEE154BeaconFrame = PibP;
- PromiscuousMode = RxEnableP;
+ PromiscuousMode = PromiscuousModeP;
GetLocalExtendedAddress = PibP.GetLocalExtendedAddress;
IEEE154TxBeaconPayload = BeaconTransmitP;
Packet = PibP;
/* ----------------- Beacon Transmission (MLME-START) ----------------- */
- components new RadioClientC() as StartRadioClient;
+ components new RadioClientC() as BeaconTxRadioClient;
PibP.MacReset -> BeaconTransmitP;
BeaconTransmitP.PIBUpdate[IEEE154_macAssociationPermit] -> PibP.PIBUpdate[IEEE154_macAssociationPermit];
BeaconTransmitP.PIBUpdate[IEEE154_macGTSPermit] -> PibP.PIBUpdate[IEEE154_macGTSPermit];
BeaconTransmitP.BeaconTxAlarm = Alarm1;
BeaconTransmitP.BeaconPayloadUpdateTimer = Timer2;
- BeaconTransmitP.RadioOff -> StartRadioClient;
+ BeaconTransmitP.RadioOff -> BeaconTxRadioClient;
BeaconTransmitP.IsBeaconEnabledPAN -> PibP.IsBeaconEnabledPAN;
- BeaconTransmitP.BeaconTx -> StartRadioClient;
+ BeaconTransmitP.BeaconTx -> BeaconTxRadioClient;
BeaconTransmitP.MLME_SET -> PibP.MLME_SET;
BeaconTransmitP.MLME_GET -> PibP;
BeaconTransmitP.SetMacSuperframeOrder -> PibP.SetMacSuperframeOrder;
BeaconTransmitP.SetMacBeaconTxTime -> PibP.SetMacBeaconTxTime;
BeaconTransmitP.SetMacPanCoordinator -> PibP.SetMacPanCoordinator;
- BeaconTransmitP.Token -> StartRadioClient;
- BeaconTransmitP.TokenToBroadcast -> StartRadioClient;
+ BeaconTransmitP.Token -> BeaconTxRadioClient;
+ BeaconTransmitP.TokenTransferred -> BeaconTxRadioClient;
+ BeaconTransmitP.TokenToBroadcast -> BeaconTxRadioClient;
BeaconTransmitP.RealignmentBeaconEnabledTx -> CoordBroadcastP.RealignmentTx;
BeaconTransmitP.RealignmentNonBeaconEnabledTx -> CoordCapQueue.FrameTx[unique(CAP_TX_CLIENT)];
BeaconTransmitP.BeaconRequestRx -> CoordCap.FrameRx[FC1_FRAMETYPE_CMD + CMD_FRAME_BEACON_REQUEST];
BeaconTransmitP.TimeCalc -> PibP;
BeaconTransmitP.Leds = Leds;
BeaconTransmitP.Debug = Ieee802154Debug[START_CLIENT];
- StartRadioClient.TransferTo -> CoordBroadcastRadioClient.TransferFrom;
+ BeaconTxRadioClient.TransferTo -> CoordBroadcastRadioClient.TransferFrom;
-/* ---------------- Beacon Synchronization (MLME-SYNC) ---------------- */
+/* ------------------ Beacon Tracking (MLME-SYNC) ------------------ */
components new RadioClientC() as SyncRadioClient;
PibP.MacReset -> BeaconSynchronizeP;
BeaconSynchronizeP.IsBeaconEnabledPAN -> PibP.IsBeaconEnabledPAN;
BeaconSynchronizeP.DataRequest -> PollP.DataRequest[SYNC_CLIENT];
BeaconSynchronizeP.Token -> SyncRadioClient;
+ BeaconSynchronizeP.TokenTransferred -> SyncRadioClient;
BeaconSynchronizeP.TokenToCap -> SyncRadioClient;
BeaconSynchronizeP.TimeCalc -> PibP;
BeaconSynchronizeP.CoordRealignmentRx -> DeviceCap.FrameRx[FC1_FRAMETYPE_CMD + CMD_FRAME_COORDINATOR_REALIGNMENT];
BeaconSynchronizeP.Debug = Ieee802154Debug[SYNC_CLIENT];
SyncRadioClient.TransferTo -> DeviceCapRadioClient.TransferFrom;
-/* --------------- Dis/Association (MLME-DIS/ASSOCIATE) --------------- */
+/* -------------------- Association (MLME-ASSOCIATE) -------------------- */
PibP.MacReset -> AssociateP;
AssociateP.AssociationRequestRx -> CoordCap.FrameRx[FC1_FRAMETYPE_CMD + CMD_FRAME_ASSOCIATION_REQUEST];
AssociateP.AssociationRequestTx -> DeviceCapQueue.FrameTx[unique(CAP_TX_CLIENT)];
AssociateP.AssociationResponseExtracted -> DeviceCap.FrameExtracted[FC1_FRAMETYPE_CMD + CMD_FRAME_ASSOCIATION_RESPONSE];
AssociateP.AssociationResponseTx -> IndirectTxP.FrameTx[unique(INDIRECT_TX_CLIENT)];
- AssociateP.DisassociationIndirectTx -> IndirectTxP.FrameTx[unique(INDIRECT_TX_CLIENT)];
- AssociateP.DisassociationDirectTx -> CoordCapQueue.FrameTx[unique(CAP_TX_CLIENT)];
- AssociateP.DisassociationToCoord -> DeviceCapQueue.FrameTx[unique(CAP_TX_CLIENT)];
- AssociateP.DisassociationDirectRxFromCoord ->
- DeviceCap.FrameRx[FC1_FRAMETYPE_CMD + CMD_FRAME_DISASSOCIATION_NOTIFICATION];
- AssociateP.DisassociationExtractedFromCoord ->
- DeviceCap.FrameExtracted[FC1_FRAMETYPE_CMD + CMD_FRAME_DISASSOCIATION_NOTIFICATION];
- AssociateP.DisassociationRxFromDevice ->
- CoordCap.FrameRx[FC1_FRAMETYPE_CMD + CMD_FRAME_DISASSOCIATION_NOTIFICATION];
AssociateP.DataRequest -> PollP.DataRequest[ASSOCIATE_CLIENT];
AssociateP.ResponseTimeout = Timer3;
AssociateP.TxFramePool -> TxFramePoolP;
AssociateP.MLME_SET -> PibP.MLME_SET;
AssociateP.FrameUtility -> PibP;
AssociateP.Frame -> PibP;
- AssociateP.Leds = Leds;
AssociateP.LocalExtendedAddress -> PibP.GetLocalExtendedAddress;
AssociateP.Debug = Ieee802154Debug[ASSOCIATE_CLIENT];
+/* --------------- Disassociation (MLME-DISASSOCIATE) --------------- */
+
+ PibP.MacReset -> DisassociateP;
+ DisassociateP.DisassociationIndirectTx -> IndirectTxP.FrameTx[unique(INDIRECT_TX_CLIENT)];
+ DisassociateP.DisassociationDirectTx -> CoordCapQueue.FrameTx[unique(CAP_TX_CLIENT)];
+ DisassociateP.DisassociationToCoord -> DeviceCapQueue.FrameTx[unique(CAP_TX_CLIENT)];
+ DisassociateP.DisassociationDirectRxFromCoord ->
+ DeviceCap.FrameRx[FC1_FRAMETYPE_CMD + CMD_FRAME_DISASSOCIATION_NOTIFICATION];
+ DisassociateP.DisassociationExtractedFromCoord ->
+ DeviceCap.FrameExtracted[FC1_FRAMETYPE_CMD + CMD_FRAME_DISASSOCIATION_NOTIFICATION];
+ DisassociateP.DisassociationRxFromDevice ->
+ CoordCap.FrameRx[FC1_FRAMETYPE_CMD + CMD_FRAME_DISASSOCIATION_NOTIFICATION];
+ DisassociateP.TxFramePool -> TxFramePoolP;
+ DisassociateP.TxControlPool -> TxControlPoolP;
+ DisassociateP.MLME_GET -> PibP;
+ DisassociateP.FrameUtility -> PibP;
+ DisassociateP.Frame -> PibP;
+ DisassociateP.LocalExtendedAddress -> PibP.GetLocalExtendedAddress;
+ DisassociateP.Debug = Ieee802154Debug[DISASSOCIATE_CLIENT];
+
/* ------------------ Data Transmission (MCPS-DATA) ------------------- */
PibP.MacReset -> DataP;
DataP.DeviceCapTx -> DeviceCapQueue.FrameTx[unique(CAP_TX_CLIENT)];
DataP.CoordCapTx -> CoordCapQueue.FrameTx[unique(CAP_TX_CLIENT)];
DataP.DeviceCapRx -> PollP.DataRx; // indirect
- DataP.DeviceCapRx -> RxEnableP.FrameRx; // promiscuous
+ DataP.DeviceCapRx -> PromiscuousModeP.FrameRx; // promiscuous
DataP.DeviceCapRx -> DeviceCap.FrameRx[FC1_FRAMETYPE_DATA]; // broadcast
DataP.TxFramePool -> TxFramePoolP;
DataP.BroadcastTx -> CoordBroadcastP.BroadcastDataFrame;
DeviceCfp.Token -> DeviceCfpRadioClient;
DeviceCfp.TokenTransferred -> DeviceCfpRadioClient;
DeviceCfp.TokenRequested -> DeviceCfpRadioClient;
+ DeviceCfp.TokenToBeaconSync -> DeviceCfpRadioClient;
DeviceCfp.CapStartRefTime -> BeaconSynchronizeP.CapStartRefTime;
+ DeviceCfp.IsSendingBeacons -> BeaconTransmitP.IsSendingBeacons;
DeviceCfp.CfpEnd -> BeaconSynchronizeP.CfpEnd;
DeviceCfp.GtsField -> BeaconSynchronizeP.GtsField;
DeviceCfp.SfSlotDuration -> BeaconSynchronizeP.SfSlotDuration;
DeviceCfp.RadioOff -> DeviceCfpRadioClient;
DeviceCfp.MLME_GET -> PibP;
DeviceCfp.MLME_SET -> PibP.MLME_SET;
+ DeviceCfpRadioClient.TransferTo -> SyncRadioClient.TransferFrom;
/* -------------------- GTS (outgoing superframe) --------------------- */
CoordCfp.Token -> CoordCfpRadioClient;
CoordCfp.TokenTransferred -> CoordCfpRadioClient;
CoordCfp.TokenRequested -> CoordCfpRadioClient;
+ CoordCfp.TokenToBeaconTransmit -> CoordCfpRadioClient;
+ CoordCfp.IsTrackingBeacons -> BeaconSynchronizeP.IsTrackingBeacons;
CoordCfp.CfpEnd -> BeaconTransmitP.CfpEnd;
CoordCfp.GtsField -> BeaconTransmitP.GtsField;
CoordCfp.SfSlotDuration -> BeaconTransmitP.SfSlotDuration;
CoordCfp.RadioOff -> CoordCfpRadioClient;
CoordCfp.MLME_GET -> PibP;
CoordCfp.MLME_SET -> PibP.MLME_SET;
+ CoordCfpRadioClient.TransferTo -> BeaconTxRadioClient.TransferFrom;
+
+/* -------------------------- promiscuous mode ------------------------ */
+
+ components new RadioClientC() as PromiscuousModeRadioClient;
+ PibP.MacReset -> PromiscuousModeP;
+ PromiscuousModeP.Token -> PromiscuousModeRadioClient;
+ PromiscuousModeP.PromiscuousRx -> PromiscuousModeRadioClient;
+ PromiscuousModeP.RadioOff -> PromiscuousModeRadioClient;
+ PromiscuousModeP.RadioPromiscuousMode = RadioPromiscuousMode;
+ PromiscuousModeP.Debug = Ieee802154Debug[PROMISCUOUS_MODE_CLIENT];
-/* ------------------ MLME-RX-ENABLE / promiscuous mode --------------- */
+/* --------------------------- MLME-RX-ENABLE ------------------------ */
- components new RadioClientC() as RxEnableRadioClient;
PibP.MacReset -> RxEnableP;
- RxEnableP.Token -> RxEnableRadioClient;
- RxEnableP.PromiscuousRx -> RxEnableRadioClient;
RxEnableP.IncomingSfStart -> BeaconSynchronizeP.CapStart;
RxEnableP.OutgoingSfStart -> BeaconTransmitP.CapStart;
RxEnableP.IncomingBeaconInterval -> BeaconSynchronizeP.BeaconInterval;
RxEnableP.IsMacPanCoordinator -> PibP.IsMacPanCoordinator;
RxEnableP.IsBeaconEnabledPAN -> PibP.IsBeaconEnabledPAN;
RxEnableP.TimeCalc -> PibP.TimeCalc;
- RxEnableP.RadioOff -> RxEnableRadioClient;
- RxEnableP.RadioPromiscuousMode = RadioPromiscuousMode;
RxEnableP.WasRxEnabled -> DeviceCap.WasRxEnabled;
RxEnableP.WasRxEnabled -> CoordCap.WasRxEnabled;
RxEnableP.RxEnableTimer = Timer5;
MainC.SoftwareInit -> PibP.LocalInit;
PibP.RadioControl = PhySplitControl;
PibP.Random = Random;
- PibP.PromiscuousModeGet -> RxEnableP;
+ PibP.PromiscuousModeGet -> PromiscuousModeP;
PibP.LocalTime = LocalTime;
PibP.Token -> PibRadioClient;
PibP.RadioOff -> PibRadioClient;
RadioControlP.PhyTx = RadioTx;
RadioControlP.PhyRx = RadioRx;
RadioControlP.PhyRadioOff = RadioOff;
- RadioControlP.RadioPromiscuousMode -> RxEnableP;
+ RadioControlP.RadioPromiscuousMode -> PromiscuousModeP;
RadioControlP.Leds = Leds;
RadioControlP.Debug = Ieee802154Debug[RADIORXTX_CLIENT];
}
RADIORXTX_CLIENT = 7,
PIBDATABASE_CLIENT = 8,
ASSOCIATE_CLIENT = 9,
- DEVICECAPQUEUE_CLIENT = 10,
- INDIRECTTX_DEBUG_CLIENT = 11,
- DATA_CLIENT = 12,
- POLL_CLIENT = 13,
- DISASSOCIATE_CLIENT = 14,
+ DISASSOCIATE_CLIENT = 10,
+ DEVICECAPQUEUE_CLIENT = 11,
+ INDIRECTTX_DEBUG_CLIENT = 12,
+ DATA_CLIENT = 13,
+ POLL_CLIENT = 14,
RXENABLE_CLIENT = 15,
+ PROMISCUOUS_MODE_CLIENT = 16,
- PHY_CLIENT = 16,
- PHY_TXCLIENT = 17,
- PHY_RXCLIENT = 18,
+ PHY_CLIENT = 17,
+ PHY_TXCLIENT = 18,
+ PHY_RXCLIENT = 19,
};
typedef nx_struct serial_debug_msg {
*
* - Revision -------------------------------------------------------------
* $Date$
- * @author Torsten Halbhuebner <hhuebner.tu-berlin.de>
+ * @author Torsten Halbhuebner <hhuebner@tkn.tu-berlin.de>
+ * @author Jan Hauer <hauer@tkn.tu-berlin.de>
* ========================================================================
*/
} ieee154_PIB_t;
// PHY PIB default attributes
-
-#define IEEE154_DEFAULT_CURRENTCHANNEL 26
-#define IEEE154_DEFAULT_CHANNELSSUPPORTED_PAGE0 0x07FFF800
-#define IEEE154_DEFAULT_CHANNELSSUPPORTED_PAGE1 0
-#define IEEE154_DEFAULT_CHANNELSSUPPORTED_PAGE2 0
-#define IEEE154_DEFAULT_CCAMODE 3
-#define IEEE154_DEFAULT_CURRENTPAGE 0
-#define IEEE154_DEFAULT_TRANSMITPOWER_dBm 0
+#ifndef IEEE154_DEFAULT_CURRENTCHANNEL
+ #define IEEE154_DEFAULT_CURRENTCHANNEL 26
+#endif
+#ifndef IEEE154_DEFAULT_CHANNELSSUPPORTED_PAGE0
+ #define IEEE154_DEFAULT_CHANNELSSUPPORTED_PAGE0 0x07FFF800
+#endif
+#ifndef IEEE154_DEFAULT_CHANNELSSUPPORTED_PAGE1
+ #define IEEE154_DEFAULT_CHANNELSSUPPORTED_PAGE1 0
+#endif
+#ifndef IEEE154_DEFAULT_CHANNELSSUPPORTED_PAGE2
+ #define IEEE154_DEFAULT_CHANNELSSUPPORTED_PAGE2 0
+#endif
+#ifndef IEEE154_DEFAULT_CCAMODE
+ #define IEEE154_DEFAULT_CCAMODE 3
+#endif
+#ifndef IEEE154_DEFAULT_CURRENTPAGE
+ #define IEEE154_DEFAULT_CURRENTPAGE 0
+#endif
+#ifndef IEEE154_DEFAULT_TRANSMITPOWER_dBm
+ #define IEEE154_DEFAULT_TRANSMITPOWER_dBm 0
+#endif
// MAC PIB default attributes
-#define IEEE154_DEFAULT_ASSOCIATEDPANCOORD FALSE
-#define IEEE154_DEFAULT_ASSOCIATIONPERMIT FALSE
-#define IEEE154_DEFAULT_AUTOREQUEST TRUE
-#define IEEE154_DEFAULT_BATTLIFEEXT FALSE
-#define IEEE154_DEFAULT_BATTLIFEEXTPERIODS 6
-#define IEEE154_DEFAULT_BEACONPAYLOAD NULL
-#define IEEE154_DEFAULT_BEACONPAYLOADLENGTH 0
-#define IEEE154_DEFAULT_BEACONORDER 15
-#define IEEE154_DEFAULT_BEACONTXTIME 0
-#define IEEE154_DEFAULT_COORDSHORTADDRESS 0xFFFF
-#define IEEE154_DEFAULT_GTSPERMIT TRUE
-#define IEEE154_DEFAULT_MAXBE 5
-#define IEEE154_DEFAULT_MAXCSMABACKOFFS 4
-#define IEEE154_DEFAULT_MAXFRAMETOTALWAITTIME 2626
-#define IEEE154_DEFAULT_MAXFRAMERETRIES 3
-#define IEEE154_DEFAULT_MINBE 3
-#define IEEE154_DEFAULT_MINLIFSPERIOD 40
-#define IEEE154_DEFAULT_MINSIFSPERIOD 12
-#define IEEE154_DEFAULT_PANID 0xFFFF
-#define IEEE154_DEFAULT_PROMISCUOUSMODE FALSE
-#define IEEE154_DEFAULT_RESPONSEWAITTIME 32
-#define IEEE154_DEFAULT_RXONWHENIDLE FALSE
-#define IEEE154_DEFAULT_SECURITYENABLED FALSE
-#define IEEE154_DEFAULT_SHORTADDRESS 0xFFFF
-
-#define IEEE154_DEFAULT_SUPERFRAMEORDER 15
-#define IEEE154_DEFAULT_SYNCSYMBOLOFFSET 0
-#define IEEE154_DEFAULT_TIMESTAMPSUPPORTED TRUE
-#define IEEE154_DEFAULT_TRANSACTIONPERSISTENCETIME 0x01F4
+#ifndef IEEE154_DEFAULT_ASSOCIATEDPANCOORD
+ #define IEEE154_DEFAULT_ASSOCIATEDPANCOORD FALSE
+#endif
+#ifndef IEEE154_DEFAULT_ASSOCIATIONPERMIT
+ #define IEEE154_DEFAULT_ASSOCIATIONPERMIT FALSE
+#endif
+#ifndef IEEE154_DEFAULT_AUTOREQUEST
+ #define IEEE154_DEFAULT_AUTOREQUEST TRUE
+#endif
+#ifndef IEEE154_DEFAULT_BATTLIFEEXT
+ #define IEEE154_DEFAULT_BATTLIFEEXT FALSE
+#endif
+#ifndef IEEE154_DEFAULT_BATTLIFEEXTPERIODS
+ #define IEEE154_DEFAULT_BATTLIFEEXTPERIODS 6
+#endif
+#ifndef IEEE154_DEFAULT_BEACONPAYLOAD
+ #define IEEE154_DEFAULT_BEACONPAYLOAD NULL
+#endif
+#ifndef IEEE154_DEFAULT_BEACONPAYLOADLENGTH
+ #define IEEE154_DEFAULT_BEACONPAYLOADLENGTH 0
+#endif
+#ifndef IEEE154_DEFAULT_BEACONORDER
+ #define IEEE154_DEFAULT_BEACONORDER 15
+#endif
+#ifndef IEEE154_DEFAULT_BEACONTXTIME
+ #define IEEE154_DEFAULT_BEACONTXTIME 0
+#endif
+#ifndef IEEE154_DEFAULT_COORDSHORTADDRESS
+ #define IEEE154_DEFAULT_COORDSHORTADDRESS 0xFFFF
+#endif
+#ifndef IEEE154_DEFAULT_GTSPERMIT
+ #define IEEE154_DEFAULT_GTSPERMIT TRUE
+#endif
+#ifndef IEEE154_DEFAULT_MAXBE
+ #define IEEE154_DEFAULT_MAXBE 5
+#endif
+#ifndef IEEE154_DEFAULT_MAXCSMABACKOFFS
+ #define IEEE154_DEFAULT_MAXCSMABACKOFFS 4
+#endif
+#ifndef IEEE154_DEFAULT_MAXFRAMETOTALWAITTIME
+ #define IEEE154_DEFAULT_MAXFRAMETOTALWAITTIME 2626
+#endif
+#ifndef IEEE154_DEFAULT_MAXFRAMERETRIES
+ #define IEEE154_DEFAULT_MAXFRAMERETRIES 3
+#endif
+#ifndef IEEE154_DEFAULT_MINBE
+ #define IEEE154_DEFAULT_MINBE 3
+#endif
+#ifndef IEEE154_DEFAULT_MINLIFSPERIOD
+ #define IEEE154_DEFAULT_MINLIFSPERIOD 40
+#endif
+#ifndef IEEE154_DEFAULT_MINSIFSPERIOD
+ #define IEEE154_DEFAULT_MINSIFSPERIOD 12
+#endif
+#ifndef IEEE154_DEFAULT_PANID
+ #define IEEE154_DEFAULT_PANID 0xFFFF
+#endif
+#ifndef IEEE154_DEFAULT_PROMISCUOUSMODE
+ #define IEEE154_DEFAULT_PROMISCUOUSMODE FALSE
+#endif
+#ifndef IEEE154_DEFAULT_RESPONSEWAITTIME
+ #define IEEE154_DEFAULT_RESPONSEWAITTIME 32
+#endif
+#ifndef IEEE154_DEFAULT_RXONWHENIDLE
+ #define IEEE154_DEFAULT_RXONWHENIDLE FALSE
+#endif
+#ifndef IEEE154_DEFAULT_SECURITYENABLED
+ #define IEEE154_DEFAULT_SECURITYENABLED FALSE
+#endif
+#ifndef IEEE154_DEFAULT_SHORTADDRESS
+ #define IEEE154_DEFAULT_SHORTADDRESS 0xFFFF
+#endif
+
+#ifndef IEEE154_DEFAULT_SUPERFRAMEORDER
+ #define IEEE154_DEFAULT_SUPERFRAMEORDER 15
+#endif
+#ifndef IEEE154_DEFAULT_SYNCSYMBOLOFFSET
+ #define IEEE154_DEFAULT_SYNCSYMBOLOFFSET 0
+#endif
+#ifndef IEEE154_DEFAULT_TIMESTAMPSUPPORTED
+ #define IEEE154_DEFAULT_TIMESTAMPSUPPORTED TRUE
+#endif
+#ifndef IEEE154_DEFAULT_TRANSACTIONPERSISTENCETIME
+ #define IEEE154_DEFAULT_TRANSACTIONPERSISTENCETIME 0x01F4
+#endif
#define IEEE154_INVALID_TIMESTAMP (0xffffffff)
async command uint8_t TransferredFrom.getUserId(){ return myUserId;}
- task void TransferredTask()
- {
- signal ResourceTransferred.transferred();
- }
-
async command void TransferredFrom.transfer()
{
- post TransferredTask();
+ signal ResourceTransferred.transferred();
}
default async command uint8_t TransferTo.getUserId(){ call Leds.led0On(); return 0xFF;}
default async command void TransferTo.transfer(){ call Leds.led0On(); }
- default event void ResourceTransferred.transferred(){}
+ default async event void ResourceTransferred.transferred(){}
}
--- /dev/null
+/*
+ * Copyright (c) 2008, Technische Universitaet Berlin
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * - Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * - Neither the name of the Technische Universitaet Berlin nor the names
+ * of its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
+ * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
+ * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
+ * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * - Revision -------------------------------------------------------------
+ * $Revision$
+ * $Date$
+ * @author Jan Hauer <hauer@tkn.tu-berlin.de>
+ * ========================================================================
+ */
+
+
+#include "TKN154_MAC.h"
+
+module NoAssociateP
+{
+ provides
+ {
+ interface Init;
+ interface MLME_ASSOCIATE;
+ interface MLME_COMM_STATUS;
+ }
+ uses
+ {
+ interface FrameRx as AssociationRequestRx;
+ interface FrameTx as AssociationRequestTx;
+ interface FrameExtracted as AssociationResponseExtracted;
+ interface FrameTx as AssociationResponseTx;
+
+ interface DataRequest;
+ interface Timer<TSymbolIEEE802154> as ResponseTimeout;
+ interface Pool<ieee154_txframe_t> as TxFramePool;
+ interface Pool<ieee154_txcontrol_t> as TxControlPool;
+ interface MLME_GET;
+ interface MLME_SET;
+ interface FrameUtility;
+ interface IEEE154Frame as Frame;
+ interface Get<uint64_t> as LocalExtendedAddress;
+ interface Ieee802154Debug as Debug;
+ }
+}
+implementation
+{
+
+ command error_t Init.init() { return SUCCESS; }
+
+/* ------------------- MLME_ASSOCIATE Request ------------------- */
+
+ command ieee154_status_t MLME_ASSOCIATE.request (
+ uint8_t LogicalChannel,
+ uint8_t ChannelPage,
+ uint8_t CoordAddrMode,
+ uint16_t CoordPANID,
+ ieee154_address_t CoordAddress,
+ ieee154_CapabilityInformation_t CapabilityInformation,
+ ieee154_security_t *security
+ )
+ {
+ return IEEE154_TRANSACTION_OVERFLOW;
+ }
+
+ event void AssociationRequestTx.transmitDone(ieee154_txframe_t *txFrame, ieee154_status_t status) { }
+
+ event void ResponseTimeout.fired() { }
+
+ event message_t* AssociationResponseExtracted.received(message_t* frame, ieee154_txframe_t *txFrame) { return frame; }
+
+ event void DataRequest.pollDone() { }
+
+/* ------------------- MLME_ASSOCIATE Response ------------------- */
+
+ event message_t* AssociationRequestRx.received(message_t* frame) { return frame; }
+
+ command ieee154_status_t MLME_ASSOCIATE.response (
+ uint64_t deviceAddress,
+ uint16_t assocShortAddress,
+ ieee154_association_status_t status,
+ ieee154_security_t *security
+ )
+ {
+ return IEEE154_TRANSACTION_OVERFLOW;
+ }
+
+ event void AssociationResponseTx.transmitDone(ieee154_txframe_t *txFrame, ieee154_status_t status) { }
+
+/* ------------------- Defaults ------------------- */
+
+ default event void MLME_ASSOCIATE.indication (
+ uint64_t DeviceAddress,
+ ieee154_CapabilityInformation_t CapabilityInformation,
+ ieee154_security_t *security
+ ){}
+ default event void MLME_ASSOCIATE.confirm (
+ uint16_t AssocShortAddress,
+ uint8_t status,
+ ieee154_security_t *security
+ ){}
+ default event void MLME_COMM_STATUS.indication (
+ uint16_t PANId,
+ uint8_t SrcAddrMode,
+ ieee154_address_t SrcAddr,
+ uint8_t DstAddrMode,
+ ieee154_address_t DstAddr,
+ ieee154_status_t status,
+ ieee154_security_t *security
+ ){}
+}
event void Token.granted() { }
- event void TokenTransferred.transferred() { call Token.release(); }
+ async event void TokenTransferred.transferred() { call Token.release(); }
async event void TrackAlarm.fired() {}
interface Init;
interface MLME_START;
interface WriteBeaconField as SuperframeSpecWrite;
- interface Get<bool> as IsSendingBeacons;
+ interface GetNow<bool> as IsSendingBeacons;
interface GetNow<uint32_t> as CapStart;
interface GetNow<ieee154_reftime_t*> as CapStartRefTime;
interface GetNow<uint32_t> as CapLen;
interface MLME_SET;
interface Resource as Token;
interface ResourceTransfer as TokenToBroadcast;
+ interface ResourceTransferred as TokenTransferred;
interface FrameTx as RealignmentBeaconEnabledTx;
interface FrameTx as RealignmentNonBeaconEnabledTx;
interface FrameRx as BeaconRequestRx;
event void Token.granted() { }
+ async event void TokenTransferred.transferred() { call Token.release(); }
+
async event void RadioOff.offDone() { }
async event void BeaconTxAlarm.fired() {}
return frame;
}
- command bool IsSendingBeacons.get(){ return FALSE;}
+ async command bool IsSendingBeacons.getNow(){ return FALSE;}
async command uint32_t CapStart.getNow() { return 0; }
async command ieee154_reftime_t* CapStartRefTime.getNow() { return NULL; }
--- /dev/null
+/*
+ * Copyright (c) 2008, Technische Universitaet Berlin
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * - Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * - Neither the name of the Technische Universitaet Berlin nor the names
+ * of its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
+ * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
+ * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
+ * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * - Revision -------------------------------------------------------------
+ * $Revision$
+ * $Date$
+ * @author Jan Hauer <hauer@tkn.tu-berlin.de>
+ * ========================================================================
+ */
+
+#include "TKN154_MAC.h"
+module NoCoordBroadcastP
+{
+ provides
+ {
+ interface Init as Reset;
+ interface FrameTx as BroadcastDataFrame;
+ interface FrameTx as RealignmentTx;
+ interface GetNow<bool> as IsBroadcastReady;
+ } uses {
+ interface Queue<ieee154_txframe_t*>;
+ interface FrameTxNow as CapTransmitNow;
+ interface ResourceTransfer as TokenToCap;
+ interface ResourceTransferred as TokenTransferred;
+ interface GetNow<bool> as BeaconFramePendingBit;
+ interface Leds;
+ }
+}
+implementation
+{
+
+ command error_t Reset.init() { return SUCCESS; }
+
+ command ieee154_status_t BroadcastDataFrame.transmit(ieee154_txframe_t *txFrame)
+ {
+ return IEEE154_TRANSACTION_OVERFLOW;
+ }
+
+ command ieee154_status_t RealignmentTx.transmit(ieee154_txframe_t *frame)
+ {
+ return IEEE154_TRANSACTION_OVERFLOW;
+ }
+
+ async command bool IsBroadcastReady.getNow()
+ {
+ return FALSE;
+ }
+
+ async event void TokenTransferred.transferred()
+ {
+ call TokenToCap.transfer();
+ }
+
+ async event void CapTransmitNow.transmitNowDone(ieee154_txframe_t *txFrame, ieee154_status_t status)
+ {
+ }
+}
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)
{
--- /dev/null
+/*
+ * Copyright (c) 2008, Technische Universitaet Berlin
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * - Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * - Neither the name of the Technische Universitaet Berlin nor the names
+ * of its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
+ * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
+ * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
+ * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * - Revision -------------------------------------------------------------
+ * $Revision$
+ * $Date$
+ * @author Jan Hauer <hauer@tkn.tu-berlin.de>
+ * ========================================================================
+ */
+
+#include "TKN154_MAC.h"
+module NoCoordRealignmentP
+{
+ provides
+ {
+ interface Init;
+ interface MLME_ORPHAN;
+ interface MLME_COMM_STATUS;
+ interface GetSet<ieee154_txframe_t*> as GetSetRealignmentFrame;
+ }
+ uses
+ {
+ interface FrameTx as CoordRealignmentTx;
+ interface FrameRx as OrphanNotificationRx;
+ interface FrameUtility;
+ interface MLME_GET;
+ interface IEEE154Frame as Frame;
+ interface Pool<ieee154_txframe_t> as TxFramePool;
+ interface Pool<ieee154_txcontrol_t> as TxControlPool;
+ interface Get<uint64_t> as LocalExtendedAddress;
+ }
+}
+implementation
+{
+
+ command error_t Init.init() { return SUCCESS; }
+
+ command ieee154_txframe_t* GetSetRealignmentFrame.get() { return NULL; }
+
+ command void GetSetRealignmentFrame.set(ieee154_txframe_t* frame) { }
+
+ event message_t* OrphanNotificationRx.received(message_t* frame) { return frame; }
+
+ command ieee154_status_t MLME_ORPHAN.response (
+ uint64_t OrphanAddress,
+ uint16_t ShortAddress,
+ bool AssociatedMember,
+ ieee154_security_t *security
+ )
+ {
+ return IEEE154_TRANSACTION_OVERFLOW;
+ }
+
+ event void CoordRealignmentTx.transmitDone(ieee154_txframe_t *txFrame, ieee154_status_t status)
+ {
+ }
+
+ default event void MLME_COMM_STATUS.indication (
+ uint16_t PANId,
+ uint8_t SrcAddrMode,
+ ieee154_address_t SrcAddr,
+ uint8_t DstAddrMode,
+ ieee154_address_t DstAddr,
+ ieee154_status_t status,
+ ieee154_security_t *security
+ ){}
+
+ default event void MLME_ORPHAN.indication (
+ uint64_t OrphanAddress,
+ ieee154_security_t *security
+ ){}
+}
return SUCCESS;
}
- event void TokenTransferred.transferred()
+ async event void TokenTransferred.transferred()
{
call TokenToCfp.transfer();
}
interface Resource as Token;
interface ResourceTransferred as TokenTransferred;
interface ResourceRequested as TokenRequested;
+ interface ResourceTransfer as TokenToBeaconSync;
interface GetNow<ieee154_reftime_t*> as CapStartRefTime;
+ interface GetNow<bool> as IsSendingBeacons;
interface GetNow<uint32_t> as CfpEnd;
interface GetNow<uint8_t*> as GtsField;
interface GetNow<uint32_t> as SfSlotDuration;
return IEEE154_INVALID_HANDLE;
}
- event void TokenTransferred.transferred()
+ async event void TokenTransferred.transferred()
{
- // the CFP has started, this component now owns the token -
+ // 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 BeaconSynchronizeP if
+ // we are not transmitting beacons)
+ if (call IsSendingBeacons.getNow())
+ call Token.release();
+ else
+ call TokenToBeaconSync.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() {}
async event void RadioTx.loadDone(){}
async event void RadioTx.transmitDone(ieee154_txframe_t *frame,
--- /dev/null
+/*
+ * Copyright (c) 2008, Technische Universitaet Berlin
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * - Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * - Neither the name of the Technische Universitaet Berlin nor the names
+ * of its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
+ * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
+ * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
+ * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * - Revision -------------------------------------------------------------
+ * $Revision$
+ * $Date$
+ * @author Jan Hauer <hauer@tkn.tu-berlin.de>
+ * ========================================================================
+ */
+
+
+#include "TKN154_MAC.h"
+
+module NoDisassociateP
+{
+ provides
+ {
+ interface Init;
+ interface MLME_DISASSOCIATE;
+ } uses {
+
+ interface FrameTx as DisassociationIndirectTx;
+ interface FrameTx as DisassociationDirectTx;
+ interface FrameTx as DisassociationToCoord;
+
+ interface FrameRx as DisassociationDirectRxFromCoord;
+ interface FrameExtracted as DisassociationExtractedFromCoord;
+ interface FrameRx as DisassociationRxFromDevice;
+
+ interface Pool<ieee154_txframe_t> as TxFramePool;
+ interface Pool<ieee154_txcontrol_t> as TxControlPool;
+ interface MLME_GET;
+ interface FrameUtility;
+ interface IEEE154Frame as Frame;
+ interface Get<uint64_t> as LocalExtendedAddress;
+ interface Ieee802154Debug as Debug;
+ }
+}
+implementation
+{
+
+ command error_t Init.init() { return SUCCESS; }
+
+/* ------------------- MLME_DISASSOCIATE (initiating) ------------------- */
+
+ command ieee154_status_t MLME_DISASSOCIATE.request (
+ uint8_t DeviceAddrMode,
+ uint16_t DevicePANID,
+ ieee154_address_t DeviceAddress,
+ ieee154_disassociation_reason_t DisassociateReason,
+ bool TxIndirect,
+ ieee154_security_t *security
+ )
+ {
+ return IEEE154_TRANSACTION_OVERFLOW;
+ }
+
+ event void DisassociationToCoord.transmitDone(ieee154_txframe_t *data, ieee154_status_t status) { }
+
+ event void DisassociationIndirectTx.transmitDone(ieee154_txframe_t *data, ieee154_status_t status) { }
+
+ event void DisassociationDirectTx.transmitDone(ieee154_txframe_t *data, ieee154_status_t status) { }
+
+/* ------------------- MLME_DISASSOCIATE (receiving) ------------------- */
+
+ event message_t* DisassociationDirectRxFromCoord.received(message_t* frame) { return frame; }
+
+ event message_t* DisassociationExtractedFromCoord.received(message_t* frame, ieee154_txframe_t *txFrame) { return frame;
+ }
+
+ event message_t* DisassociationRxFromDevice.received(message_t* frame) { return frame; }
+
+/* ------------------- Defaults ------------------- */
+
+ default event void MLME_DISASSOCIATE.indication (
+ uint64_t DeviceAddress,
+ ieee154_disassociation_reason_t DisassociateReason,
+ ieee154_security_t *security
+ ){}
+ default event void MLME_DISASSOCIATE.confirm (
+ ieee154_status_t status,
+ uint8_t DeviceAddrMode,
+ uint16_t DevicePANID,
+ ieee154_address_t DeviceAddress
+ ){}
+
+}
--- /dev/null
+/*
+ * Copyright (c) 2008, Technische Universitaet Berlin
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * - Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * - Neither the name of the Technische Universitaet Berlin nor the names
+ * of its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
+ * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
+ * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
+ * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * - Revision -------------------------------------------------------------
+ * $Revision$
+ * $Date$
+ * @author Jan Hauer <hauer@tkn.tu-berlin.de>
+ * ========================================================================
+ */
+
+#include "TKN154_PHY.h"
+#include "TKN154_MAC.h"
+module NoPromiscuousModeP
+{
+ provides {
+ interface Init;
+ interface SplitControl as PromiscuousMode;
+ interface Get<bool> as PromiscuousModeGet;
+ interface FrameRx;
+ } uses {
+ interface Resource as Token;
+ interface RadioRx as PromiscuousRx;
+ interface RadioOff;
+ interface Set<bool> as RadioPromiscuousMode;
+ interface Ieee802154Debug as Debug;
+ }
+}
+implementation
+{
+
+ command error_t Init.init() { return SUCCESS; }
+
+/* ----------------------- Promiscuous Mode ----------------------- */
+
+ command bool PromiscuousModeGet.get() { return FALSE; }
+
+ command error_t PromiscuousMode.start() { return FAIL; }
+
+ event void Token.granted() { call Token.release(); }
+
+ async event void PromiscuousRx.prepareDone() { }
+
+ event message_t* PromiscuousRx.received(message_t *frame, ieee154_reftime_t *timestamp) { return frame; }
+
+ command error_t PromiscuousMode.stop() { return FAIL; }
+
+ async event void RadioOff.offDone() { }
+
+ default event void PromiscuousMode.startDone(error_t error){}
+ default event void PromiscuousMode.stopDone(error_t error){}
+}
--- /dev/null
+/*
+ * Copyright (c) 2008, Technische Universitaet Berlin
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * - Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * - Neither the name of the Technische Universitaet Berlin nor the names
+ * of its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
+ * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
+ * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
+ * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * - Revision -------------------------------------------------------------
+ * $Revision$
+ * $Date$
+ * @author Jan Hauer <hauer@tkn.tu-berlin.de>
+ * ========================================================================
+ */
+
+#include "TKN154_PHY.h"
+#include "TKN154_MAC.h"
+module NoRxEnableP
+{
+ provides
+ {
+ interface Init;
+ interface MLME_RX_ENABLE;
+ interface GetNow<bool> as IsRxEnableActive;
+ interface Notify<bool> as RxEnableStateChange;
+ }
+ uses
+ {
+ interface Ieee802154Debug as Debug;
+ interface Timer<TSymbolIEEE802154> as RxEnableTimer;
+ interface Get<bool> as IsBeaconEnabledPAN;
+ interface Get<ieee154_macPanCoordinator_t> as IsMacPanCoordinator;
+ interface GetNow<bool> as IsTrackingBeacons;
+ interface GetNow<uint32_t> as IncomingSfStart;
+ interface GetNow<uint32_t> as IncomingBeaconInterval;
+ interface GetNow<bool> as IsSendingBeacons;
+ interface GetNow<uint32_t> as OutgoingSfStart;
+ interface GetNow<uint32_t> as OutgoingBeaconInterval;
+ interface Notify<bool> as WasRxEnabled;
+ interface TimeCalc;
+ }
+}
+implementation
+{
+
+ command error_t Init.init() { return SUCCESS; }
+
+/* ----------------------- MLME-RX-ENABLE ----------------------- */
+
+ command ieee154_status_t MLME_RX_ENABLE.request (
+ bool DeferPermit,
+ uint32_t RxOnTime,
+ uint32_t RxOnDuration
+ )
+ {
+ return IEEE154_TRANSACTION_OVERFLOW;
+ }
+
+ event void RxEnableTimer.fired() {}
+
+ async command bool IsRxEnableActive.getNow() { return FALSE; }
+
+ event void WasRxEnabled.notify( bool val ) { }
+
+ command error_t RxEnableStateChange.enable(){return FAIL;}
+ command error_t RxEnableStateChange.disable(){return FAIL;}
+ default event void MLME_RX_ENABLE.confirm(ieee154_status_t status){}
+}
{
/**
- * Transfer control of a resource to another client. Conceptually, this
- * command is similar to calling Resource.release() and then forcing the
- * arbiter to signal the Resource.granted() event to the target client. But
- * there is one difference: when a resource that was transferred through this
- * command is released, it is released on behalf of the "original" client,
- * i.e. who was last signalled the Resource.granted() event. Releasing a
- * transferred resource is thus equivalent to first transferring it back to
- * the original client and then forcing the latter to release the resource
- * through a call to Resource.release() -- this ensures that the arbitration
- * policy can continue properly (and avoids possible starvation).
+ * Transfers ownership of a resource to another client, which will in turn
+ * be signalled a ResourceTransferred.transferred() event.
*
- * Note that a resource may be transferred multiple times, before it is
- * released. Then the current owner will change, but the "original" client
- * will stay the same.
+ * When a resource that was transferred through this command is released, it
+ * is released on behalf of the "original" client, i.e. who was last
+ * signalled the Resource.granted() event and it then depends on the original
+ * queueing policy which component will be granted the resource next.
*
* @return SUCCESS If ownership has been transferred.<br> FAIL ownership has
* not been transferred, because the caller is not owner of the resource
*/
-
- async command error_t transfer();
+ async command error_t transfer();
}
{
/**
- * Control of a resource was transferred to this component from another
- * client. This event is similar to the Resource.granted() event, but when a
- * the resource is released, it is released on behalf of the client who was
- * last signalled the Resource.granted() event.
+ * Ownership of a resource is transferred, possibly overriding the default
+ * queueing policy. This event is similar to an async Resource.granted()
+ * event, but when a the resource is released, it is released on behalf of
+ * the client who was last signalled the Resource.granted() event.
*
* @see ResourceTransfer interface
*/
- event void transferred();
+ async event void transferred();
}