Modules#

EmberGpAddress

EmberGpSinkAddress

EmberGpSinkGroup

EmberGpSinkListEntry

EmberGpProxyTableEntry

EmberGpSinkTableEntry

EmberCGpAddress

EmberGpProxyClusterAttributes

EmberGpTxQueueEntry

EmberGpApplicationInfo

EmberGpAttributeRecord

EmberGpDataPointDescriptor

EmberGpReportDescriptor

EmberGpSwitchInformation

EmberGpGenericSwitchData

EmberGpTranslationTableAdditionalInfoBlockOptionRecordField

Zigbee Green Power types and defines. See greenpower for documentation.

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 SILABS_GP_TYPES_H
#define SILABS_GP_TYPES_H

// Mask used in the Gp Ep Incoming Message Handler to pass bidirectional information
// Incoming GPDF has rxAfterTx bit set
#define EMBER_GP_BIDIRECTION_INFO_RX_AFTER_TX_MASK        0x01
// A tx queue is available at gp stub to hold an outgoing GPDF
#define EMBER_GP_BIDIRECTION_INFO_TX_QUEUE_AVAILABLE_MASK 0x02
typedef uint32_t EmberGpSourceId;
typedef uint32_t EmberGpSecurityFrameCounter;
typedef uint32_t EmberGpMic;

#ifdef DOXYGEN_SHOULD_SKIP_THIS
enum EmberGpSecurityLevel
#else
typedef uint8_t EmberGpSecurityLevel;
enum
#endif
{
  EMBER_GP_SECURITY_LEVEL_NONE = 0x00,
  EMBER_GP_SECURITY_LEVEL_RESERVED = 0x01,
  EMBER_GP_SECURITY_LEVEL_FC_MIC = 0x02,
  EMBER_GP_SECURITY_LEVEL_FC_MIC_ENCRYPTED = 0x03,
};
#ifdef DOXYGEN_SHOULD_SKIP_THIS
enum EmberGpKeyType
#else
typedef uint8_t EmberGpKeyType;
enum
#endif
{
  EMBER_GP_SECURITY_KEY_NONE = 0x00,
  EMBER_GP_SECURITY_KEY_NWK = 0x01,
  EMBER_GP_SECURITY_KEY_GPD_GROUP = 0x02,
  EMBER_GP_SECURITY_KEY_NWK_DERIVED = 0x03,
  EMBER_GP_SECURITY_KEY_GPD_OOB = 0x04,
  EMBER_GP_SECURITY_KEY_GPD_DERIVED = 0x07,
};
#ifdef DOXYGEN_SHOULD_SKIP_THIS
enum EmberGpApplicationId
#else
typedef uint8_t EmberGpApplicationId;
enum
#endif
{
  EMBER_GP_APPLICATION_SOURCE_ID = 0x00,
  EMBER_GP_APPLICATION_IEEE_ADDRESS = 0x02,
};

#define EMBER_GP_APPLICATION_ID_MASK 0x03
#ifdef DOXYGEN_SHOULD_SKIP_THIS
enum EmberGpProxyTableEntryStatus
#else
typedef uint8_t EmberGpProxyTableEntryStatus;
enum
#endif
{
  EMBER_GP_PROXY_TABLE_ENTRY_STATUS_ACTIVE = 0x01,
  EMBER_GP_PROXY_TABLE_ENTRY_STATUS_UNUSED = 0xFF,
};

#ifdef DOXYGEN_SHOULD_SKIP_THIS
enum EmberGpSinkTableEntryStatus
#else
typedef uint8_t EmberGpSinkTableEntryStatus;
enum
#endif
{
  EMBER_GP_SINK_TABLE_ENTRY_STATUS_ACTIVE = 0x01,
  EMBER_GP_SINK_TABLE_ENTRY_STATUS_UNUSED = 0xFF,
};

typedef struct {
  union {
    EmberEUI64 gpdIeeeAddress;
    EmberGpSourceId sourceId;
  } id;
  EmberGpApplicationId applicationId;
  uint8_t endpoint;
} EmberGpAddress;

typedef enum {
  EMBER_GP_SINK_TYPE_FULL_UNICAST,
  EMBER_GP_SINK_TYPE_D_GROUPCAST,
  EMBER_GP_SINK_TYPE_GROUPCAST,
  EMBER_GP_SINK_TYPE_LW_UNICAST,
  EMBER_GP_SINK_TYPE_UNUSED = 0xFF
} EmberGpSinkType;

typedef struct {
  EmberEUI64 sinkEUI;
  EmberNodeId sinkNodeId;
} EmberGpSinkAddress;

typedef struct {
  uint16_t groupID;
  uint16_t alias;
} EmberGpSinkGroup;

typedef struct {
  EmberGpSinkType type;

  union {
    EmberGpSinkAddress unicast;
    EmberGpSinkGroup groupcast;
    EmberGpSinkGroup groupList;   // Entry for Sink Group List
  } target;
} EmberGpSinkListEntry;

#define GP_SINK_LIST_ENTRIES 2

// The size of the SinkList entries in sink table in format of octet string that has a format of {<1 byte length>, <n bytes for sink groups>}
#define GP_SIZE_OF_SINK_LIST_ENTRIES_OCTET_STRING (1 + (GP_SINK_LIST_ENTRIES * (sizeof(EmberGpSinkGroup))))

typedef struct {
  EmberGpProxyTableEntryStatus status;
  uint32_t options;
  EmberGpAddress gpd;
  EmberNodeId assignedAlias;
  uint8_t securityOptions;
  EmberGpSecurityFrameCounter gpdSecurityFrameCounter;
  EmberKeyData gpdKey;
  EmberGpSinkListEntry sinkList[GP_SINK_LIST_ENTRIES];
  uint8_t groupcastRadius;
  uint8_t searchCounter;
} EmberGpProxyTableEntry;

typedef struct {
  EmberGpSinkTableEntryStatus status;
  uint16_t options;
  EmberGpAddress gpd;
  uint8_t deviceId;
  EmberGpSinkListEntry sinkList[GP_SINK_LIST_ENTRIES];
  EmberNodeId assignedAlias;
  uint8_t groupcastRadius;
  uint8_t securityOptions;
  EmberGpSecurityFrameCounter gpdSecurityFrameCounter;
  EmberKeyData gpdKey;
} EmberGpSinkTableEntry;

