BUG Report: endpoint indices used instead of endpoint IDs in JN5189DK6 ZCL OTA code

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

BUG Report: endpoint indices used instead of endpoint IDs in JN5189DK6 ZCL OTA code

跳至解决方案
681 次查看
dstevens
Contributor II

 

The ZCL codes uses endpoint indices internally (index to psZCL_Common->psZCL_EndPointRecord) and maps between IDs provided on registration via eZCL_SearchForEPIndex and u8ZCL_GetEPIdFromIndex.

The current ZCL OTA code mistakenly uses indices where IDs are expected in two locations. The problem this causes is hidden when endpoint IDs are continuous and begin at 1.

Details:

- SDK Version: 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);
}

and

 

 

0 项奖励
回复
1 解答
620 次查看
sofiaurueta
NXP Employee
NXP Employee

Hello,

 

Thank you for your feedback, I will let the responsible team know about this.

 

Regards,

Ana Sofia.

在原帖中查看解决方案

0 项奖励
回复
2 回复数
679 次查看
dstevens
Contributor II

Here is the second item. The system says I've run out of time to edit the message, despite it being about 30 seconds:

//
// 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
}
0 项奖励
回复
621 次查看
sofiaurueta
NXP Employee
NXP Employee

Hello,

 

Thank you for your feedback, I will let the responsible team know about this.

 

Regards,

Ana Sofia.

0 项奖励
回复