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

#include "stack/include/sl_zigbee_types.h"

#define SL_ZIGBEE_GP_BIDIRECTION_INFO_RX_AFTER_TX_MASK        0x01

#define SL_ZIGBEE_GP_BIDIRECTION_INFO_TX_QUEUE_AVAILABLE_MASK 0x02

#define GP_SINK_LIST_ENTRIES 2

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

#define GP_PARAMS                                  \
  sl_zigbee_gp_status_t status,                    \
  uint8_t gpdLink,                                 \
  uint8_t sequenceNumber,                          \
  sl_zigbee_gp_address_t * addr,                   \
  sl_zigbee_gp_security_level_t gpdfSecurityLevel, \
  sl_zigbee_gp_key_type_t 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))

#define GP_COMMISSIONING_MAX_BYTES (55 - 3)

#define GP_GPD_SRC_ID_FOR_CAHNNEL_CONFIG 0x00000000

#define GP_GPD_SRC_ID_WILDCARD           0xFFFFFFFF

#define GP_GPD_SRC_ID_RESERVED_0 0x00000000

#define GP_GPD_SRC_ID_RESERVED_FFFFFF9 0xFFFFFFF9

#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

typedef uint32_t sl_zigbee_gp_source_id_t;
typedef uint32_t sl_zigbee_gp_security_frame_counter_t;
typedef uint32_t sl_zigbee_gp_mic_t;

#ifdef DOXYGEN_SHOULD_SKIP_THIS
enum sl_zigbee_gp_status_t
#else
typedef uint8_t sl_zigbee_gp_status_t;
enum
#endif
{
  SL_ZIGBEE_GP_STATUS_OK,
  SL_ZIGBEE_GP_STATUS_MATCH,
  SL_ZIGBEE_GP_STATUS_DROP_FRAME,
  SL_ZIGBEE_GP_STATUS_UNPROCESSED,
  SL_ZIGBEE_GP_STATUS_PASS_UNPROCESSED,
  SL_ZIGBEE_GP_STATUS_TX_THEN_DROP,
  SL_ZIGBEE_GP_STATUS_NO_SECURITY,
  SL_ZIGBEE_GP_STATUS_AUTH_FAILURE,
};

#ifdef DOXYGEN_SHOULD_SKIP_THIS
enum sl_zigbee_gp_security_level_t
#else
typedef uint8_t sl_zigbee_gp_security_level_t;
enum
#endif
{
  SL_ZIGBEE_GP_SECURITY_LEVEL_NONE = 0x00,
  SL_ZIGBEE_GP_SECURITY_LEVEL_RESERVED = 0x01,
  SL_ZIGBEE_GP_SECURITY_LEVEL_FC_MIC = 0x02,
  SL_ZIGBEE_GP_SECURITY_LEVEL_FC_MIC_ENCRYPTED = 0x03,
};
#ifdef DOXYGEN_SHOULD_SKIP_THIS
enum sl_zigbee_gp_key_type_t
#else
typedef uint8_t sl_zigbee_gp_key_type_t;
enum
#endif
{
  SL_ZIGBEE_GP_SECURITY_KEY_NONE = 0x00,
  SL_ZIGBEE_GP_SECURITY_KEY_NWK = 0x01,
  SL_ZIGBEE_GP_SECURITY_KEY_GPD_GROUP = 0x02,
  SL_ZIGBEE_GP_SECURITY_KEY_NWK_DERIVED = 0x03,
  SL_ZIGBEE_GP_SECURITY_KEY_GPD_OOB = 0x04,
  SL_ZIGBEE_GP_SECURITY_KEY_GPD_DERIVED = 0x07,
};
#ifdef DOXYGEN_SHOULD_SKIP_THIS
enum sl_zigbee_gp_application_id_t
#else
typedef uint8_t sl_zigbee_gp_application_id_t;
enum
#endif
{
  SL_ZIGBEE_GP_APPLICATION_SOURCE_ID = 0x00,
  SL_ZIGBEE_GP_APPLICATION_IEEE_ADDRESS = 0x02,
};

#ifdef DOXYGEN_SHOULD_SKIP_THIS
enum sl_zigbee_gp_proxy_table_entry_status_t
#else
typedef uint8_t sl_zigbee_gp_proxy_table_entry_status_t;
enum
#endif
{
  SL_ZIGBEE_GP_PROXY_TABLE_ENTRY_STATUS_ACTIVE = 0x01,
  SL_ZIGBEE_GP_PROXY_TABLE_ENTRY_STATUS_UNUSED = 0xFF,
};

