IOBluetooth

RSS for tag

Gain user-space access to Bluetooth devices using IOBluetooth.

Posts under IOBluetooth tag

35 Posts
Sort by:

Post

Replies

Boosts

Views

Activity

Bluetooth — Peripheral Won't Appear in Bluetooth Settings Menu
Xcode 15.3 macOS Sonoma 14.5 I'm trying to build an app for macOS that will emulate a HID device (keyboard, mouse, game controller) and send those inputs to an IOS device over Bluetooth. I've figured out how to map the inputs from the relevant documentation (Human Interface Device Profile 1.1, Apple Accessory Design Guidelines) but I can't seem to get the Bluetooth services working. I've found an example of how to implement the Bluetooth service (from macOS Mojave but updated to Swift 5). The code will build without issue and asks for the necessary permissions in settings. After giving permissions and rebuilding, the peripheral simply does not appear on the iPhone Bluetooth settings menu (or the Bluetooth settings menu of any device). I suppose the question I'm asking here is if macOS Sonoma prevents the macOS device from advertising as a keyboard peripheral. Furthermore, is there any documentation that describes these limitations. Here is the full example code (too large to post): https://github.com/MonoidMusician/Bluetooth-Keyboard-Emulator/blob/master/Keyboard%20Connect%20Open%20Source/BTKeyboard.swift
1
0
77
5d
iPhone and iPad Collaboration
Hello, I'm building apps for iPhone and iPad. Those are working together like a 2-screen Nintendo switch. Is there any way for communication between iPhone and iPad without an outside server? PAN(personal area network) could be a solution, but I could not find any information to use it for my case. If the iPad is connected to iPhone as a personal hotspot (though there's no cell tower), they should be communicate each other. I think there's a better way for my case. Could anyone can tell me where I start to looking for? Thanks, JJ
1
0
145
1w
Increase in Download Time from Sensors to Mobile with Recent IOS Updates
We have observed a significant increase in download time from the sensors to the mobile device after recent OS updates. We are connected to the external sensors via the BLE interface using the following connection parameters(15,15,0,6000) https://mbientlab.com/tutorials/MetaMotionRL.html: example 1.For 1 Meter with duration of 28 Seconds the IOS 17.1 taking 44 secs where as IOS 17.5.1 taking 82 secs . 2..For 1 Meter with duration of 45 Seconds the IOS 17.1 taking 74 secs where as IOS 17.5.1 taking 143 secs . Even with the same connection parameters, download times were considerably lower in iOS 15 and below devices. We are currently using the connection parameters 15, 15, 0, 6000. I have learned from some documents that the minimum connection interval was changed to 20, but when I tried it, the download time increased further. I am seeking assistance on how to achieve the same download times as the older versions. https://mbientlab.com/community/discussion/comment/11852#Comment_11852
2
0
168
3w
The infinite connection callback observed for some Bluetooth devices
Hi guys, I observed the infinite connection callback(inSelector) for some Bluetooth devices (such as an iPhone SE or Mac Mini) even when I powered off them. However, the issue is not reproducible easily. (IOBluetoothUserNotification *)registerForConnectNotifications:(id)observer selector:(SEL)inSelector ble.txt Looks like there are many -[CBManager xpcConnectionDidReceiveMsg:args:] calls when the issue occurs based on the sample, so it might be caused by the XPC connection with bluetoothd? Has anyone else experienced this issue, or any workaround for it? such as should I restart the bluetoothd?
1
0
253
May ’24
Tracking bluetooth connection from macOS to non-Apple smartphones
Hi! I am trying to figure out whether there are any ways to get notifications when a macOS user connects to another device via Bluetooth (specifically when a smartphone is paired with a MacBook). I know about IOBluetooth, but it seems like you have to send periodic queries for devices when using this framework, and there is no general way to receive such notifications. I know that IOHIDManager may help to track connection with human interface devices such as keyboards, trackpads, joysticks, etc. But is there any API in IOKit/DriverKit that could help get notifications when a macOS user connects to a smartphone? Maybe I am missing an important part of IOBluetooth, so I would appreciate any help.
0
0
269
Apr ’24
VisionOS Bluetooth usage
Hi! I have previously developed an app that established a Bluetooth connection between two devices (two iPads). Now, I want to port the client-side app to VisionPro. Similar to the iPad app, I have supplemented my info.plist file with the following line: NSBluetoothAlwaysUsageDescription Uses BLE to communicate with devices. Despite this, when I launch the app on VisionPro, the prompt to use Bluetooth does not appear. What could be the issue? What additional settings do I need to configure to enable Bluetooth usage?
1
0
388
Mar ’24
IOBluetooth: discovering if my (classic) bluetooth headset is "connected" to macOS
I want my program to behave differently if a specific bluetooth headset is "connected" to the system. By "connected" I mean that it is: paired with the system appears on a list of audio output in Settings (not necessarily selected as default output) appears on "My Devices" list in Bluetooth preference pane with "Connected" status. I want this to determine "availability" of the device, i.e. likehood that establishing an active connection will succeed. Apparently IOBluetooth does not offer API to easily achieve this... I've tried: [IOBluetooth pairedDevices] to iterate though paired device list. This one correctly returns IOBluetoothDevice object representing my device. When I call [IOBluetoothDevice isConnected] it returns false even though device is listed as "connected" on My Devices list in Bluetooth settings. If I leave the headset at original place, go with my mac to a physically different location and call getLastInqiuryUpdate or recentAccessDate, both return current time, even though the headset is not in range for several days now. So I'm looking to determine the headset "connected" state the same way Bluetooth Settings pane does it and without making an active connection attempt.
0
1
373
Feb ’24
watchOS 10.2 Bluetooth in the background often disconnects
My watch APP needs to keep Bluetooth connected with peripherals whether it is in the foreground or background, but the results of my test show that the connection in the background is very unstable, sometimes you can keep the Bluetooth on for a day, but sometimes it will be disconnected 50 times a day, and every time it is disconnected, I will immediately initiate a reconnection, it is certain that there is no problem with the peripheral Bluetooth, because I have another iOS device that has been stably connected to the peripheral, I want to know what causes this instability, and if there is any solution, if someone can provide relevant advice, I will be very grateful
1
0
498
Feb ’24
Issues with Bluetooth Streaming Speed and GATT Operations Post-Sonoma Update
Hello everyone, I've developed an application using ElectronJS and NodeJS, utilizing the Web Bluetooth API for connecting to and streaming data from peripherals. Initially, this was built and tested on macOS Ventura, where everything worked as expected. However, I've encountered a couple of issues post the Sonoma update. Issue 1: Slower Streaming Speed Post-Sonoma Update After updating to Sonoma, the streaming speed from peripherals significantly decreased. This is perplexing because the app continues to perform well on Ventura. To troubleshoot, I even developed a version using Rust with the btleplug library, hoping for improved Bluetooth performance. However, this did not lead to any noticeable difference; both the Electron and Rust versions perform nearly the same. Has anyone experienced similar issues or knows what might be causing this slowdown? Issue 2: GATT Operation Error Resolved, but Streaming Speed Affected On Ventura, one specific command consistently failed with a GATT operation error. Interestingly, post-Sonoma update, this command works without error, but this seems to have affected the streaming speed. The improved GATT operation seems to come at the cost of decreased streaming performance. Is there a known connection between these two aspects, or has anyone observed a similar trade-off? I'm looking for insights or suggestions to resolve these issues, particularly the streaming speed degradation post-Sonoma. The application needs to maintain consistent performance across different macOS versions, and these discrepancies are quite challenging. Thank you in advance for your help and insights! Best regards,
0
0
407
Jan ’24
Bluetooth LE Secure Connection issues
I am developing an App that uses BLE to connect to third-party devices. Considering information security, perform a LE Secure Connection before BLE connection. But we encountered an issue: after uninstalling the App and reinstalling it, the paired device cannot be connected again. This requires to ignore this device in Settings to continue using it. But we can't do this, it's not friendly to our customers. So, I would like to ask the developers here if they know how to solve this issue. Thank you
1
0
423
Jan ’24
objectC, swift, swiftUI, Bluetooth classic, Bluetooth Low Energy, IOS deploy version? Users Number?
objectC program: iOS all : iPhone ~ swift program. : iOS 13 ~ : iPhone 6s ~ swiftUI Program : iOS 13 ~ : iPhone 6s ~ bluetooth classic : ~ iPhone 4s Bluetooth Low Engery : iPhone 5 ~ are All above content right? i am making iOS app with swiftUI app, and Bluetooth Low Energy. after making app, i found that my app can run on greater than iOS13 , iPhone 6s. how many is ther number of above iPhone6s User ?
0
0
468
Dec ’23
How to make sound output from Bluetooth instead of speakers in IOS 17
When I set the AVAudioSessionCategory avAudioSessionCategory: AVAudioSessionCategory.playAndRecord, sound to come out of the built-in speaker instead of Bluetooth headphones。ios17 。It is normal in IOS 16 or 15 final session = await AudioSession.instance; await session.configure(AudioSessionConfiguration( avAudioSessionCategory: AVAudioSessionCategory.playAndRecord, avAudioSessionCategoryOptions:AVAudioSessionCategoryOptions.allowBluetooth | AVAudioSessionCategoryOptions.allowBluetoothA2dp, avAudioSessionMode: AVAudioSessionMode.defaultMode, avAudioSessionRouteSharingPolicy: AVAudioSessionRouteSharingPolicy.defaultPolicy, avAudioSessionSetActiveOptions: AVAudioSessionSetActiveOptions.none, androidAudioAttributes: const AndroidAudioAttributes( contentType: AndroidAudioContentType.music, flags: AndroidAudioFlags.none, usage: AndroidAudioUsage.media, ), androidAudioFocusGainType: AndroidAudioFocusGainType.gain, androidWillPauseWhenDucked: true, )); How to make sound output from Bluetooth instead of speakers in IOS 17? How to make sound output from Bluetooth instead of speakers in IOS 17?
1
0
486
Dec ’23
CUPS Bluetooth Printer issue with Mac OS Sonoma 14 & 14.1
I am trying to print using CUPS and my own backend, Bluetooth, but it is failing on macOS Sonoma. The backend I built don’t have permission to perform Bluetooth communication or get a list of Paired devices. I granted permissions to /usr/libexec/cups/backend/ from System Settings -> Privacy and Security -> Bluetooth, but that did not solve the problem. When I run only the backend I created, the permission dialog appears and I can print, but when I try to print from CUPS, it does not appear and fails to print. The print queue still shows "Ready to print" and the job remains. Printing succeeds with USB and LAN, but only with Bluetooth. Printing succeeds on 13.6 and earlier, problem occurs on 14 and 14.1. Please let me know how to give permission to my backend.
0
0
587
Oct ’23