4.7.1 GP Infrastructure Devices

Initialization

  • Use the following public API to initialize the ZGP high proxy, which manages the communication between the GPDs and the Zigbee network:

    • Retrieving the green power cluster information and adding the event handler for the ZGP proxy attribute event
    • Initializing ZGP high generic and cluster generic features
    • Initializing the ZGP NVM table, which contains the ID of GPD, security keys, frame counters and sink address list, commissioned id, endpoint and more
    • Initializing the ZGP client cluster
    void ZGPH_ProxyBasicInit(void);

    Parameters:

    • None
  • Use the following public API to initialize the ZGP high sink, which manages the communication between the GPDs and the Zigbee network:

    • Initializing the ZGP server cluster
    void ZGPH_SinkBasicInit(void);

    Parameters:

    • None
  • Use the following public API to initialize the low ZGP, mainly the dStub and cStub components:

    void ZGPL_Init(void);

    Parameters:

    • None

Commissioning

  • Use the following public API to put the sink in Commissioning mode:
    void ZGPH_PutLocalSinkInCommissioningMode(uint8_t options, uint8_t endPoint, bool unicastComm);

    Parameters:

    • options – Commissioning mode options (bit fields according to the set bit fields)
      • uint8_t action : 1;
      • uint8_t involveGPMinSecurity : 1;
      • uint8_t involveGPMinPairing : 1;
      • uint8_t involveProxies : 1;
      • uint8_t reserved : 4;
    • endPoint – Value of communicating endpoint
    • unicastComm – True or false
  • Use the following public API to send the ZGP proxy commissioning mode command:
    ZCL_Status_t ZGPH_SendProxyCommissioningModeCommand(uint8_t options, uint16_t commissioningWindow, uint8_t channel);

    Parameters:

    • options – Proxy options field
    • commissioningWindow – Commissioning window value
    • channel – Channel value
    Usage:
    //If involveProxies is enabled from the options in ZGPH_PutLocalSinkInCommissioningMode(uint8_t sinkCommModeOptions, uint8_t endPoint, bool unicastComm) API
    
    uint8_t options;
    zgpGpProxyCommModeOptions_t *proxyOptions = (zgpGpProxyCommModeOptions_t *)&options;
    
    proxyOptions->action = sinkCommModeOptions->action;
    proxyOptions->channelPresent = false; // As per the current spec., this is set to 0 always
    proxyOptions->exitMode = ON_FIRST_PAIRING_SUCCESS;
    proxyOptions->unicastCommunication = unicastComm;
    
    ZGPH_SendProxyCommissioningModeCommand(proxyOptions, COMMISSIONING_WINDOW_DEFAULT_VALUE_IN_MSEC , ZGP_PROXY_COMM_MODE_CHANNEL);