#ifdef DOXYGEN_SHOULD_SKIP_THIS
enum sl_zigbee_gp_sink_table_entry_status_t
#else
typedef uint8_t sl_zigbee_gp_sink_table_entry_status_t;
enum
#endif
{
  SL_ZIGBEE_GP_SINK_TABLE_ENTRY_STATUS_ACTIVE = 0x01,
  SL_ZIGBEE_GP_SINK_TABLE_ENTRY_STATUS_UNUSED = 0xFF,
};

typedef struct {
  union {
    sl_802154_long_addr_t gpdIeeeAddress;
    sl_zigbee_gp_source_id_t sourceId;
  } id;
  sl_zigbee_gp_application_id_t applicationId;
  uint8_t endpoint;
} sl_zigbee_gp_address_t;

typedef enum {
  SL_ZIGBEE_GP_SINK_TYPE_FULL_UNICAST,
  SL_ZIGBEE_GP_SINK_TYPE_D_GROUPCAST,
  SL_ZIGBEE_GP_SINK_TYPE_GROUPCAST,
  SL_ZIGBEE_GP_SINK_TYPE_LW_UNICAST,
  SL_ZIGBEE_GP_SINK_TYPE_UNUSED = 0xFF
} sl_zigbee_gp_sink_type_t;

typedef struct {
  sl_802154_long_addr_t sinkEUI;
  sl_802154_short_addr_t sinkNodeId;
} sl_zigbee_gp_sink_address_t;

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

typedef struct {
  sl_zigbee_gp_sink_type_t type;

  union {
    sl_zigbee_gp_sink_address_t unicast;
    sl_zigbee_gp_sink_group_t groupcast;
    sl_zigbee_gp_sink_group_t groupList;   // Entry for Sink Group List
  } target;
} sl_zigbee_gp_sink_list_entry_t;

typedef struct {
  sl_zigbee_gp_proxy_table_entry_status_t status;
  uint32_t options;
  sl_zigbee_gp_address_t gpd;
  sl_802154_short_addr_t assignedAlias;
  uint8_t securityOptions;
  sl_zigbee_gp_security_frame_counter_t gpdSecurityFrameCounter;
  sl_zigbee_key_data_t gpdKey;
  sl_zigbee_gp_sink_list_entry_t sinkList[GP_SINK_LIST_ENTRIES];
  uint8_t groupcastRadius;
  uint8_t searchCounter;
} sl_zigbee_gp_proxy_table_entry_t;

typedef struct {
  sl_zigbee_gp_sink_table_entry_status_t status;
  uint16_t options;
  sl_zigbee_gp_address_t gpd;
  uint8_t deviceId;
  sl_zigbee_gp_sink_list_entry_t sinkList[GP_SINK_LIST_ENTRIES];
  sl_802154_short_addr_t assignedAlias;
  uint8_t groupcastRadius;
  uint8_t securityOptions;
  sl_zigbee_gp_security_frame_counter_t gpdSecurityFrameCounter;
  sl_zigbee_key_data_t gpdKey;
} sl_zigbee_gp_sink_table_entry_t;

#ifdef DOXYGEN_SHOULD_SKIP_THIS
enum sl_zigbee_c_gp_tx_option_t
#else
typedef uint8_t sl_zigbee_c_gp_tx_option_t;
enum
#endif
{
  SL_ZIGBEE_CGP_TX_OPTION_NONE = 0x00,
  SL_ZIGBEE_CGP_TX_OPTION_USE_CSMA_CA = 0x01,
  SL_ZIGBEE_CGP_TX_OPTION_USE_MAC_ACK = 0x02,
  SL_ZIGBEE_CGP_TX_OPTION_RESERVED = 0xFC,
};

#ifdef DOXYGEN_SHOULD_SKIP_THIS
enum sl_zigbee_c_gp_address_mode_t
#else
typedef uint8_t sl_zigbee_c_gp_address_mode_t;
enum
#endif
{
  SL_ZIGBEE_CGP_ADDRESS_MODE_NONE = 0x00,
  SL_ZIGBEE_CGP_ADDRESS_MODE_RESERVED = 0x01,
  SL_ZIGBEE_CGP_ADDRESS_MODE_SHORT = 0x02,
  SL_ZIGBEE_CGP_ADDRESS_MODE_EXTENDED = 0x03,
};