#ifdef DOXYGEN_SHOULD_SKIP_THIS
enum EmberCGpTxOption
#else
typedef uint8_t EmberCGpTxOption;
enum
#endif
{
  EMBER_CGP_TX_OPTION_NONE = 0x00,
  EMBER_CGP_TX_OPTION_USE_CSMA_CA = 0x01,
  EMBER_CGP_TX_OPTION_USE_MAC_ACK = 0x02,
  EMBER_CGP_TX_OPTION_RESERVED = 0xFC,
};

#ifdef DOXYGEN_SHOULD_SKIP_THIS
enum EmberCGpAddressMode
#else
typedef uint8_t EmberCGpAddressMode;
enum
#endif
{
  EMBER_CGP_ADDRESS_MODE_NONE = 0x00,
  EMBER_CGP_ADDRESS_MODE_RESERVED = 0x01,
  EMBER_CGP_ADDRESS_MODE_SHORT = 0x02,
  EMBER_CGP_ADDRESS_MODE_EXTENDED = 0x03,
};

typedef struct {
  union {
    EmberNodeId shortId;
    EmberEUI64 extendedId;
  } address;
  EmberPanId panId;
  EmberCGpAddressMode mode;
} EmberCGpAddress;
#ifdef DOXYGEN_SHOULD_SKIP_THIS
enum EmberDGpTxOption
#else
typedef uint8_t EmberDGpTxOption;
enum
#endif
{
  EMBER_DGP_TX_OPTION_NONE = 0x00,
  EMBER_DGP_TX_OPTION_USE_GP_TX_QUEUE = 0x01,
  EMBER_DGP_TX_OPTION_USE_CSMA_CA = 0x02,
  EMBER_DGP_TX_OPTION_USE_MAC_ACK = 0x04,
  EMBER_DGP_TX_OPTION_FRAME_TYPE_DATA = 0x00,
  EMBER_DGP_TX_OPTION_FRAME_TYPE_MAINTENANCE = 0x08,
  EMBER_DGP_TX_OPTION_RESERVED = 0xE0,
};

typedef struct {
  uint8_t foo;
} EmberGpProxyClusterAttributes;

typedef struct {
  bool inUse;
  bool useCca;
  EmberGpAddress addr;
  uint8_t gpdCommandId;
  EmberMessageBuffer asdu;
  uint8_t gpepHandle;
  uint16_t queueEntryLifetimeMs;
} EmberGpTxQueueEntry;

#define GP_PARAMS                         \
  EmberStatus status,                     \
  uint8_t gpdLink,                        \
  uint8_t sequenceNumber,                 \
  EmberGpAddress * addr,                  \
  EmberGpSecurityLevel gpdfSecurityLevel, \
  EmberGpKeyType gpdfSecurityKeyType,     \
  bool autoCommissioning,                 \
  uint8_t bidirectionalInfo,              \
  uint32_t gpdSecurityFrameCounter,       \
  uint8_t gpdCommandId,                   \
  uint32_t mic,                           \
  uint8_t proxyTableIndex,                \
  uint8_t gpdCommandPayloadLength,        \
  uint8_t * gpdCommandPayload

#define GP_ARGS            \
  status,                  \
  gpdLink,                 \
  sequenceNumber,          \
  addr,                    \
  gpdfSecurityLevel,       \
  gpdfSecurityKeyType,     \
  autoCommissioning,       \
  bidirectionalInfo,       \
  gpdSecurityFrameCounter, \
  gpdCommandId,            \
  mic,                     \
  proxyTableIndex,         \
  gpdCommandPayloadLength, \
  gpdCommandPayload

#define GP_UNUSED_ARGS           \
  (void)status;                  \
  (void)gpdLink;                 \
  (void)sequenceNumber;          \
  (void)addr;                    \
  (void)gpdfSecurityLevel;       \
  (void)gpdfSecurityKeyType;     \
  (void)autoCommissioning;       \
  (void)rxAfterTx;               \
  (void)gpdSecurityFrameCounter; \
  (void)gpdCommandId;            \
  (void)mic;                     \
  (void)proxyTableIndex;         \
  (void)gpdCommandPayloadLength; \
  (void)gpdCommandPayload;

#define GP_PROXY_TABLE_OPTIONS_IN_RANGE (BIT(10))

//3 consumed by device id, options, and app info byte
#define GP_COMMISSIONING_MAX_BYTES (55 - 3)

typedef struct {
  uint8_t deviceId;
  uint8_t applInfoBitmap;
  uint16_t manufacturerId;
  uint16_t modelId;
  uint8_t numberOfGpdCommands;
  uint8_t gpdCommands[GP_COMMISSIONING_MAX_BYTES - 1];
  uint8_t numberOfPairedEndpoints;
  uint8_t pairedEndpoints[GP_COMMISSIONING_MAX_BYTES - 1];
  uint8_t numberOfGpdClientCluster;
  uint8_t numberOfGpdServerCluster;
  uint16_t serverClusters[15];
  uint16_t clientClusters[15];
} EmberGpApplicationInfo;

typedef struct {
  uint16_t              attributeID;
  uint8_t               attributeDataType;
  uint8_t               remainingAttributRecordLength; // on 4 bits
  uint8_t               reported;
  uint8_t               attrValuePresent;
  uint8_t               attrOffsetWithinReport;
  // TODO change "attrValue" from u32 to a pointer, as the data could be up to a string
  // the field "attributeDataType" tell with format it is, among  more than 55 possibilities)
  // so a add a private field which just tell the length of attrValue to easier
  // process it
  uint32_t              attrValue;
  uint8_t               attrValueSize;
} EmberGpAttributeRecord;
typedef struct {
  // Note: it is "N-1", if there is 2 attr record then nbAttrRecord=1 and not 2 !
  uint8_t               nbAttrRecord;
  uint8_t               clientServer;
  uint8_t               ManIdPresent;
  uint8_t               datapointOptions;
  uint16_t              clusterID;
  uint16_t              manufacturerID;
  EmberGpAttributeRecord attrRecord;
} EmberGpDataPointDescriptor;

