Skip to content
This repository has been archived by the owner on Jan 27, 2023. It is now read-only.

Commit

Permalink
Update constants, classes and version numbers to match 1.2.0
Browse files Browse the repository at this point in the history
Also alphabetize the list of device types.
  • Loading branch information
seveas committed Aug 8, 2016
1 parent 6da0797 commit 5d3b3b5
Show file tree
Hide file tree
Showing 4 changed files with 86 additions and 44 deletions.
86 changes: 58 additions & 28 deletions NetworkManager.py
Original file line number Diff line number Diff line change
Expand Up @@ -264,18 +264,24 @@ class Device(NMDbusInterface):

def SpecificDevice(self):
return {
NM_DEVICE_TYPE_ADSL: Adsl,
NM_DEVICE_TYPE_BOND: Bond,
NM_DEVICE_TYPE_BRIDGE: Bridge,
NM_DEVICE_TYPE_BT: Bluetooth,
NM_DEVICE_TYPE_ETHERNET: Wired,
NM_DEVICE_TYPE_WIFI: Wireless,
NM_DEVICE_TYPE_GENERIC: Generic,
NM_DEVICE_TYPE_INFINIBAND: Infiniband,
NM_DEVICE_TYPE_IP_TUNNEL: IPTunnel,
NM_DEVICE_TYPE_MACVLAN: Macvlan,
NM_DEVICE_TYPE_MODEM: Modem,
NM_DEVICE_TYPE_BT: Bluetooth,
NM_DEVICE_TYPE_OLPC_MESH: OlpcMesh,
NM_DEVICE_TYPE_WIMAX: Wimax,
NM_DEVICE_TYPE_INFINIBAND: Infiniband,
NM_DEVICE_TYPE_BOND: Bond,
NM_DEVICE_TYPE_TEAM: Team,
NM_DEVICE_TYPE_TUN: Tun,
NM_DEVICE_TYPE_VETH: Veth,
NM_DEVICE_TYPE_VLAN: Vlan,
NM_DEVICE_TYPE_ADSL: Adsl,
NM_DEVICE_TYPE_BRIDGE: Bridge,
NM_DEVICE_TYPE_GENERIC: Generic
NM_DEVICE_TYPE_VXLAN: Vxlan,
NM_DEVICE_TYPE_WIFI: Wireless,
NM_DEVICE_TYPE_WIMAX: Wimax,
}[self.DeviceType](self.object_path)

def postprocess(self, name, val):
Expand All @@ -295,42 +301,60 @@ def postprocess(self, name, val):
return fixups.strength_to_python(val)
return val

class Wired(NMDbusInterface):
interface_name = 'org.freedesktop.NetworkManager.Device.Wired'

class Wireless(NMDbusInterface):
interface_name = 'org.freedesktop.NetworkManager.Device.Wireless'

class Modem(NMDbusInterface):
interface_name = 'org.freedesktop.NetworkManager.Device.Modem'
class Adsl(NMDbusInterface):
interface_name = 'org.freedesktop.NetworkManager.Device.adsl'

class Bluetooth(NMDbusInterface):
interface_name = 'org.freedesktop.NetworkManager.Device.Bluetooth'

class OlpcMesh(NMDbusInterface):
interface_name = 'org.freedesktop.NetworkManager.Device.OlpcMesh'
class Bond(NMDbusInterface):
interface_name = 'org.freedesktop.NetworkManager.Device.Bond'

class Wimax(NMDbusInterface):
interface_name = 'org.freedesktop.NetworkManager.Device.Wimax'
class Bridge(NMDbusInterface):
interface_name = 'org.freedesktop.NetworkManager.Device.Bridge'

class Generic(NMDbusInterface):
interface_name = 'org.freedesktop.NetworkManager.Device.Generic'

class Infiniband(NMDbusInterface):
interface_name = 'org.freedesktop.NetworkManager.Device.Infiniband'

class Bond(NMDbusInterface):
interface_name = 'org.freedesktop.NetworkManager.Device.Bond'
class IPTunnel(NMDbusInterface):
interface_name = 'org.freedesktop.NetworkManager.Device.Infiniband'

class Bridge(NMDbusInterface):
interface_name = 'org.freedesktop.NetworkManager.Device.Bridge'
class Macvlan(NMDbusInterface):
interface_name = 'org.freedesktop.NetworkManager.Device.Generic'

class Modem(NMDbusInterface):
interface_name = 'org.freedesktop.NetworkManager.Device.Modem'

class OlpcMesh(NMDbusInterface):
interface_name = 'org.freedesktop.NetworkManager.Device.OlpcMesh'

