Other Parts Discussed in Thread: Z-STACK
Tool/software:
Hello,
I am currently working on a Zigbee application using the Z-Stack and encountered an issue while sending a Config Reporting
command from a coordinator to an endDevice.
The configuration is successfully received on the endDevice. However, when the BDB_FINDING_BINDING_CAPABILITY_ENABLED
option is disabled, the Z-Stack fails to save the configuration. Upon analyzing the code in bdb_reporting.c
, specifically in the function bdb_ProcessInConfigReportCmd
, I found that it fails due to the absence of an endPointDescriptor
. The issue is located in this part of the code:
// Find Ep Descriptor endPointDesc_t* epDescriptor = bdb_FindEpDesc(pInMsg->endPoint); if (epDescriptor == NULL) { return (ZInvalidParameter); }
The problem seems to stem from the
bdb_HeadEpDescriptorList
pointer, which is not initialized when BDB_FINDING_BINDING_CAPABILITY_ENABLED
is disabled. In the file af.c
, within the function afRegisterExtended
, I noticed that the initialization of bdb_HeadEpDescriptorList
is conditioned by this option:#if (BDB_FINDING_BINDING_CAPABILITY_ENABLED == 1) // Make sure we add at least one application endpoint if ((epDesc->endPoint != 0) && (epDesc->endPoint < BDB_ZIGBEE_RESERVED_ENDPOINTS_START)) { bdb_HeadEpDescriptorList = epList; ep->epDesc->epType = bdb_zclFindingBindingEpType(ep->epDesc); } #endif
To resolve this issue, I modified the code to initialize
bdb_HeadEpDescriptorList
even when BDB_FINDING_BINDING_CAPABILITY_ENABLED
is disabled. Here is the updated code:// Make sure we add at least one application endpoint if ((epDesc->endPoint != 0) && (epDesc->endPoint < BDB_ZIGBEE_RESERVED_ENDPOINTS_START)) { bdb_HeadEpDescriptorList = epList; #if (BDB_FINDING_BINDING_CAPABILITY_ENABLED == 1) ep->epDesc->epType = bdb_zclFindingBindingEpType(ep->epDesc); #endif }
With this modification, the reporting configuration works correctly, and the Z-Stack successfully saves the configuration.
My question is: why is the initialization of bdb_HeadEpDescriptorList
conditioned by BDB_FINDING_BINDING_CAPABILITY_ENABLED
in the original Z-Stack? This logic seems to block basic features like reporting when this option is disabled. Is there a specific reason for this design, or are there implications I should be aware of?
Thank you in advance for your insights!