ZCL コードは、エンドポイント インデックスを内部的に使用し ( インデックスは psZCL_Common->psZCL_EndPointRecord)、 eZCL_SearchForEPIndex と u8ZCL_GetEPIdFromIndex による登録時に指定された ID 間でマップします。
現在の ZCL OTA コードでは、ID が 2 つの場所で予期されるインデックスが誤って使用されています。これが引き起こす問題は、エンドポイント ID が連続し、1 から始まる場合に隠されます。
細部:
- SDK バージョン: 2.6.15
- JN5189DK6/middleware/wireless/zigbee/ZCL/Clusters/OTA/Source/OTA.c (英語)
//
// The u8SourceEndPointId > u8ZCL_GetNumberOfEndpointsRegistered
// range check is incorrect and needs to be removed
//
PUBLIC teZCL_Status eOtaFindCluster(
uint8 u8SourceEndPointId,
tsZCL_EndPointDefinition **ppsEndPointDefinition,
tsZCL_ClusterInstance **ppsClusterInstance,
tsOTA_Common **ppsOTACustomDataStructure,
bool_t bIsServer)
{
if(u8SourceEndPointId > u8ZCL_GetNumberOfEndpointsRegistered())
{
return(E_ZCL_ERR_EP_RANGE);
}
// check EP is registered and cluster is present in the send device
if(eZCL_SearchForEPentry(u8SourceEndPointId, ppsEndPointDefinition) != E_ZCL_SUCCESS)
{
return(E_ZCL_ERR_EP_RANGE);
}
if(eZCL_SearchForClusterEntry(u8SourceEndPointId, OTA_CLUSTER_ID, bIsServer, ppsClusterInstance) != E_ZCL_SUCCESS)
{
return(E_ZCL_ERR_CLUSTER_NOT_FOUND);
}
// initialise custom data pointer
*ppsOTACustomDataStructure = (tsOTA_Common *)(*ppsClusterInstance)->pvEndPointCustomStructPtr;
if(*ppsOTACustomDataStructure==NULL)
{
return(E_ZCL_ERR_PARAMETER_NULL);
}
return(E_ZCL_SUCCESS);
}
//
// FIXED
//
PUBLIC teZCL_Status eOtaFindCluster(
uint8 u8SourceEndPointId,
tsZCL_EndPointDefinition **ppsEndPointDefinition,
tsZCL_ClusterInstance **ppsClusterInstance,
tsOTA_Common **ppsOTACustomDataStructure,
bool_t bIsServer)
{
// check EP is registered and cluster is present in the send device
if(eZCL_SearchForEPentry(u8SourceEndPointId, ppsEndPointDefinition) != E_ZCL_SUCCESS)
{
return(E_ZCL_ERR_EP_RANGE);
}
if(eZCL_SearchForClusterEntry(u8SourceEndPointId, OTA_CLUSTER_ID, bIsServer, ppsClusterInstance) != E_ZCL_SUCCESS)
{
return(E_ZCL_ERR_CLUSTER_NOT_FOUND);
}
// initialise custom data pointer
*ppsOTACustomDataStructure = (tsOTA_Common *)(*ppsClusterInstance)->pvEndPointCustomStructPtr;
if(*ppsOTACustomDataStructure==NULL)
{
return(E_ZCL_ERR_PARAMETER_NULL);
}
return(E_ZCL_SUCCESS);
}及び
これが2番目のアイテムです。システムは、約30秒であるにもかかわらず、メッセージを編集する時間がなくなったと言います。
//
// The *eOtaTimeUpdate* function expects an endpoint ID, not an index
//
PUBLIC void vOtaTimerClickCallback(tsZCL_CallBackEvent *psCallBackEvent)
{
#if (defined(OTA_SERVER) && defined(OTA_PAGE_REQUEST_SUPPORT)) || defined(OTA_CLIENT)
int i;
uint8 u8NumberOfendpoints;
u8NumberOfendpoints = u8ZCL_GetNumberOfEndpointsRegistered();
// find price clusters on each EP - if any
for(i=1; i<(u8NumberOfendpoints+1); i++)
{
// deliver time to any EP-server/client
eOtaTimeUpdate(i, TRUE, psCallBackEvent);
eOtaTimeUpdate(i, FALSE, psCallBackEvent);
}
#endif
}
//
// FIXED
//
PUBLIC void vOtaTimerClickCallback(tsZCL_CallBackEvent *psCallBackEvent)
{
#if (defined(OTA_SERVER) && defined(OTA_PAGE_REQUEST_SUPPORT)) || defined(OTA_CLIENT)
int i;
uint8 u8NumberOfendpoints;
u8NumberOfendpoints = u8ZCL_GetNumberOfEndpointsRegistered();
// find price clusters on each EP - if any
for(i = 0; i < u8NumberOfendpoints; i++)
{
uint8_t u8EndpointId = u8ZCL_GetEPIdFromIndex(i);
// deliver time to any EP-server/client
eOtaTimeUpdate(u8EndpointId, TRUE, psCallBackEvent);
eOtaTimeUpdate(u8EndpointId, FALSE, psCallBackEvent);
}
#endif
}