diff --git a/naxalnet/iwd.py b/naxalnet/iwd.py index 1f4f335..3feb57e 100644 --- a/naxalnet/iwd.py +++ b/naxalnet/iwd.py @@ -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)