typedef struct {
  uint8_t               repId;
  uint8_t               reportOptions;
  uint16_t              timeoutPeriod;
  uint8_t               totalLength;
  EmberGpDataPointDescriptor  dataPoint;
} EmberGpReportDescriptor;
typedef struct {
  uint8_t switchInfoLength;
  uint8_t nbOfContacts;
  uint8_t switchType;
  uint8_t currentContact;
  uint8_t savedContact;
}EmberGpSwitchInformation;
#define TT_NB_MAX_OPTION_RECORD                                         (8)
typedef struct {
  uint8_t       currentStatus;
  uint8_t       contactBitmask;
} EmberGpGenericSwitchData;

typedef struct {
  uint8_t       totalLengthOfAddInfoBlock;
  uint8_t       optionSelector;
  union {
    struct {
      uint8_t       reportIdentifier;
      uint8_t       attrOffsetWithinReport;
      uint16_t      clusterID;
      uint16_t      attributeID;
      uint8_t       attributeDataType;
      uint8_t       attributeOptions; //clientServer bit0 manufacturerIdPresent bit1
      uint16_t      manufacturerID;
    } compactAttr;
    struct {
      uint8_t       contactStatus;
      uint8_t       contactBitmask;
    } genericSwitch;
  } optionData;//EmberGpTranslationTableAdditionalInfoBlockOptionRecordOptionDataField;
} EmberGpTranslationTableAdditionalInfoBlockOptionRecordField;


#define GP_GPD_SRC_ID_FOR_CAHNNEL_CONFIG 0x00000000
#define GP_GPD_SRC_ID_WILDCARD           0xFFFFFFFF

// GPD SrcID reserved values
#define GP_GPD_SRC_ID_RESERVED_0 0x00000000
#define GP_GPD_SRC_ID_RESERVED_FFFFFF9 0xFFFFFFF9
#define GP_GPD_SRC_ID_RESERVED_FFFFFFA 0xFFFFFFFA
#define GP_GPD_SRC_ID_RESERVED_FFFFFFB 0xFFFFFFFB
#define GP_GPD_SRC_ID_RESERVED_FFFFFFC 0xFFFFFFFC
#define GP_GPD_SRC_ID_RESERVED_FFFFFFD 0xFFFFFFFD
#define GP_GPD_SRC_ID_RESERVED_FFFFFFE 0xFFFFFFFE

#define GP_DERIVED_GROUP_ALIAS_NOT_USED 0xffff

#define GP_DMIN_B 32
#define GP_DMIN_U 5
#define GP_DMAX 100

// -----------------------------------------------------------------------------
// API

EmberStatus emberDGpSend(bool action,
                         bool useCca,
                         EmberGpAddress *addr,
                         uint8_t gpdCommandId,
                         uint8_t gpdAsduLength,
                         uint8_t const *gpdAsdu,
                         uint8_t gpepHandle,
                         uint16_t gpTxQueueEntryLifetimeMs);

bool emberGpProxyTableProcessGpPairing(uint32_t options,
                                       EmberGpAddress* addr,
                                       uint8_t commMode,
                                       uint16_t sinkNwkAddress,
                                       uint16_t sinkGroupId,
                                       uint16_t assignedAlias,
                                       uint8_t* sinkIeeeAddress,
                                       EmberKeyData *gpdKey,
                                       uint32_t gpdSecurityFrameCounter,
                                       uint8_t forwardingRadius);
uint8_t emberGpProxyTableLookup(EmberGpAddress *addr);

EmberStatus emberGpProxyTableGetEntry(uint8_t proxyIndex,
                                      EmberGpProxyTableEntry *entry);

EmberStatus emberGpSinkTableGetEntry(uint8_t sinkIndex,
                                     EmberGpSinkTableEntry *entry);
uint8_t emberGpSinkTableLookup(EmberGpAddress *addr);

void emberGpSinkTableClearAll(void);

EmberStatus emberGpSinkTableSetEntry(uint8_t sinkTableIndex,
                                     EmberGpSinkTableEntry *entry);

uint8_t emberGpSinkTableFindOrAllocateEntry(EmberGpAddress *addr);

void emberGpSinkTableRemoveEntry(uint8_t index);

void emberGpSinkTableInit(void);

void emberGpSinkTableSetSecurityFrameCounter(uint8_t index,
                                             uint32_t sfc);
// Tx Queue APIs

MessageBufferQueue * emberGpGetTxQueueHead(void);

void emberGpSetMaxTxQueueEntry(uint16_t maxEntries);

uint16_t emberGetGpMaxTxQListCount(void);

uint16_t emberGetGpTxQListCount(void);

EmberMessageBuffer emberGpGetTxQueueEntryFromQueue(EmberGpTxQueueEntry *txQueue,
                                                   uint8_t *data,
                                                   uint16_t *dataLength,
                                                   uint16_t allocatedDataLength);
EmberMessageBuffer emberGpAddGpTxQueueEntryWithPayload(EmberGpTxQueueEntry *txQueue,
                                                       uint8_t *data,
                                                       uint16_t dataLength);
bool emberGpRemoveFromTxQueue(EmberGpTxQueueEntry *txQueue);

void emberGpClearTxQueue(void);

#endif // SILABS_GP_TYPES_H
 // end of name API

GP Types#

#define

Number of GP sink list entries. Minimum is 2 sink list entries.

#define

Number of GP sink list entries. Minimum is 2 sink list entries.

#define
GP_SIZE_OF_SINK_LIST_ENTRIES_OCTET_STRING (1 + (GP_SINK_LIST_ENTRIES * (sizeof(EmberGpSinkGroup))))

Number of GP sink list entries. Minimum is 2 sink list entries.

#define
GP_PARAMS undefined

Number of GP sink list entries. Minimum is 2 sink list entries.

#define
GP_ARGS undefined

Number of GP sink list entries. Minimum is 2 sink list entries.

#define
GP_UNUSED_ARGS undefined

Number of GP sink list entries. Minimum is 2 sink list entries.

#define

Number of GP sink list entries. Minimum is 2 sink list entries.

#define

Number of GP sink list entries. Minimum is 2 sink list entries.

#define

Number of maximum option record entries in translation table.

#define

