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
11 # gratuitous convertor to test writable properties
12 def english_to_bool(v
):
19 class NetworkManager(Base
):
26 ActivateConnection ( s: service_name, o: connection, o: device, o: specific_object ) → o
27 DeactivateConnection ( o: active_connection ) → nothing
28 Sleep ( b: sleep ) → nothing
31 StateChanged ( u: state )
32 PropertiesChanged ( a{sv}: properties )
33 DeviceAdded ( o: device_path )
34 DeviceRemoved ( o: device_path )
37 WirelessEnabled - b - (readwrite)
38 WirelessHardwareEnabled - b - (read)
39 ActiveConnections - ao - (read)
40 State - u - (read) (NM_STATE)
46 SERVICE
= "org.freedesktop.NetworkManager"
47 OPATH
= "/org/freedesktop/NetworkManager"
48 IFACE
= "org.freedesktop.NetworkManager"
51 super(NetworkManager
, self
).__init
__(self
.SERVICE
, self
.OPATH
, default_interface
=self
.IFACE
)
61 "TODO find a good term for 'adaptor'"
63 #from dbusclient.adaptors import *
65 NetworkManager
._add
_adaptors
(
66 GetDevices
= MA(seq_adaptor(Device
._create
)),
67 ActivateConnection
= MA(ActiveConnection
, identity
, object_path
, object_path
, object_path
),
68 DeactivateConnection
= MA(void
, object_path
),
70 State
= PA(NetworkManager
.State
),
71 WirelessEnabled
= PA(bool, english_to_bool
),
72 WirelessHardwareEnabled
= PA(bool),
73 ActiveConnections
= PA(seq_adaptor(ActiveConnection
)),
75 StateChanged
= SA(NetworkManager
.State
),