1 # -*- coding: utf-8 -*-
4 from dbusclient
import DBusClient
, object_path
5 from device
import Device
6 from activeconnection
import ActiveConnection
10 # need better/shorter names? or hide them?
11 SYSTEM_SERVICE
= "org.freedesktop.NetworkManagerSystemSettings"
12 USER_SERVICE
= "org.freedesktop.NetworkManagerUserSettings"
14 # gratuitous convertor to test writable properties
15 def english_to_bool(v
):
22 class NetworkManager(DBusClient
):
29 ActivateConnection ( s: service_name, o: connection, o: device, o: specific_object ) → o
30 DeactivateConnection ( o: active_connection ) → nothing
31 Sleep ( b: sleep ) → nothing
34 StateChanged ( u: state )
35 PropertiesChanged ( a{sv}: properties )
36 DeviceAdded ( o: device_path )
37 DeviceRemoved ( o: device_path )
40 WirelessEnabled - b - (readwrite)
41 WirelessHardwareEnabled - b - (read)
42 ActiveConnections - ao - (read)
43 State - u - (read) (NM_STATE)
49 SERVICE
= "org.freedesktop.NetworkManager"
50 OPATH
= "/org/freedesktop/NetworkManager"
51 IFACE
= "org.freedesktop.NetworkManager"
54 super(NetworkManager
, self
).__init
__(dbus
.SystemBus(), self
.SERVICE
, self
.OPATH
, default_interface
=self
.IFACE
)
64 "TODO find a good term for 'adaptor'"
65 NetworkManager
._add
_adaptors
(
67 "GetDevices": seq_adaptor(Device
._create
),
68 "ActivateConnection": [ActiveConnection
, [identity
, object_path
, object_path
, object_path
]],
69 "DeactivateConnection": [void
, [object_path
]],
72 "State": NetworkManager
.State
,
73 "WirelessEnabled": [bool, english_to_bool
],
74 "WirelessHardwareEnabled": bool,
75 "ActiveConnections": seq_adaptor(ActiveConnection
),
78 "StateChanged": [void
, [NetworkManager
.State
]],