2

如何在 Python-Openzwave 上为设备设置轮询间隔。命令 network.set_polling_interval(time)似乎没有更改默认轮询间隔

代码

network = ZWaveNetwork(options, autostart=False)

dispatcher.connect(louie_network_started,ZWaveNetwork.SIGNAL_NETWORK_STARTED)
dispatcher.connect(louie_network_failed, ZWaveNetwork.SIGNAL_NETWORK_FAILED)
dispatcher.connect(louie_network_ready, ZWaveNetwork.SIGNAL_NETWORK_READY)


network.start()
network.set_poll_interval(1000)
print network.get_poll_interval()  

这里似乎设置为指定的值

#We wait for the network.
#print "***** Waiting for network to become ready : "
for i in range(0,90):
if network.state>=network.STATE_READY:
    #print "***** Network is ready"
    break
else:
    #sys.stdout.write(".")
    #sys.stdout.flush()
    time.sleep(1.0)


 print network.get_poll_interval()

这里它重置为默认值

4

1 回答 1

2

's的内联文档中python-openzwavenetwork.py,函数不是set_polling_interval,但实际上

def set_poll_interval(self, milliseconds=500, bIntervalBetweenPolls=True):

milliseconds在哪里

[the] 轮询间隔的长度,以毫秒为单位

并且bIntervalBetweenPolls是一个布尔值,它

[如果] 设置为 true(通过 SetPollInterval),pollInterval则将散布在每个轮询之间(因此更小的m_pollInterval如 100、500 或 1,000 可能是合适的)。如果为 false,则库尝试完成m_pollInterval.

于 2015-09-21T13:28:04.897 回答