This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
协议栈默认的开关只有两个状态:开或者关
我们目前的开关是三路的(有三个按键),按照默认的协议智能三个要么一起开要么一起关,
可有时只需要开关某一路,我是否可以把数据类型改为ZCL_DATATYPE_UINT8,这样sever端根据收到的数据去判断
// *** On / Off Cluster Attributes ***
{
ZCL_CLUSTER_ID_GEN_ON_OFF,
{
// Attribute record
ATTRID_ON_OFF,
ZCL_DATATYPE_UINT8,//默认为ZCL_DATATYPE_BOOLEAN,
ACCESS_CONTROL_READ,
(void *)&zclSampleSw_OnOff
}
},
你可以增加endpoint 来控制,如果你不会添加endpoint 可以参考下面注册一个endpoint 以及各种回调仿照原来light 即可。
//Register Endpoint zclSampleLightEpDesc2.endPoint = SAMPLELIGHT2_ENDPOINT; zclSampleLightEpDesc2.simpleDesc = &zclSampleLight2_SimpleDesc; zclport_registerEndpoint(id, &zclSampleLightEpDesc2); // Register the ZCL General Cluster Library callback functions zclGeneral_RegisterCmdCallbacks( SAMPLELIGHT2_ENDPOINT, &zclSampleLight2_CmdCallbacks ); // Register the application's attribute list and reset to default values zclSampleLight2_ResetAttributesToDefaultValues(); zcl_registerAttrList( SAMPLELIGHT2_ENDPOINT, zclSampleLight2_NumAttributes, zclSampleLight2_Attrs ); zcl_registerCmdList( SAMPLELIGHT2_ENDPOINT, zclSampleLight2_zclCmdsArraySize, zclSampleLight2_Cmds ); zclSampleLight2_initializeClocks();