This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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')) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from pyobjus import autoclass, protocol | |
from pyobjus.dylib_manager import load_framework, INCLUDE | |
(CBCentralManagerStateUnknown, | |
CBCentralManagerStateResetting, | |
CBCentralManagerStateUnsupported, | |
CBCentralManagerStateUnauthorized, | |
CBCentralManagerStatePoweredOff, | |
CBCentralManagerStatePoweredOn) = range(6) |