typedef struct {
  union {
    sl_802154_short_addr_t shortId;
    sl_802154_long_addr_t extendedId;
  } address;
  sl_802154_pan_id_t panId;
  sl_zigbee_c_gp_address_mode_t mode;
} sl_zigbee_c_gp_address_t;
#ifdef DOXYGEN_SHOULD_SKIP_THIS
enum sl_zigbee_d_gp_tx_option_t
#else
typedef uint8_t sl_zigbee_d_gp_tx_option_t;
enum
#endif
{
  SL_ZIGBEE_DGP_TX_OPTION_NONE = 0x00,
  SL_ZIGBEE_DGP_TX_OPTION_USE_GP_TX_QUEUE = 0x01,
  SL_ZIGBEE_DGP_TX_OPTION_USE_CSMA_CA = 0x02,
  SL_ZIGBEE_DGP_TX_OPTION_USE_MAC_ACK = 0x04,
  SL_ZIGBEE_DGP_TX_OPTION_FRAME_TYPE_DATA = 0x00,
  SL_ZIGBEE_DGP_TX_OPTION_FRAME_TYPE_MAINTENANCE = 0x08,
  SL_ZIGBEE_DGP_TX_OPTION_RESERVED = 0xE0,
};

typedef struct {
  uint8_t foo;
} sl_zigbee_gp_proxy_cluster_attributes_t;

typedef struct {
  bool inUse;
  bool useCca;
  sl_zigbee_gp_address_t addr;
  uint8_t gpdCommandId;
  uint8_t gpepHandle;
  uint16_t queueEntryLifetimeMs;
} sl_zigbee_gp_tx_queue_entry_t;

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];
} sl_zigbee_gp_application_info_t;

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;
} sl_zigbee_gp_attribute_record_t;
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;
  sl_zigbee_gp_attribute_record_t attrRecord;
} sl_zigbee_gp_data_point_descriptor_t;

typedef struct {
  uint8_t               repId;
  uint8_t               reportOptions;
  uint16_t              timeoutPeriod;
  uint8_t               totalLength;
  sl_zigbee_gp_data_point_descriptor_t  dataPoint;
} sl_zigbee_gp_report_descriptor_t;
typedef struct {
  uint8_t switchInfoLength;
  uint8_t nbOfContacts;
  uint8_t switchType;
  uint8_t currentContact;
  uint8_t savedContact;
}sl_zigbee_gp_switch_information_t;

typedef struct {
  uint8_t       currentStatus;
  uint8_t       contactBitmask;
} sl_zigbee_gp_generic_switch_data_t;

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;//sl_zigbee_gp_translation_table_additional_info_block_option_record_option_data_field_t;
} sl_zigbee_gp_translation_table_additional_info_block_option_record_field_t;


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

sl_status_t sl_zigbee_d_gp_send(bool action,
                                bool useCca,
                                sl_zigbee_gp_address_t *addr,
                                uint8_t gpdCommandId,
                                uint8_t gpdAsduLength,
                                uint8_t const *gpdAsdu,
                                uint8_t gpepHandle,
                                uint16_t gpTxQueueEntryLifetimeMs);

// Tx Queue APIs

sli_zigbee_message_buffer_queue_t * sl_zigbee_gp_get_tx_queue_head(void);

void sl_zigbee_gp_set_max_tx_queue_entry(uint16_t maxEntries);

uint16_t sl_zigbee_get_gp_max_tx_q_list_count(void);

uint16_t sl_zigbee_get_gp_tx_q_list_count(void);

sli_buffer_manager_buffer_t sl_zigbee_gp_get_tx_queue_entry_from_queue(sl_zigbee_gp_tx_queue_entry_t *txQueue,
                                                                       uint8_t *data,
                                                                       uint16_t *dataLength,
                                                                       uint16_t allocatedDataLength);

sl_status_t sl_zigbee_gp_get_tx_queue_entry_from_queue_index(uint8_t index,
                                                             sl_zigbee_gp_tx_queue_entry_t *txQueue,
                                                             uint8_t *payload,
                                                             uint16_t *payload_len);

sli_buffer_manager_buffer_t sl_zigbee_gp_add_gp_tx_queue_entry_with_payload(sl_zigbee_gp_tx_queue_entry_t *txQueue,
                                                                            uint8_t *data,
                                                                            uint16_t dataLength);
bool sl_zigbee_gp_remove_from_tx_queue(sl_zigbee_gp_tx_queue_entry_t *txQueue);

void sl_zigbee_gp_clear_tx_queue(void);

