Core Bluetooth

RSS for tag

Communicate with Bluetooth 4.0 low energy devices using Core Bluetooth.

Core Bluetooth Documentation

Posts under Core Bluetooth tag

174 Posts
Sort by:
Post not yet marked as solved
0 Replies
28 Views
We develop alerting Bluetooth devices for special users. We have an alerting system that helps send alerts when important things happen, e.g. phone calls, and SMS. We also want able to relay emergency and government alerts so that users also may be warned. This means we want emergency and government alerts to be transmitted to our Bluetooth devices paired with iPhone, can this be implemented?
Posted
by ttqtqt.
Last updated
.
Post not yet marked as solved
1 Replies
77 Views
I'm currently trying to develop a l2cap demo application where I want to send data to a bluetooth chip over l2cap. I'm able to send several packet from the iPhone to the bluetooth chip. The chip send back credits and the iPhone continue to send data. After a moment suddenly the outputstream crash and rise a error that I'm not able to interpret. here is the error raised : /Users/13fmeyer/Documents/Screenshot 2024-05-07 at 15.15.37.png Here is the section of the code that manage the write : /Users/13fmeyer/Documents/Screenshot 2024-05-07 at 15.16.49.png and the write method : /Users/13fmeyer/Documents/Screenshot 2024-05-07 at 15.17.20.png Finally it close the act connection and stop the transmission. Does somebody have any idea about what happen ?
Posted
by fmeyer.
Last updated
.
Post not yet marked as solved
0 Replies
44 Views
Is it possible to link CBPeripheral which comes from scan delegate with the peripheral which comes from retrieveConnectedPeripherals result ? My assumption is that is not fully possible, but I want to confirm. They don't have nothing in common, except the name. But in my use case I have products which don't have name.
Posted Last updated
.
Post not yet marked as solved
2 Replies
109 Views
So, we've got a mobile app that is using background processing to occasionally scan for nearby BLE beacons. When running a debug / local build of the app, everything behaves as expected, but if we upload a build to TestFlight and install from there, the background processing doesn't happen. This behavior would seem to point to a capability in the App ID not being provisioned, but when I look in the Identifiers section of Apple Developer, Background Modes as a capability isn't listed for either the existing Application Identifier or when creating a brand new one. The app has the Background Modes capability assigned if I look at it in XCode. Any thoughts as to where to look next or what I'm missing?
Posted Last updated
.
Post not yet marked as solved
0 Replies
80 Views
On versions iOS 14+, my app which is connected by bluetooth to another device will become slow to write information. This isn't a couple hundred ms or a second or two, but upwards of 10 minutes for it to be sent and then 400 ms to be processed by the device and send its response back. I've confirmed with PacketLogger and with system logs that what commands we are sending with .writeValue are taking over 10 minutes. This is the timestamp of when we are writing to the device This is the PacketLogger timestamp of when the phone actually wrote to our device This doesn't occur immediately, but is intermittent and once it does begin to occur, there's nothing to do to get out of it except for connecting once again to the device. Which, overtime, the issue begins to spring up again. So why is it taking 13 minutes for it to go through the phone and finally being sent?
Posted
by ken-kun.
Last updated
.
Post not yet marked as solved
1 Replies
126 Views
Hello everyone! I'm currently working on an iOS app developed with Swift that involves connecting to a specific bluetooth device and exchanging data even when the app is terminated or running in the background. I just want to understand why the CBCenterManager should be Implicitly unwrapped to use it. I have check out couple off apple developer sample project it was set to Implicitly unwrapped. can some one help to understand the reason behind this, also what are possible issues/scenario trigger if we set the centermanager to optional "CBcentermanager?" Thanks in Advance!
Posted Last updated
.
Post not yet marked as solved
0 Replies
92 Views
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?
Posted Last updated
.
Post not yet marked as solved
0 Replies
126 Views
Hi, so I have looked through a lot of the Arduino forums and some of which have been helpful and others not so much. I am trying to transfer data from my arduino uno r4 wifi to my xcode project through my HM-10 XC4382 BLE Bluetooth Module. I am trying to essentially scan an RFID tag and transmit the name and UUID to the phone app to acknowledge the tag has been scanned. Every time I connect to my HM-10 module successfully on my phone but when I try and print the message it shows up as empty. When trying to debug it does show the statement when I scan the RFID tag each time which tells me it is being received but perhaps the format is not compatible with Xcode? Would appreciate any assistance 🙂 I have both arduino code and swift code. In my arduino code, I am working with RFID Scanner (from Jaycar) using the MFRC522 library and is connected the following ways: Apologies if I may have missed some code / context to this question. Thank you! RFID Module Setup 3.3V - 3.3V RST - 9 GND - GND MISO - 12 MOSI - 11 SCK - 13 SDA - 10 HM-10 Setup 5V - 5V GND - GND RX - TX (arduino) TX - RX (arduino) Find code attached in text files. ArduinoCode.rtf SwiftCode.rtf
Posted
by gubby1707.
Last updated
.
Post not yet marked as solved
2 Replies
715 Views
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
Posted
by just-me.
Last updated
.
Post not yet marked as solved
0 Replies
117 Views
Hi, I'm trying to build an app to connect to both BR/EDR ("Classic") or BLE devices. For Classic, the recommended flow in Apple docs is: Start your app and initialize your CBCentralManager Pair the phone and the device manually through settings This should automatically call the connectionEventDidOccur From then on it depends on the dev to choose what to do with the information from the callback (peripheral, event, etc), but the callback is simply never fired. Here's my basic implementation of the callback: func centralManager(_ central: CBCentralManager, connectionEventDidOccur event: CBConnectionEvent, for peripheral: CBPeripheral) { print("IOS: connectionEventDidOccur for peripheral: %@", peripheral) if (event == .peerConnected) { print("IOS: Case is peer connected") connectToPeripheral(peripheral.identifier.uuidString) if(!savedPeripheralList.contains(where: { $0.identifier == peripheral.identifier })){ savedPeripheralList.append(peripheral) } } else if (event == .peerDisconnected ){ print("IOS: Peer %@ disconnected!", peripheral) } else { print("IOS: if statement didn't work") } } I'm essentially: Printing the fact that the callback was called Trying to connect the app to the peripheral (by now only the phone is connected) Saving this newly connected peripheral to a local list For context, I've been able to scan and connect to BLE devices like earbuds normally, so my general implementation of other callbacks like didDiscover or didConnect works just fine, this is the only non functional callback. Any ideas would be appreciated, thanks!
Posted Last updated
.
Post not yet marked as solved
1 Replies
1.2k Views
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!
Posted
by Marie_MN.
Last updated
.
Post not yet marked as solved
0 Replies
130 Views
I'm trying to build a feature which allows: Peripheral send some info (up to 512 bytes) to central Central connects to all nearby peripheral, and display the connected peripherals as a list When user tap on any of the peripheral from the list, central send back some info back. In order to achieve this, I need to make sure to connect to the discovered peripherals before sending over the data because the data i want to send through BLE is larger than advertisementData MTU while peripheral starts broadcasting. However, I also saw some discussion suggesting that I should stop scanning first before establish connection. I wonder if you have any recommendation for my scenario. (Let's assume BLE is the ONLY approach I can go with for transferring data because I want to do this cross Android and iOS offline) Should I maintain 2 peripheral arrays to tracked the discovered and connected peripherals? Am I supposed to connect to the peripheral while scanning? If not, any recommendations? Thank you!
Posted Last updated
.
Post not yet marked as solved
2 Replies
199 Views
Hello, It's been more than three weeks that i've been freaking out about this crash that occurs while establishing a BLE connection to a peripheral, scan wifi networks and connect to one of them via BLE. Here is the crash's stacktrace and I hope that I can get some help in order to resolve this ungoing crash : +0x284 mov x2, x22 +0x288 mov x3, x28 +0x28c bl "swift::ConcurrentReadableHashMap<MallocTypeCacheEntry, swift::LazyMutex>::resize(swift::ConcurrentReadableHashMap<MallocTypeCacheEntry, swift::LazyMutex>::IndexStorage, unsigned char, MallocTypeCacheEntry*)" +0x290 mov x23, x0 +0x294 add x0, sp, #0x2c +0x298 mov x1, x23 +0x29c mov x2, x24 +0x2a0 mov x3, x28 +0x2a4 bl "std::__1::pair<MallocTypeCacheEntry*, unsigned int> swift::ConcurrentReadableHashMap<MallocTypeCacheEntry, swift::LazyMutex>::find<unsigned int>(unsigned int const&, swift::ConcurrentReadableHashMap<MallocTypeCacheEntry, swift::LazyMutex>::IndexStorage, unsigned long, MallocTypeCacheEntry*)" +0x2a8 and x26, x1, #0xffffffff +0x2ac cbnz x27, "_swift_allocObject_+0x2bc" +0x2b0 b "_swift_allocObject_+0x2cc" +0x2b4 mov x26, x1 +0x2b8 cbz x27, "_swift_allocObject_+0x2cc" +0x2bc ldr w8, [x27] +0x2c0 mov x22, x27 +0x2c4 cmp w24, w8 +0x2c8 b.lo "_swift_allocObject_+0x358" +0x2cc add x8, x24, x24, lsr #2 +0x2d0 add x9, x24, #0x1 +0x2d4 cmp x8, x9 +0x2d8 csinc x8, x8, x24, hi +0x2dc lsl x8, x8, #3 +0x2e0 add x0, x8, #0x8 +0x2e4 bl "DYLD-STUB$$malloc_good_size" +0x2e8 mov x28, x0 +0x2ec mov w1, #0xb407 +0x2f0 movk w1, #0x5640, lsl #16 +0x2f4 bl "0x1a255c690" +0x2f8 cbz x0, "_swift_allocObject_+0x49c" +0x2fc mov x22, x0 +0x300 mov x8, #0x7fffffff8 +0x304 add x8, x28, x8 +0x308 lsr x8, x8, #3 +0x30c str w8, [x0] +0x310 cbz x27, "_swift_allocObject_+0x34c" +0x314 add x0, x22, #0x8 +0x318 lsl x2, x24, #3 +0x31c mov x1, x25 +0x320 bl "DYLD-STUB$$memcpy" +0x324 mov w0, #0x10 +0x328 mov x1, #0x3c70 +0x32c movk x1, #0xaff9, lsl #16 +0x330 movk x1, #0x80, lsl #32 +0x334 movk x1, #0xa, lsl #48 +0x338 bl "0x1a255c690" +0x33c adrp x8, 403725 ; 0x6290d000 +0x340 ldr x9, [x8, #0xdf8] +0x344 stp x9, x27, [x0] +0x348 str x0, [x8, #0xdf8] +0x34c adrp x8, 403725 ; 0x6290d000 +0x350 add x8, x8, #0xde0 +0x354 stlr x22, [x8] +0x358 add x8, x22, x24, lsl #3 +0x35c ldp x10, x22, [sp, #0x8] +0x360 mov x9, x22 +0x364 bfi x9, x21, #32, #32 +0x368 str x9, [x8, #0x8] +0x36c stlr w10, [x20] +0x370 and x8, x26, #0xffffffff +0x374 and w16, w23, #0x3 +0x378 ldp x26, x25, [sp, #0x18] +0x37c cmp x16, #0x3 +0x380 csel x16, x16, xzr, ls +0x384 adrp x17, 0 ; 0x0 +0x388 add x17, x17, #0x6cc +0x38c ldrsw x16, [x17, x16, lsl #2] +0x390 adr x17, #0x0 +0x394 add x16, x17, x16 +0x398 br x16 +0x39c lsl x8, x8, #2 +0x3a0 lsl x8, x10, x8 +0x3a4 orr x8, x8, x23 +0x3a8 adrp x9, 403725 ; 0x6290d000 +0x3ac add x9, x9, #0xde8 +0x3b0 stlr x8, [x9] +0x3b4 b "_swift_allocObject_+0x3fc" +0x3b8 and x9, x23, #0xfffffffffffffffc +0x3bc tst x23, #0x3 +0x3c0 csel x9, xzr, x9, eq +0x3c4 add x8, x9, x8 +0x3c8 stlrb w10, [x8] +0x3cc b "_swift_allocObject_+0x3fc" +0x3d0 and x9, x23, #0xfffffffffffffffc +0x3d4 tst x23, #0x3 +0x3d8 csel x9, xzr, x9, eq +0x3dc add x8, x9, x8, lsl #1 +0x3e0 stlrh w10, [x8] +0x3e4 b "_swift_allocObject_+0x3fc" +0x3e8 and x9, x23, #0xfffffffffffffffc +0x3ec tst x23, #0x3 +0x3f0 csel x9, xzr, x9, eq +0x3f4 add x8, x9, x8, lsl #2 +0x3f8 stlr w10, [x8] +0x3fc dmb ish +0x400 adrp x8, 403725 ; 0x6290d000 +0x404 ldr w8, [x8, #0xdd8] +0x408 cbnz w8, "_swift_allocObject_+0x438" +0x40c adrp x8, 403725 ; 0x6290d000 +0x410 ldr x23, [x8, #0xdf8] +0x414 cbz x23, "_swift_allocObject_+0x430" +0x418 ldp x20, x0, [x23] +0x41c bl "DYLD-STUB$$free" +0x420 mov x0, x23 +0x424 bl "DYLD-STUB$$free" +0x428 mov x23, x20 +0x42c cbnz x20, "_swift_allocObject_+0x418" +0x430 adrp x8, 403725 ; 0x6290d000 +0x434 str xzr, [x8, #0xdf8] +0x438 adrp x0, 403725 ; 0x6290d000 +0x43c add x0, x0, #0xdf0 +0x440 bl "0x1a255c9f0" +0x444 bfi x22, x21, #32, #32 +0x448 mov x0, x26 +0x44c mov x1, x25 +0x450 mov x2, x22 +0x454 bl "swift::swift_slowAllocTyped(unsigned long, unsigned long, unsigned long long)" +0x458 cbz x19, "_swift_allocObject_+0x470" +0x45c mov x16, x0 +0x460 movk x16, #0x6ae1, lsl #48 +0x464 mov x17, x19 +0x468 pacda x17, x16 +0x46c b "_swift_allocObject_+0x474" +0x470 mov x17, #0x0 +0x474 mov w8, #0x3 +0x478 stp x17, x8, [x0] +0x47c ldp x29, x30, [sp, #0x80] +0x480 ldp x20, x19, [sp, #0x70] +0x484 ldp x22, x21, [sp, #0x60] +0x488 ldp x24, x23, [sp, #0x50] +0x48c ldp x26, x25, [sp, #0x40] +0x490 ldp x28, x27, [sp, #0x30] +0x494 add sp, sp, #0x90 +0x498 retab +0x49c bl "_swift_allocObject_.cold.1"
Posted Last updated
.
Post marked as solved
2 Replies
237 Views
This app has crashed because it attempted to access privacy-sensitive data without a usage description. The app's Info.plist must contain an NSBluetoothAlwaysUsageDescription key with a string value explaining to the user how the app uses this data. I don't know how to add these permissions when i can't find plist files. It is not when any tutorial or document says it is
Posted Last updated
.
Post not yet marked as solved
0 Replies
193 Views
I've encountered a strange issue reading characteristics from a BLE device using CoreBluetooth ONLY ON iPHONE 12 AND iPHONE 12 PRO. The problem is that the BLE device receives a read characteristic request for an errored characteristic id. The BLE Device is using blue kitchen btstack (https://github.com/bluekitchen/btstack). We also filed a bug report on their side here Say i ask for a characteristic discovered with CBUUID "F97A6DA4-B3AA-44B0-8DE7-40D238BE5E02", the device receives a request for a "F97A6DA4-B3AA-44B0-8DE7-40D238BE5E09" id. The exact same swift code is working perfectly on MacOS, reading the right characteristic on the device. I is also perfectly fine, tested on various iOS versions on iPhone 8, SE (1st gen), 11, 13, 15. The only devices affected are the 12 & 12 Pro. I also tried using popular apps like light blue, or nRF Connect for iOS, and the iOS app has the same behavior on iPhone 12 & 12 Pro (that is wrong), but is ok on other iPhone devices. Has anyone encountered such a strange behavior and have any insight on how to solve that ?
Posted
by aactimage.
Last updated
.
Post not yet marked as solved
0 Replies
177 Views
Dear Apple support, We are working on one of the projects related to BLE, in which our BLE device is acting as a GATT client and our iPhone device (iPhone 13, OS17.3) is acting as a GATT server. Issue being faced: Whenever my BLE device subscribes to the ANCS notifications, and the moment the IOS device starts bombarding with the notifications available in notification center, the BLE device controller's heap memory becomes UNAVAILABLE in runtime for this notifications' queue and eventually making the BLE controller to reset. Thereafter, whenever user tries making a new connection session of BLE, again same thing repeats. Notifications allowed in BLE display : W-SMS, W-CALL, SMS, CALL, none other than this. Issue observed with : IF and ONLY 150 notifications and above available in notification center, otherwise our product works fine with iPhone with less number of notifications. We would like to know how we can curb the number of PRE-EXISTING type notifications available in the notification center flowing towards the BLE device? What best solution can be done at the IOS side, we also have IOS APP team for this project. What kind of APIs does Core Bluetooth framework can provide to the IOS developer in order to overcome this issue. Please suggest possible ways from the IPHONE device only to overcome this. BLE's software CANNOT BE CHANGED under any circumstances as the product is already in production and complaints are coming from end user (from the field). OUR GOAL : ONLY notifications which will be available in run time, i.e. AFTER SUCCESSFUL BLE connection established to be displayed in the BLE's display. We DON'T WANT older notifications to be displayed and flow towards BLE over ANCS. WE MUST make 'notification popup' option as ALLOW to be shared with our BLE device, otherwise SMS,CALL, W-SMS,W-CALL during live connection will not come on the BLE 's display.
Posted
by MM_GGN.
Last updated
.
Post not yet marked as solved
2 Replies
187 Views
I would like to know, do we have any support from iOS in order to turn on wifi and bluetooth using internal apis on tap of a button in my IOS App, I am struggling to find information over this, more precisely , I want to turn on wifi from my custom widget in I phone, is it possible then please share info.
Posted
by gmantrao.
Last updated
.
Post not yet marked as solved
0 Replies
186 Views
"When an iBeacon is received, a BLE scan API is called within didEnterRegion. However, if executed while the screen is off, Core Bluetooth's didDiscover does not function. Yet, if the screen is turned on once and then turned off again, didDiscover functions. Is there a way to make Core Bluetooth's didDiscover work while the screen is off?" Let me know if you need further assistance or clarification! func locationManager(_ manager: CLLocationManager, didEnterRegion region: CLRegion) { if let beaconRegion = region as? CLBeaconRegion { startRanging(in: beaconRegion) } } func startRanging(in beaconRegion: CLBeaconRegion) { // バックグラウンドタスクを開始 bgTask = UIApplication.shared.beginBackgroundTask(expirationHandler: { [self] in print("バックグラウンドタスクの有効期限が切れ") // バックグラウンドタスクの有効期限が切れたときに、バックグラウンドタスクを終了 self.lm!.stopRangingBeacons(satisfying: beaconRegion.beaconIdentityConstraint) UIApplication.shared.endBackgroundTask(bgTask) // バックグラウンドタスクの識別子を無効 bgTask = .invalid }) // レンジング開始 self.lm!.startRangingBeacons(satisfying: beaconRegion.beaconIdentityConstraint) //サービス指定してCoreBluetoothを起動 self.centralManager.stopScan() self.centralManager.scanForPeripherals(withServices: [self.kServiceUUID], options: nil) // バックグラウンドタスク終了 let time = UIApplication.shared.backgroundTimeRemaining - 1.0 DispatchQueue.main.asyncAfter(deadline: .now() + time) { self.stopRanging(in: beaconRegion) } } func centralManager(_ central: CBCentralManager, didDiscover peripheral: CBPeripheral, advertisementData: [String : Any], rssi RSSI: NSNumber) { print("---- didDiscover ----") print("peripheral-->\(peripheral)") print("advertisementData-->\(advertisementData)") print("rssi-->\(RSSI)") print("---------------------") }
Posted
by tgrgenki.
Last updated
.
Post not yet marked as solved
0 Replies
253 Views
When I connect a speed and cadence sensor to my Apple Watch in Bluetooth settings I expect to see the following HKQuantity types in workoutBuilder:(HKLiveWorkoutBuilder *)workoutBuilder didCollectDataOfTypes HKQuantityTypeIdentifierCyclingSpeed, HKQuantityTypeIdentifierDistanceCycling, and HKQuantityTypeIdentifierCyclingCadence. However, after starting an HKWorkoutSession I only get updates for HKQuantityTypeIdentifierDistanceCycling. I know that these metrics are being updated because the Apple Workout app displays them. I have authorized my app to read and write these quantity types, so what could I be missing here? Are these quantities only available to the workout app, as I haven't found a third-party app that sees these metrics when the sensors are connected this way?
Posted Last updated
.