Core Bluetooth

RSS for tag

Communicate with Bluetooth 4.0 low energy devices using Core Bluetooth.

Posts under Core Bluetooth tag

175 Posts
Sort by:

Post

Replies

Boosts

Views

Activity

XPC Error CoreBluetooth
Hi,I'm currently looking into CoreBluetooth, but I'm already struggeling with the simple setup. On starting the test app github I receive the below error message:Search not started as central isn't powered on! unknown2016-08-12 20:37:18.050489 SwiftBluetooth[1865:574397] [CoreBluetooth] XPC connection invalidThis is happening while I had my bluetooth headphones sucessfully connected to the iPhone.So I would expect that at least the headphones get recognised.Device: iPhone 6 OS: 10.0Thanks for your helpTimo
12
0
26k
Sep ’23
Custom pairing scree
whenever i connect a BT peripheral and try to to read a characteristic first time, i see the "Bluetooth pairing request" popup for the user to enetr the PIN. I want to develop a custom screen for pairing PIN entry. How can we do this? I did not find any code examples or APIs in any documentation.
2
0
753
Oct ’23
iOS supported profiles
Which Bluetooth Profiles / services are supported by iOS?I found this:https://support.apple.com/en-us/HT204387I read up the iOS 11.3 will only see the built in pre-defined profiles. Is there a work around?Hands-Free Profile (HFP 1.6)Phone Book Access Profile (PBAP)Advanced Audio Distribution Profile (A2DP)Audio/Video Remote Control Profile (AVRCP 1.4)Personal Area Network Profile (PAN) Human Interface Device Profile (HID)Message Access Profile (MAP)So the Android phones will see the advertising of all kinds of BT / BLE devices, but iPhone does not, unless it was previousely paired by a custom app.Once you "Forget" this device on iPhone, it goes away and will not be seen during scanning.So even a Serial Port dongle with Serial Port Profile is not supported.(SPP), unless it is drive by a custom app?Any help appreciated
2
0
9.1k
Aug ’23
Not able to writeValue to a Bluetooth Peripheral when announced properties state writing+reading is available
I am trying to send a simple JSON to a connected Bluetooth peripheral but getting some problems in the process.The properties read from the peripheral in the didDiscoverCharacteristicsFor method are the following:po characteristic.properties ▿ CBCharacteristicProperties - rawValue : 10Which as this is a mask and if I am not mistaken this states that I can read (2) and write (8) from/to the device.I am writing the data as soon as I discover a new characteristic that matches the requirements in the following wayfunc peripheral(_ peripheral: CBPeripheral, didDiscoverCharacteristicsFor service: CBService,error: Error?) { for characteristic in service.characteristics! { let characteristic = characteristic as CBCharacteristic print(characteristic.uuid) if characteristic.uuid.isEqual(RX_UUID) { // Received only support for writing with response, writing without response is not allowed if characteristic.properties.contains(CBCharacteristicProperties.write) { self.writeJsonStringToPeripheral(peripheral: peripheral, characteristic: characteristic, writeType: .withResponse) } else if characteristic.properties.contains(CBCharacteristicProperties.writeWithoutResponse) { self.writeJsonStringToPeripheral(peripheral: peripheral, characteristic: characteristic, writeType: .withoutResponse) } } } } func writeJsonStringToPeripheral(peripheral: CBPeripheral, characteristic: CBCharacteristic, writeType: CBCharacteristicWriteType) { do { let msgDictionary = ["SSID": self.wiFiCredentials.SSID, "Password": self.wiFiCredentials.Password] let jsonData = try JSONSerialization.data(withJSONObject: msgDictionary, options: []) //let data = "".data(using: .utf8) peripheral.writeValue(jsonData, for: characteristic, type: writeType) } catch let error as NSError { debugPrint("Error in auth message JSON: \(error.description)") This snippet calls the function at line 10 indicating the possibility of writing with a response and after callign it the didWriteValueFor delegate method is called.func peripheral(_ peripheral: CBPeripheral, didWriteValueFor characteristic: CBCharacteristic, error: Error?) { if let error = error { print(error) } else { print("Value writen sucessfully.") } }Printing the following error.Error Domain=CBATTErrorDomain Code=3 "Writing is not permitted." UserInfo={NSLocalizedDescription=Writing is not permitted.}I've made myself sure that the device is connected and I can also see it in the Settings.app. I am a bit lost and I don't know what could be going on here.On the other side if I force the writing to be withoutResponse I get another console log2020-03-25 22:23:50.286662+0100 Cloudy[2595:1232291] [CoreBluetooth] WARNING: Characteristic does not specify the "Write Without Response" property - ignoring response-less writeAfter sending the specified JSON to the device it should start a sequence to connect to the specified WiFi SSID. I am sure the hardware works because I can set those values using the console on the device itself and the process works so there must be something I am missing here that causes this to fail.This test has been done using an iPhone 6S running ios 13.3.1.
2
0
2.3k
Aug ’23
CBATTErrorDomain Code=14 "Peer removed pairing information"
Hi,I have been working with CoreBluetooth for a while now and I've never run into this error before. This error occurred when I tried connecting to my desired peripheral. I've pasted the error message below:Domain=CBATTErrorDomain Code=14 "Peer removed pairing information" UserInfo={NSLocalizedDescription=Peer removed pairing information}I've tried to connect with the peripheral using a third-party app on the Android platform, and it works fine. However, third-party application on iOS isn't able to connect to this peripheral. It timeout when connecting on the iOS platform with the third-party app.I'm not sure what the source of this error is, or how to go about solving this error?Thanks!
9
0
8.9k
Aug ’23
Bluetooth ANCS don't send ringing alarm clock and countdown timer
Hello everyone, sorry for my ignorance about it, with ANCS I managed to get all the notifications except the alarm that rings and the timer expired, where am I wrong? do they travel on other channels like gatt? if yes can someone help me understand how to receive these 2 information? the alarm goes off and the timer expired? Thanks in advance to everyone who will help me, Marco.
1
0
1.2k
Aug ’23
Command Line Utility vs. Core Bluetooth Permissions
I'm writing a command line tool for macOS which interfaces with BLE devices. I have a problems with regards to permissions: If I launch my tool on the command line, it gets killed by the OS. Only if I launch it via the debugger, I get the alerter to allow the bluetooth permission. My plist that contains the NSBluetoothAlwaysUsageDescription key is embedded as __TEXT __info_plist in the binary. Is this no longer enough for a command-line tool to access security-guarded OS facilities these days?
2
0
2k
Aug ’23
Android phone can't discover services advertised from MacOS
I'm writing a MacOS Application to mimic some real hardware for debugging purposes. The application acts as a peripheral (using CBPeripheralManager). It advertises a single service, the primary service, with two characteristics. I have both iOS and Android applications that connect to the MacOS app. For the iOS application, everything works. I can connect to the app, discover services, and manipulate characteristics. The Android application does a BLE scan for peripherals with the service ID and the MacOS application shows up as being available. After connecting to the peripheral, however, when the Android application asks to discover the services of the peripheral, the one service my peripheral offers does not show up. Somehow the service makes it into the advertisement but does not show up during service discovery. Can anyone explain why my services would be advertised, but then not discoverable?
1
1
832
Sep ’23
1 minute Delay in External Accessory framework showBluetoothAccessoryPicker
I have to pair the classic Bluetooth device with my iOS application. For that, I have implemented showBluetoothAccessoryPicker with the External Accessory framework. EAAccessoryManager.shared().showBluetoothAccessoryPicker(withNameFilter: nil)), this is the code I have used for that. Added "Supported external accessory protocols" in .plist and enabled Wireless Accessory Configuration from capabilities. The actual issue is the picker displaying the device to pair with a 1-minute delay. What is the reason behind this reason and how can we resolve that?
1
0
888
Oct ’23
iOS16.1 Connection Interval Changes?
Hello, When Apple officially released iOS16 to users in Sept and Oct this year, our custom device that uses a nRF52832 Nordic based BLE chip would no longer hold the connection for more that 90 seconds before disconnecting. Through other forums and documentation, we realized that with iOS16, Apple changed their requested Connection Intervals and we had to modify them on our product to solve. [Previously Worked with iOS15 & below] Connection Interval for Product: Min 7.5ms - Max 15ms Does not work with iOS16.0 Does work with iOS16.1 & iOS16.1.1 [Had to Change for iOS16.0, 16.0.1, 16.0.2, 16.0.3] Connection Interval for Product: Min 15ms - Max 30ms However, with the release of iOS16.1 in November, our original connection interval parameters work again. Does anyone know what Apple changed for iOS16.1 for the connection intervals? Why does iOS16.1 accept 7.5-15ms intervals when iOS16.0 doesn't? There are no changes to the connection interval requirements on the Apple Design Guidelines as of the last revision Oct26th,2022. Would really appreciate if anyone can share more info on the BLE change logs for iOS16.1. Thanks for the help!
1
0
1.3k
Apr ’24
Bluetooth L2CAP iOS
Hi, I have 2 questions: the api for L2CAP is only for BLE or can also work for BR/EDR? (currently didn't manage to connect with BR/EDR) I use https://github.com/bluekitchen/CBL2CAPChannel-Demo on iPhone with le_credit_based_flow_control_mode from blue kitchen and the throughput was very low. I also tried to use L2TEST from Bluez (which uses L2CAP BASIC MODE) but it failed to connect Can anybody help how to increase throughput? The best result I received was 18 kilobyte/second. Thank you
2
0
1k
Apr ’24
How to clear Bluetooth LE cache manually in iOS 16?
I have a BLE peripheral I have connected to before with an iPhone running iOS 16 (via my app). The peripheral has a utility to change its name. After the name change my app still displays the old name. I've run into this issue before, a year or so ago, under an older version of iOS. Performing a reboot of the phone would clear the cached name and allow the new name to appear. This remedy no longer works in iOS 16. I have verified with another iOS device and an Android app that the new name is being advertised. I monitor for a name change with peripheralDidUpdateName but that function never gets called. How do I clear the cache in iOS 16? I do not need to do this programmatically and I would rather not reset the iPhone, which WILL work.
1
0
1.3k
Aug ’23
"Encryption is insufficient" message with BLE
I'm working on a BLE app with a hardware partner using samples of their device, which I am able to erase and re-flash when needed. When I try to use the device it initially works fine. I can connect to it, make requests, and get back responses. However, after a short time and a few successful runs, I start getting the error "Encryption is insufficient". The error is seen in the "didUpdateValueFor" function. I can still connect to the device, and enumerate all of its services and characteristics, but I can't read any data. If at this point I re-flash the device and also go into the iOS setting app and "forget" it, then I can use the device normally again, at least for a while. What causes this? Is there a way I can fix it in my app? Thanks, Frank
3
0
1.3k
Aug ’23
hello, i am finding Swift Bluetooth Classic communication sample code.
i am coding swift Bluetooth classic Communication program. my app need to communicate with esp32 with Bluetooth classic. but i didn't know how i can do this. there are so many sample code that use Bluetooth Low Energy communication with Swift or SwiftUI but i can't find Bluetooth classic with swift or swiftui. i think apple doesn't support Bluetooth Classic Communication . for example, they doesn't explain well about "Using core bluetooth classic" guide at their document at apple web site.
0
0
457
Jul ’23
Arduino HM-10 Bluetooth with iOS : Connected, but it doesn't send values
I'm trying to make an iOS (SwiftUI based) app to connect the arduino and send the current latitude value of ios to arduino. I successfully made the view that allow user to select the bluetooth device, and the UUID/name of the device is successfully displayed. Also, the arduino device detects connection (I used LiquidCrystal to display serial and it says "OK+CONN" and "OK+LOST" if connection was lost.), but when I click "fetch location" button, nothing happens on arduino side. The code is in stackoverflow due to character limits: https://stackoverflow.com/questions/76752529/arduino-hm-10-bluetooth-with-ios-connected-but-it-doesnt-send-values
0
0
636
Jul ’23
how can i make a ios bluetooth classic program? is this Mission Impossible?
i must make a code that ios app communicate with esp32 module over bluetooth classic . i have been searching for several weeks... but i didn't find out sample code for bluetooth classic. i found one code that use External Accessory Framework. but this needs a registration for that device some one says that i can't this. because ESP32 Module can't be registered . and i found another one it is coded by reactive native. but finally, this one use a MFi(Made For Iphone) that use External Accessory Framework. i guess.. is it impossilbe that making a ios app that communicate with other device over bluetooth classic ? so, now i am finding some apps that can communicate esp32 module that is coded by arduino IDE over bluetooth classic, and this arduino app can communicate with android bluetooth classic terminal app. please help me
9
0
2.3k
Sep ’23
how can i use this "https://developer.apple.com/documentation/corebluetooth/using_core_bluetooth_classic" sample code ?
i want to make a bluetooth classic code i found sample code at apple web site just like below https://developer.apple.com/documentation/corebluetooth/using_core_bluetooth_classic but i can't use... i need some explanation for this, i watched video below https://developer.apple.com/videos/play/wwdc2019/901 but i need more easy and detailed explanation. this is all~~~ about ios bluetooth classic explanation in text. please help me is any other clips in youtube or sites that explain this easy and in detail ?
0
0
401
Jul ’23
How to connect to a peripheral already paired with iphone without scan again.
I working with an app have ability to connect to an peripheral device. When the device paired, it's stop broadcasting so I can not found it again by scanForPeripherals until I go to setting on iphone and forgot that devices. This is so inconvenient to user. When they kill app, the connect is break and when they open app again, they can not connect to my peripheral device. I already try use retrieveConnectedPeripherals and retrievePeripherals to get the peripheral back to connect but both thing seem to be notworking. Both method not return anything and Idk why. Does anyone have same use case and know how fix this ? Thanks so much!
1
0
536
Jul ’23