#endif // SILABS_GP_TYPES_H
 // end of name API

Modules#

sl_zigbee_gp_address_t

sl_zigbee_gp_sink_address_t

sl_zigbee_gp_sink_group_t

sl_zigbee_gp_sink_list_entry_t

sl_zigbee_gp_proxy_table_entry_t

sl_zigbee_gp_sink_table_entry_t

sl_zigbee_c_gp_address_t

sl_zigbee_gp_proxy_cluster_attributes_t

sl_zigbee_gp_tx_queue_entry_t

sl_zigbee_gp_application_info_t

sl_zigbee_gp_attribute_record_t

sl_zigbee_gp_data_point_descriptor_t

sl_zigbee_gp_report_descriptor_t

sl_zigbee_gp_switch_information_t

sl_zigbee_gp_generic_switch_data_t

sl_zigbee_gp_translation_table_additional_info_block_option_record_field_t

GP Types#

enum
SL_ZIGBEE_GP_STATUS_OK
SL_ZIGBEE_GP_STATUS_MATCH
SL_ZIGBEE_GP_STATUS_DROP_FRAME
SL_ZIGBEE_GP_STATUS_UNPROCESSED
SL_ZIGBEE_GP_STATUS_PASS_UNPROCESSED
SL_ZIGBEE_GP_STATUS_TX_THEN_DROP
SL_ZIGBEE_GP_STATUS_NO_SECURITY
SL_ZIGBEE_GP_STATUS_AUTH_FAILURE
}

Green Power Security Level.

enum
SL_ZIGBEE_GP_SECURITY_LEVEL_NONE = 0x00
SL_ZIGBEE_GP_SECURITY_LEVEL_RESERVED = 0x01
SL_ZIGBEE_GP_SECURITY_LEVEL_FC_MIC = 0x02
SL_ZIGBEE_GP_SECURITY_LEVEL_FC_MIC_ENCRYPTED = 0x03
}

Green Power Security Level.

enum
SL_ZIGBEE_GP_SECURITY_KEY_NONE = 0x00
SL_ZIGBEE_GP_SECURITY_KEY_NWK = 0x01
SL_ZIGBEE_GP_SECURITY_KEY_GPD_GROUP = 0x02
SL_ZIGBEE_GP_SECURITY_KEY_NWK_DERIVED = 0x03
SL_ZIGBEE_GP_SECURITY_KEY_GPD_OOB = 0x04
SL_ZIGBEE_GP_SECURITY_KEY_GPD_DERIVED = 0x07
}

Green Power Security Security Key Type.

enum
SL_ZIGBEE_GP_APPLICATION_SOURCE_ID = 0x00
SL_ZIGBEE_GP_APPLICATION_IEEE_ADDRESS = 0x02
}

Green Power Application ID.

enum
SL_ZIGBEE_GP_PROXY_TABLE_ENTRY_STATUS_ACTIVE = 0x01
SL_ZIGBEE_GP_PROXY_TABLE_ENTRY_STATUS_UNUSED = 0xFF
}

GP proxy table entry status.

enum
SL_ZIGBEE_GP_SINK_TABLE_ENTRY_STATUS_ACTIVE = 0x01
SL_ZIGBEE_GP_SINK_TABLE_ENTRY_STATUS_UNUSED = 0xFF
}

GP sink table entry status.

enum
SL_ZIGBEE_GP_SINK_TYPE_FULL_UNICAST
SL_ZIGBEE_GP_SINK_TYPE_D_GROUPCAST
SL_ZIGBEE_GP_SINK_TYPE_GROUPCAST
SL_ZIGBEE_GP_SINK_TYPE_LW_UNICAST
SL_ZIGBEE_GP_SINK_TYPE_UNUSED = 0xFF
}

GP Sink Type.

enum
SL_ZIGBEE_CGP_TX_OPTION_NONE = 0x00
SL_ZIGBEE_CGP_TX_OPTION_USE_CSMA_CA = 0x01
SL_ZIGBEE_CGP_TX_OPTION_USE_MAC_ACK = 0x02
SL_ZIGBEE_CGP_TX_OPTION_RESERVED = 0xFC
}

CGp Transmit options.

enum
SL_ZIGBEE_CGP_ADDRESS_MODE_NONE = 0x00
SL_ZIGBEE_CGP_ADDRESS_MODE_RESERVED = 0x01
SL_ZIGBEE_CGP_ADDRESS_MODE_SHORT = 0x02
SL_ZIGBEE_CGP_ADDRESS_MODE_EXTENDED = 0x03
}

