Skip to content

Commit 079ebfe

Browse files
committed
Decode signal strengths to integers
1 parent e3a979c commit 079ebfe

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

NetworkManager.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,8 @@ class AccessPoint(NMDbusInterface):
229229
def postprocess(self, name, val):
230230
if name == 'Ssid':
231231
return fixups.ssid_to_python(val)
232+
elif name == 'Strength':
233+
return fixups.strength_to_python(val)
232234
return val
233235

234236
class Wired(NMDbusInterface):
@@ -330,6 +332,10 @@ def ssid_to_dbus(ssid):
330332
ssid = ssid.encode('utf-8')
331333
return [dbus.Byte(x) for x in ssid]
332334

335+
@staticmethod
336+
def strength_to_python(strength):
337+
return struct.unpack('B', strength)[0]
338+
333339
@staticmethod
334340
def mac_to_python(mac):
335341
return "%02X:%02X:%02X:%02X:%02X:%02X" % tuple([ord(x) for x in mac])

0 commit comments

Comments
 (0)