Skip to content

Commit cef2a52

Browse files
📝 Add docstrings to drop_gui (#40)
Docstrings generation was requested by @JarbasAl. * #39 (comment) The following files were modified: * `ovos_PHAL_plugin_network_manager/__init__.py` Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
1 parent 6fb1937 commit cef2a52

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

ovos_PHAL_plugin_network_manager/__init__.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,15 @@ class NetworkManagerPlugin(PHALPlugin):
7777
validator = NetworkManagerValidator
7878

7979
def __init__(self, bus=None, config=None):
80+
"""
81+
Initialize the NetworkManagerPlugin and register PHAL network event handlers on the message bus.
82+
83+
Registers handlers for network manager events such as scanning, connecting (including open networks), reconnecting, disconnecting, forgetting networks, and querying the currently connected network.
84+
85+
Parameters:
86+
bus: Message bus instance used to subscribe to PHAL events.
87+
config: Optional configuration dictionary or object for plugin initialization.
88+
"""
8089
super().__init__(bus=bus, name="ovos-PHAL-plugin-network-manager", config=config)
8190
# Register Network Manager Events
8291
self.bus.on("ovos.phal.nm.scan", self.handle_network_scan_request)
@@ -90,6 +99,16 @@ def __init__(self, bus=None, config=None):
9099
# Network Manager Events
91100
def handle_network_scan_request(self, message):
92101
# Scan for networks using Network Manager and build a list of networks found and their security types
102+
"""
103+
Scan for available Wi-Fi networks using Network Manager and emit a completion message with results.
104+
105+
Performs an nmcli rescan and lists SSID and SECURITY fields, then emits an "ovos.phal.nm.scan.complete" Message on the bus with a payload containing a "networks" list. Each list item is a dict with keys:
106+
- "ssid": network SSID string
107+
- "security": security string reported by nmcli
108+
109+
Parameters:
110+
message (Message): Incoming request message (contents are not inspected).
111+
"""
93112
LOG.info("Scanning for networks using nmcli backend")
94113
subprocess.Popen(
95114
['nmcli', 'dev', 'wifi', 'rescan']

0 commit comments

Comments
 (0)