Number of GP sink list entries. Minimum is 2 sink list entries.

#define

Number of GP sink list entries. Minimum is 2 sink list entries.

#define

Number of GP sink list entries. Minimum is 2 sink list entries.

#define

Number of GP sink list entries. Minimum is 2 sink list entries.

#define

Number of GP sink list entries. Minimum is 2 sink list entries.

#define

Number of GP sink list entries. Minimum is 2 sink list entries.

#define

Number of GP sink list entries. Minimum is 2 sink list entries.

#define

Number of GP sink list entries. Minimum is 2 sink list entries.

#define

Number of GP sink list entries. Minimum is 2 sink list entries.

#define

Number of GP sink list entries. Minimum is 2 sink list entries.

#define

Number of GP sink list entries. Minimum is 2 sink list entries.

#define

Number of GP sink list entries. Minimum is 2 sink list entries.

#define

Number of GP sink list entries. Minimum is 2 sink list entries.

enum
EMBER_GP_SECURITY_LEVEL_NONE = 0x00
EMBER_GP_SECURITY_LEVEL_RESERVED = 0x01
EMBER_GP_SECURITY_LEVEL_FC_MIC = 0x02
EMBER_GP_SECURITY_LEVEL_FC_MIC_ENCRYPTED = 0x03
}

Green Power Security Level.

enum
EMBER_GP_SECURITY_KEY_NONE = 0x00
EMBER_GP_SECURITY_KEY_NWK = 0x01
EMBER_GP_SECURITY_KEY_GPD_GROUP = 0x02
EMBER_GP_SECURITY_KEY_NWK_DERIVED = 0x03
EMBER_GP_SECURITY_KEY_GPD_OOB = 0x04
EMBER_GP_SECURITY_KEY_GPD_DERIVED = 0x07
}

Green Power Security Security Key Type.

enum
EMBER_GP_APPLICATION_SOURCE_ID = 0x00
EMBER_GP_APPLICATION_IEEE_ADDRESS = 0x02
}

Green Power Application Id.

enum
EMBER_GP_PROXY_TABLE_ENTRY_STATUS_ACTIVE = 0x01
EMBER_GP_PROXY_TABLE_ENTRY_STATUS_UNUSED = 0xFF
}

GP proxy table entry status.

enum
EMBER_GP_SINK_TABLE_ENTRY_STATUS_ACTIVE = 0x01
EMBER_GP_SINK_TABLE_ENTRY_STATUS_UNUSED = 0xFF
}

GP sink table entry status.

enum
EMBER_GP_SINK_TYPE_FULL_UNICAST
EMBER_GP_SINK_TYPE_D_GROUPCAST
EMBER_GP_SINK_TYPE_GROUPCAST
EMBER_GP_SINK_TYPE_LW_UNICAST
EMBER_GP_SINK_TYPE_UNUSED = 0xFF
}

GP Sink Type.

enum
EMBER_CGP_TX_OPTION_NONE = 0x00
EMBER_CGP_TX_OPTION_USE_CSMA_CA = 0x01
EMBER_CGP_TX_OPTION_USE_MAC_ACK = 0x02
EMBER_CGP_TX_OPTION_RESERVED = 0xFC
}

CGp Transmit options.

enum
EMBER_CGP_ADDRESS_MODE_NONE = 0x00
EMBER_CGP_ADDRESS_MODE_RESERVED = 0x01
EMBER_CGP_ADDRESS_MODE_SHORT = 0x02
EMBER_CGP_ADDRESS_MODE_EXTENDED = 0x03
}

Addressing modes for CGp messages.

enum
EMBER_DGP_TX_OPTION_NONE = 0x00
EMBER_DGP_TX_OPTION_USE_GP_TX_QUEUE = 0x01
EMBER_DGP_TX_OPTION_USE_CSMA_CA = 0x02
EMBER_DGP_TX_OPTION_USE_MAC_ACK = 0x04
EMBER_DGP_TX_OPTION_FRAME_TYPE_DATA = 0x00
EMBER_DGP_TX_OPTION_FRAME_TYPE_MAINTENANCE = 0x08
EMBER_DGP_TX_OPTION_RESERVED = 0xE0
}

Transmit options for DGp messages.

typedef uint32_t
typedef uint32_t

API#

emberDGpSend(bool action, bool useCca, EmberGpAddress *addr, uint8_t gpdCommandId, uint8_t gpdAsduLength, uint8_t const *gpdAsdu, uint8_t gpepHandle, uint16_t gpTxQueueEntryLifetimeMs)

DGp Send.

bool
emberGpProxyTableProcessGpPairing(uint32_t options, EmberGpAddress *addr, uint8_t commMode, uint16_t sinkNwkAddress, uint16_t sinkGroupId, uint16_t assignedAlias, uint8_t *sinkIeeeAddress, EmberKeyData *gpdKey, uint32_t gpdSecurityFrameCounter, uint8_t forwardingRadius)

Process Gp Pairing.

uint8_t
emberGpProxyTableLookup(EmberGpAddress *addr)

Proxy table look up.

emberGpProxyTableGetEntry(uint8_t proxyIndex, EmberGpProxyTableEntry *entry)

Get Proxy table entry.

emberGpSinkTableGetEntry(uint8_t sinkIndex, EmberGpSinkTableEntry *entry)

Get Sink table entry.

uint8_t
emberGpSinkTableLookup(EmberGpAddress *addr)

Sink table look up.

void

Clear sink table.

emberGpSinkTableSetEntry(uint8_t sinkTableIndex, EmberGpSinkTableEntry *entry)

Get Sink table entry.

uint8_t

Allocates an entry in sink able.

void

Remove an entry in sink table.

void

Initialize sink table.

void
emberGpSinkTableSetSecurityFrameCounter(uint8_t index, uint32_t sfc)

Sets security frame counter in sink table entry.

Gets tx queue head.

void
emberGpSetMaxTxQueueEntry(uint16_t maxEntries)

Sets maximum limit for number of entries in the tx queue.

uint16_t

Gets the limit set for maximum number of entries in the tx queue.

uint16_t

Gets the number of entries in the tx queue.

emberGpGetTxQueueEntryFromQueue(EmberGpTxQueueEntry *txQueue, uint8_t *data, uint16_t *dataLength, uint16_t allocatedDataLength)

