check registered commands
This commit is contained in:
parent
752f603066
commit
87e9617499
1 changed files with 12 additions and 2 deletions
|
@ -160,6 +160,11 @@ class Gateway:
|
|||
igd_args: OrderedDict = None, ssdp_socket: socket.socket = None,
|
||||
soap_socket: socket.socket = None, unicast: bool = False):
|
||||
ignored: set = set()
|
||||
required_commands = [
|
||||
'AddPortMapping',
|
||||
'DeletePortMapping',
|
||||
'GetExternalIPAddress'
|
||||
]
|
||||
while True:
|
||||
if not igd_args:
|
||||
m_search_args, datagram = await asyncio.wait_for(fuzzy_m_search(lan_address, gateway_address, timeout, ssdp_socket,
|
||||
|
@ -172,6 +177,11 @@ class Gateway:
|
|||
gateway = cls(datagram, m_search_args, lan_address, gateway_address)
|
||||
log.debug('get gateway descriptor %s', datagram.location)
|
||||
await gateway.discover_commands(soap_socket)
|
||||
requirements_met = all([required in gateway._registered_commands for required in required_commands])
|
||||
if not requirements_met:
|
||||
log.debug("found gateway, but it does not implement required soap commands")
|
||||
continue
|
||||
else:
|
||||
log.debug('found gateway device %s', datagram.location)
|
||||
return gateway
|
||||
except (asyncio.TimeoutError, UPnPError) as err:
|
||||
|
|
Loading…
Reference in a new issue