View remove_bt.py
#!/usr/bin/python | |
from Foundation import NSBundle | |
IOBluetooth = NSBundle.bundleWithIdentifier_('com.apple.Bluetooth') | |
IOBluetoothDevice = IOBluetooth.classNamed_('IOBluetoothDevice') | |
# remove configured devices | |
try: | |
devices = list(IOBluetoothDevice.configuredDevices()) | |
except: |
View gist:11284662
import select | |
import socket | |
import sys | |
import objc | |
from PyObjCTools import AppHelper | |
objc.loadBundle("CoreBluetooth", globals(), | |
bundle_path=objc.pathForFramework(u'/System/Library/Frameworks/IOBluetooth.framework/Versions/A/Frameworks/CoreBluetooth.framework')) |
View ble.py
from pyobjus import autoclass, protocol | |
from pyobjus.dylib_manager import load_framework, INCLUDE | |
(CBCentralManagerStateUnknown, | |
CBCentralManagerStateResetting, | |
CBCentralManagerStateUnsupported, | |
CBCentralManagerStateUnauthorized, | |
CBCentralManagerStatePoweredOff, | |
CBCentralManagerStatePoweredOn) = range(6) |