diff options
author | Marek Siarkowicz <mareksiarkowicz@gmail.com> | 2015-06-15 01:10:40 +0200 |
---|---|---|
committer | Marek Siarkowicz <mareksiarkowicz@gmail.com> | 2015-06-15 01:20:11 +0200 |
commit | ffa76dd958282735c1b39793351a075a3d1a64ac (patch) | |
tree | 99593c6c6e09a6228c4a7172f773779e77f7e6f3 /BluetoothPairedDevices.py | |
parent | 21cf625f6970c001c9f14bdbc603a104e544b9e1 (diff) | |
download | pyParrotZikTCP-ffa76dd958282735c1b39793351a075a3d1a64ac.tar.xz pyParrotZikTCP-ffa76dd958282735c1b39793351a075a3d1a64ac.zip |
Refactor.
Diffstat (limited to 'BluetoothPairedDevices.py')
-rw-r--r-- | BluetoothPairedDevices.py | 45 |
1 files changed, 0 insertions, 45 deletions
diff --git a/BluetoothPairedDevices.py b/BluetoothPairedDevices.py deleted file mode 100644 index aa5b056..0000000 --- a/BluetoothPairedDevices.py +++ /dev/null @@ -1,45 +0,0 @@ -import sys -import re -import os - -if sys.platform == "darwin": - from binplist import binplist -elif sys.platform == "win32": - import _winreg - - -def ParrotZikMac(): - p = re.compile('90:03:[0-9A-Fa-f]{2}:[0-9A-Fa-f]{2}:[0-9A-Fa-f]{2}:[0-9A-Fa-f]{2}|' - 'A0:14:[0-9A-Fa-f]{2}:[0-9A-Fa-f]{2}:[0-9A-Fa-f]{2}:[0-9A-Fa-f]{2}') - if sys.platform == "linux2": - out = os.popen("bluez-test-device list").read() - res = p.findall(out) - if len(res) > 0: - return res[0] - - elif sys.platform == "darwin": - fd = open("/Library/Preferences/com.apple.Bluetooth.plist", "rb") - plist = binplist.BinaryPlist(file_obj=fd) - parsed_plist = plist.Parse() - try: - for mac in parsed_plist['PairedDevices']: - if p.match(mac.replace("-", ":")): - return mac.replace("-", ":") - except Exception: - pass - - elif sys.platform == "win32": - aReg = _winreg.ConnectRegistry(None, _winreg.HKEY_LOCAL_MACHINE) - aKey = _winreg.OpenKey( - aReg, 'SYSTEM\CurrentControlSet\Services\ - BTHPORT\Parameters\Devices') - for i in range(10): - try: - asubkey_name = _winreg.EnumKey(aKey, i) - mac = ':'.join(asubkey_name[i:i+2] for i in range(0, 12, 2)) - res = p.findall(mac) - if len(res) > 0: - return res[0] - - except EnvironmentError: - pass |