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.
上图的On/Off Cluster Operation State Machine状态机的几个问题:
1.这个On/Off Cluster Operation State Machine的状态机什么时候启动??
2.协调器那边传过来ontime和offwaittime之后,从"Off" ----> "Timed On", 然后当OnTime减少到0之后,就恢复到"Off"状态??
3.时间的减少自动0.1秒减少1??比如:100就是10秒
协调器发送的OnTime, offWaitTime,是被保存在这里吗?
{ ZCL_CLUSTER_ID_GENERAL_ON_OFF, { // Attribute record ATTRID_ON_OFF_OFF_WAIT_TIME, ZCL_DATATYPE_UINT40, ACCESS_CONTROL_READ | ACCESS_CLIENT, (void *)&zclPixie_onoff_time } }
ACCESS_CONTROL_READ | ACCESS_CLIENT 这个是不是要加上ACCESS_CONTROL_WRITE类型?
zclPixie_onoff_time这个不能设置成const?
协调器发送onTime,offWaitTime的值,终端接收到这个值之后,是不会自动保存好的吧
协调器发送函数:
ZStatus_t zclGeneral_SendOnOff_CmdOnWithTimedOff ( uint8_t srcEP, afAddrType_t *dstAddr, zclOnOffCtrl_t onOffCtrl, uint16_t onTime, uint16_t offWaitTime, uint8_t disableDefaultRsp, uint8_t seqNum ) { uint8_t buf[5]; buf[0] = onOffCtrl.byte; buf[1] = LO_UINT16( onTime ); buf[2] = HI_UINT16( onTime ); buf[3] = LO_UINT16( offWaitTime ); buf[4] = HI_UINT16( offWaitTime ); return zcl_SendCommand( srcEP, dstAddr, ZCL_CLUSTER_ID_GENERAL_ON_OFF, COMMAND_ON_OFF_ON_WITH_TIMED_OFF, TRUE, ZCL_FRAME_CLIENT_SERVER_DIR, disableDefaultRsp, 0, seqNum, 5, buf ); }
终端接收函数:
case COMMAND_ON_OFF_ON_WITH_TIMED_OFF:
if ( pCBs->pfnOnOff_OnWithTimedOff )
{
zclOnWithTimedOff_t cmd;
cmd.onOffCtrl.byte = pInMsg->pData[0];
cmd.onTime = BUILD_UINT16( pInMsg->pData[1], pInMsg->pData[2] );
cmd.offWaitTime = BUILD_UINT16( pInMsg->pData[3], pInMsg->pData[4] );
pCBs->pfnOnOff_OnWithTimedOff( &cmd );
}
break;
/*********************************/ /*** On/Off Cluster Attributes ***/ /*********************************/ /// Represents the On/Off device state #define ATTRID_ON_OFF_ON_OFF 0x0000 /// In order to support the use case where the user gets back the last setting /// of the devices #define ATTRID_ON_OFF_GLOBAL_SCENE_CONTROL 0x4000 /// The OnTime attribute specifies the length of time (in 1/10ths second) that /// the "on" state SHALL be maintained before automatically transitioning to the /// "off" state when using the On with timed off command. #define ATTRID_ON_OFF_ON_TIME 0x4001 /// The OffWaitTime attribute specifies the length of time (in 1/10ths second) /// that the "off" state SHALL be guarded to prevent an on command turning the /// device back to its "on" state (e.g., when leaving a room, the lights are /// turned off but an occupancy sensor detects the leaving person and attempts /// to turn the lights back on). #define ATTRID_ON_OFF_OFF_WAIT_TIME 0x4002 // Start Up On/Off Attribute #define ATTRID_ON_OFF_START_UP_ON_OFF 0x4003
TI的ON/OFF cluster 比zigbee联盟定义的要多一个0x4003.
这个怎么使用?