sleep机制
Posted zhuguangming
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了sleep机制相关的知识,希望对你有一定的参考价值。
1:如下条件都要满足才可以进入SLEEP
1.1:
emAfForceEndDeviceToStayAwake=TURE; 不能SLEEP
1.2:
如果emAfStayAwakeWhenNotJoined=1,则只有设备加入网络了才能睡觉
1.3:串口BUF中要没有数据才能睡觉
1.4这里面的任务的(emberAfGetCurrentSleepControlCallback() != EMBER_AF_STAY_AWAKE);
#define EMBER_AF_GENERATED_EVENT_CONTEXT { 0x1, 0x3, false, EMBER_AF_LONG_POLL, EMBER_AF_OK_TO_SLEEP, &emberAfIdentifyClusterServerTickCallbackControl1},
{ 0x1, 0x19, true, EMBER_AF_LONG_POLL, EMBER_AF_OK_TO_SLEEP, &emberAfOtaBootloadClusterClientTickCallbackControl1},
{ 0x2, 0x3, false, EMBER_AF_LONG_POLL, EMBER_AF_OK_TO_SLEEP, &emberAfIdentifyClusterServerTickCallbackControl2},
{ 0x3, 0x3, false, EMBER_AF_LONG_POLL, EMBER_AF_OK_TO_SLEEP, &emberAfIdentifyClusterServerTickCallbackControl3},
{ 0x4, 0x3, false, EMBER_AF_LONG_POLL, EMBER_AF_OK_TO_SLEEP, &emberAfIdentifyClusterServerTickCallbackControl4},
{ 0x4, 0x19, true, EMBER_AF_LONG_POLL, EMBER_AF_OK_TO_SLEEP, &emberAfOtaBootloadClusterClientTickCallbackControl4}
开发人员可以使用下面这个函数来控制要不要进入睡眠
void emberAfForceEndDeviceToStayAwake(bool stayAwake)
以上是关于sleep机制的主要内容,如果未能解决你的问题,请参考以下文章
JS实现停留几秒sleep,Js中for循环的阻塞机制,setTimeout延迟执行
Java多线程系列---“基础篇”14之 wait,sleep,join,yield,park,unpark,notify等通信机制对比