zigbee - Zstack read attribute -
i want know how can read attribute on local , remote zigbee device using ti zstack , how put value uart. i'm zstack beginner. managed use uart usb uart converter , can send data pc. need know how attribute data. i've read api manual didn't anderstand how use zcl_sendread function. thanks.
follow section "3.3 send read" of "z-stack zcl api.pdf" should contain enough info getting read attr correct destination device. contents of readcmd array of attribute id's, specific attribute(s) want read. need consult zcl specification or device documentation determine correct attr id , cluster id.
an example sending read attr shown below. reads attrid_ms_temperature_measured_value attribute (from zcl_cluster_id_ms_temperature_measurement cluster) device short address 0x1234 , endpoint 0x1.
afaddrtype_t dstaddr; dstaddr.addrmode = afaddr16bit; dstaddr.addr.shortaddr = 0x1234; //set correct address dstaddr.addr.endpoint = 0x1; // set correct ep zclreadcmd_t *cmd = osal_mem_alloc((sizeof zclreadcmd_t) + sizeof(uint16)); cmd->numattr = 1; cmd->attrid[0] = attrid_ms_temperature_measured_value; zcl_sendread( samplethermostat_endpoint, &dstaddr, zcl_cluster_id_ms_temperature_measurement, &cmd, zcl_frame_client_server_dir, hdr->fc.disabledefaultrsp, hdr->transseqnum );
once command sent need process received response, notice functions contained in zstack sample applications not populated, instance sampleswitch application has zclsamplesw_processinreadrspcmd() function, called process read attr response , need populate want response.
regards, tc.
Comments
Post a Comment