使用zed_samppleApp创建了一个light sensor的设备,在sysconfig中设置Application name为"light",zcl_config.c中创建了一个名为light_serviceTaskId的task ID,但是在初始化BDB Reporting的时候,Zstackapi_bdbRepAddAttrCfgRecordDefaultToListReq使用的task ID却是sampleApp_serviceTaskId
/*********************************************************************
* @fn zclConfigInit
*
* @brief This is called to initialize the statically-generated
* SysConfig ZCL code. This API should not be modified by
* the user.
*
* @param none
*
* @return none
*********************************************************************/
void zclConfigInit(void)
{
// register endpoint with ZCL
lightEpDesc.endPoint = light_EndPoint;
lightEpDesc.simpleDesc = &light_SimpleDesc;
zclport_registerEndpoint(light_serviceTaskId, &lightEpDesc);
otaClientEpDesc.endPoint = otaClient_EndPoint;
otaClientEpDesc.simpleDesc = &otaClient_SimpleDesc;
otaClient_ResetAttributesToDefaultValues();
otaClient_OTAUpgrade_CurrentFileVersion = 0x00000001;
otaClient_CreateTask(otaClient_EndPoint, otaClientEpDesc, otaClient_zclAttrsArraySize,
otaClient_Attrs, otaClient_zclCmdsArraySize, otaClient_Cmds);
// register the applications attribute list with ZCL
zcl_registerAttrList( light_EndPoint, light_zclAttrsArraySize, light_Attrs );
// reset attributes to their default values
light_ResetAttributesToDefaultValues();
#ifdef ZCL_DISCOVER
// register the applications command list with ZCL
zcl_registerCmdList( light_EndPoint, light_zclCmdsArraySize, light_Cmds );
#endif
zclGeneral_RegisterCmdCallbacks( LIGHT_ENDPOINT, &light_zclGeneralCmdCallbacks );
zclMS_RegisterCmdCallbacks( LIGHT_ENDPOINT, &light_zclMSCmdCallbacks );
#ifdef BDB_REPORTING
zstack_bdbRepAddAttrCfgRecordDefaultToListReq_t Req = {0};
struct foo {
uint8_t arr[BDBREPORTING_MAX_ANALOG_ATTR_SIZE];
};
struct foo foo;
#ifdef ZCL_MS
foo = (struct foo) { .arr = {0x40, 0x00, 0x00, 0x00} };
Req.attrID = ATTRID_ILLUMINANCE_MEASUREMENT_MEASURED_VALUE ;
Req.cluster = ZCL_CLUSTER_ID_MS_ILLUMINANCE_MEASUREMENT;
Req.endpoint = LIGHT_ENDPOINT;
Req.maxReportInt = 0xFFFF;
Req.minReportInt = 0x0000;
OsalPort_memcpy(Req.reportableChange, foo.arr, BDBREPORTING_MAX_ANALOG_ATTR_SIZE);
Zstackapi_bdbRepAddAttrCfgRecordDefaultToListReq(sampleApp_serviceTaskId,&Req);
foo = (struct foo) { .arr = {0x40, 0x00, 0x00, 0x00} };
Req.attrID = ATTRID_ILLUMINANCE_LEVEL_SENSING_LEVEL_STATUS ;
Req.cluster = ZCL_CLUSTER_ID_MS_ILLUMINANCE_LEVEL_SENSING_CONFIG;
Req.endpoint = LIGHT_ENDPOINT;
Req.maxReportInt = 0xFFFF;
Req.minReportInt = 0x0000;
OsalPort_memcpy(Req.reportableChange, foo.arr, BDBREPORTING_MAX_ANALOG_ATTR_SIZE);
Zstackapi_bdbRepAddAttrCfgRecordDefaultToListReq(sampleApp_serviceTaskId,&Req);
#endif
#endif
}