Gets an entry from Tx Queue The function searches the tx queue using gpd address pointed by supplied in the input/output argument txQueue and returns the message buffer that currently holding the outgoing gpdf information, returns EMBER_NULL_MESSAGE_BUFFER if not found.

emberGpAddGpTxQueueEntryWithPayload(EmberGpTxQueueEntry *txQueue, uint8_t *data, uint16_t dataLength)

Adds an entry to Tx Queue This function adds an entry along with supplied payload data to the Buffer queue. Returns the buffer handle if success else null message buffer upon failure.

bool
emberGpRemoveFromTxQueue(EmberGpTxQueueEntry *txQueue)

Remove an entry from Tx Queue This function searches and removes the entry provided.

void

Purges Tx Queue This function purges the tx queue.

GP Types Documentation#

EMBER_GP_APPLICATION_ID_MASK#

#define EMBER_GP_APPLICATION_ID_MASK
Value:
0x03

Number of GP sink list entries. Minimum is 2 sink list entries.


Definition at line 105 of file stack/include/gp-types.h

GP_SINK_LIST_ENTRIES#

#define GP_SINK_LIST_ENTRIES
Value:
2

Number of GP sink list entries. Minimum is 2 sink list entries.


Definition at line 225 of file stack/include/gp-types.h

GP_SIZE_OF_SINK_LIST_ENTRIES_OCTET_STRING#

#define GP_SIZE_OF_SINK_LIST_ENTRIES_OCTET_STRING
Value:
(1 + (GP_SINK_LIST_ENTRIES * (sizeof(EmberGpSinkGroup))))

Number of GP sink list entries. Minimum is 2 sink list entries.


Definition at line 228 of file stack/include/gp-types.h

GP_PARAMS#

#define GP_PARAMS
Value:
EmberStatus status, \
uint8_t gpdLink, \
uint8_t sequenceNumber, \
EmberGpAddress * addr, \
EmberGpSecurityLevel gpdfSecurityLevel, \
EmberGpKeyType gpdfSecurityKeyType, \
bool autoCommissioning, \
uint8_t bidirectionalInfo, \
uint32_t gpdSecurityFrameCounter, \
uint8_t gpdCommandId, \
uint32_t mic, \
uint8_t proxyTableIndex, \
uint8_t gpdCommandPayloadLength, \
uint8_t * gpdCommandPayload

Number of GP sink list entries. Minimum is 2 sink list entries.


Definition at line 434 of file stack/include/gp-types.h

GP_ARGS#

#define GP_ARGS
Value:
status, \
gpdLink, \
sequenceNumber, \
addr, \
gpdfSecurityLevel, \
gpdfSecurityKeyType, \
autoCommissioning, \
bidirectionalInfo, \
gpdSecurityFrameCounter, \
gpdCommandId, \
mic, \
proxyTableIndex, \
gpdCommandPayloadLength, \
gpdCommandPayload

Number of GP sink list entries. Minimum is 2 sink list entries.


Definition at line 450 of file stack/include/gp-types.h

GP_UNUSED_ARGS#

#define GP_UNUSED_ARGS
Value:
(void)status; \
(void)gpdLink; \
(void)sequenceNumber; \
(void)addr; \
(void)gpdfSecurityLevel; \
(void)gpdfSecurityKeyType; \
(void)autoCommissioning; \
(void)rxAfterTx; \
(void)gpdSecurityFrameCounter; \
(void)gpdCommandId; \
(void)mic; \
(void)proxyTableIndex; \
(void)gpdCommandPayloadLength; \
(void)gpdCommandPayload;

Number of GP sink list entries. Minimum is 2 sink list entries.


Definition at line 466 of file stack/include/gp-types.h

GP_PROXY_TABLE_OPTIONS_IN_RANGE#

#define GP_PROXY_TABLE_OPTIONS_IN_RANGE
Value:
(BIT(10))

Number of GP sink list entries. Minimum is 2 sink list entries.


Definition at line 482 of file stack/include/gp-types.h

GP_COMMISSIONING_MAX_BYTES#

#define GP_COMMISSIONING_MAX_BYTES
Value:
(55 - 3)

Number of GP sink list entries. Minimum is 2 sink list entries.


Definition at line 485 of file stack/include/gp-types.h

TT_NB_MAX_OPTION_RECORD#

#define TT_NB_MAX_OPTION_RECORD
Value:
(8)

Number of maximum option record entries in translation table.


Definition at line 610 of file stack/include/gp-types.h

GP_GPD_SRC_ID_FOR_CAHNNEL_CONFIG#

#define GP_GPD_SRC_ID_FOR_CAHNNEL_CONFIG
Value:
0x00000000

Number of GP sink list entries. Minimum is 2 sink list entries.


Definition at line 659 of file stack/include/gp-types.h

GP_GPD_SRC_ID_WILDCARD#

#define GP_GPD_SRC_ID_WILDCARD
Value:
0xFFFFFFFF

Number of GP sink list entries. Minimum is 2 sink list entries.


Definition at line 660 of file stack/include/gp-types.h

GP_GPD_SRC_ID_RESERVED_0#

#define GP_GPD_SRC_ID_RESERVED_0
Value:
0x00000000

Number of GP sink list entries. Minimum is 2 sink list entries.


Definition at line 663 of file stack/include/gp-types.h

GP_GPD_SRC_ID_RESERVED_FFFFFF9#

#define GP_GPD_SRC_ID_RESERVED_FFFFFF9
Value:
0xFFFFFFF9

Number of GP sink list entries. Minimum is 2 sink list entries.


Definition at line 664 of file stack/include/gp-types.h

GP_GPD_SRC_ID_RESERVED_FFFFFFA#

#define GP_GPD_SRC_ID_RESERVED_FFFFFFA
Value:
0xFFFFFFFA

Number of GP sink list entries. Minimum is 2 sink list entries.


Definition at line 665 of file stack/include/gp-types.h

GP_GPD_SRC_ID_RESERVED_FFFFFFB#

#define GP_GPD_SRC_ID_RESERVED_FFFFFFB
Value:
0xFFFFFFFB

Number of GP sink list entries. Minimum is 2 sink list entries.