Generic ZGP Infrastructure APIs

  • The following public API enables or disables the Direct mode of GPDF and is applicable to COMBO basic devices (proxy + sink). Based on this setting, it forwards the c-stub indication to the d-stub block:
    void ZGPL_EnableDisableDirectMode(bool enabled);

    Parameters:

    • enabled – Enable/Disable flag
  • The following public API requests the ZGP simple descriptor to retrieve information such as cluster IDs, profile ID, device ID and more for the specified network address and endpoint:
    void ZGPL_SendSimpleDescReq(ShortAddr_t addr,uint8_t ep);

    Parameters:

    • addr – Network address of the node
    • ep – Endpoint value
  • The following public API broadcasts the device announce of the ZGP to the network, typically called after successful ZGP commissioning:
    void ZGPL_SendDeviceAnnounceCmd(uint16_t nwkAddr, uint64_t extAddr);

    Parameters:

    • nwkAddr – NWK address to be placed in the device announce
    • extAddr – External address to be placed in the device announce
  • Use the following public API to send the ZGP read attribute command with green power profile ID, cluster ID for the respective attribute ID to the Zigbee network:
    ZCL_Status_t ZGPH_SendReadAttribute(uint16_t addr, uint8_t dir, uint16_t attrId);

    Parameters:

    • addr – Destination address
    • dir – Server to client or client to server
    • attrId – Attribute ID
  • Use the following public API to send the ZGP commands in the Raw mode with the payload:
    ZCL_Status_t ZGPH_SendCmdInRawMode(uint16_t dstAddr, bool dir, uint16_t cmdId, uint8_t payLoadLength, uint8_t  *payLoad);

    Parameters:

    • dstAddr – Destination address
    • dir – Server to client or client to server
    • cmdId – Cluster command ID
    • payLoadLength – Sending specific length of payload
    • payLoad – Send the payload
  • A proxy node maintains information about the GP source nodes that it serves as a proxy for. The system stores this information in a local proxy table that includes an entry for each source node within direct range. Each proxy table entry holds pairing information about the source node and the associated sink node, including security requirements and the Communication mode. The GP cluster constructs the proxy table automatically during the commissioning process.

    Use the following public API to send a request for the ZGP proxy table to the specific network address:
    ZCL_Status_t ZGPH_SendProxyTableRequest(uint16_t addr, uint8_t options, uint64_t gpdId_Ieee, uint8_t ep, uint8_t index);

    Parameters:

    • addr – Destination address
    • options – Options field
    • gpdId_Ieee – GPD ID or IEEE® address
    • ep – Endpoint for IEEE address GPD
    • index – Index field
  • A sink node must keep a record of the source nodes that it pairs with. The system stores this information in a local sink table that includes an entry for each paired source node. The sink table enables the sink node to verify if it is the intended recipient of a GP frame received from a source node, whether directly or through a proxy node. The GP cluster constructs the sink table automatically during the commissioning process.

    Use the following public API to send a request for the ZGP sink table information for the respective network address and end point:
    ZCL_Status_t ZGPH_SendSinkTableRequest(uint16_t addr, uint8_t options, uint64_t gpdId_Ieee, uint8_t ep, uint8_t index);

    Parameters:

    • addr – Destination address
    • options – Options field
    • gpdId_Ieee – GPD ID or IEEE address
    • ep – Endpoint for IEEE address GPD
    • index – Index field
  • Use the following public API to update the sink entry locally on NVM based on the given action:
    ZGP_InfraDeviceStatus_t ZGPH_UpdateLocalSinkEntry(zgpSinkTableEntry_t *sinkEntry, zgpSinkTableActions_t action);

    Parameters:

    • sinkEntry – Pointer to the sinkEntry to be updated
    • action – Add/replace/remove
  • Use the following public API to set the sink group ID for commissioning the GPD
    ZGP_InfraDeviceStatus_t ZGPH_SetSinkGroupEntry(GroupAddr_t sinkGroupId);

    Parameters:

    • sinkGroupId – sink group Id to be set
  • Use the following public API to set the assigned alias for the GPD to be commissioned:
    ZGP_InfraDeviceStatus_t ZGPH_SetGPDAssignedAlias(ShortAddr_t gpdAssignedAlias);

    Parameters:

    • gpdAssignedAlias – The commissioned 16-bit ID to be used as an alias for this GPD
  • Use the following public API to read the sink entry based on the index:
    bool ZGPH_GetSinkTableEntryByIndex(zgpSinkTableEntry_t *entry, uint8_t index);

    Parameters:

    • entry – Entry to be populated
    • index – Entry index
  • Use the following public API to send the gpPairingConfiguration command OTA:
    ZGP_InfraDeviceStatus_t ZGPH_SendGpPairingConfigCmd(APS_AddrMode_t addrMode, APS_Address_t *dstAddr, ZGP_PairingConfigCmdInfo_t pairingConfigCmdInfo, zgpCommReqAppInfo_t *commReqAppInfo, zgpEndpointInfo_t endPointInfo);

    Parameters:

    • addrMode – Address mode to be used OTA
    • dstAddr – Destination address of the remote device
    • pairingConfigCmdInfo – Pairing configuration command inputs
    • commReqAppInfo – Application information
    • endpointInfo – Paired Endpoints information
  • Use the following public API to flush out the TX request queued in the TX queue:
    void ZGPL_FlushTxQueue (void);

    Parameters:

    • None
  • Use the following public API to initiate the gpd data request from the high sink/proxy:
    void ZGPL_GpdfDataRequest(ZGP_GpdfDataReq_t *zgpGpdfDataReq);

    Parameters:

    • zgpGpdfDataReq – Data request parameters that need to be filled in the queue
  • Use the following public API to check the gpdf for duplicate packets:
    bool ZGPL_CheckForDuplicate(ZGPL_DataInd_t *dStubDataInd);

    Parameters:

    • dstubDataInd – dstub data indication parameters
  • Use the following public API to derive the GPD security key from the network/group key. This high sink mainly uses this API:
    void ZGPL_KeyDerivationHmac(zgpSinkTableEntry_t* sinkTableEntry, uint8_t *derivedKey, void (*keyedHashMacCb)(void));

    Parameters:

    • sinkTableEntry – Pointer to the sinkTableEntry structure
    • derivedKey – Key to be derived
    • sinkTableEntry – Callback function
  • Use the following public API to set the Proxy/Sink mode (commissioning/operational):
    void ZGPL_SetDeviceMode(bool isProxy, zgpMode_t mode);

    Parameters:

    • isProxy – True for proxy, false for sink
    • mode – Commissioning/operational
  • Use the following public API to get the Proxy/Sink mode (commissioning/operational):
    void ZGPL_GetDeviceMode(bool isProxy, zgpMode_t mode);

    Parameters:

    • isProxy – True for proxy, false for sink
    • mode – Commissioning/operational
  • Use the following public API to check whether the given srcId is valid, considering the frame type:
    bool ZGPL_IsValidSrcId(uint32_t srcId, ZGP_FrameType_t frameType, bool isPairingReq);

    Parameters:

    • srcId – GPD srcId
    • frameType – Maintenance frame/data frame
    • isPairingReqrcId received in pairing configuration/commissioning
  • Use the following public API to check whether the given key is valid:
    bool ZGPL_IskeyValid(uint8_t *key);

    Parameters:

    • key – Key to be validated
  • Use the following public API to derive the alias from the provided gpdId:
    uint16_t ZGPL_GetAliasSourceAddr(gpdId_t *gpdId);

    Parameters:

    • gpdIdgpdId to derive the alias from

