omz:forum

    • Register
    • Login
    • Search
    • Recent
    • Popular

    Welcome!

    This is the community forum for my apps Pythonista and Editorial.

    For individual support questions, you can also send an email. If you have a very short question or just want to say hello — I'm @olemoritz on Twitter.


    Using ExternalAccessory framework to list connected BT devices

    Pythonista
    bluetooth objc
    1
    1
    1722
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • kristof_be
      kristof_be last edited by

      Hi,

      I'm trying to get the list of connected Bluetooth devices (regular BT, not LE, so I can't use the cb module).

      I found a topic referencing the ExternalAccessory framework, and while initially it seemed that it would only work for MFi devices, looking at this posts, it seems that the author was able to output information regarding the peripheral (Lego Mindstorms).

      The code I have so far (this is Pythonista with Python3 on iOS 12):

      from objc_util import *
      
      NSBundle = ObjCClass('NSBundle')
      ea_framework = NSBundle.bundleWithPath_('/System/Library/Frameworks/ExternalAccessory.framework')
      ea_framework.load()
      
      EAAccessoryManager = ObjCClass('EAAccessoryManager')
      accessories = EAAccessoryManager.sharedAccessoryManager().connectedAccessories()
      print(accessories)
      

      I'm not getting any errors, but it seems accessories is empty, while at least one device is connected to BT (in this case an Apple Watch).

      Just to be clear: I'm not looking to interact with BT devices, I just want to know which ones are connected. Specifically, I want to find out if my iPhone is connected to the car's BT.

      Thanks!

      1 Reply Last reply Reply Quote 0
      • First post
        Last post
      Powered by NodeBB Forums | Contributors