mirror of
https://github.com/espressif/openthread.git
synced 2026-09-02 23:30:07 +00:00
[thci] update pollperiod command to accept ms resolution configuration (#3361)
This commit is contained in:
@@ -1301,7 +1301,13 @@ class OpenThread(IThci):
|
||||
def getPollingRate(self):
|
||||
"""get data polling rate for sleepy end device"""
|
||||
print '%s call getPollingRate' % self.port
|
||||
return self.__sendCommand('pollperiod')[0]
|
||||
sPollingRate = self.__sendCommand('pollperiod')[0]
|
||||
try:
|
||||
iPollingRate = int(sPollingRate)/1000
|
||||
fPollingRate = round(float(sPollingRate)/1000, 3)
|
||||
return fPollingRate if fPollingRate > iPollingRate else iPollingRate
|
||||
except Exception, e:
|
||||
ModuleHelper.WriteIntoDebugLogger("getPollingRate() Error: " + str(e))
|
||||
|
||||
def setPollingRate(self, iPollingRate):
|
||||
"""set data polling rate for sleepy end device
|
||||
@@ -1314,9 +1320,11 @@ class OpenThread(IThci):
|
||||
False: fail to set the data polling rate for sleepy end device
|
||||
"""
|
||||
print '%s call setPollingRate' % self.port
|
||||
print iPollingRate
|
||||
# convert s to ms
|
||||
iPollingRate *= 1000
|
||||
print int(iPollingRate)
|
||||
try:
|
||||
cmd = 'pollperiod %s' % str(iPollingRate)
|
||||
cmd = 'pollperiod %d' % int(iPollingRate)
|
||||
print cmd
|
||||
return self.__sendCommand(cmd)[0] == 'Done'
|
||||
except Exception, e:
|
||||
@@ -1535,9 +1543,10 @@ class OpenThread(IThci):
|
||||
False: fail to set the data poll period for SED
|
||||
"""
|
||||
print '%s call setKeepAliveTimeOut' % self.port
|
||||
print iTimeOut
|
||||
iTimeOut *= 1000
|
||||
print int(iTimeOut)
|
||||
try:
|
||||
cmd = 'pollperiod %s' % str(iTimeOut)
|
||||
cmd = 'pollperiod %d' % int(iTimeOut)
|
||||
print cmd
|
||||
return self.__sendCommand(cmd)[0] == 'Done'
|
||||
except Exception, e:
|
||||
|
||||
Reference in New Issue
Block a user