NVM Table APIs

The following sections explain the APIsʼ usage with respect to the NVM table.
  • Use the following public API to initialize the NVM Table:
    void ZGPL_NvmTableInit (void);

    Parameters:

    • None
  • Use the following public API to reset all parameters of the specified entry to their initial value:
    void ZGPL_ResetTableEntry (void *entry, ZGP_TableType_t tableType);

    Parameters:

    • entry – Entry to be reset
    • tableType – Sink/proxy entry
  • Use the following public API to fetch the total number of non-empty entries. The high proxy/sink mainly uses this while sending sink/proxy table responses:
    uint8_t ZGPL_TotalNonEmptyEntries(bool isProxyTable);

    Parameters:

    • isProxyTable – Proxy/sink entry
  • Use the following public API to add/update the proxy/sink entry on the NVM:
    bool ZGPL_AddOrUpdateTableEntryOnNvm(void *entryPtr, ZGP_TableUpdateAction_t action, ZGP_EntryType_t tableType);

    Parameters:

    • entryPtr – Pointer to the entry
    • action – To be performed on the entry
    • tableType – Proxy or sink entry
  • Use the following public API to read the proxy/sink entry from NVM:
    ZGP_ReadOperationStatus_t ZGPL_ReadTableEntryFromNvm(void *entryPtr,ZGP_TableOperationField_t tableOperationField , gpdId_t *gpdId, uint8_t endPoint);

    Parameters:

    • entryPtr – Fill the entry
    • tableOperationField – Filter fields for read operation
    • gpdId – Pointer to the address information
    • endPoint – GPD end point
  • Use the following public API to delete the sink/proxy entry from NVM:
    bool ZGPL_DeleteTableEntryFromNvm(ZGP_TableOperationField_t filterField, gpdId_t *gpdId, uint8_t endPoint);

    Parameters:

    • tableOperationField – Filter fields for the read operation
    • gpdId – Pointer to the address info
    • endPoint – GPD end point
  • Use the following public API to read/update frame counter on NVM:
    bool ZGPL_FrameCounterReadorUpdateOnNvm(uint32_t *frameCounter,ZGP_TableOperationField_t tableOperationField , gpdId_t *gpdId, uint8_t endPoint, bool isUpdateOperation);

    Parameters:

    • frameCounter – Frame counter to be updated/read
    • tableOperationField – Filter fields for read operation
    • gpdId – Pointer to the address info
    • isUpdateOperation – True for update, false for read
  • Use the following public API to check whether the pairing info in the sink entry is empty or not. The high/low ZGP uses this while processing sink entry:
    bool ZGPL_SinkEntryIsPairingInfoEmpty(zgpSinkTableEntry_t *currEntry);

    Parameters:

    • currEntry – Entry address
  • Use the following public API to add the group entry to the given sink entry:
    bool ZGPL_AddSinkGroupEntry(zgpSinkTableEntry_t *currEntry, zgpSinkGroup_t *groupEntry);

    Parameters:

    • currEntry – Entry address
    • groupEntry – Add group entry ID
  • Use the following public API to delete all the table entries:
    void ZGP_ResetTableToFN(void);

    Parameters:

    • None