Definition at line 666 of file stack/include/gp-types.h

GP_GPD_SRC_ID_RESERVED_FFFFFFC#

#define GP_GPD_SRC_ID_RESERVED_FFFFFFC
Value:
0xFFFFFFFC

Number of GP sink list entries. Minimum is 2 sink list entries.


Definition at line 667 of file stack/include/gp-types.h

GP_GPD_SRC_ID_RESERVED_FFFFFFD#

#define GP_GPD_SRC_ID_RESERVED_FFFFFFD
Value:
0xFFFFFFFD

Number of GP sink list entries. Minimum is 2 sink list entries.


Definition at line 668 of file stack/include/gp-types.h

GP_GPD_SRC_ID_RESERVED_FFFFFFE#

#define GP_GPD_SRC_ID_RESERVED_FFFFFFE
Value:
0xFFFFFFFE

Number of GP sink list entries. Minimum is 2 sink list entries.


Definition at line 669 of file stack/include/gp-types.h

GP_DERIVED_GROUP_ALIAS_NOT_USED#

#define GP_DERIVED_GROUP_ALIAS_NOT_USED
Value:
0xffff

Number of GP sink list entries. Minimum is 2 sink list entries.


Definition at line 671 of file stack/include/gp-types.h

GP_DMIN_B#

#define GP_DMIN_B
Value:
32

Number of GP sink list entries. Minimum is 2 sink list entries.


Definition at line 673 of file stack/include/gp-types.h

GP_DMIN_U#

#define GP_DMIN_U
Value:
5

Number of GP sink list entries. Minimum is 2 sink list entries.


Definition at line 674 of file stack/include/gp-types.h

GP_DMAX#

#define GP_DMAX
Value:
100

Number of GP sink list entries. Minimum is 2 sink list entries.


Definition at line 675 of file stack/include/gp-types.h

EmberGpSecurityLevel#

EmberGpSecurityLevel

Green Power Security Level.

Enumerator
EMBER_GP_SECURITY_LEVEL_NONE

No Security

EMBER_GP_SECURITY_LEVEL_RESERVED

Reserved

EMBER_GP_SECURITY_LEVEL_FC_MIC

4 Byte Frame Counter and 4 Byte MIC

EMBER_GP_SECURITY_LEVEL_FC_MIC_ENCRYPTED

4 Byte Frame Counter and 4 Byte MIC with encryption


Definition at line 51 of file stack/include/gp-types.h

EmberGpKeyType#

EmberGpKeyType

Green Power Security Security Key Type.

Enumerator
EMBER_GP_SECURITY_KEY_NONE

No Key

EMBER_GP_SECURITY_KEY_NWK

GP Security Key Type is Zigbee Network Key

EMBER_GP_SECURITY_KEY_GPD_GROUP

GP Security Key Type is Group Key

EMBER_GP_SECURITY_KEY_NWK_DERIVED

GP Security Key Type is Derived Network Key

EMBER_GP_SECURITY_KEY_GPD_OOB

GP Security Key Type is Out Of Box Key

EMBER_GP_SECURITY_KEY_GPD_DERIVED

GP Security Key Type is GPD Derived Key


Definition at line 70 of file stack/include/gp-types.h

EmberGpApplicationId#

EmberGpApplicationId

Green Power Application Id.

Enumerator
EMBER_GP_APPLICATION_SOURCE_ID

Source identifier.

EMBER_GP_APPLICATION_IEEE_ADDRESS

IEEE address.


Definition at line 93 of file stack/include/gp-types.h

EmberGpProxyTableEntryStatus#

EmberGpProxyTableEntryStatus

GP proxy table entry status.

Enumerator
EMBER_GP_PROXY_TABLE_ENTRY_STATUS_ACTIVE

The GP table entry is in use for a Proxy Table Entry.

EMBER_GP_PROXY_TABLE_ENTRY_STATUS_UNUSED

The proxy table entry is not in use.


Definition at line 110 of file stack/include/gp-types.h

EmberGpSinkTableEntryStatus#

EmberGpSinkTableEntryStatus

GP sink table entry status.

Enumerator
EMBER_GP_SINK_TABLE_ENTRY_STATUS_ACTIVE

The GP table entry is in use for a Sink Table Entry.

EMBER_GP_SINK_TABLE_ENTRY_STATUS_UNUSED

The proxy table entry is not in use.


Definition at line 130 of file stack/include/gp-types.h

EmberGpSinkType#

EmberGpSinkType

GP Sink Type.

Enumerator
EMBER_GP_SINK_TYPE_FULL_UNICAST

Sink Type is Full Unicast

EMBER_GP_SINK_TYPE_D_GROUPCAST

Sink Type is Derived groupcast, the group ID is derived from the GpdId during commissioning. The sink is added to the APS group with that groupId.

EMBER_GP_SINK_TYPE_GROUPCAST

Sink type EMBER_GP_SINK_TYPE_GROUPCAST, the groupId can be obtained from the APS group table or from the sink table.

EMBER_GP_SINK_TYPE_LW_UNICAST

Sink Type is Light Weight Unicast.

EMBER_GP_SINK_TYPE_UNUSED

Unused sink type


Definition at line 171 of file stack/include/gp-types.h

EmberCGpTxOption#

EmberCGpTxOption

CGp Transmit options.

Enumerator
EMBER_CGP_TX_OPTION_NONE

No options.

EMBER_CGP_TX_OPTION_USE_CSMA_CA

Use CSMA/CA.

EMBER_CGP_TX_OPTION_USE_MAC_ACK

Use MAC ACK.

EMBER_CGP_TX_OPTION_RESERVED

Reserved.


Definition at line 326 of file stack/include/gp-types.h

EmberCGpAddressMode#

EmberCGpAddressMode

Addressing modes for CGp messages.

Enumerator
EMBER_CGP_ADDRESS_MODE_NONE

No address (PAN identifier and address omitted).

EMBER_CGP_ADDRESS_MODE_RESERVED

Reserved.

EMBER_CGP_ADDRESS_MODE_SHORT

16-bit short address.

EMBER_CGP_ADDRESS_MODE_EXTENDED

64-bit extended address.


Definition at line 346 of file stack/include/gp-types.h