Addressing modes for CGp messages.

enum
SL_ZIGBEE_DGP_TX_OPTION_NONE = 0x00
SL_ZIGBEE_DGP_TX_OPTION_USE_GP_TX_QUEUE = 0x01
SL_ZIGBEE_DGP_TX_OPTION_USE_CSMA_CA = 0x02
SL_ZIGBEE_DGP_TX_OPTION_USE_MAC_ACK = 0x04
SL_ZIGBEE_DGP_TX_OPTION_FRAME_TYPE_DATA = 0x00
SL_ZIGBEE_DGP_TX_OPTION_FRAME_TYPE_MAINTENANCE = 0x08
SL_ZIGBEE_DGP_TX_OPTION_RESERVED = 0xE0
}

Transmit options for DGp messages.

typedef uint32_t
typedef uint32_t

API#

sl_status_t
sl_zigbee_d_gp_send(bool action, bool useCca, sl_zigbee_gp_address_t *addr, uint8_t gpdCommandId, uint8_t gpdAsduLength, uint8_t const *gpdAsdu, uint8_t gpepHandle, uint16_t gpTxQueueEntryLifetimeMs)

DGp Send.

void

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.

sl_zigbee_gp_get_tx_queue_entry_from_queue(sl_zigbee_gp_tx_queue_entry_t *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 SL_ZIGBEE_NULL_MESSAGE_BUFFER if not found.

sl_status_t
sl_zigbee_gp_get_tx_queue_entry_from_queue_index(uint8_t index, sl_zigbee_gp_tx_queue_entry_t *txQueue, uint8_t *payload, uint16_t *payload_len)

Gets the entry at the specified index of Tx Queue The function goes through the tx queue and populates the output parameters with the relevant entry if it exists.

sl_zigbee_gp_add_gp_tx_queue_entry_with_payload(sl_zigbee_gp_tx_queue_entry_t *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
sl_zigbee_gp_remove_from_tx_queue(sl_zigbee_gp_tx_queue_entry_t *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.

Macros#

#define

Mask used in the green power endpoint incoming message handler to pass bidirectional information. Incoming GPDF has rxAfterTx bit set.

#define

Mask to test if transmit queue is available at green power stub layer to hold an outgoing GPDF.

#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(sl_zigbee_gp_sink_group_t))))

The size of the SinkList entries in sink table in form of octet string that has a format of [<1 byte length>, <n bytes for sink groups>].

#define
GP_PARAMS undefined

GP parameters list represented as a macro for GP endpoint incoming message handler and callbacks prototypes.

#define
GP_ARGS undefined

GP arguments list represented as a macro while calling GP endpoint incoming message handler and callbacks.

#define
GP_UNUSED_ARGS undefined

GP arguments list with void type cast represented as a macro to be used in callback stubs.

#define

Bit mask for the proxy table ebtry option bit representing in-range bit field.

#define

Maximum number of bytes in a green power commissioning frame excluding 3 bytes for device ID, option and application information fields.

#define

GPD Source ID when requesting channel request.

#define

GPD wildcard Source ID.

#define

GPD Reserved Source ID. Used in maintenance frame.

#define

GPD Reserved Source ID. All addresses between 0xFFFFFFF9 and 0xFFFFFFFE are reserved.

#define

GPD Reserved Source ID. All addresses between 0xFFFFFFF9 and 0xFFFFFFFE are reserved.

#define

Default value for derived group ID when alias is not used.

#define

Tunneling delay constant Dmin_b in milliseconds. Ref green power specification for more information on this constant.

#define

Tunneling delay constant Dmin_u in milliseconds. Ref green power specification for more information on this constant.

#define

Tunneling delay constant Dmax in milliseconds. Ref green power specification for more information on this constant.

GP Types Documentation#

sl_zigbee_gp_status_t#

sl_zigbee_gp_status_t

Green Power Security Level.

Enumerator
SL_ZIGBEE_GP_STATUS_OK

Success Status

SL_ZIGBEE_GP_STATUS_MATCH

Match Frame

SL_ZIGBEE_GP_STATUS_DROP_FRAME

Drop Frame

SL_ZIGBEE_GP_STATUS_UNPROCESSED

Frame Unprocessed

SL_ZIGBEE_GP_STATUS_PASS_UNPROCESSED

Frame Pass Unprocessed

SL_ZIGBEE_GP_STATUS_TX_THEN_DROP

Frame TX Then Drop

SL_ZIGBEE_GP_STATUS_NO_SECURITY

No Security

SL_ZIGBEE_GP_STATUS_AUTH_FAILURE

Security Failure


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

sl_zigbee_gp_security_level_t#

sl_zigbee_gp_security_level_t

Green Power Security Level.

Enumerator
SL_ZIGBEE_GP_SECURITY_LEVEL_NONE

No Security

SL_ZIGBEE_GP_SECURITY_LEVEL_RESERVED

Reserved

SL_ZIGBEE_GP_SECURITY_LEVEL_FC_MIC

4 Byte Frame Counter and 4 Byte MIC

SL_ZIGBEE_GP_SECURITY_LEVEL_FC_MIC_ENCRYPTED

4 Byte Frame Counter and 4 Byte MIC with encryption


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

sl_zigbee_gp_key_type_t#

sl_zigbee_gp_key_type_t

Green Power Security Security Key Type.

Enumerator
SL_ZIGBEE_GP_SECURITY_KEY_NONE

No Key

SL_ZIGBEE_GP_SECURITY_KEY_NWK

GP Security Key Type is Zigbee Network Key

SL_ZIGBEE_GP_SECURITY_KEY_GPD_GROUP

GP Security Key Type is Group Key

SL_ZIGBEE_GP_SECURITY_KEY_NWK_DERIVED

GP Security Key Type is Derived Network Key

SL_ZIGBEE_GP_SECURITY_KEY_GPD_OOB

GP Security Key Type is Out Of Box Key

SL_ZIGBEE_GP_SECURITY_KEY_GPD_DERIVED

GP Security Key Type is GPD Derived Key


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

sl_zigbee_gp_application_id_t#

sl_zigbee_gp_application_id_t

Green Power Application ID.

Enumerator
SL_ZIGBEE_GP_APPLICATION_SOURCE_ID

Source identifier.

SL_ZIGBEE_GP_APPLICATION_IEEE_ADDRESS

IEEE address.


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

sl_zigbee_gp_proxy_table_entry_status_t#

sl_zigbee_gp_proxy_table_entry_status_t

GP proxy table entry status.

Enumerator
SL_ZIGBEE_GP_PROXY_TABLE_ENTRY_STATUS_ACTIVE

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

SL_ZIGBEE_GP_PROXY_TABLE_ENTRY_STATUS_UNUSED

The proxy table entry is not in use.


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

sl_zigbee_gp_sink_table_entry_status_t#

sl_zigbee_gp_sink_table_entry_status_t

GP sink table entry status.

Enumerator
SL_ZIGBEE_GP_SINK_TABLE_ENTRY_STATUS_ACTIVE

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

SL_ZIGBEE_GP_SINK_TABLE_ENTRY_STATUS_UNUSED

The proxy table entry is not in use.


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

sl_zigbee_gp_sink_type_t#

sl_zigbee_gp_sink_type_t

GP Sink Type.

Enumerator
SL_ZIGBEE_GP_SINK_TYPE_FULL_UNICAST

Sink Type is Full Unicast

SL_ZIGBEE_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.

SL_ZIGBEE_GP_SINK_TYPE_GROUPCAST

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

SL_ZIGBEE_GP_SINK_TYPE_LW_UNICAST

Sink Type is Light Weight Unicast.

SL_ZIGBEE_GP_SINK_TYPE_UNUSED

Unused sink type


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

sl_zigbee_c_gp_tx_option_t#

sl_zigbee_c_gp_tx_option_t

CGp Transmit options.

Enumerator
SL_ZIGBEE_CGP_TX_OPTION_NONE

No options.

SL_ZIGBEE_CGP_TX_OPTION_USE_CSMA_CA

Use CSMA/CA.

SL_ZIGBEE_CGP_TX_OPTION_USE_MAC_ACK

Use MAC ACK.

SL_ZIGBEE_CGP_TX_OPTION_RESERVED

Reserved.


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

sl_zigbee_c_gp_address_mode_t#

sl_zigbee_c_gp_address_mode_t

Addressing modes for CGp messages.

Enumerator
SL_ZIGBEE_CGP_ADDRESS_MODE_NONE

No address (PAN identifier and address omitted).

SL_ZIGBEE_CGP_ADDRESS_MODE_RESERVED

Reserved.

SL_ZIGBEE_CGP_ADDRESS_MODE_SHORT

16-bit short address.

SL_ZIGBEE_CGP_ADDRESS_MODE_EXTENDED

64-bit extended address.


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

sl_zigbee_d_gp_tx_option_t#

sl_zigbee_d_gp_tx_option_t

Transmit options for DGp messages.

Enumerator
SL_ZIGBEE_DGP_TX_OPTION_NONE

No options.

SL_ZIGBEE_DGP_TX_OPTION_USE_GP_TX_QUEUE

Use gpTxQueue.

SL_ZIGBEE_DGP_TX_OPTION_USE_CSMA_CA

Use CSMA/CA.

SL_ZIGBEE_DGP_TX_OPTION_USE_MAC_ACK

Use MAC ACK.

SL_ZIGBEE_DGP_TX_OPTION_FRAME_TYPE_DATA

Data frame.

SL_ZIGBEE_DGP_TX_OPTION_FRAME_TYPE_MAINTENANCE

Maintenance frame.

SL_ZIGBEE_DGP_TX_OPTION_RESERVED

Reserved.


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

sl_zigbee_gp_source_id_t#

typedef uint32_t sl_zigbee_gp_source_id_t

32-bit GPD source identifier


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

sl_zigbee_gp_security_frame_counter_t#

typedef uint32_t sl_zigbee_gp_security_frame_counter_t

32-bit security frame counter


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

sl_zigbee_gp_mic_t#

typedef uint32_t sl_zigbee_gp_mic_t

32-bit MIC code


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

API Documentation#

sl_zigbee_d_gp_send#

sl_status_t sl_zigbee_d_gp_send (bool action, bool useCca, sl_zigbee_gp_address_t * 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 sl_zigbee_gp_address_t.

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

  • An ::sl_status_t as status.


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

sl_zigbee_gp_get_tx_queue_head#

sli_zigbee_message_buffer_queue_t * sl_zigbee_gp_get_tx_queue_head (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 794 of file stack/include/gp-types.h

sl_zigbee_gp_set_max_tx_queue_entry#

void sl_zigbee_gp_set_max_tx_queue_entry (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 800 of file stack/include/gp-types.h

sl_zigbee_get_gp_max_tx_q_list_count#

uint16_t sl_zigbee_get_gp_max_tx_q_list_count (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 808 of file stack/include/gp-types.h

sl_zigbee_get_gp_tx_q_list_count#

uint16_t sl_zigbee_get_gp_tx_q_list_count (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 816 of file stack/include/gp-types.h

sl_zigbee_gp_get_tx_queue_entry_from_queue#

sli_buffer_manager_buffer_t sl_zigbee_gp_get_tx_queue_entry_from_queue (sl_zigbee_gp_tx_queue_entry_t * 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 SL_ZIGBEE_NULL_MESSAGE_BUFFER if not found.

Parameters
N/AtxQueue

sl_zigbee_gp_tx_queue_entry_t 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


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

sl_zigbee_gp_get_tx_queue_entry_from_queue_index#

sl_status_t sl_zigbee_gp_get_tx_queue_entry_from_queue_index (uint8_t index, sl_zigbee_gp_tx_queue_entry_t * txQueue, uint8_t * payload, uint16_t * payload_len, allocatedDataLength)

Gets the entry at the specified index of Tx Queue The function goes through the tx queue and populates the output parameters with the relevant entry if it exists.

Parameters
N/Aindex

The index in the queue to retrieve from.

N/AtxQueue

sl_zigbee_gp_tx_queue_entry_t 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/Apayload

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/Apayload_len

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

  • sl_status_t SL_STATUS_OK if a valid entry was retrieved, SL_STATUS_NOT_FOUND if not.


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

sl_zigbee_gp_add_gp_tx_queue_entry_with_payload#

sli_buffer_manager_buffer_t sl_zigbee_gp_add_gp_tx_queue_entry_with_payload (sl_zigbee_gp_tx_queue_entry_t * 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

sl_zigbee_gp_tx_queue_entry_t 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 872 of file stack/include/gp-types.h

sl_zigbee_gp_remove_from_tx_queue#

bool sl_zigbee_gp_remove_from_tx_queue (sl_zigbee_gp_tx_queue_entry_t * txQueue)

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

Parameters
N/AtxQueue

sl_zigbee_gp_tx_queue_entry_t 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 882 of file stack/include/gp-types.h

sl_zigbee_gp_clear_tx_queue#

void sl_zigbee_gp_clear_tx_queue (void )

Purges Tx Queue This function purges the tx queue.

Parameters
N/A

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

Macro Definition Documentation#

SL_ZIGBEE_GP_BIDIRECTION_INFO_RX_AFTER_TX_MASK#

#define SL_ZIGBEE_GP_BIDIRECTION_INFO_RX_AFTER_TX_MASK
Value:
0x01

Mask used in the green power endpoint incoming message handler to pass bidirectional information. Incoming GPDF has rxAfterTx bit set.


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

SL_ZIGBEE_GP_BIDIRECTION_INFO_TX_QUEUE_AVAILABLE_MASK#

#define SL_ZIGBEE_GP_BIDIRECTION_INFO_TX_QUEUE_AVAILABLE_MASK
Value:
0x02

Mask to test if transmit queue is available at green power stub layer to hold an outgoing GPDF.


Definition at line 42 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 47 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(sl_zigbee_gp_sink_group_t))))

The size of the SinkList entries in sink table in form of octet string that has a format of [<1 byte length>, <n bytes for sink groups>].


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

GP_PARAMS#

#define GP_PARAMS
Value:
sl_zigbee_gp_status_t status, \
uint8_t gpdLink, \
uint8_t sequenceNumber, \
sl_zigbee_gp_address_t * addr, \
sl_zigbee_gp_security_level_t gpdfSecurityLevel, \
sl_zigbee_gp_key_type_t gpdfSecurityKeyType, \
bool autoCommissioning, \
uint8_t bidirectionalInfo, \
uint32_t gpdSecurityFrameCounter, \
uint8_t gpdCommandId, \
uint32_t mic, \
uint8_t proxyTableIndex, \
uint8_t gpdCommandPayloadLength, \
uint8_t * gpdCommandPayload

GP parameters list represented as a macro for GP endpoint incoming message handler and callbacks prototypes.


Definition at line 57 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

GP arguments list represented as a macro while calling GP endpoint incoming message handler and callbacks.


Definition at line 76 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;

GP arguments list with void type cast represented as a macro to be used in callback stubs.


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

GP_PROXY_TABLE_OPTIONS_IN_RANGE#

#define GP_PROXY_TABLE_OPTIONS_IN_RANGE
Value:
(BIT(10))

Bit mask for the proxy table ebtry option bit representing in-range bit field.


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

GP_COMMISSIONING_MAX_BYTES#

#define GP_COMMISSIONING_MAX_BYTES
Value:
(55 - 3)

Maximum number of bytes in a green power commissioning frame excluding 3 bytes for device ID, option and application information fields.


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

GP_GPD_SRC_ID_FOR_CAHNNEL_CONFIG#

#define GP_GPD_SRC_ID_FOR_CAHNNEL_CONFIG
Value:
0x00000000

GPD Source ID when requesting channel request.


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

GP_GPD_SRC_ID_WILDCARD#

#define GP_GPD_SRC_ID_WILDCARD
Value:
0xFFFFFFFF

GPD wildcard Source ID.


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

GP_GPD_SRC_ID_RESERVED_0#

#define GP_GPD_SRC_ID_RESERVED_0
Value:
0x00000000

GPD Reserved Source ID. Used in maintenance frame.


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

GP_GPD_SRC_ID_RESERVED_FFFFFF9#

#define GP_GPD_SRC_ID_RESERVED_FFFFFF9
Value:
0xFFFFFFF9

GPD Reserved Source ID. All addresses between 0xFFFFFFF9 and 0xFFFFFFFE are reserved.


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

GP_GPD_SRC_ID_RESERVED_FFFFFFE#

#define GP_GPD_SRC_ID_RESERVED_FFFFFFE
Value:
0xFFFFFFFE

GPD Reserved Source ID. All addresses between 0xFFFFFFF9 and 0xFFFFFFFE are reserved.


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

GP_DERIVED_GROUP_ALIAS_NOT_USED#

#define GP_DERIVED_GROUP_ALIAS_NOT_USED
Value:
0xffff

Default value for derived group ID when alias is not used.


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

GP_DMIN_B#

#define GP_DMIN_B
Value:
32

Tunneling delay constant Dmin_b in milliseconds. Ref green power specification for more information on this constant.


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

GP_DMIN_U#

#define GP_DMIN_U
Value:
5

Tunneling delay constant Dmin_u in milliseconds. Ref green power specification for more information on this constant.


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

GP_DMAX#

#define GP_DMAX
Value:
100

Tunneling delay constant Dmax in milliseconds. Ref green power specification for more information on this constant.


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