📄 sscs_802_15_4.cpp
字号:
void Sscs802_15_4MLME_ASSOCIATE_confirm( Node* node, int interfaceIndex, UInt16 AssocShortAddress, M802_15_4_enum status){ MacData802_15_4* mac; SscsData802_15_4* sscs802_15_4; M802_15_4PIB t_mpib; mac = (MacData802_15_4*) node->macData[interfaceIndex]->macVar; sscs802_15_4 = (SscsData802_15_4*)mac->sscs; if (status == M802_15_4_SUCCESS) { mac->rt_myNodeID = AssocShortAddress; t_mpib.macShortAddress = (UInt16)node->nodeId; //don't use cluster Mac802_15_4MLME_SET_request( node, interfaceIndex, macShortAddress, &t_mpib); } if (sscs802_15_4->state != S802_15_4NULL) { Sscs802_15_4StartDevice( node, interfaceIndex, TRUE, status); }}// /**// FUNCTION :: Sscs802_15_4MLME_DISASSOCIATE_confirm// LAYER :: Mac// PURPOSE :: Primitive to report result of disassociate request// PARAMETERS ::// + node : Node* : Node receiving call// + interfaceIndex : int : Interface Index// + status : M802_15_4_enum: Status of disassociation attempt// RETURN :: None// **/void Sscs802_15_4MLME_DISASSOCIATE_confirm( Node* node, int interfaceIndex, M802_15_4_enum status){}// /**// FUNCTION :: Sscs802_15_4MLME_BEACON_NOTIFY_indication// LAYER :: Mac// PURPOSE :: Primitive to send params contained within a beacon to SSCS// PARAMETERS ::// + node : Node* : Node receiving call// + interfaceIndex : int : Interface Index// + BSN : UInt8 : The beacon sequence number.// + PANDescriptor : M802_15_4PanEle* : PANDescriptor for the recd beacon// + PendAddrSpec : UInt8 : Beacon pending address spec// + AddrList : MACADDR* : list of addresses of the devices// for which beacon source has data// + sduLength : UInt8 : number of octets contained in the// beacon payload of the beacon frame// + sdu : UInt8* : beacon payload to be transferred// RETURN :: None// **/void Sscs802_15_4MLME_BEACON_NOTIFY_indication( Node* node, int interfaceIndex, UInt8 BSN, M802_15_4PanEle* PANDescriptor, UInt8 PendAddrSpec, MACADDR* AddrList, UInt8 sduLength, UInt8* sdu){}// /**// FUNCTION :: Sscs802_15_4MLME_GET_confirm// LAYER :: Mac// PURPOSE :: Primitive to report result of GET request// PARAMETERS ::// + node : Node* : Node receiving call// + interfaceIndex : int : Interface Index// + status : M802_15_4_enum : Status of GET attempt// + PIBAttribute : M802_15_4_PIBA_enum : PIB attribute id// + PIBAttributeValue : M802_15_4PIB* : Attribute value// RETURN :: None// **/void Sscs802_15_4MLME_GET_confirm( Node* node, int interfaceIndex, M802_15_4_enum status, M802_15_4_PIBA_enum PIBAttribute, M802_15_4PIB* PIBAttributeValue){}// /**// FUNCTION :: Sscs802_15_4MLME_ORPHAN_indication// LAYER :: Mac// PURPOSE :: Primitive to notify presence of orphan device to SSCS// PARAMETERS ::// + node : Node* : Node receiving call// + interfaceIndex : int : Interface Index// + OrphanAddress : MACADDR : Address of orphan device// + SecurityUse : BOOL : Whether enabled security or not// + ACLEntry : UInt8 : ACL entry// RETURN :: None// **/void Sscs802_15_4MLME_ORPHAN_indication( Node* node, int interfaceIndex, MACADDR OrphanAddress, BOOL SecurityUse, UInt8 ACLEntry){ MacData802_15_4* mac; mac = (MacData802_15_4*) node->macData[interfaceIndex]->macVar; if(Mac802_15_4UpdateDeviceLink( 2, &mac->deviceLink1, &mac->deviceLink2, OrphanAddress) == 0) { Mac802_15_4MLME_ORPHAN_response( node, interfaceIndex, OrphanAddress, (UInt16)OrphanAddress, TRUE, FALSE); } else { Mac802_15_4MLME_ORPHAN_response( node, interfaceIndex, OrphanAddress, 0, FALSE, FALSE); }}// /**// FUNCTION :: Sscs802_15_4MLME_RESET_confirm// LAYER :: Mac// PURPOSE :: Primitive to report result of RESET request// PARAMETERS ::// + node : Node* : Node receiving call// + interfaceIndex : int : Interface Index// + status : M802_15_4_enum : Status of RESET attempt// RETURN :: None// **/void Sscs802_15_4MLME_RESET_confirm( Node* node, int interfaceIndex, M802_15_4_enum status){ Sscs802_15_4StopDevice(node, interfaceIndex, status);}// /**// FUNCTION :: Sscs802_15_4MLME_RX_ENABLE_confirm// LAYER :: Mac// PURPOSE :: Primitive to report result of RxEnable request// PARAMETERS ::// + node : Node* : Node receiving call// + interfaceIndex : int : Interface Index// + status : M802_15_4_enum : Status of RxEnable attempt// RETURN :: None// **/void Sscs802_15_4MLME_RX_ENABLE_confirm( Node* node, int interfaceIndex, M802_15_4_enum status){}// /**// FUNCTION :: Sscs802_15_4MLME_SET_confirm// LAYER :: Mac// PURPOSE :: Primitive to report result of SET request// PARAMETERS ::// + node : Node* : Node receiving call// + interfaceIndex : int : Interface Index// + status : M802_15_4_enum : Status of SET attempt// + PIBAttribute : M802_15_4_PIBA_enum : PIB attribute id// RETURN :: None// **/void Sscs802_15_4MLME_SET_confirm( Node* node, int interfaceIndex, M802_15_4_enum status, M802_15_4_PIBA_enum PIBAttribute){}// /**// FUNCTION :: Sscs802_15_4MLME_SCAN_confirm// LAYER :: Mac// PURPOSE :: Primitive to report result of SCAN request// PARAMETERS ::// + node : Node* : Node receiving call// + interfaceIndex : int : Interface Index// + status : M802_15_4_enum : Status of Scan attempt// + ScanType : UInt8 : Type of scan// + UnscannedChannels : UInt32 : Channels given in the request// not scanned// + ResultListSize : UInt8 : Number of elements returned// + EnergyDetectList : UInt8* : List of energy measurements,// one for each channel// + PANDescriptorList : M802_15_4PanEle* : List of PAN descriptors// RETURN :: None// **/void Sscs802_15_4MLME_SCAN_confirm( Node* node, int interfaceIndex, M802_15_4_enum status, UInt8 ScanType, UInt32 UnscannedChannels, UInt8 ResultListSize, UInt8* EnergyDetectList, M802_15_4PanEle* PANDescriptorList){ MacData802_15_4* mac; SscsData802_15_4* sscs802_15_4; M802_15_4PIB t_mpib; mac = (MacData802_15_4*) node->macData[interfaceIndex]->macVar; sscs802_15_4 = (SscsData802_15_4*)mac->sscs; sscs802_15_4->T_UnscannedChannels = UnscannedChannels; sscs802_15_4->T_ResultListSize = ResultListSize; sscs802_15_4->T_EnergyDetectList = EnergyDetectList; sscs802_15_4->T_PANDescriptorList = PANDescriptorList; if (ScanType == 0x01) { if (sscs802_15_4->t_isFFD && sscs802_15_4->ffdMode == 0 && sscs802_15_4->state != S802_15_4NULL) //PAN coordinator { Sscs802_15_4StartPANCoord( node, interfaceIndex, status); } else if (sscs802_15_4->state != S802_15_4NULL) { Sscs802_15_4StartDevice( node, interfaceIndex, TRUE, status); } } if (ScanType == 0x03) { if (status == M802_15_4_SUCCESS) { //re-synchronize with the coordinator Phy802_15_4PLME_GET_request( node, interfaceIndex, phyCurrentChannel); Mac802_15_4MLME_SYNC_request( node, interfaceIndex, (UInt8)mac->tmp_ppib.phyCurrentChannel, TRUE); } else { BOOL isCoord = ((mac->capability.FFD) && (Mac802_15_4NumberDeviceLink(&mac->deviceLink1) > 0)); if (!isCoord) //I am not a coordinator { t_mpib.macShortAddress = 0xffff; Mac802_15_4MLME_SET_request( node, interfaceIndex, macShortAddress, &t_mpib); t_mpib.macCoordExtendedAddress = M802_15_4_COORDEXTENDEDADDRESS; Mac802_15_4MLME_SET_request( node, interfaceIndex, macCoordExtendedAddress, &t_mpib); sscs802_15_4->state = S802_15_4NULL; Sscs802_15_4StartDevice( node, interfaceIndex, sscs802_15_4->t_assoPermit, M802_15_4_SUCCESS); } } }}// /**// FUNCTION :: Sscs802_15_4MLME_COMM_STATUS_indication// LAYER :: Mac// PURPOSE :: Primitive to indicate a communications status// PARAMETERS ::// + node : Node* : Node receiving call// + interfaceIndex : int : Interface Index// + PANId : UInt16 : PAN id// + SrcAddrMode : UInt8 : Source address mode// + SrcAddr : MACADDR : Source address// + DstAddrMode : UInt8 : Destination address mode// + DstAddr : MACADDR : Destination Address// + status : M802_15_4_enum: Status of Communication// RETURN :: None// **/void Sscs802_15_4MLME_COMM_STATUS_indication( Node* node, int interfaceIndex, UInt16 PANId, UInt8 SrcAddrMode, MACADDR SrcAddr, UInt8 DstAddrMode, MACADDR DstAddr, M802_15_4_enum status){ if(status == M802_15_4_TRANSACTION_OVERFLOW) { if(DEBUG) { printf("%lld: Node %d: 802.15.4SSCS : Already processing a " "request. Discarding one received from node %d\n", getSimTime(node), node->nodeId, DstAddr); } }}// /**// FUNCTION :: Sscs802_15_4MLME_START_confirm// LAYER :: Mac// PURPOSE :: Primitive to report result of START request// PARAMETERS ::// + node : Node* : Node receiving call// + interfaceIndex : int : Interface Index// + status : M802_15_4_enum : Status of START attempt// RETURN :: None// **/void Sscs802_15_4MLME_START_confirm( Node* node, int interfaceIndex, M802_15_4_enum status){ MacData802_15_4* mac; SscsData802_15_4* sscs802_15_4; mac = (MacData802_15_4*) node->macData[interfaceIndex]->macVar; sscs802_15_4 = (SscsData802_15_4*)mac->sscs; if (sscs802_15_4->ffdMode == 0 && sscs802_15_4->state != S802_15_4NULL) //PAN coordinator { Sscs802_15_4StartPANCoord( node, interfaceIndex, status); } else if (sscs802_15_4->state != S802_15_4NULL) { Sscs802_15_4StartDevice( node, interfaceIndex, TRUE, status); } else { if (mac->mpib.macBeaconOrder == 15) { if(DEBUG) { printf("%lld : Node %d: 802.15.4SSCS : Beacon transmission " "stopped on " "channel %d with PAN Id %d\n", getSimTime(node), node->nodeId, mac->tmp_ppib.phyCurrentChannel, mac->mpib.macPANId); } } else if (status == M802_15_4_SUCCESS) { if(DEBUG) { printf("%lld : Node %d: 802.15.4SSCS : Successfully " "transmitted beacons on " "channel %d with PAN Id %d\n", getSimTime(node), node->nodeId, mac->tmp_ppib.phyCurrentChannel, mac->mpib.macPANId); } } else { if(DEBUG) { printf("%lld : Node %d: 802.15.4SSCS : Failed to transmit " "beacons on channel %d with PAN Id %d -> %s\n", getSimTime(node), node->nodeId, mac->tmp_ppib.phyCurrentChannel, mac->mpib.macPANId, Sscs802_15_4StatusName(status)); } } }}// /**// FUNCTION :: Sscs802_15_4MLME_SYNC_LOSS_indication// LAYER :: Mac// PURPOSE :: Primitive to indicate the loss of synchronization with a// coordinator// PARAMETERS ::// + node : Node* : Node receiving call// + interfaceIndex : int : Interface Index// + LossReason : M802_15_4_enum : Reason for Sync Loss// RETURN :: None// **/void Sscs802_15_4MLME_SYNC_LOSS_indication( Node* node, int interfaceIndex, M802_15_4_enum LossReason){ SscsData802_15_4* sscs802_15_4; MacData802_15_4* mac; mac = (MacData802_15_4*) node->macData[interfaceIndex]->macVar; sscs802_15_4 = (SscsData802_15_4*) mac->sscs; if (DEBUG) { printf("%lld : Node %d: 802.15.4SSCS : Synchronization loss\n", getSimTime(node), node->nodeId); } if(sscs802_15_4->state != S802_15_4NULL) { mac->isSyncLoss = TRUE; sscs802_15_4->stats.numSyncLoss++; Mac802_15_4MLME_SCAN_request( node, interfaceIndex, 0x03, S802_15_4SCANCHANNELS, 0); }}// /**// FUNCTION :: Sscs802_15_4MLME_POLL_confirm// LAYER :: Mac// PURPOSE :: Primitive to report result of POLL request// PARAMETERS ::// + node : Node* : Node receiving call// + interfaceIndex : int : Interface Index// + status : M802_15_4_enum : Status of POLL attempt// RETURN :: None
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -