Modules#

InterPanHeader

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_H
#define AMI_INTER_PAN_H

// The three types of inter-PAN messages.  The values are actually 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.
//

#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;

EmberMessageBuffer makeInterPanMessage(InterPanHeader *headerData,
                                       EmberMessageBuffer payload);

uint8_t parseInterPanMessage(EmberMessageBuffer message,
                             uint8_t startOffset,
                             InterPanHeader *headerData);

#endif // AMI_INTER_PAN_H

Macros#

#define
#define
MAX_INTER_PAN_MAC_SIZE (2 + 1 + 2 + 8 + 2 + 8)
#define
#define
MAX_STUB_APS_SIZE (1 + 2 + 2 + 2)
#define
MAX_INTER_PAN_HEADER_SIZE (MAX_INTER_PAN_MAC_SIZE + STUB_NWK_SIZE + MAX_STUB_APS_SIZE)

Functions#

EmberMessageBuffer
makeInterPanMessage(InterPanHeader *headerData, EmberMessageBuffer payload)

Create an interpan message suitable for passing to emberSendRawMessage().

uint8_t
parseInterPanMessage(EmberMessageBuffer message, uint8_t startOffset, InterPanHeader *headerData)

Meant to be called on the message and offset values 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_UNICAST
Value:
0x03

Definition at line 39 of file app/util/zigbee-framework/ami-inter-pan.h

INTER_PAN_BROADCAST#

#define INTER_PAN_BROADCAST
Value:
0x0B

Definition at line 40 of file app/util/zigbee-framework/ami-inter-pan.h

INTER_PAN_MULTICAST#

#define INTER_PAN_MULTICAST
Value:
0x0F

Definition at line 41 of file app/util/zigbee-framework/ami-inter-pan.h

MAX_INTER_PAN_MAC_SIZE#

#define MAX_INTER_PAN_MAC_SIZE
Value:
(2 + 1 + 2 + 8 + 2 + 8)

Definition at line 44 of file app/util/zigbee-framework/ami-inter-pan.h

STUB_NWK_SIZE#

#define STUB_NWK_SIZE
Value:
2

Definition at line 48 of file app/util/zigbee-framework/ami-inter-pan.h

STUB_NWK_FRAME_CONTROL#

#define STUB_NWK_FRAME_CONTROL
Value:
0x000B

Definition at line 49 of file app/util/zigbee-framework/ami-inter-pan.h

MAX_STUB_APS_SIZE#

#define MAX_STUB_APS_SIZE
Value:
(1 + 2 + 2 + 2)

Definition at line 52 of file app/util/zigbee-framework/ami-inter-pan.h

MAX_INTER_PAN_HEADER_SIZE#

#define MAX_INTER_PAN_HEADER_SIZE
Value:
  (MAX_INTER_PAN_MAC_SIZE + STUB_NWK_SIZE + MAX_STUB_APS_SIZE)

Definition at line 55 of file app/util/zigbee-framework/ami-inter-pan.h

Function Documentation#

makeInterPanMessage#

EmberMessageBuffer makeInterPanMessage (InterPanHeader *headerData, EmberMessageBuffer payload)

Create an interpan message suitable for passing to emberSendRawMessage().

Parameters
N/AheaderData
N/Apayload

Definition at line 81 of file app/util/zigbee-framework/ami-inter-pan.h

parseInterPanMessage#

uint8_t parseInterPanMessage (EmberMessageBuffer message, uint8_t startOffset, InterPanHeader *headerData)

Meant to be called on the message and offset values 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.

Parameters
N/Amessage
N/AstartOffset
N/AheaderData

Definition at line 91 of file app/util/zigbee-framework/ami-inter-pan.h