doc: Migrating from cnetworkmanager to nmcli
[cnetworkmanager.git] / networkmanager / accesspoint.py
blob172a57a33ca89bf0c24bea4c9776d46f417f948c
1 # -*- coding: utf-8 -*-
2 import dbus
3 from dbusclient import DBusClient
4 from dbusclient.func import *
5 from base import Base
6 import util
8 class Mode(util.Enum):
9 "Mode of a wireless device or access point."
10 UNKNOWN = 0
11 ADHOC = 1
12 INFRA = 2
14 class AccessPoint(Base):
15 """
17 Signals:
18 PropertiesChanged ( a{sv}: properties )
20 Properties:
21 Flags - u - (read) (NM_802_11_AP_FLAGS)
22 WpaFlags - u - (read) (NM_802_11_AP_SEC)
23 RsnFlags - u - (read) (NM_802_11_AP_SEC)
24 Ssid - ay - (read)
25 Frequency - u - (read)
26 HwAddress - s - (read)
27 Mode - u - (read) (NM_802_11_MODE)
28 MaxBitrate - u - (read)
29 Strength - y - (read)
31 Sets of flags:
32 NM_802_11_AP_FLAGS
33 NM_802_11_AP_SEC
34 """
36 class Flags(util.Flags):
37 NONE = 0x0
38 PRIVACY = 0x1
40 class Sec(util.Flags):
41 NONE = 0x0
42 PAIR_WEP40 = 0x1
43 PAIR_WEP104 = 0x2
44 PAIR_TKIP = 0x4
45 PAIR_CCMP = 0x8
46 GROUP_WEP40 = 0x10
47 GROUP_WEP104 = 0x20
48 GROUP_TKIP = 0x40
49 GROUP_CCMP = 0x80
50 KEY_MGMT_PSK = 0x100
51 KEY_MGMT_802_1X = 0x200
53 SERVICE = "org.freedesktop.NetworkManager"
54 IFACE = "org.freedesktop.NetworkManager.AccessPoint"
56 def __init__(self, opath):
57 super(AccessPoint, self).__init__(self.SERVICE, opath, default_interface=self.IFACE)
59 AccessPoint._add_adaptors(
60 # PropertiesChanged = SA(identity),
61 Flags = PA(AccessPoint.Flags),
62 WpaFlags = PA(AccessPoint.Sec),
63 RsnFlags = PA(AccessPoint.Sec),
64 # Ssid = PA(identity),
65 # Frequency = PA(identity),
66 # HwAddress = PA(identity),
67 Mode = PA(Mode),
68 # MaxBitrate = PA(identity),
69 Strength = PA(int),