[thci] update pollperiod command to accept ms resolution configuration (#3361)

This commit is contained in:
Jing
2018-12-27 15:39:46 -08:00
committed by Jonathan Hui
parent 7dc645a856
commit eca3e81fd3
3 changed files with 19 additions and 9 deletions
+14 -5
View File
@@ -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: