[zigbee] zcl read attributes
来源:互联网 发布:dedecms tag 数据库 编辑:程序博客网 时间:2024/05/29 08:47
//For your application (device2), the interesting attribute is :// *** On/Off Cluster Attributes *** { ZCL_CLUSTER_ID_GEN_ON_OFF, { // Attribute record ATTRID_ON_OFF, ZCL_DATATYPE_UINT8, ACCESS_CONTROL_READ, (void *)&zclSampleLight_OnOff } },/*This defines the attribute "OnOff" of cluster "Generic On/Off" in read access and gives the pointer to the variable in which you can find the status.Below, there's the definition of clusters implemented in input and output :*/const cId_t zclSampleLight_InClusterList[ZCLSAMPLELIGHT_MAX_INCLUSTERS] ={ ... ZCL_CLUSTER_ID_GEN_ON_OFF,};/*And below there's a SimpleDescriptionFormat_t structure that describe the device type and gives the in and out clusters list. May be you've already seen this so I'll directly jump to the read process (device1).In you main source file, you should have functions :zclyourapp_ProcessIncomingMsgzclyourapp_ProcessInReadRspCmdSee the SampleLight example for the whole process. The only thing they don't show you in this example is how to read an attribute. Reading an attribute is done in an asynchronous way since you don't want Device1 to be stuck waiting for Device2 answer.For the read :*/afAddrType_t addr;addr.endPoint = APP_ENDPOINT;addr.addrMode = (afAddrMode_t) afAddr16Bit;addr.addr.shortAddr = device2_shortaddr;zclReadCmd_t readCmd;readCmd.numAttr = 1;readCmd.attrID[0] = 0; // Attribute ID of OnOff in Cluster Gen On/Off is 0 (see ZigBee Cluster Library spec)zcl_SendRead(APP_ENDPOINT, &addr, ZCL_CLUSTER_ID_GEN_ON_OFF, &readCmd, ZCL_FRAME_CLIENT_SERVER_DIR, TRUE, 0); //When the answer is received, the Zstack sends it to your ProcessIncomingMsg and your receive it through :static uint8 zclyourapp_ProcessInReadRspCmd(zclIncomingMsg_t *pInMsg){ zclReadRspCmd_t * readRspCmd; readRspCmd = (zclReadRspCmd_t *) pInMsg->attrCmd; switch(pInMsg->clusterId) { case ZCL_CLUSTER_ID_GEN_ON_OFF: { uint8 onoff = * ((uint8 *) readRspCmd->attrList[0].data); // And that's OK ! } break; } return TRUE;}
阅读全文
0 0
- [zigbee] zcl read attributes
- Zigbee ZCL解读
- Zigbee Cluster Library(ZCL) 解读
- Zigbee Cluster Library(ZCL) 解读
- Zigbee协议栈之ZCL API简介
- Zigbee ZCL report command 相关翻译
- zigbee zcl规范及其协议栈实现1
- zigbee zcl规范及其协议栈实现2
- zigbee zcl规范及其协议栈实现1
- Silicon Lab Ember Zigbee学习杂谈------zcl extension
- silicon lab ember zigbee学习杂谈 --------- 发送zcl command
- Silicon Lab Ember zigbee学习杂谈---zcl frame解析
- zigbee zcl规范及其协议栈实现1
- zigbee zcl规范及其协议栈实现2
- zigbee zcl规范及其协议栈实现3 读取服务器端属性值
- zigbee zcl规范及其协议栈实现3 读取服务器端属性值
- ZCL 规范
- Attributes
- Qt生成随机数
- 栈和堆
- Referenced file contains errors (http://www.springframework.org/schema/beans/spring-beans-3.1.xsd)
- Python(10) Numpy操作
- 大话数据结构读书笔记(2)----线性表(1)
- [zigbee] zcl read attributes
- 微信公众号和服务器连接
- luogu p1111 并查集
- python 入门学习3 链表
- python笔记
- PHP实习前3天学习笔记
- xml的使用及详解
- Map源码分析
- 226. Invert Binary Tree