The following steps show you how to use two endpoints in SIMPLELINK-CC13X2-26X2-SDK Z-Stack zed_sw example.
1. Define a new SAMPLESW_ENDPOINT2 as 9 in zcl_samplesw.h.
#define SAMPLESW_ENDPOINT2 9
2. Define a new zclSampleSwEp2Desc in zcl_samplesw.c.
static endPointDesc_t zclSampleSwEp2Desc = {0};
3. Clone zclSampleSwEp2_Attrs, zclSampleSwEp2_InClusterList, and zclSampleSwEp2_OutClusterList from zclSampleSw_Attrs, zclSampleSw_InClusterList, and zclSampleSw_OutClusterList in zcl_samplesw_data.c.
4. Define a new zclSampleSwEp2_SimpleDesc in zcl_samplesw_data.c.
#define ZCLSAMPLESWEp2_MAX_INCLUSTERS ( sizeof( zclSampleSwEp2_InClusterList ) / sizeof( zclSampleSwEp2_InClusterList[0] ))
#define ZCLSAMPLESWEp2_MAX_OUTCLUSTERS ( sizeof( zclSampleSwEp2_OutClusterList ) / sizeof( zclSampleSwEp2_OutClusterList[0] ))
SimpleDescriptionFormat_t zclSampleSwEp2_SimpleDesc =
{
SAMPLESW_ENDPOINT2, // int Endpoint;
ZCL_HA_PROFILE_ID, // uint16_t AppProfId[2];
ZCL_HA_DEVICEID_ON_OFF_LIGHT_SWITCH,// uint16_t AppDeviceId[2];
SAMPLESW_DEVICE_VERSION, // int AppDevVer:4;
SAMPLESW_FLAGS, // int AppFlags:4;
ZCLSAMPLESWEp2_MAX_INCLUSTERS, // byte AppNumInClusters;
(cId_t *)zclSampleSwEp2_InClusterList, // byte *pAppInClusterList;
ZCLSAMPLESWEp2_MAX_OUTCLUSTERS, // byte AppNumInClusters;
(cId_t *)zclSampleSwEp2_OutClusterList // byte *pAppInClusterList;
};
5. Register the new SAMPLESW_ENDPOINT2 and zclSampleSwEp2Desc in zclSampleSw_Init().
//Register Endpoint 2
zclSampleSwEp2Desc.endPoint = SAMPLESW_ENDPOINT2;
zclSampleSwEp2Desc.simpleDesc = &zclSampleSwEp2_SimpleDesc;
zclport_registerEndpoint(appServiceTaskId, &zclSampleSwEp2Desc);
6. Clone zclSampleSwEp2_CmdCallbacks (remember to implement your own callbacks for SAMPLESW_ENDPOINT2) from zclSampleSw_CmdCallbacks in zcl_samplesw.c and register zclSampleSwEp2_CmdCallbacks using zclGeneral_RegisterCmdCallbacks().
zclGeneral_RegisterCmdCallbacks( SAMPLESW_ENDPOINT2, &zclSampleSwEp2_CmdCallbacks );
7. Define zclSampleSwEp2_NumAttributes in zcl_samplesw_data.c.
uint8_t CONST zclSampleSwEp2_NumAttributes = ( sizeof(zclSampleSwEp2_Attrs) / sizeof(zclSampleSwEp2_Attrs[0]) );
8. Register attributes for SAMPLESW_ENDPOINT2 using zcl_registerAttrList() in .
zcl_registerAttrList( SAMPLESW_ENDPOINT, zclSampleSwEp2_NumAttributes, zclSampleSwEp2_Attrs );
9. Build and test your application for two active endpoints.
No comments:
Post a Comment