Other Parts Discussed in Thread: Z-STACK
Hi Guys,t
I´m trying to implementing the ZCL SE METERING, the last changes in my On/off device over the Z-Stack Home 1.2.2a.44539 before port it to Zstack 3.0.2 supported by CC2530.
I used in my device 3 endpoints, onde specific to working with ZCL_SE_METERING_SERVER and another two to working with ZCL_CLUSTER_ID_GEN_BASIC and other mandatory clusters. as i describe below:
EndPoint 1 ZCL_CLUSTER_ID_GEN_BASIC, ZCL_CLUSTER_ID_GEN_IDENTIFY and ZCL_CLUSTER_ID_GEN_ON_OFF
EndPoint 2 ZCL_CLUSTER_ID_GEN_BASIC, ZCL_CLUSTER_ID_GEN_IDENTIFY and ZCL_CLUSTER_ID_GEN_ON_OFF and ZCL_SE_METERING_SERVER
EndPoint 3 ZCL_CLUSTER_ID_GEN_BASIC, ZCL_CLUSTER_ID_GEN_IDENTIFY and ZCL_CLUSTER_ID_GEN_ON_OFF
I included the ZCL_se.c and ZCL_se.h on my application MyApp.c and MyApp_data.c
I dindt have success to implement the call back for ZCL Read Attributes Mesage - 0x00 (Client to Server) to my device answer those attributes:
Current Summation Delivered (0x0000)
Instanteneous Demand (0x0400)
Unit of measure (0x0300)
I have used the Texas Reference desing (TIREX) to implement the ZCL SE Callback:https://dev.ti.com/tirex/explore/node?node=AHbBZxMuyaeDZaCvHJ42MQ__t1zoukP__LATEST
I have observed on breackpoint that My Callback is not reached.
Someone can help me?
My Callback code:
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