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

ソリューションへジャンプ
685件の閲覧回数
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 解決策
624件の閲覧回数
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 返答(返信)
683件の閲覧回数
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 件の賞賛
返信
625件の閲覧回数
sofiaurueta
NXP Employee
NXP Employee

Hello,

 

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

 

Regards,

Ana Sofia.

0 件の賞賛
返信