Tool/software: WEBENCH® Design Tools
My last solotion for ota_client_app's issue is only working when OTA-endpoint is a standalone. If OTA-endpoint is shareing with Application-endpoint, it can be fixed like this.
uint8_t (*zclOTAClientUserMsgCB)(zclIncoming_t *pInMsg) = NULL;
bool OTAClient_SetEndpoint( uint8_t endpoint, zclport_pFnZclHandleExternal pfnCB )
{
if( currentOtaEndpoint == OTA_UNUSED_ENDPOINT )
{
currentOtaEndpoint = endpoint;
// Register for all OTA End Point, unhandled, ZCL foundation commands
//zcl_registerForMsgExt( zclOTA_TaskID, currentOtaEndpoint ); // use zclport_registerZclHandleExternal
zclport_registerZclHandleExternal( endpoint, OTA_ProcessUnhandledFoundationZCLMsgs );
zclOTAClientUserMsgCB = pfnCB;
return TRUE;
}
else if( endpoint == currentOtaEndpoint)
{
return TRUE;
}
else
{
return FALSE;
}
}
static uint8_t OTA_ProcessUnhandledFoundationZCLMsgs ( zclIncoming_t *pMsg )
{
zclIncomingMsg_t *pCmd;
if( zclOTAClientUserMsgCB )
{
zclOTAClientUserMsgCB( pMsg );
}
pCmd = (zclIncomingMsg_t *)OsalPort_msgAllocate( sizeof ( zclIncomingMsg_t ) );
if ( pCmd != NULL )
{
// fill in the message
pCmd->hdr.event = ZCL_INCOMING_MSG;
pCmd->zclHdr = pMsg->hdr;
pCmd->clusterId = pMsg->msg->clusterId;
pCmd->srcAddr = pMsg->msg->srcAddr;
pCmd->endPoint = pMsg->msg->endPoint;
pCmd->attrCmd = pMsg->attrCmd;
switch ( pCmd->zclHdr.commandID )
{
case ZCL_CMD_DEFAULT_RSP:
zclOTA_ProcessInDefaultRspCmd( pCmd );
break;
default :
break;
}
OsalPort_msgDeallocate((uint8_t *)pCmd);
}
if ( pMsg->attrCmd )
{
//OsalPort_free( pMsg->attrCmd );
OsalPort_free(pMsg->attrCmd);
pMsg->attrCmd = NULL;
}
return 0;
}