14.2.3.7.1 GP Infrastructure devices

Initialization

1. Following public API is used to initialize the zgp high proxy which will do

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

Parameters:

  • None

2. Following public API is used to initialize the zgp high sink, which will do

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

Parameters:

  • None

3. Following public API is used to initialize the lowzgp(mainly dStub/cStub)

void ZGPL_Init(void);

Parameters:

  • None

Commissioning

1. Following public API is used to put 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

2. Following public API is used 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

1. Following public API is used to enable or disable the direct mode of GPDF, and it is applicable for the COMBO basic devices(proxy + sink). Depending upon this it will forward c-stub indication to d-stub block.

void ZGPL_EnableDisableDirectMode(bool enabled);

Parameters:

  • enabled - enable/disable flag

2. Following public API is used to request the zgp simple descriptor to get the information like cluster ids, profile id and device id etc for the requested network address and end point.

void ZGPL_SendSimpleDescReq(ShortAddr_t addr,uint8_t ep);

Parameters:

  • addr - Network address of the node
  • ep - endpoint value

3. Following public API Is used to broadcast the device announce of zgp to the network which will be called generally after successful zgp commissioning.

void ZGPL_SendDeviceAnnounceCmd(uint16_t nwkAddr, uint64_t extAddr);

Parameters:

  • nwkAddr - nwk addr to be placed in the device announce
  • extAddr - ext addr to be placed in the device announce

4. Following public API is used 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

5. Following public API is used to send the zgp commands in 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 - length of payload to be sent
  • payLoad - payload to be sent

6. A proxy node must keep information about the GP source nodes for which it acts as a proxy. This information is stored in a local 'proxy table', which contains an entry for each source node which is in direct range. A proxy table entry stores pairing information about the source node and the paired sink node, including the security requirements and communication mode. The proxy table is automatically built up by the Green Power cluster as a part of the commissioning process

Following public API is used to send request for 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

7. A sink node must keep a record of the source nodes with which it is paired. This information is stored in a local ‘sink table’, which contains an entry for each paired source node. This table allows the sink node to determine whether a GP frame received from a source node (directly or via a proxy node) is intended for itself. The sink table is automatically built up by the Green Power cluster as a part of the commissioning process

Following public API is used to send request for 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

8. Following public API is used to update 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

9. Following public API is used to set the sink group id used for the GPD to be commissioned.

ZGP_InfraDeviceStatus_t ZGPH_SetSinkGroupEntry(GroupAddr_t sinkGroupId);

Parameters:

  • sinkGroupId - sink group Id to be set

10. Following public API is used 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 alias for this GPD

11. Following public API is used 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

12. Following public API is used to send gpPairingConfiguration command over the air

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 over the air
  • dstAddr - destination address of the remote device
  • pairingConfigCmdInfo - pairingConfig command inputs
  • commReqAppInfo - Application information
  • endpointInfo - paired Endpoints information

13. Following public API is used to flush out the tx request queued in tx queue.

void ZGPL_FlushTxQueue (void);

Parameters:

  • None

14. Following public API is used to initiate gpd data request from high sink/proxy.

void ZGPL_GpdfDataRequest(ZGP_GpdfDataReq_t *zgpGpdfDataReq);

Parameters:

  • zgpGpdfDataReq - data request paramters to be filled in queue

15. Following public API is used to check the gpdf for duplicate packets.

bool ZGPL_CheckForDuplicate(ZGPL_DataInd_t *dStubDataInd);

Parameters:

  • dstubDataInd - dstub data indication paramters

16. Following public API is used to derive the GPD security key from the network/group key.This API is mainly used by high Sink.

void ZGPL_KeyDerivationHmac(zgpSinkTableEntry_t* sinkTableEntry, uint8_t *derivedKey, void (*keyedHashMacCb)(void));

Parameters:

  • sinkTableEntry - pointer to the sinkTableEntry
  • derivedKey - key to be derived
  • sinkTableEntry - callback function

17. Following public API is used 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

18. Following public API is used 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

19. Following public API is used to check whether the given srcId is valid or not considering frame type

bool ZGPL_IsValidSrcId(uint32_t srcId, ZGP_FrameType_t frameType, bool isPairingReq);

Parameters:

  • srcId - GPD srcId
  • frameType - Maintanence Frame/Data Frame
  • isPairingReq - rcId received in PairingConfig/Commissioning

20. Following public API is used to check whether the given key is valid or not

bool ZGPL_IskeyValid(uint8_t *key);

Parameters:

  • key - key to be validated

21. Following public API is used to derive the alias from the given gpdId

uint16_t ZGPL_GetAliasSourceAddr(gpdId_t *gpdId);

Parameters:

  • gpdId - gpdId from which the alias has to be derived

NVM_Table API's

Following sections explains about the API's usage with respect to NVM table

1. Following public API is used to initilaize the NVM Table

void ZGPL_NvmTableInit (void);

Parameters:

  • none

2. Following public API is used to reset all parameters of the given entry to init value.

void ZGPL_ResetTableEntry (void *entry, ZGP_TableType_t tableType);

Parameters:

  • entry - entry to be reset
  • tableType - sink/proxy entry

3. Following public API is used to fetch the total no.of non empty entries. This is mainly used by high proxy/sink while sending sink/proxy table responses

uint8_t ZGPL_TotalNonEmptyEntries(bool isProxyTable);

Parameters:

  • isProxyTable - proxy/sink entry

4. Following public API is used to add/update the proxy/sink entry on NVM.

bool ZGPL_AddOrUpdateTableEntryOnNvm(void *entryPtr, ZGP_TableUpdateAction_t action, ZGP_TableType_t tableType);

Parameters:

  • entryPtr - pointer to the entry
  • action - to be performed on the entry
  • tableType - proxy or sink entry

5. Following public API is used 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 - entry to be filled
  • tableOperationField - filter fields for read operation
  • gpdId - pointer to the addr info
  • endPoint - GPD end point

6. Following public API is used 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 read operation
  • gpdId - pointer to the addr info
  • endPoint - GPD end point

7. Following public API is used 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 - frameCounter to be updated/read
  • tableOperationField - filter fields for read operation
  • gpdId - pointer to the addr info
  • isUpdateOperation - true for update,false for read

8. Following public API is used to check whether the pairing info in the sink entry is empty or not. This is used by high/low zgp while processing sink entry.

bool ZGPL_SinkEntryIsPairingInfoEmpty(zgpSinkTableEntry_t *currEntry);

Parameters:

  • currEntry - entry address

9. Following public API is used to add the group entry to the given sink entry.

bool ZGPL_AddSinkGroupEntry(zgpSinkTableEntry_t *currEntry, zgpSinkGroup_t *groupEntry);

Parameters:

  • currEntry - entry address
  • groupEntry - group entry id to be added

10. Following public API is used to delete all the table entries

void ZGP_ResetTableToFN(void);

Parameters:

  • none