class Team(NMDbusInterface):
interface_name = 'org.freedesktop.NetworkManager.Device.Generic'

class Tun(NMDbusInterface):
interface_name = 'org.freedesktop.NetworkManager.Device.Generic'

class Veth(NMDbusInterface):
interface_name = 'org.freedesktop.NetworkManager.Device.Generic'

class Vlan(NMDbusInterface):
interface_name = 'org.freedesktop.NetworkManager.Device.Vlan'

class Adsl(NMDbusInterface):
interface_name = 'org.freedesktop.NetworkManager.Device.adsl'

class Generic(NMDbusInterface):
class Vxlan(NMDbusInterface):
interface_name = 'org.freedesktop.NetworkManager.Device.Generic'

class Wimax(NMDbusInterface):
interface_name = 'org.freedesktop.NetworkManager.Device.Wimax'

class Wired(NMDbusInterface):
interface_name = 'org.freedesktop.NetworkManager.Device.Wired'

class Wireless(NMDbusInterface):
interface_name = 'org.freedesktop.NetworkManager.Device.Wireless'

class NSP(NMDbusInterface):
interface_name = 'org.freedesktop.NetworkManager.Wimax.NSP'

Expand Down Expand Up @@ -513,6 +537,11 @@ def route_to_dbus(route,family):
NM_DEVICE_TYPE_BRIDGE = 13
NM_DEVICE_TYPE_GENERIC = 14
NM_DEVICE_TYPE_TEAM = 15
NM_DEVICE_TYPE_TUN = 16
NM_DEVICE_TYPE_IP_TUNNEL = 17
NM_DEVICE_TYPE_MACVLAN = 18
NM_DEVICE_TYPE_VXLAN = 19
NM_DEVICE_TYPE_VETH = 20
NM_DEVICE_CAP_NONE = 0
NM_DEVICE_CAP_NM_SUPPORTED = 1
NM_DEVICE_CAP_CARRIER_DETECT = 2
Expand All @@ -529,6 +558,7 @@ def route_to_dbus(route,family):
NM_WIFI_DEVICE_CAP_FREQ_VALID = 256
NM_WIFI_DEVICE_CAP_FREQ_2GHZ = 512
NM_WIFI_DEVICE_CAP_FREQ_5GHZ = 1024
NM_WIFI_DEVICE_CAP_IBSS_RSN = 2048
NM_802_11_AP_FLAGS_NONE = 0
NM_802_11_AP_FLAGS_PRIVACY = 1
NM_802_11_AP_SEC_NONE = 0
Expand Down
4 changes: 2 additions & 2 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,9 @@
# built documents.
#
# The short X.Y version.
version = '1.1'
version = '1.2'
# The full version, including alpha/beta/rc tags.
release = '1.1'
release = '1.2'

# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
Expand Down
38 changes: 25 additions & 13 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ simple as you think it is:
>>> import NetworkManager
>>> NetworkManager.NetworkManager.Version
'1.0.4'
'1.2.0'
NetworkManager exposes a lot of information via D-Bus and also allows full
control of network settings. The full D-Bus API can be found on `NetworkManager
Expand Down Expand Up @@ -71,7 +71,7 @@ translate them to text. For example:
>>> NetworkManager.const('device_type', 2)
'wifi'
.. _`NetworkManager project website`: https://developer.gnome.org/NetworkManager/0.9/spec.html
.. _`NetworkManager project website`: https://developer.gnome.org/NetworkManager/1.2/spec.html

List of classes
---------------
Expand Down Expand Up @@ -110,29 +110,41 @@ interface.

.. class:: Device

.. class:: Wired

.. class:: Wireless

.. class:: Modem
.. class:: Adsl

.. class:: Bluetooth

.. class:: OlpcMesh
.. class:: Bond

.. class:: Wimax
.. class:: Bridge

.. class:: Generic

.. class:: Infiniband

.. class:: Bond
.. class:: IPTunnel

.. class:: Bridge
.. class:: Macvlan

.. class:: Modem

.. class:: OlpcMesh

.. class:: Team

.. class:: Tun

.. class:: Veth

.. class:: Vlan

.. class:: Adsl
.. class:: Vxlan

.. class:: Generic
.. class:: Wimax

.. class:: Wired

.. class:: Wireless

These classes represent D-Bus interfaces for various types of hardware. Note
that methods such as :data:`NetworkManager.GetDevices()` will only return
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from distutils.core import setup

setup(name = "python-networkmanager",
version = "1.1",
version = "1.2",
author = "Dennis Kaarsemaker",
author_email = "[email protected]",
url = "http://github.com/seveas/python-networkmanager",
Expand Down

0 comments on commit 5d3b3b5

Please sign in to comment.