Utilities for sending and receiving ZigBee AMI InterPAN messages. See Sending and Receiving Messages for documentation.
DeprecatedThe ami-inter-pan library is deprecated and will be removed in a future release. Similar functionality is available in the Inter-PAN plugin in Application Framework.
License#
Copyright 2018 Silicon Laboratories Inc. www.silabs.com
The licensor of this software is Silicon Laboratories Inc. Your use of this software is governed by the terms of Silicon Labs Master Software License Agreement (MSLA) available at www.silabs.com/about-us/legal/master-software-license-agreement. This software is distributed to you in Source Code format and is governed by the sections of the MSLA applicable to Source Code.
/***************************************************************************/
#ifndef AMI_INTER_PAN_HOST_H
#define AMI_INTER_PAN_HOST_H
#define INTER_PAN_UNICAST 0x03
#define INTER_PAN_BROADCAST 0x0B
#define INTER_PAN_MULTICAST 0x0F
// Frame control, sequence, dest PAN ID, dest, source PAN ID, source.
#define MAX_INTER_PAN_MAC_SIZE (2 + 1 + 2 + 8 + 2 + 8)
//Short form has a short destination.
// NWK stub frame has two control bytes.
#define STUB_NWK_SIZE 2
#define STUB_NWK_FRAME_CONTROL 0x000B
// APS frame control, group ID, cluster ID, profile ID
#define MAX_STUB_APS_SIZE (1 + 2 + 2 + 2)
// Short form has no group ID.
#define MAX_INTER_PAN_HEADER_SIZE \
(MAX_INTER_PAN_MAC_SIZE + STUB_NWK_SIZE + MAX_STUB_APS_SIZE)
typedef struct {
uint8_t messageType; // one of the INTER_PAN_...CAST values
// MAC addressing
// For outgoing messages this is the destination. For incoming messages
// it is the source, which always has a long address.
uint16_t panId;
bool hasLongAddress; // always true for incoming messages
EmberNodeId shortAddress;
EmberEUI64 longAddress;
// APS data
uint16_t profileId;
uint16_t clusterId;
uint16_t groupId; // only used for INTER_PAN_MULTICAST
} InterPanHeader;
uint8_t makeInterPanMessage(InterPanHeader *headerData,
uint8_t *message,
uint8_t maxLength,
uint8_t *payload,
uint8_t payloadLength);
uint8_t parseInterPanMessage(uint8_t *message,
uint8_t messageLength,
InterPanHeader *headerData);
#endif // AMI_INTER_PAN_HOST_H
Modules#
Macros#
The three types of inter-PAN messages. The values are the corresponding APS frame controls. 0x03 is the special interPAN message type. Unicast mode is 0x00, broadcast mode is 0x08, and multicast mode is 0x0C.
Functions#
Create an interpan message. The message needs to have enough space for the message contents. Upon return, the return value will be the length of the message, or 0 in case of error.
Meant to be called on the message passed to emberMacPassthroughMessageHandler(...). The header is parsed and the various fields are written to the InterPanHeader. The returned value is the offset of the payload in the message, or 0 if the message is not a correctly formed AMI interPAN message.
Macro Definition Documentation#
INTER_PAN_UNICAST#
#define INTER_PAN_UNICASTValue:
0x03
The three types of inter-PAN messages. The values are the corresponding APS frame controls. 0x03 is the special interPAN message type. Unicast mode is 0x00, broadcast mode is 0x08, and multicast mode is 0x0C.
38
of file app/util/zigbee-framework/ami-inter-pan-host.h
INTER_PAN_BROADCAST#
#define INTER_PAN_BROADCASTValue:
0x0B
39
of file app/util/zigbee-framework/ami-inter-pan-host.h
INTER_PAN_MULTICAST#
#define INTER_PAN_MULTICASTValue:
0x0F
40
of file app/util/zigbee-framework/ami-inter-pan-host.h
MAX_INTER_PAN_MAC_SIZE#
#define MAX_INTER_PAN_MAC_SIZEValue:
(2 + 1 + 2 + 8 + 2 + 8)
43
of file app/util/zigbee-framework/ami-inter-pan-host.h
STUB_NWK_SIZE#
#define STUB_NWK_SIZEValue:
2
47
of file app/util/zigbee-framework/ami-inter-pan-host.h
STUB_NWK_FRAME_CONTROL#
#define STUB_NWK_FRAME_CONTROLValue:
0x000B
48
of file app/util/zigbee-framework/ami-inter-pan-host.h
MAX_STUB_APS_SIZE#
#define MAX_STUB_APS_SIZEValue:
(1 + 2 + 2 + 2)
51
of file app/util/zigbee-framework/ami-inter-pan-host.h
MAX_INTER_PAN_HEADER_SIZE#
#define MAX_INTER_PAN_HEADER_SIZEValue:
(MAX_INTER_PAN_MAC_SIZE + STUB_NWK_SIZE + MAX_STUB_APS_SIZE)
54
of file app/util/zigbee-framework/ami-inter-pan-host.h
Function Documentation#
makeInterPanMessage#
uint8_t makeInterPanMessage (InterPanHeader * headerData, uint8_t * message, uint8_t maxLength, uint8_t * payload, uint8_t payloadLength)
Create an interpan message. The message needs to have enough space for the message contents. Upon return, the return value will be the length of the message, or 0 in case of error.
N/A | headerData | |
N/A | message | |
N/A | maxLength | |
N/A | payload | |
N/A | payloadLength |
84
of file app/util/zigbee-framework/ami-inter-pan-host.h
parseInterPanMessage#
uint8_t parseInterPanMessage (uint8_t * message, uint8_t messageLength, InterPanHeader * headerData)
Meant to be called on the message passed to emberMacPassthroughMessageHandler(...). The header is parsed and the various fields are written to the InterPanHeader. The returned value is the offset of the payload in the message, or 0 if the message is not a correctly formed AMI interPAN message.
N/A | message | |
N/A | messageLength | |
N/A | headerData |
97
of file app/util/zigbee-framework/ami-inter-pan-host.h