Skip to content

Commit f5ce991

Browse files
committed
Added DEVICE_TYPE_TO_CLASS which maps device type int to class
1 parent 8481b9d commit f5ce991

File tree

2 files changed

+32
-0
lines changed

2 files changed

+32
-0
lines changed

sdbus_async/networkmanager/__init__.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,20 @@
128128
WiFiP2PPeer,
129129
)
130130

131+
132+
DEVICE_TYPE_TO_CLASS = {
133+
DeviceType.ETHERNET: NetworkDeviceWired,
134+
DeviceType.WIFI: NetworkDeviceWireless,
135+
DeviceType.BLUETOOTH: NetworkDeviceBluetooth,
136+
DeviceType.OLPC_MESH: NetworkDeviceOlpcMesh,
137+
DeviceType.VETH: NetworkDeviceVeth,
138+
DeviceType.WIREGUARD: NetworkDeviceWireGuard,
139+
DeviceType.PPP: NetworkDevicePPP,
140+
DeviceType.BRIDGE: NetworkDeviceBridge,
141+
DeviceType.MODEM: NetworkDeviceModem,
142+
}
143+
144+
131145
__all__ = (
132146
'AccessPointCapabilities', 'BluetoothCapabilities',
133147
'ConnectionFlags', 'ConnectionState', 'ConnectionStateFlags',
@@ -218,4 +232,6 @@
218232
'AccessPoint',
219233
'WiFiP2PPeer',
220234
'ConfigCheckpoint',
235+
236+
'DEVICE_TYPE_TO_CLASS',
221237
)

sdbus_block/networkmanager/__init__.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,20 @@
8686
NetworkManagerDnsManager, NetworkManagerSettings,
8787
WiFiP2PPeer)
8888

89+
90+
DEVICE_TYPE_TO_CLASS = {
91+
DeviceType.ETHERNET: NetworkDeviceWired,
92+
DeviceType.WIFI: NetworkDeviceWireless,
93+
DeviceType.BLUETOOTH: NetworkDeviceBluetooth,
94+
DeviceType.OLPC_MESH: NetworkDeviceOlpcMesh,
95+
DeviceType.VETH: NetworkDeviceVeth,
96+
DeviceType.WIREGUARD: NetworkDeviceWireGuard,
97+
DeviceType.PPP: NetworkDevicePPP,
98+
DeviceType.BRIDGE: NetworkDeviceBridge,
99+
DeviceType.MODEM: NetworkDeviceModem,
100+
}
101+
102+
89103
__all__ = (
90104
'AccessPointCapabilities', 'BluetoothCapabilities',
91105
'ConnectionFlags', 'ConnectionState', 'ConnectionStateFlags',
@@ -176,4 +190,6 @@
176190
'AccessPoint',
177191
'WiFiP2PPeer',
178192
'ConfigCheckpoint',
193+
194+
'DEVICE_TYPE_TO_CLASS',
179195
)

0 commit comments

Comments
 (0)