File: accesspoint.py

package info (click to toggle)
cnetworkmanager 0.21.1-1.1
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 220 kB
  • ctags: 442
  • sloc: python: 1,252; makefile: 29
file content (69 lines) | stat: -rw-r--r-- 1,713 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
# -*- coding: utf-8 -*-
import dbus
from dbusclient import DBusClient
from dbusclient.func import *
import util

class Mode(util.Enum):
    "Mode of a wireless device or access point."
    UNKNOWN = 0
    ADHOC = 1
    INFRA = 2

class AccessPoint(DBusClient):
    """
    
     Signals:
    PropertiesChanged ( a{sv}: properties )
    
     Properties:
    Flags - u - (read) (NM_802_11_AP_FLAGS)
    WpaFlags - u - (read) (NM_802_11_AP_SEC)
    RsnFlags - u - (read) (NM_802_11_AP_SEC)
    Ssid - ay - (read)
    Frequency - u - (read)
    HwAddress - s - (read)
    Mode - u - (read) (NM_802_11_MODE)
    MaxBitrate - u - (read)
    Strength - y - (read)
    
     Sets of flags:
    NM_802_11_AP_FLAGS
    NM_802_11_AP_SEC
    """

    class Flags(util.Flags):
        NONE = 0x0
        PRIVACY = 0x1

    class Sec(util.Flags):
        NONE = 0x0
        PAIR_WEP40 = 0x1
        PAIR_WEP104 = 0x2
        PAIR_TKIP = 0x4
        PAIR_CCMP = 0x8
        GROUP_WEP40 = 0x10
        GROUP_WEP104 = 0x20
        GROUP_TKIP = 0x40
        GROUP_CCMP = 0x80
        KEY_MGMT_PSK = 0x100
        KEY_MGMT_802_1X = 0x200

    SERVICE = "org.freedesktop.NetworkManager"
    IFACE = "org.freedesktop.NetworkManager.AccessPoint"

    def __init__(self, opath):
        super(AccessPoint, self).__init__(dbus.SystemBus(), self.SERVICE, opath, default_interface=self.IFACE)

AccessPoint._add_adaptors(
#    PropertiesChanged = SA(identity),
    Flags = PA(AccessPoint.Flags),
    WpaFlags = PA(AccessPoint.Sec),
    RsnFlags = PA(AccessPoint.Sec),
#    Ssid = PA(identity),
#    Frequency = PA(identity),
#    HwAddress = PA(identity),
    Mode = PA(Mode),
#    MaxBitrate = PA(identity),
    Strength = PA(int),
    )