1 # -*- coding: utf-8 -*-
4 from dbusclient
import DBusClient
, object_path
5 from dbusclient
.func
import *
6 from device
import Device
7 from activeconnection
import ActiveConnection
10 # gratuitous convertor to test writable properties
11 def english_to_bool(v
):
18 class NetworkManager(DBusClient
):
25 ActivateConnection ( s: service_name, o: connection, o: device, o: specific_object ) → o
26 DeactivateConnection ( o: active_connection ) → nothing
27 Sleep ( b: sleep ) → nothing
30 StateChanged ( u: state )
31 PropertiesChanged ( a{sv}: properties )
32 DeviceAdded ( o: device_path )
33 DeviceRemoved ( o: device_path )
36 WirelessEnabled - b - (readwrite)
37 WirelessHardwareEnabled - b - (read)
38 ActiveConnections - ao - (read)
39 State - u - (read) (NM_STATE)
45 SERVICE
= "org.freedesktop.NetworkManager"
46 OPATH
= "/org/freedesktop/NetworkManager"
47 IFACE
= "org.freedesktop.NetworkManager"
50 super(NetworkManager
, self
).__init
__(dbus
.SystemBus(), self
.SERVICE
, self
.OPATH
, default_interface
=self
.IFACE
)
60 "TODO find a good term for 'adaptor'"
62 #from dbusclient.adaptors import *
64 NetworkManager
._add
_adaptors
(
65 GetDevices
= MA(seq_adaptor(Device
._create
)),
66 ActivateConnection
= MA(ActiveConnection
, identity
, object_path
, object_path
, object_path
),
67 DeactivateConnection
= MA(void
, object_path
),
69 State
= PA(NetworkManager
.State
),
70 WirelessEnabled
= PA(bool, english_to_bool
),
71 WirelessHardwareEnabled
= PA(bool),
72 ActiveConnections
= PA(seq_adaptor(ActiveConnection
)),
74 StateChanged
= SA(NetworkManager
.State
),