iwd.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
From: James Prestwood <prestwoj@gmail.com>
To: iwd@lists.linux.dev
Cc: James Prestwood <prestwoj@gmail.com>
Subject: [PATCH 3/4] auto-t: iwd.py: allow certain APIs to be used in AP mode
Date: Thu,  3 Nov 2022 10:30:56 -0700	[thread overview]
Message-ID: <20221103173057.381232-3-prestwoj@gmail.com> (raw)
In-Reply-To: <20221103173057.381232-1-prestwoj@gmail.com>

AP mode implements a few DBus methods/properties which are named
the same as station: Scan, Scanning, and GetOrderedNetworks. Allow
the Device object to work with these in AP mode by calling the
correct method if the Mode is 'ap'.
---
 autotests/util/iwd.py | 24 ++++++++++++++++--------
 1 file changed, 16 insertions(+), 8 deletions(-)

diff --git a/autotests/util/iwd.py b/autotests/util/iwd.py
index 98b9ea1c..5fa12444 100755
--- a/autotests/util/iwd.py
+++ b/autotests/util/iwd.py
@@ -521,13 +521,16 @@ class Device(IWDDBusAbstract):
     def scanning(self):
         '''
         Reflects whether the device is currently scanning
-        for networks.  net.connman.iwd.Network objects are
-        updated when this property goes from true to false.
+        for networks.  For station devices net.connman.iwd.Network
+        objects are updated when this property goes from true to false
 
         @rtype: boolean
         '''
-        props = self._station_properties()
-        return bool(props['Scanning'])
+        if self._properties['Mode'] == 'station':
+            props = self._station_properties()
+            return bool(props['Scanning'])
+        else:
+            return bool(self._ap.scanning)
 
     @property
     def autoconnect(self):
@@ -544,12 +547,14 @@ class Device(IWDDBusAbstract):
            Possible exception: BusyEx
                                FailedEx
         '''
-        self._iface.Scan(dbus_interface=IWD_STATION_INTERFACE,
+        if self._properties['Mode'] == 'station':
+            self._iface.Scan(dbus_interface=IWD_STATION_INTERFACE,
                                reply_handler=self._success,
                                error_handler=self._failure)
-
-        if wait:
-            self._wait_for_async_op()
+            if wait:
+                self._wait_for_async_op()
+        else:
+            self._ap.scan()
 
     def disconnect(self):
         '''Disconnect from the network
@@ -576,6 +581,9 @@ class Device(IWDDBusAbstract):
            groups the maximum relative signal-strength is the
            main sorting factor.
         '''
+        if self._properties['Mode'] == 'ap':
+            return self._ap.get_ordered_networks()
+
         ordered_networks = []
         if not full_scan:
             for bus_obj in self._station.GetOrderedNetworks():
-- 
2.34.3


  parent reply	other threads:[~2022-11-03 17:31 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-03 17:30 [PATCH 1/4] doc: document AP properties PairwiseCiphers/GroupCipher James Prestwood
2022-11-03 17:30 ` [PATCH 2/4] ap: update Scanning property when AP starts James Prestwood
2022-11-03 17:30 ` James Prestwood [this message]
2022-11-03 17:30 ` [PATCH 4/4] auto-t: add test for scanning in AP mode James Prestwood
2022-11-03 18:17 ` [PATCH 1/4] doc: document AP properties PairwiseCiphers/GroupCipher Marcel Holtmann
2022-11-03 19:01   ` James Prestwood
2022-11-03 19:28     ` Denis Kenzior
  -- strict thread matches above, loose matches on Subject: below --
2022-11-03 17:00 James Prestwood
2022-11-03 17:00 ` [PATCH 3/4] auto-t: iwd.py: allow certain APIs to be used in AP mode 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=20221103173057.381232-3-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;
as well as URLs for NNTP newsgroup(s).