public inbox for iwd@lists.linux.dev
 help / color / mirror / Atom feed
From: James Prestwood <prestwoj@gmail.com>
To: iwd@lists.linux.dev
Cc: James Prestwood <prestwoj@gmail.com>
Subject: [PATCH 14/16] auto-t: update utils to use DeviceProvisioningAgent
Date: Tue, 24 Sep 2024 05:04:45 -0700	[thread overview]
Message-ID: <20240924120447.251761-14-prestwoj@gmail.com> (raw)
In-Reply-To: <20240924120447.251761-1-prestwoj@gmail.com>

---
 autotests/util/iwd.py | 48 ++++++++++++++++++++++++++++++++-----------
 1 file changed, 36 insertions(+), 12 deletions(-)

diff --git a/autotests/util/iwd.py b/autotests/util/iwd.py
index 83f2d9ef..262afe52 100755
--- a/autotests/util/iwd.py
+++ b/autotests/util/iwd.py
@@ -43,7 +43,7 @@ IWD_P2P_WFD_INTERFACE =         'net.connman.iwd.p2p.Display'
 IWD_STATION_DEBUG_INTERFACE =   'net.connman.iwd.StationDebug'
 IWD_DPP_INTERFACE =             'net.connman.iwd.DeviceProvisioning'
 IWD_DPP_PKEX_INTERFACE =        'net.connman.iwd.SharedCodeDeviceProvisioning'
-IWD_SHARED_CODE_AGENT_INTERFACE = 'net.connman.iwd.SharedCodeAgent'
+IWD_DPP_AGENT_INTERFACE =       'net.connman.iwd.DeviceProvisioningAgent'
 
 IWD_AGENT_MANAGER_PATH =        '/net/connman/iwd'
 IWD_TOP_LEVEL_PATH =            '/'
@@ -214,31 +214,32 @@ class SignalAgent(dbus.service.Object):
     def handle_new_level(self, path, level):
         pass
 
-class SharedCodeAgent(dbus.service.Object):
+class DeviceProvisioningAgent(dbus.service.Object):
     def __init__(self, codes = {}):
         self._path = '/test/agent/' + str(int(round(time.time() * 1000)))
         self._codes = codes
+        self._bus = dbus.bus.BusConnection(address_or_type=ctx.dbus_address)
 
-        dbus.service.Object.__init__(self, ctx.get_bus(), self._path)
+        dbus.service.Object.__init__(self, self._bus, self._path)
 
     @property
     def path(self):
         return self._path
 