EmberDGpTxOption#

EmberDGpTxOption

Transmit options for DGp messages.

Enumerator
EMBER_DGP_TX_OPTION_NONE

No options.

EMBER_DGP_TX_OPTION_USE_GP_TX_QUEUE

Use gpTxQueue.

EMBER_DGP_TX_OPTION_USE_CSMA_CA

Use CSMA/CA.

EMBER_DGP_TX_OPTION_USE_MAC_ACK

Use MAC ACK.

EMBER_DGP_TX_OPTION_FRAME_TYPE_DATA

Data frame.

EMBER_DGP_TX_OPTION_FRAME_TYPE_MAINTENANCE

Maintenance frame.

EMBER_DGP_TX_OPTION_RESERVED

Reserved.


Definition at line 388 of file stack/include/gp-types.h

EmberGpSourceId#

typedef uint32_t EmberGpSourceId

32-bit GPD source identifier


Definition at line 41 of file stack/include/gp-types.h

EmberGpSecurityFrameCounter#

typedef uint32_t EmberGpSecurityFrameCounter

32-bit security frame counter


Definition at line 43 of file stack/include/gp-types.h

EmberGpMic#

typedef uint32_t EmberGpMic

32-bit MIC code


Definition at line 45 of file stack/include/gp-types.h

API Documentation#

emberDGpSend#

EmberStatus emberDGpSend (bool action, bool useCca, EmberGpAddress * addr, uint8_t gpdCommandId, uint8_t gpdAsduLength, uint8_t const * gpdAsdu, uint8_t gpepHandle, uint16_t gpTxQueueEntryLifetimeMs)

DGp Send.

Parameters
N/Aaction

Action to add (true) or remove (false)

N/AuseCca

Use CCA for GPDF transmission.

N/Aaddr

The gpd address EmberGpAddress.

N/AgpdCommandId

GPD Command ID

N/AgpdAsduLength

ASDU Length.

N/AgpdAsdu

The ASDU buffer that holds the outgoing GPDF as payload.

N/AgpepHandle

Handle for the asdu.

N/AgpTxQueueEntryLifetimeMs

Life time in milliseconds in Tx queue after which it gets cleared.

This API adds or removes an outgoing GPDF (passed as ASDU) in the GP stub layer. As part of Gp Response command processing by green power client cluster, this API submits a outgoing a channel configuration or a commissioning reply GPDF. Similarly, it is called with appropriate action to clear the Tx queue upon channel request timeout.

Returns


Definition at line 704 of file stack/include/gp-types.h

emberGpProxyTableProcessGpPairing#

bool emberGpProxyTableProcessGpPairing (uint32_t options, EmberGpAddress * addr, uint8_t commMode, uint16_t sinkNwkAddress, uint16_t sinkGroupId, uint16_t assignedAlias, uint8_t * sinkIeeeAddress, EmberKeyData * gpdKey, uint32_t gpdSecurityFrameCounter, uint8_t forwardingRadius)

Process Gp Pairing.

Parameters
N/Aoptions

option field of the Gp Pairing command, this holds the validity of other inputs.

N/Aaddr

The gpd address EmberGpAddress.

N/AcommMode

Communication mode as supplied in the Gp Pairing command.

N/AsinkNwkAddress

Network address of the sink.

N/AsinkGroupId

Group Id of the sink.

N/AassignedAlias

Assigned alias for the GPD under commissioning.

N/AsinkIeeeAddress

sink EUI64 address

N/AgpdKey

GPD key

N/AgpdSecurityFrameCounter

security frame counter from GPD.

N/AforwardingRadius

forwarding radius

This function adds or updates the entry in the proxy table as part of Gp Pairing command processing. All the input arguments for this API is derived directly from the incoming GP Pairing command

Returns

  • true on success and false for failure.


Definition at line 731 of file stack/include/gp-types.h

emberGpProxyTableLookup#

uint8_t emberGpProxyTableLookup (EmberGpAddress * addr)

Proxy table look up.

Parameters
N/Aaddr

The gpd address EmberGpAddress to look up.

This function looks up a gpd address in the Gp Proxy Table and returns index of the entry.

Returns

  • a valid index to the entry in proxy table and 0xFF in case of not found.


Definition at line 749 of file stack/include/gp-types.h

emberGpProxyTableGetEntry#

EmberStatus emberGpProxyTableGetEntry (uint8_t proxyIndex, EmberGpProxyTableEntry * entry)

Get Proxy table entry.

Parameters
N/AproxyIndex

a valid index to proxy table.

N/Aentry

proxy table entry

This function gets an entry from proxy table at the supplied index.

Returns


Definition at line 760 of file stack/include/gp-types.h

emberGpSinkTableGetEntry#

EmberStatus emberGpSinkTableGetEntry (uint8_t sinkIndex, EmberGpSinkTableEntry * entry)

Get Sink table entry.

Parameters
N/AsinkIndex

a valid index to sink table.

N/Aentry

sink table entry

This function gets an entry from sink table at the supplied index.

Returns


Definition at line 772 of file stack/include/gp-types.h

emberGpSinkTableLookup#

uint8_t emberGpSinkTableLookup (EmberGpAddress * addr)

Sink table look up.

Parameters
N/Aaddr

The gpd address EmberGpAddress to look up.

This function looks up a gpd address in the Gp Sink Table and returns index of the entry.

Returns

  • a valid index to the entry in proxy table and 0xFF in case of not found.


Definition at line 782 of file stack/include/gp-types.h

emberGpSinkTableClearAll#

void emberGpSinkTableClearAll (void )

Clear sink table.

Parameters
N/A

This function clears all entries in the sink table.


Definition at line 789 of file stack/include/gp-types.h

emberGpSinkTableSetEntry#

EmberStatus emberGpSinkTableSetEntry (uint8_t sinkTableIndex, EmberGpSinkTableEntry * entry)

Get Sink table entry.

Parameters
N/AsinkTableIndex

a valid index to sink table.

N/Aentry

sink table entry

This function gets an entry from sink table at the supplied index.

Returns


Definition at line 800 of file stack/include/gp-types.h

emberGpSinkTableFindOrAllocateEntry#

uint8_t emberGpSinkTableFindOrAllocateEntry (EmberGpAddress * addr)

