From 809c09afe02335429ec4cca549cdfa325633128e Mon Sep 17 00:00:00 2001 From: Pranav Jerry Date: Sun, 18 Jul 2021 14:24:27 +0530 Subject: [PATCH] Added class Adapter in iwd.py Initial implementation. No useful public methods yet --- naxalnet/iwd.py | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) 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)