Added class Adapter in iwd.py

Initial implementation. No useful public methods yet
This commit is contained in:
Pranav Jerry 2021-07-18 14:24:27 +05:30
parent 3c22fa63f4
commit 809c09afe0
No known key found for this signature in database
GPG Key ID: F1DCDC4FED0A0C5B

View File

@ -197,4 +197,17 @@ class Device:
self._proxy.StartOpen(name)
# TODO: make a class Adapter with power_on() and power_off()
# TODO: add power_on() and power_off()
class Adapter:
"""represents an adapter as a python object"""
def __init__(self, name: str, bus=SystemMessageBus()):
self._iwd = IWD(bus)
self._bus = self._iwd._bus
self._path = self._iwd.get_adapter_path_from_name(name)
# Initialise self._proxy
self.reload()
def reload(self):
"""reload the proxy after changing mode"""
self._proxy = self._bus.get_proxy(IWD_BUS, self._path)