Allocates an entry in sink able.

Parameters
N/Aaddr

The gpd address EmberGpAddress to look up.

This function looks up a gpd address in sink table. Returns the index of the entry if exists. If the entry is not found but there are space available in the table, allocates an entry and returns the index. If no space available returns 0xFF.

Returns

  • a valid index to the entry in proxy table and 0xFF in case of no space.


Definition at line 813 of file stack/include/gp-types.h

emberGpSinkTableRemoveEntry#

void emberGpSinkTableRemoveEntry (uint8_t index)

Remove an entry in sink table.

Parameters
N/Aindex

This function removes an entry at the index provided.


Definition at line 820 of file stack/include/gp-types.h

emberGpSinkTableInit#

void emberGpSinkTableInit (void )

Initialize sink table.

Parameters
N/A

This function initializes the sink table in RAM. It copies the non-volatile sink table entries to a RAM table which is used during operation. By design,the non-volatile token entry for the sink table are compressed and does not hold the data that can be derived. This function is only called during initialization of the green power stack to initialize the entire table with derived data.


Definition at line 830 of file stack/include/gp-types.h

emberGpSinkTableSetSecurityFrameCounter#

void emberGpSinkTableSetSecurityFrameCounter (uint8_t index, uint32_t sfc)

Sets security frame counter in sink table entry.

Parameters
N/Aindex

Valid sink table entry index

N/Asfc

byte security frame counter

This function sets the security frame counter for a sink table entry at an index.


Definition at line 839 of file stack/include/gp-types.h

emberGpGetTxQueueHead#

MessageBufferQueue * emberGpGetTxQueueHead (void )

Gets tx queue head.

Parameters
N/A

This function gets the head pointer of the tx queue. Note : since it returns a pointer to memory the head, it 'll not be useful on host.

Returns


Definition at line 850 of file stack/include/gp-types.h

emberGpSetMaxTxQueueEntry#

void emberGpSetMaxTxQueueEntry (uint16_t maxEntries)

Sets maximum limit for number of entries in the tx queue.

Parameters
N/AmaxEntries

This function sets the maximum number of entries the tx queue is supposed to grow.


Definition at line 856 of file stack/include/gp-types.h

emberGetGpMaxTxQListCount#

uint16_t emberGetGpMaxTxQListCount (void )

Gets the limit set for maximum number of entries in the tx queue.

Parameters
N/A

This function gets the limit set for the maximum number of entries the tx queue is supposed to hold.

Returns

  • limit to the maximum number of entries.


Definition at line 864 of file stack/include/gp-types.h

emberGetGpTxQListCount#

uint16_t emberGetGpTxQListCount (void )

Gets the number of entries in the tx queue.

Parameters
N/A

This function gets the number of entries present in tx queue.

Returns

  • number of entries.


Definition at line 872 of file stack/include/gp-types.h

emberGpGetTxQueueEntryFromQueue#

EmberMessageBuffer emberGpGetTxQueueEntryFromQueue (EmberGpTxQueueEntry * txQueue, uint8_t * data, uint16_t * dataLength, uint16_t allocatedDataLength)

Gets an entry from Tx Queue The function searches the tx queue using gpd address pointed by supplied in the input/output argument txQueue and returns the message buffer that currently holding the outgoing gpdf information, returns EMBER_NULL_MESSAGE_BUFFER if not found.

Parameters
N/AtxQueue

EmberGpTxQueueEntry A pointer to an allocated memory to get a copy of the tx queue entry from the buffer queue. The caller populates the addr field of this parameter which is used as a search key.

N/Adata

A pointer to an allocated memory to get a copy of the gpd command payload if an entry is found. This can be passed as NULL if payload is not required by caller.

N/AdataLength

A pointer to hold the length of the gpd command payload when an entry is found and the data collector is non-NULL.

N/AallocatedDataLength

Size in bytes for the allocated memory for the data collector. If this value is smaller compared to length of the data in the queue, no data gets copied out.

Returns

  • Buffer EmberMessageBuffer that holds the entry if found, null message buffer if not found.


Definition at line 887 of file stack/include/gp-types.h

emberGpAddGpTxQueueEntryWithPayload#

EmberMessageBuffer emberGpAddGpTxQueueEntryWithPayload (EmberGpTxQueueEntry * txQueue, uint8_t * data, uint16_t dataLength)

Adds an entry to Tx Queue This function adds an entry along with supplied payload data to the Buffer queue. Returns the buffer handle if success else null message buffer upon failure.

Parameters
N/AtxQueue

EmberGpTxQueueEntry A pointer to an allocated memory holding the entry with all the members of the structure assigned as needed.

N/Adata

A pointer holding the data payload. Can be supplied as NULL if there is no data payload.

N/AdataLength

Length of the data.

Returns


Definition at line 900 of file stack/include/gp-types.h

emberGpRemoveFromTxQueue#

bool emberGpRemoveFromTxQueue (EmberGpTxQueueEntry * txQueue)

Remove an entry from Tx Queue This function searches and removes the entry provided.

Parameters
N/AtxQueue

EmberGpTxQueueEntry A pointer to an allocated memory holding the entry with gpd addr field assigned, which is used as for searching the tx queue. NOTE : Use of wildcard gpd addr (AppId = 0,SrcId = 0xFFFFFFFF) , removes all the entries of the tx queue.

Returns

  • True upon success else false.


Definition at line 910 of file stack/include/gp-types.h

emberGpClearTxQueue#

void emberGpClearTxQueue (void )

Purges Tx Queue This function purges the tx queue.

Parameters
N/A

Definition at line 916 of file stack/include/gp-types.h

Macro Definition Documentation#

EMBER_GP_BIDIRECTION_INFO_RX_AFTER_TX_MASK#

#define EMBER_GP_BIDIRECTION_INFO_RX_AFTER_TX_MASK
Value:
0x01

Definition at line 33 of file stack/include/gp-types.h

EMBER_GP_BIDIRECTION_INFO_TX_QUEUE_AVAILABLE_MASK#

#define EMBER_GP_BIDIRECTION_INFO_TX_QUEUE_AVAILABLE_MASK
Value:
0x02

Definition at line 35 of file stack/include/gp-types.h