| 479 | # interface_names = ['org.freedesktop.NetworkManager.VPN.Plugin'] |
| 480 | |
| 481 | def const(prefix, val): |
| 482 | prefix = 'NM_' + prefix.upper() + '_' |
| 483 | for key, vval in globals().items(): |
| 484 | if 'REASON' in key and 'REASON' not in prefix: |
| 485 | continue |
| 486 | if key.startswith(prefix) and val == vval: |
| 487 | return key.replace(prefix,'').lower() |
| 488 | raise ValueError("No constant found for %s* with value %d", (prefix, val)) |
| 489 | |
| 490 | # Several fixer methods to make the data easier to handle in python |
| 491 | # - SSID sent/returned as bytes (only encoding tried is utf-8) |