mirror of
https://github.com/espressif/openthread.git
synced 2026-08-07 19:27:46 +00:00
Add timeout parameter to NodeAPI's ping function (#1440)
* Added timeout variable to API's ping function (WIN only).
This commit is contained in:
committed by
Jonathan Hui
parent
5cd94ef937
commit
83918bc76f
@@ -235,10 +235,11 @@ class otApi:
|
||||
def scan(self):
|
||||
return self.Api.otNodeScan(self.otNode).decode("utf-8").split("\n")
|
||||
|
||||
def ping(self, ipaddr, num_responses=1, size=None):
|
||||
def ping(self, ipaddr, num_responses=1, size=None, timeout=5000):
|
||||
if size == None:
|
||||
size = 100
|
||||
numberOfResponders = self.Api.otNodePing(self.otNode, ipaddr.encode('utf-8'), ctypes.c_ushort(size), ctypes.c_uint(num_responses))
|
||||
numberOfResponders = self.Api.otNodePing(self.otNode, ipaddr.encode('utf-8'), ctypes.c_ushort(size),
|
||||
ctypes.c_uint(num_responses), ctypes.c_uint16(timeout))
|
||||
return numberOfResponders >= num_responses
|
||||
|
||||
def set_router_selection_jitter(self, jitter):
|
||||
@@ -533,7 +534,8 @@ class otApi:
|
||||
self.Api.otNodePing.argtypes = [ctypes.c_void_p,
|
||||
ctypes.c_char_p,
|
||||
ctypes.c_ushort,
|
||||
ctypes.c_uint]
|
||||
ctypes.c_uint,
|
||||
ctypes.c_uint16]
|
||||
self.Api.otNodePing.restype = ctypes.c_uint
|
||||
|
||||
self.Api.otNodeSetRouterSelectionJitter.argtypes = [ctypes.c_void_p,
|
||||
|
||||
Reference in New Issue
Block a user