📄 tkn154beaconenabledp.nc
字号:
/*
* 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: 1.9 $
* $Date: 2009/10/16 12:25:45 $
* @author Jan Hauer <hauer@tkn.tu-berlin.de>
* ========================================================================
*/
#include "TKN154_PHY.h"
#include "TKN154_MAC.h"
#include "TKN154_PIB.h"
#define IEEE154_BEACON_ENABLED_PAN TRUE
configuration TKN154BeaconEnabledP
{
provides
{
/* MCPS-SAP */
interface MCPS_DATA;
interface MCPS_PURGE;
interface Packet;
/* MLME-SAP */
interface MLME_ASSOCIATE;
interface MLME_BEACON_NOTIFY;
interface MLME_COMM_STATUS;
interface MLME_DISASSOCIATE;
interface MLME_GET;
/* interface MLME_GTS;*/
interface MLME_ORPHAN;
interface MLME_POLL;
interface MLME_RESET;
interface MLME_RX_ENABLE;
interface MLME_SCAN;
interface MLME_SET;
interface MLME_START;
interface MLME_SYNC;
interface MLME_SYNC_LOSS;
interface Notify<const void*> as PIBUpdate[uint8_t attributeID];
interface IEEE154Frame;
interface IEEE154BeaconFrame;
interface IEEE154TxBeaconPayload;
interface SplitControl as PromiscuousMode;
interface Get<uint64_t> as GetLocalExtendedAddress;
interface TimeCalc;
interface FrameUtility;
} uses {
interface RadioRx;
interface RadioTx;
interface RadioOff;
interface SlottedCsmaCa;
interface EnergyDetection;
interface SplitControl as PhySplitControl;
interface Set<bool> as RadioPromiscuousMode;
interface Alarm<TSymbolIEEE802154,uint32_t> as Alarm1;
interface Alarm<TSymbolIEEE802154,uint32_t> as Alarm2;
interface Alarm<TSymbolIEEE802154,uint32_t> as Alarm3;
interface Alarm<TSymbolIEEE802154,uint32_t> as Alarm4;
interface Alarm<TSymbolIEEE802154,uint32_t> as Alarm5;
interface Alarm<TSymbolIEEE802154,uint32_t> as Alarm6;
interface Alarm<TSymbolIEEE802154,uint32_t> as Alarm7;
interface Alarm<TSymbolIEEE802154,uint32_t> as Alarm8;
interface Alarm<TSymbolIEEE802154,uint32_t> as Alarm9;
interface Alarm<TSymbolIEEE802154,uint32_t> as Alarm10;
interface Alarm<TSymbolIEEE802154,uint32_t> as Alarm11;
interface Timer<TSymbolIEEE802154> as Timer1;
interface Timer<TSymbolIEEE802154> as Timer2;
interface Timer<TSymbolIEEE802154> as Timer3;
interface Timer<TSymbolIEEE802154> as Timer4;
interface Timer<TSymbolIEEE802154> as Timer5;
interface LocalTime<TSymbolIEEE802154>;
interface Random;
interface Leds;
}
}
implementation
{
components DataP,
PibP,
RadioControlP,
IndirectTxP,
PollP,
#ifndef IEEE154_SCAN_DISABLED
ScanP,
#else
NoScanP as ScanP,
#endif
#ifndef IEEE154_ASSOCIATION_DISABLED
AssociateP,
#else
NoAssociateP as AssociateP,
#endif
#ifndef IEEE154_DISASSOCIATION_DISABLED
DisassociateP,
#else
NoDisassociateP as DisassociateP,
#endif
#ifndef IEEE154_BEACON_SYNC_DISABLED
BeaconSynchronizeP,
new DispatchQueueP() as DeviceCapQueue,
new DispatchSlottedCsmaP(INCOMING_SUPERFRAME) as DeviceCap,
#else
NoBeaconSynchronizeP as BeaconSynchronizeP,
new NoDispatchQueueP() as DeviceCapQueue,
new NoDispatchSlottedCsmaP(INCOMING_SUPERFRAME) as DeviceCap,
#endif
NoDeviceCfpP as DeviceCfp,
#ifndef IEEE154_BEACON_TX_DISABLED
BeaconTransmitP,
new DispatchQueueP() as CoordCapQueue,
new DispatchSlottedCsmaP(OUTGOING_SUPERFRAME) as CoordCap,
#else
NoBeaconTransmitP as BeaconTransmitP,
new NoDispatchQueueP() as CoordCapQueue,
new NoDispatchSlottedCsmaP(OUTGOING_SUPERFRAME) as CoordCap,
#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,
new QueueC(ieee154_txframe_t*, CAP_TX_QUEUE_SIZE) as CoordCapQueueC,
new QueueC(ieee154_txframe_t*, CAP_TX_QUEUE_SIZE) as BroadcastQueueC;
components MainC;
/* MCPS */
MCPS_DATA = DataP;
MCPS_PURGE = DataP;
/* 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_GET = PibP;
MLME_ORPHAN = CoordRealignmentP;
/* MLME_GTS = CfpTransmitP;*/
MLME_POLL = PollP;
MLME_RESET = PibP;
MLME_RX_ENABLE = RxEnableP;
MLME_SCAN = ScanP;
MLME_SET = PibP;
MLME_SYNC = BeaconSynchronizeP;
MLME_SYNC_LOSS = BeaconSynchronizeP;
IEEE154Frame = PibP;
IEEE154BeaconFrame = PibP;
PromiscuousMode = PromiscuousModeP;
GetLocalExtendedAddress = PibP.GetLocalExtendedAddress;
IEEE154TxBeaconPayload = BeaconTransmitP;
Packet = PibP;
TimeCalc = PibP;
FrameUtility = PibP;
/* ----------------------- Scanning (MLME-SCAN) ----------------------- */
components new RadioClientC(RADIO_CLIENT_SCAN) as ScanRadioClient;
PibP.MacReset -> ScanP;
ScanP.MLME_GET -> PibP;
ScanP.MLME_SET -> PibP.MLME_SET;
ScanP.EnergyDetection = EnergyDetection;
ScanP.RadioRx -> ScanRadioClient;
ScanP.RadioTx -> ScanRadioClient;
ScanP.Frame -> PibP;
ScanP.BeaconFrame -> PibP;
ScanP.RadioOff -> ScanRadioClient;
ScanP.ScanTimer = Timer1;
ScanP.TxFramePool -> TxFramePoolP;
ScanP.TxControlPool -> TxControlPoolP;
ScanP.RadioToken -> ScanRadioClient;
ScanP.Leds = Leds;
ScanP.FrameUtility -> PibP;
/* ----------------- Beacon Transmission (MLME-START) ----------------- */
components new RadioClientC(RADIO_CLIENT_BEACONTRANSMIT) as BeaconTxRadioClient;
PibP.MacReset -> BeaconTransmitP;
BeaconTransmitP.PIBUpdate[IEEE154_macAssociationPermit] -> PibP.PIBUpdate[IEEE154_macAssociationPermit];
BeaconTransmitP.PIBUpdate[IEEE154_macGTSPermit] -> PibP.PIBUpdate[IEEE154_macGTSPermit];
BeaconTransmitP.BeaconSendAlarm = Alarm1;
BeaconTransmitP.BeaconPayloadUpdateTimer = Timer2;
BeaconTransmitP.RadioOff -> BeaconTxRadioClient;
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.RadioToken -> 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.GtsInfoWrite -> CoordCfp.GtsInfoWrite;
BeaconTransmitP.PendingAddrSpecUpdated -> IndirectTxP.PendingAddrSpecUpdated;
BeaconTransmitP.PendingAddrWrite -> IndirectTxP.PendingAddrWrite;
BeaconTransmitP.FrameUtility -> PibP.FrameUtility;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -