5.1.8 Zigbee Green Power (ZGP) APIs

The Zigbee Green Power (ZGP) APIs provide details about the parameters required for communication between ZGP devices and ZGP infrastructure devices. It also defines the interfaces necessary for servicing Green Power profile command handling. ZGP functions facilitate commissioning, controlling and retrieving information from Green Power (GP) devices. The following sections provide more details about the API usage and code examples related to ZGP device functionalities.
Table 5-13. ZGP APIs
Function PrototypeDescription
void ZGP_GetChannel(uint8_t *channel)Get ZGP channel
void ZGP_ResetReq(ZGP_ResetReq_t *reqParams)To raise ZGP Reset request
void ZGP_SetChannel(uint8_t channel)Set ZGP channel
void ZGP_UnsubscribeCommissioning(void)Use this unsubscription to deregister a commissioning callback for use in bidirectional commissioning
void ZGPH_ProxyBasicInit(void)To initialize high proxy
ZGP_InfraDeviceStatus_t ZGPH_PutLocalSinkInCommissioningMode(ZGP_SinkCommissioningModeOptions_t *sinkCommModeOptions, uint8_t endPoint, bool unicastComm)To put local sink in commissioning mode
ZGP_ReadOperationStatus_t ZGPL_ReadTableEntryFromNvm(void *entryPtr, ZGP_TableOperationField_t tableOperationField , ZGP_GpdId_t *gpdId, uint8_t endPoint)To read a proxy/sink entry from NVM
void ZGPH_SinkBasicInit(void)To initialize high sink
ZCL_Status_t ZGPH_SendProxyCommissioningModeCommand(zgpGpProxyCommModeOptions_t options, uint16_t commissioningWindow, uint8_t channel)Send proxy commissioning mode command
ZCL_Status_t ZGPH_SendReadAttribute(uint16_t addr, uint8_t dir, uint16_t attrId)Sending read attribute command
ZCL_Status_t ZGPH_SendProxyTableRequest(uint16_t addr, uint8_t options, uint64_t gpdId_Ieee, uint8_t ep, uint8_t index)Sending proxy table request
ZCL_Status_t ZGPH_SendSinkTableRequest(uint16_t addr, uint8_t options, uint64_t gpdId_Ieee, uint8_t ep, uint8_t index)Sending sink table request
ZGP_InfraDeviceStatus_t ZGPH_UpdateLocalSinkEntry(ZGP_SinkTableEntry_t *sinkEntry, ZGP_SinkTableActions_t action)To update sink entry locally on NVM based on the given action
ZGP_InfraDeviceStatus_t ZGPH_SetSinkGroupEntry(GroupAddr_t sinkGroupId)To set sink group ID used for the GPD to be commissioned
ZGP_InfraDeviceStatus_t ZGPH_SetGPDAssignedAlias(ShortAddr_t gpdAssignedAlias)To set assigned alias used for the GPD to be commissioned
bool ZGPH_GetSinkTableEntryByIndex(ZGP_SinkTableEntry_t *entry, uint8_t index)To read the sink entry based on the index
ZGP_InfraDeviceStatus_t ZGPH_SendGpPairingConfigCmd(APS_AddrMode_t addrMode, APS_Address_t *dstAddr, ZGP_PairingConfigCmdInfo_t pairingConfigCmdInfo, ZGP_GpdAppInfo_t *commReqAppInfo, ZGP_EndpointInfo_t endPointInfo)To build and send ZGP pairing configuration command
void ZGPL_EnableDisableDirectMode(bool enabled)Enable/disable direct mode to receive GPDF
bool ZGPL_DeleteTableEntryFromNvm(ZGP_TableOperationField_t filterField, ZGP_GpdId_t *gpdId, uint8_t endPoint)To delete proxy/sink entry
uint8_t ZGPL_TotalNonEmptyEntries(bool isProxyTable)
  • To fetch the total number of non-empty entries
  • High sink/proxy mainly uses this while sending sink/proxy table response.
void ZGPL_FlushTxQueue(void)Flush-out gpTxqueue
bool ZGPL_AddOrUpdateTableEntryOnNvm(void *entryPtr, ZGP_TableUpdateAction_t action, ZGP_EntryType_t tableType)To add/update proxy/sink entry on NVM
ZGP_Mode_t ZGPL_GetDeviceMode(bool isProxy)To get the Device mode (Operational/Commissioning mode)
void ZGPL_GpdfDataRequest(ZGP_GpdfDataReq_t *zgpGpdfDataReq)GP data request (raising from higher layer to dStub)
void ZGPL_Init(void)Initializing low ZGP
void ZGPL_KeyDerivationHmac(ZGP_SinkTableEntry_t* sinkTableEntry, uint8_t *derivedKey, void (*keyedHashMacCb)(void))
  • To derive the GPD security key from network/group key
  • High sink mainly uses this function
void ZGPL_NvmTableInit(void)Initialize ZGP NVM table
void ZGPL_ResetTableEntry(void *entry, ZGP_EntryType_t tableType)To reset all the parameters of the given entry to initialization value
ZCL_Status_t ZGPH_SendCmdInRawMode(ZCL_Addressing_t *dstAddr, bool dir, uint8_t cmdId, uint8_t payLoadLength, uint8_t *payLoad)Send ZGP cluster command in Raw mode
void ZGPL_SendDeviceAnnounceCmd(uint16_t nwkAddr, uint64_t extAddr)Sending device announcement
void ZGPL_SendSimpleDescReq(ShortAddr_t addr,uint8_t ep)To send simple descriptor request
void ZGPL_SetDeviceMode(bool isProxy, ZGP_Mode_t mode)To set the device in Operational/Commissioning mode
bool ZGPL_IsValidSrcId(uint32_t srcId, ZGP_FrameType_t frameType, bool isPairingConfig)To check whether the SrcID is valid or not considering the Frame Type
bool ZGPL_IskeyValid(uint8_t *key)To check whether the key is valid or not
uint16_t ZGPL_GetAliasSourceAddr(ZGP_GpdId_t *gpdId)To derive alias address for the given srcId/Ieee addr
bool ZGPL_CheckForDuplicate(ZGP_LowDataInd_t *dStubDataInd)Check for duplicate packet
void ZGPL_ResetTableToFN(void)To reset all table entries on NVM
bool ZGPL_AddSinkGroupEntry(ZGP_SinkTableEntry_t *currEntry, ZGP_SinkGroup_t *groupEntry)Add sink group entry to the sink table entry
bool ZGPL_SinkEntryIsPairingInfoEmpty(ZGP_SinkTableEntry_t *currEntry)To check whether pairing info in the sink entry is empty or not
bool ZGPL_FrameCounterReadorUpdateOnNvm(uint32_t *frameCounter, ZGP_TableOperationField_t tableOperationField , ZGP_GpdId_t *gpdId, uint8_t endPoint, bool isUpdateOperation)To read/update frameCounter