Thread 中讨论的其他器件: Z-stack
嗨、大家好
我´m 实现 ZCL SE 计量、这是我的开/关器件在 将其移植到 CC2530支持的 ZStack 3.0.2之前、对 Z-Stack Home 1.2.2a.44539进行的最后一次更改。
我在器件3端点中使用、专用于 与 ZCL_SE_Metering 服务器配合 使用、另两个用于与 ZCL_CLUSTER_ID_GEN_BASIC 和其他强制集群配合使用。 正如我在下面所描述的:
端点1 ZCL_CLUSTER_ID_GEN_BASIC、 ZCL_CLUSTER_ID_GEN_Identify 和 ZCL_CL_CLUSTER_ID_GEN_ON_OFF
端点2 ZCL_CLUSTER_ID_GEN_BASIC、 ZCL_CLUSTER_ID_GEN_Identify 和 ZCL_CL_CLUSTER_ID_GEN_ON_OFF 和 ZCL_SE_METERING_SERVER
端点3 ZCL_CLUSTER_ID_GEN_BASIC、 ZCL_CLUSTER_ID_GEN_Identify 和 ZCL_CL_CLUSTER_ID_GEN_ON_OFF
我在我的应用 MyApp.c 和 MyApp_data.c 中包含了 ZCL_se.c 和 ZCL_se.h
我无法成功执行对 ZCL 读取 属性消息- 0x00 (客户端到服务器)的回调、我的设备将回答以下属性:
提供的电流总和(0x0000)
同步需求(0x0400)
测量单位(0x0300)
我已使用德州仪器(TI)参考设计(TIREX)来实现 ZCL SE 回调:https://dev.ti.com/tirex/explore/node?node=AHbBZxMuyaeDZaCvHJ42MQ__t1zoukP__LATEST
我在背面观察到我的回叫未到达。
有人可以帮助我吗?
我的回叫代码:
void zclAZh0006SE_Init( byte task_id )
{
zclAZh0006SE1_TaskID = task_id;
// Set destination address to indirect
// zclAZh0006_DstAddr.addrMode = (afAddrMode_t)AddrNotPresent;
// zclAZh0006_DstAddr.endPoint = 0;
// zclAZh0006_DstAddr.addr.shortAddr = 0;
/**********************************************************************************************************
* UART Init - by ASA
**********************************************************************************************************/
// Set UART Definitions:
//uartMapPort(1,0);
initUart0(uart0RxCb);
/**********************************************************************************************************
* ZCL Addressing Mode - by ASA
efeito através das mensagens originadas a partir deste dispositivo
**********************************************************************************************************/
zclAZh0006_DstAddr.addrMode = (afAddrMode_t)Addr16Bit;
zclAZh0006_DstAddr.addr.shortAddr = 0; // Short Address sent to gateway
zclAZh0006_DstAddr.endPoint=1; // DST Endpoint sent to Gateway
// This app is part of the Home Automation Profile
zclHA_Init(&zclAZh0006SE1_SimpleDesc);
// Register the ZCL SE Cluster Library callback functions according zcl_se.c
#ifdef ZCL_SE_METERING_SERVER
zclSE_RegisterCmdCallbacks( AZh0006_ENDPOINT2, &zclAZh0006_SECmdCallbacks );
#endif
// Register the application's attribute list
zcl_registerAttrList( AZh0006_ENDPOINT2,zclAZh0006_NumAttributesSE1, zclAZh0006_AttrsSE1 );
// Register the Application to receive the unprocessed Foundation command/response messages
zcl_registerForMsg( zclAZh0006SE1_TaskID );
#ifdef ZCL_DISCOVER
// Register the application's command list
zcl_registerCmdList( AZh0006_ENDPOINT2, zclCmdsArraySize, zclAZh0006_Cmds );
#endif
// Register for all key events - This app will handle all key events
RegisterForKeys( zclAZh0006SE1_TaskID );
// Register for a test endpoint
afRegister( &AZh0006_TestEp2 );
#ifdef ZCL_EZMODE
// Register EZ-Mode
zcl_RegisterEZMode( &zclAZh0006_RegisterEZModeDataSE );
// Register with the ZDO to receive Match Descriptor Responses
ZDO_RegisterForZDOMsg(task_id, Match_Desc_rsp);
//Register with the ZDO to receive Permit to Join Request
ZDO_RegisterForZDOMsg(task_id, Mgmt_Permit_Join_req);
//Register with the ZDO to receive Leave Req
ZDO_RegisterForZDOMsg(task_id, Mgmt_Leave_req);
#endif
#ifdef ZCL_DIAGNOSTIC
// Register the application's callback function to read/write attribute data.
// This is only required when the attribute data format is unknown to ZCL.
zcl_registerReadWriteCB( AZh0006_ENDPOINT2, zclDiagnostic_ReadWriteAttrCB, NULL );
if ( zclDiagnostic_InitStats() == ZSuccess )
{
// Here the user could start the timer to save Diagnostics to NV
}
#endif
#ifdef ZGP_AUTO_TT
zgpTranslationTable_RegisterEP ( &zclAZh0006SE1_SimpleDesc );
#endif
}
/*********************************************************************
* ZCL SE Profile Callback table for EP2
*/ // Client-to-Server Callbacks
static const zclSE_MeteringServerCBs_t zclAZh0006_MeteringServerCBs =
{
zclAZh0006_MeteringGetProfileCB,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL
};
static zclSE_AppCallbacks_t zclAZh0006_SECmdCallbacks =
{
NULL, // zclSE_DRLC_ServerCBs_t
NULL, // zclSE_DRLC_ClientCBs_t
&zclAZh0006_MeteringServerCBs, // zclSE_MeteringServerCBs_t
NULL, // zclSE_MeteringClientCBs_t
NULL, // zclSE_PriceServerCBs_t
NULL, // zclSE_PriceClientCBs_t
NULL, // zclSE_MessagingServerCBs_t
NULL, // zclSE_MessagingClientCBs_t
NULL, // zclSE_TunnelingServerCBs_t
NULL, // zclSE_TunnelingClientCBs_t
NULL, // zclSE_PrepaymentServerCBs_t
NULL, // zclSE_PrepaymentClientCBs_t
NULL, // zclSE_EnergyMgmtServerCBs_t
NULL, // zclSE_EnergyMgmtClientCBs_t
NULL, // zclSE_CalendarServerCBs_t
NULL, // zclSE_CalendarClientCBs_t
NULL, // zclSE_DeviceMgmtServerCBs_t
NULL, // zclSE_DeviceMgmtClientCBs_t
NULL, // zclSE_EventsServerCBs_t
NULL, // zclSE_EventsClientCBs_t
NULL, // zclSE_MDUPairingServerCBs_t
NULL // zclSE_MDUPairingClientCBs_t
};
static void zclAZh0006_MeteringGetProfileCB( zclIncoming_t *pInMsg,zclSE_MeteringGetProfile_t *pCmd )
{
switch ( pInMsg->hdr.commandID )
{
case COMMAND_SE_METERING_GET_PROFILE:
//zclAZh0006_ProcessInReadRspCmd( pInMsg );
break;
}
if ( pInMsg->attrCmd )
osal_mem_free( pInMsg->attrCmd );
}
BR、
Alex