-    @dbus.service.method(IWD_SHARED_CODE_AGENT_INTERFACE,
+    @dbus.service.method(IWD_DPP_AGENT_INTERFACE,
                          in_signature='', out_signature='')
     def Release(self):
-        print("SharedCodeAgent released")
+        print("DeviceProvisioningAgent released")
 
-    @dbus.service.method(IWD_SHARED_CODE_AGENT_INTERFACE,
+    @dbus.service.method(IWD_DPP_AGENT_INTERFACE,
                          in_signature='s', out_signature='')
-    def Cancel(self, reason):
-        print("SharedCodeAgent canceled (%s)" % reason)
+    def CancelSharedCode(self, reason):
+        print("DeviceProvisioningAgent canceled (%s)" % reason)
 
-    @dbus.service.method(IWD_SHARED_CODE_AGENT_INTERFACE,
+    @dbus.service.method(IWD_DPP_AGENT_INTERFACE,
                          in_signature='s', out_signature='s')
     def RequestSharedCode(self, identifier):
-        print("SharedCodeAgent request for %s" % identifier)
+        print("DeviceProvisioningAgent request for %s" % identifier)
 
         code = self._codes.get(identifier, None)
         if not code:
@@ -352,8 +353,8 @@ class SharedCodeDeviceProvisioning(IWDDBusAbstract):
 
         self._iface.StartEnrollee(args)
 
-    def start_configurator(self, path):
-        self._iface.StartConfigurator(dbus.ObjectPath(path))
+    def start_configurator(self):
+        self._iface.StartConfigurator()
 
     def configure_enrollee(self, code, identifier=None):
         args = {
@@ -1572,6 +1573,29 @@ class IWD(AsyncOpAbstract):
         self._wait_for_async_op()
         self.psk_agents.remove(psk_agent)
 
+    def register_dpp_agent(self, dpp_agent):
+        iface = dbus.Interface(dpp_agent._bus.get_object(IWD_SERVICE,
+                                                IWD_AGENT_MANAGER_PATH),
+                                                IWD_AGENT_MANAGER_INTERFACE)
+        iface.RegisterDeviceProvisioningAgent(dpp_agent.path,
+                            dbus_interface=IWD_AGENT_MANAGER_INTERFACE,
+                            reply_handler=self._success,
+                            error_handler=self._failure)
+
+        self._wait_for_async_op()
+        self.dpp_agent = dpp_agent
+
+    def unregister_dpp_agent(self, dpp_agent):
+        iface = dbus.Interface(dpp_agent._bus.get_object(IWD_SERVICE,
+                                                IWD_AGENT_MANAGER_PATH),
+                                                IWD_AGENT_MANAGER_INTERFACE)
+        iface.UnregisterDeviceProvisioningAgent(dpp_agent.path,
+                                dbus_interface=IWD_AGENT_MANAGER_INTERFACE,
+                                reply_handler=self._success,
+                                error_handler=self._failure)
+        self._wait_for_async_op()
+        self.dpp_agent = None
+
     @staticmethod
     def get_instance():
         return IWD._default_instance()
-- 
2.34.1


  parent reply	other threads:[~2024-09-24 12:05 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-24 12:04 [PATCH 01/16] ie: add IE_AKM_IS_PSK James Prestwood
2024-09-24 12:04 ` [PATCH 02/16] dpp-util: refactor dpp_configuration_new into a _psk helper James Prestwood
2024-09-24 12:04 ` [PATCH 03/16] dpp: fix some return/cleanup issues for error cases James Prestwood
2024-09-24 12:04 ` [PATCH 04/16] dpp-util: refactor dpp_configuration_to_json for only PSK networks James Prestwood
2024-09-24 12:04 ` [PATCH 05/16] dpp: refactor dpp_send_config_response to take JSON as a parameter James Prestwood
2024-09-24 12:04 ` [PATCH 06/16] dpp: refactor dpp_configuration_start to take the " James Prestwood
2024-09-24 12:04 ` [PATCH 07/16] dpp: refactor config writing, add checks for PSK James Prestwood
2024-09-24 12:04 ` [PATCH 08/16] dpp-util: check the AKM is "psk" before further parsing the object James Prestwood
2024-09-24 12:04 ` [PATCH 09/16] dbus: add generic DPP agent interface James Prestwood
2024-09-24 12:04 ` [PATCH 10/16] dpp: replace PKEX agent with generic DPP agent James Prestwood
2024-09-24 12:04 ` [PATCH 11/16] agent: add APIs for DeviceProvisioningAgent James Prestwood
2024-09-24 12:04 ` [PATCH 12/16] dpp: replace SharedCodeAgent with DeviceProvisioningAgent James Prestwood
2024-09-24 12:04 ` [PATCH 13/16] dpp: remove agent path from StartConfigurator James Prestwood
2024-09-24 12:04 ` James Prestwood [this message]
2024-09-24 12:04 ` [PATCH 15/16] auto-t: update PKEX test to use DeviceProvisioningAgent James Prestwood
2024-09-24 12:04 ` [PATCH 16/16] doc: Document new DeviceProvisioningAgent James Prestwood

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240924120447.251761-14-prestwoj@gmail.com \
    --to=prestwoj@gmail.com \
    --cc=iwd@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox