📄 mac.h
字号:
// PARAMETERS:
// MAC_ENUM status
// (SUCCESS | TRANSACTION_OVERFLOW | TRANSACTION_EXPIRED | CHANNEL_ACCESS_FAILURE
// INVALID_GTS | NO_ACK | UNAVAILABLE_KEY | FRAME_TOO_LONG | FAILED_SECURITY_CHECK)
// BYTE msduHandle,
// A handle to this packet from the mcpsDataRequest() function
//-------------------------------------------------------------------------------------------------------
void mcpsDataConfirm(MAC_ENUM status, BYTE msduHandle);
//-------------------------------------------------------------------------------------------------------
// void mcpsDataIndication(MCPS_DATA_INDICATION *pMDI)
//
// DESCRIPTION:
// MAC callback to the higher layer upon reception of a MAC data frame
// Multi-buffering is handled internally in the MAC sublayer
// Function must be implemented by the higher layer
//
// PARAMETERS:
// MCPS_DATA_INDICATION *pMDI
// Pointer to the MCPS_DATA_INDICATION data indication struct
//-------------------------------------------------------------------------------------------------------
void mcpsDataIndication(MCPS_DATA_INDICATION *pMDI);
//-------------------------------------------------------------------------------------------------------
// MAC_ENUM mcpsPurgeRequest(BYTE msduHandle)
//
// DESCRIPTION:
// Purge data frames from the indirect data transmission queue
//
// PARAMETERS:
// BYTE msduHandle
// The packet handle (from mcpsDataRequest(...))
//
// RETURN VALUE:
// MAC_ENUM
// SUCCESS: OK
// INVALID_HANDLE: The packet could not be found (already transmitted?)
//-------------------------------------------------------------------------------------------------------
MAC_ENUM mcpsPurgeRequest(BYTE msduHandle);
//----------------------------------------------------------------------------------------------------------
// MLME prototypes
//-------------------------------------------------------------------------------------------------------
// void mlmeAssociateRequest(UINT8 logicalChannel, BYTE coordAddrMode, WORD coordPANId, ...)
//
// DESCRIPTION:
// Generates an association request command frame, transmitted to the coordinator using direct
// transmission. The response is polled automatically from the coordinator.
// NOTE: Please note that the PAN ID and the coordinator address (short or extended) are set by the
// the MAC layer, according to the IEEE 802.15.4 spec.
//
// PARAMETERS:
// UINT8 logicalChannel
// Channel number (0x0B - 0x1A)
// BYTE coordAddrMode
// AM_SHORT_16 or AM_EXTENDED_64
// WORD coordPANId
// The coordinator PAN identifier
// ADDRESS *pCoordAddress
// Pointer to the short or extended address of the coordinator
// BYTE capabilityInformation
// (CI_ALTERNATE_PAN_COORD_BM | CI_DEVICE_TYPE_IS_FFD_BM | CI_POWER_SOURCE_BM |
// CI_RX_ON_WHEN_IDLE_BM | CI_SECURITY_CAPABILITY_BM | CI_ALLOCATE_ADDRESS_BM)
// ZBOOL securityEnable
// Security is enabled?
//-------------------------------------------------------------------------------------------------------
void mlmeAssociateRequest(UINT8 logicalChannel, BYTE coordAddrMode, WORD coordPANId, ADDRESS *pCoordAddress, BYTE capabilityInformation, ZBOOL securityEnable);
//-------------------------------------------------------------------------------------------------------
// void mlmeAssociateIndication(ADDRESS deviceAddress, BYTE capabilityInformation, ZBOOL securityUse,...)
//
// DESCRIPTION:
// mlmeAssociateIndication is generated by the MAC layer upon reception of an associate request
// command frame. For this demo application, all devices are allowed to associate, however only one
// device at the time. The coordinator must be reset before a new device can associate.
//
// The short address is assigned from the associatedAddress variable, which should have been
// incremented if more devices could have joined.
//
// Function must be implemented by the higher layer
//
// PARAMETERS:
// ADDRESS deviceAddress
// The extended address of the device requesting association
// BYTE capabilityInformation
// The operational capabilities of the device requesting association
// CI_ALTERNATE_PAN_COORD_BM 0x01
// CI_DEVICE_TYPE_IS_FFD_BM 0x02
// CI_POWER_SOURCE_BM 0x04
// CI_RX_ON_WHEN_IDLE_BM 0x08
// CI_SECURITY_CAPABILITY_BM 0x40
// CI_ALLOCATE_ADDRESS_BM 0x80
// ZBOOL securityUse
// An indication of whether the received MAC command frame is using security. This value set to
// TRUE if the security enable subfield was set to 1 or FALSE if the security enabled subfield
// was set to 0
// UINT8 aclEntry
// The macSecurityMode parameter value from the ACL entry associated with the sender of the
// data frame. This value is set to 0x08 if the sender of the data frame was not found in the
// ACL.
//-------------------------------------------------------------------------------------------------------
void mlmeAssociateIndication(ADDRESS* deviceAddress, BYTE capabilityInformation, ZBOOL securityUse, UINT8 aclEntry);
//-------------------------------------------------------------------------------------------------------
// void mlmeAssociateResponse(ADDRESS *pDeviceAddress, WORD assocShortAddress, MAC_ENUM status, ...
//
// DESCRIPTION:
// Used by a ccordinator to respond to an association indication. The response is placed in the
// indirect transmission queue.
// Generates a mlmeCommStatusIndication callback upon completion
//
// PARAMETERS:
// ADDRESS *pDeviceAddress
// Pointer to the extended address of the associated device
// WORD assocShortAddress
// The assigned short address
// MAC_ENUM status
// The association status
// ZBOOL securityEnable
// Security is enabled?
//-------------------------------------------------------------------------------------------------------
void mlmeAssociateResponse(ADDRESS *deviceAddress, WORD assocShortAddress, MAC_ENUM status, ZBOOL securityEnable);
//-------------------------------------------------------------------------------------------------------
// void mlmeAssociateConfirm(WORD assocShortAddress, MAC_ENUM status)
//
// DESCRIPTION:
// mlmeAssociateConfirm is generated by the MAC layer when an association attempt has succeeded or
// failed (initiated by mlmeAssociateRequest(...)).
// Function must be implemented by the higher layer
//
// PARAMETERS:
// WORD assocShortAddress
// The short device address allocated by the coordinator on successful association. This
// parameter will be equal to 0xFFFF if the association attempt was unsuccessful.
// MAC_ENUM status
// The status of the association attempt (SUCCESS, CHANNEL_ACCESS_FAILURE, MAC_NO_DATA, etc.)
//-------------------------------------------------------------------------------------------------------
void mlmeAssociateConfirm(UINT16 AssocShortAddress, MAC_ENUM status);
//-------------------------------------------------------------------------------------------------------
// void mlmeBeaconNotifyIndication(MLME_BEACON_NOTIFY_INDICATION *pMBNI)
//
// DESCRIPTION:
// MAC callback to the higher layer upon reception of a beacon frame with beacon payload
// or when MAC_AUTO_REQUEST is set to FALSE.
// Function must be implemented by the higher layer
//
// PARAMETERS:
// MLME_BEACON_NOTIFY_INDICATION *pMBNI
// Pointer to the MLME_BEACON_NOTIFY_INDICATION beacon notification struct
//-------------------------------------------------------------------------------------------------------
void mlmeBeaconNotifyIndication(MLME_BEACON_NOTIFY_INDICATION *pMBNI);
//-------------------------------------------------------------------------------------------------------
// void mlmeCommStatusIndication(WORD panId, BYTE srcAddrMode, ADDRESS *pSrcAddr, BYTE dstAddrMode, ...
//
// DESCRIPTION:
// The mlmeCommStatusIndication callback is called by the MAC sublayer
// either following a transmission instigated through a .response primitive or on receipt of a
// frame that generates an error in its secure processing.
//
// Function must be implemented by the higher layer
//
// PARAMETERS:
// WORD panId
// The 16 bit PAN identifier of the device from which the frame was received or to
// which the frame was being sent.
// BYTE srcAddrMode
// Source address mode
// ADDRESS *pSrcAddr
// Source address pointer
// BYTE dstAddrMode
// Destination address mode
// ADDRESS *pDstAddr
// Destination address pointer
// MAC_ENUM status
// Status enumeration
// (SUCCESS | TRANSACTION_OVERFLOW | TRANSACTION_EXPIRED | CHANNEL_ACCESS_FAILURE | NO_ACK |
// UNAVAILABLE_KEY | FRAME_TOO_LONG | FAILED_SECURITY_CHECK | INVALID_PARAMETER)
//-------------------------------------------------------------------------------------------------------
void mlmeCommStatusIndication(UINT16 panId, BYTE srcAddrMode, ADDRESS *pSrcAddr, BYTE dstAddrMode, ADDRESS *pDstAddr, MAC_ENUM status);
//-------------------------------------------------------------------------------------------------------
// void mlmeDisassociateRequest(QWORD *pDeviceAddress, BYTE disassociateReason, ZBOOL securityEnable)
//
// DESCRIPTION:
// Used by an associated device to notify the coordinator of its intent to leave the PAN or
// used by the coordinator to instruct an associated device to leave the PAN. pDeviceAddress is a
// pointer to the extended address of the device to which to send the disassociation notification
// command.
//
// PARAMETERS:
// QWORD *pDeviceAddress
// For coordinators: A pointer to the extended address of the device to disassociate
// For devices: A pointer to the extended address of coordinator
// BYTE disassociateReason
// The disassociate reason (COORD_WISHES_DEVICE_TO_LEAVE | DEVICE_WISHES_TO_LEAVE)
// ZBOOL securityEnable
// Security is enabled?
//-------------------------------------------------------------------------------------------------------
void mlmeDisassociateRequest(QWORD *pDeviceAddress, BYTE disassociateReason, ZBOOL securityEnable);
//-------------------------------------------------------------------------------------------------------
// void mlmeDisassociateIndication(QWORD deviceAddress, BYTE disassociateReason, ZBOOL securityUse, ...
//
// DESCRIPTION:
// Callback generated by the MAC sublayer to the higher layer upon reception of a
// disassociation notification command frame
// Function must be implemented by the higher layer of a FFD device
//
// PARAMETERS:
// QWORD deviceAddress
// Extended address of the device requesting disassociation
// BYTE disassociateReason
// The disassociate reason (COORD_WISHES_DEVICE_TO_LEAVE | DEVICE_WISHES_TO_LEAVE)
// ZBOOL securityUse
// Security enabled for the incoming frame?
// UINT8 aclEntry
// The macSecurityMode parameter value from the ACL entry associated with the sender of
// the data frame. This value is set to 0x08 if the sender of the data frame was not
// found in the ACL.
//-------------------------------------------------------------------------------------------------------
void mlmeDisassociateIndication(ADDRESS * deviceAddress, BYTE disassociateReason, ZBOOL securityUse, UINT8 aclEntry);
//-------------------------------------------------------------------------------------------------------
// void mlmeDisassociateConfirm(MAC_ENUM status)
//
// DESCRIPTION:
// Callback generated by the MAC sublayer to the higher layer upon completion of a
// mlmeDisassociateRequest(...) call from the higher layer.
// Function must be implemented by the higher layer.
//
// PARAMETERS:
// MAC_ENUM status
// Status returned by the callback
// (SUCCESS | TRANSACTION_OVERFLOW | TRANSACTION_EXPIRED | NO_ACK |
// CHANNEL_ACCESS_FAILURE | UNAVAILABLE_KEY | FAILED_SECURITY_CHECK |
// INVALID_PARAMETER)
//-------------------------------------------------------------------------------------------------------
void mlmeDisassociateConfirm(MAC_ENUM status);
//-------------------------------------------------------------------------------------------------------
// MAC_ENUM mlmeGetRequest(MAC_PIB_ATTR pibAttribute, void *pPibAttributeValue)
//
// DESCRIPTION:
// Get MAC PIB attributes. The value is copied to the location pointed to by the void*. Note that
// some values are returned as pointers:
// - pMacBeaconPayload
// - pMacACLEntryDescriptorSet
// - pMacDefaultSecurityMaterial
//
// PARAMETERS:
// MAC_PIB_ATTR pibAttribute
// The attribute to be changed
// void *pPibAttributeValue
// A pointer to the PIB attribute. Note that this data is _copied_ into the PIB.
//
// RETURN VALUE:
// MAC_ENUM
// SUCCESS or UNSUPPORTED_ATTRIBUTE
//-------------------------------------------------------------------------------------------------------
MAC_ENUM mlmeGetRequest(MAC_PIB_ATTR pibAttribute, void *pPibAttributeValue);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -