Core Bluetooth

RSS for tag

Communicate with Bluetooth 4.0 low energy devices using Core Bluetooth.

Core Bluetooth Documentation

Posts under Core Bluetooth tag

170 Posts
Sort by:
Post not yet marked as solved
2 Replies
677 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
Post not yet marked as solved
1 Replies
1.1k Views
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.
Posted
by
Post not yet marked as solved
3 Replies
1.1k Views
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
Posted
by
Post not yet marked as solved
0 Replies
330 Views
The programming guide for Core Bluetooth states that "Upon being woken up, an app has around 10 seconds to complete a task. Ideally, it should complete the task as fast as possible and allow itself to be suspended again. Apps that spend too much time executing in the background can be throttled back by the system or killed." My use case however demands that I continue to receive live data from a Bluetooth peripheral for more than 10 seconds. In my testing things are working fine and my app runs for more than 10 seconds. Why is this the case and could this become an issue later on? I have set the background modes for Background Processing, Fetch and Use Bluetooth LE accessories.
Posted
by
Post not yet marked as solved
0 Replies
671 Views
Hello, I’m looking to hire 1 or 2 iOS app developers to join our team. I’m a mechanical engineer located in Connecticut (2 hrs from New York City & Boston). I’ve been designing a consumer facing iPhone app and planning its associated business venture and launch for a while, and I am now ready to begin the coding phase and hire code writers. This opportunity would be paid, part-time work that may lead to full-time employment within our group as we prepare for app launch next year. Ideal candidates would be seasoned Swift developers and have experience coding with Bluetooth. This app will be industry disrupting and transformative with global reach. Capitalize on your hard work, experience, and talent, and reach out today to learn more! Contact me at matthewcyr1 @ gmail.com.
Posted
by
Post not yet marked as solved
0 Replies
884 Views
I'm trying to determine if Core Bluetooth, in the latest versions of iOS and iPadOS, supports scanning for periodic advertisements as defined in Bluetooth 5? If so, what configuration parameters are required for a peripheral device to successfully achieve recognizable periodic advertisements that will be discovered by iPhones/iPads? For instance, supported PHY settings or anything else? If iOS/iPadOs doesn’t support periodic advertising, is it on the roadmap? If so, when will it be available and which devices will be supported? Thanks.
Posted
by
Post not yet marked as solved
0 Replies
812 Views
I am working on the background mode of nearby interaction, from the WWDC 2022 video, my Apps have to do pairing, connect with third party device's BLE Afterward, I have to implement a method called triggerPairing ( peripheral: peripheral, encryptedCharacteristics: CBCharacteristics), to trigger pairing process. The document mention that Apps should NOT discover the nearby interaction GATT service, but the encrypted characteristic is belonged to this service. how can I pass the parameters into the triggerPairing function if the Apps does not discover the service? what parameter should I pass into the function? Does anyone help?
Posted
by
Post not yet marked as solved
0 Replies
295 Views
I have called the func stopAdvertising() but the Advertising still runs although the state isAdvertising is false. I tried to uninstall the app but it does not change anything How can I stop Advertising?
Posted
by
Post not yet marked as solved
2 Replies
865 Views
Hi, I've read over many of the helpful posts on background modes ([1], [2], and responses to my thread [3]) but am encountering something that doesn't quite line up with my understanding. Background My app is using Bluetooth background mode in order to receive data from a peripheral periodically and then perform a network request (eventually, this will involve two network requests, one of them being an upload of audio, which will be a much larger transfer of up to a couple hundred KB, possibly requiring m4a compression first). In background mode, all the Bluetooth messages (currently a small string) are received reliably. The app is woken up and from my understanding, given some time to run in the background. I perform a POST request using URLSession.shared.dataTask(with: request). Problem Encountered These often succeed but sporadically fail with a timeout in background mode and with the error message "connection was lost". Furthermore, nearly every request in background mode is associated with some sort of connection error that appears in the log. Given that many of the requests still succeed, I'm not sure what to make of these. I see a variety of different ones. For example: Case 1: 2023-05-23 16:33:49.428668-0700 ChatGPT for Monocle[4775:1088487] [connection] nw_read_request_report [C1] Receive failed with error "Socket is not connected" 2023-05-23 16:33:49.429633-0700 ChatGPT for Monocle[4775:1088487] [connection] nw_read_request_report [C1] Receive failed with error "Socket is not connected" 2023-05-23 16:33:49.431677-0700 ChatGPT for Monocle[4775:1088487] [connection] nw_read_request_report [C1] Receive failed with error "Socket is not connected" 2023-05-23 16:33:49.440358-0700 ChatGPT for Monocle[4775:1088487] [quic] quic_conn_send_frames_for_key_state_block_invoke [C1.1.1.1:2] [-0151a6eeef6cab8c6b53cceead6cada7cf118a4e] unable to request outbound data 2023-05-23 16:33:49.440528-0700 ChatGPT for Monocle[4775:1088487] [quic] quic_conn_send_frames_for_key_state_block_invoke [C1.1.1.1:2] [-0151a6eeef6cab8c6b53cceead6cada7cf118a4e] unable to request outbound data 2023-05-23 16:33:49.440640-0700 ChatGPT for Monocle[4775:1088487] [quic] quic_conn_send_frames_for_key_state_block_invoke [C1.1.1.1:2] [-0151a6eeef6cab8c6b53cceead6cada7cf118a4e] unable to request outbound data 2023-05-23 16:33:49.440784-0700 ChatGPT for Monocle[4775:1088487] [quic] quic_conn_send_frames_for_key_state_block_invoke [C1.1.1.1:2] [-0151a6eeef6cab8c6b53cceead6cada7cf118a4e] unable to request outbound data 2023-05-23 16:33:49.441459-0700 ChatGPT for Monocle[4775:1088487] [quic] quic_conn_send_frames_for_key_state_block_invoke [C1.1.1.1:2] [-0151a6eeef6cab8c6b53cceead6cada7cf118a4e] unable to request outbound data 2023-05-23 16:33:49.441684-0700 ChatGPT for Monocle[4775:1088487] [quic] quic_conn_send_frames_for_key_state_block_invoke [C1.1.1.1:2] [-0151a6eeef6cab8c6b53cceead6cada7cf118a4e] unable to request outbound data 2023-05-23 16:33:49.445598-0700 ChatGPT for Monocle[4775:1088487] [connection] nw_endpoint_handler_add_write_request [C1.1.1.1 104.18.6.192:443 failed channel-flow (satisfied (Path is satisfied), viable, interface: en0[802.11], ipv4, ipv6, dns)] Cannot send after flow table is released 2023-05-23 16:33:49.445773-0700 ChatGPT for Monocle[4775:1088487] [connection] nw_write_request_report [C1] Send failed with error "Socket is not connected" 2023-05-23 16:33:49.446925-0700 ChatGPT for Monocle[4775:1088487] Connection 1: received failure notification 2023-05-23 16:33:49.447348-0700 ChatGPT for Monocle[4775:1088487] Connection 1: write error 1:57 2023-05-23 16:33:49.464436-0700 ChatGPT for Monocle[4775:1088487] [connection] nw_endpoint_handler_unregister_context [C1.1.1.1 104.18.6.192:443 failed channel-flow (satisfied (Path is satisfied), viable, interface: en0[802.11], ipv4, ipv6, dns)] Cannot unregister after flow table is released 2023-05-23 16:33:49.464974-0700 ChatGPT for Monocle[4775:1088487] [] nw_endpoint_flow_fillout_data_transfer_snapshot copy_info() returned NULL Case 2: 2023-05-23 16:34:09.422783-0700 ChatGPT for Monocle[4775:1088784] [connection] nw_read_request_report [C3] Receive failed with error "Socket is not connected" 2023-05-23 16:34:09.423511-0700 ChatGPT for Monocle[4775:1088784] [connection] nw_read_request_report [C3] Receive failed with error "Socket is not connected" 2023-05-23 16:34:09.425478-0700 ChatGPT for Monocle[4775:1088784] [connection] nw_read_request_report [C3] Receive failed with error "Socket is not connected" 2023-05-23 16:34:09.434263-0700 ChatGPT for Monocle[4775:1088784] [quic] quic_conn_send_frames_for_key_state_block_invoke [C3.1.1.1:2] [-01809801f02b5c3795812501322b6f9d3c91236f] unable to request outbound data The code that is generating these requests is fairly straightforward: public func send(query: String, apiKey: String, model: String, completion: @escaping (String, ChatGPTError?) -> Void) { let requestHeader = [ "Authorization": "Bearer \(apiKey)", "Content-Type": "application/json" ] _payload["model"] = model if var messages = _payload["messages"] as? [[String: String]] { messages.append([ "role": "user", "content": "\(query)" ]) _payload["messages"] = messages } let jsonPayload = try? JSONSerialization.data(withJSONObject: _payload) let url = URL(string: "https://api.openai.com/v1/chat/completions")! var request = URLRequest(url: url) request.httpMethod = "POST" request.allHTTPHeaderFields = requestHeader request.httpBody = jsonPayload _task = URLSession.shared.dataTask(with: request) { data, response, error in if let error = error { DispatchQueue.main.async { completion("", ChatGPTError.networkRequestFailed(error: error)) } return } if let data = data { let (contentError, response) = self.extractContent(from: data) if let contentError = contentError { DispatchQueue.main.async { completion("", contentError) } } else if let response = response { DispatchQueue.main.async { completion(response, nil) } } return } DispatchQueue.main.async { completion("", ChatGPTError.responsePayloadParseError) } } _task?.resume() } Questions Is there any way to make this process more reliable? I assume the error messages are meaningful and should not be ignored. If not, will I end up encountering issues when trying to upload larger payloads? Thank you! -- B.
Posted
by
Post not yet marked as solved
0 Replies
433 Views
As a result, I judged this phenomenon to be an iOS bug. In a technical article by some knowledgeable people, CoreBluetooth said that when it goes into the background, it goes into passive scanning instead of active scanning. So I actually checked. First, send the advertised data on the BLE module board. Next, when the app side receives the advertised data, it skips the scan request. When the BLE module board receives a scan request, it will send a scan response. As a result, the strange thing was that the app was able to get the scan response whether it was in the foreground or the background. But it was one of confusion rather than joy. As a test, if the BLE module board side changes the data packet of the scan response while the application side is in the background state and resends it, the application side does not acquire the changed data. For some reason it returns the past scan response data acquired in the foreground. Why is the specification to return the past scan response? Or am I doing something wrong? I saw the official documentation about this, but there is no description anywhere in the iOS specification. I don't care about any information, so I would like to borrow wisdom from all the experts. thank you.
Posted
by
Post not yet marked as solved
0 Replies
283 Views
I'm initialising my CBPeripheralManager with the option [CBPeripheralManagerOptionShowPowerAlertKey: false] but this key does not suppress the system alert if the bluetooth is either turned off from Settings app or the control centre. Is there a way to disable this alert?
Posted
by
Post not yet marked as solved
0 Replies
411 Views
Hi everybody, In my app when I do following steps: I don't allow access to bluetooth for my app I start the pairing Then I navigate to settings and enable bluetooth access and coming back to the app. I see two different behaviours in two different OS version **So for iOS 15: It is opening me the home screen and I must start the pairing again. for iOS 16: It is opening the view that asks from user "Do you want to perform connection?" and I should select there again if I want or not and then pairing starts again.** Is it because of iOS versions that we cannot really influence on it? Because the implementation is same for both OS version. That is why I started to think that it is not a bug, but it is a iOS related feature. Can you share your ideas about it? If it is iOS related, is there any documentation that I can read? I have searched but couldn't find... Thanks in advance!
Posted
by
Post not yet marked as solved
0 Replies
384 Views
Does the iPhone or iPad support reception of the following communication standards? If so, please let me know if there is an swift API available. ・Bluetooth 5.x Long Range ・Wi-Fi Neighbor Awareness Networking (Wi-Fi Aware) ・Wi-Fi Beacon
Posted
by
Post not yet marked as solved
0 Replies
326 Views
I have been looking into this concept off and on for a while and came across this previous post. The answer to their question was no due to the fact that they seemed to want a more guaranteed version of data transmission. But what if you don't care about this? I am attempting to make an experiment of a system to swap data between instances of a game while the app isn't open. (Optional of course, for battery and privacy reasons.) If the app detects the broadcasted data from the other app instance, it will save this and use it for optional game features. Imagine you can decorate a simple house, the data of this house is made as small as possible, and then broadcast for other instances of the game to download and allow players to view, with the received data only being shown after a random period of 2-8 hours in order to minimize the possibility of tracking. For this example, it is not mandatory for the data to make it to the peer's phone or vice versa, it would just be nice if it did. Is this possible in the iOS background bluetooth system?
Posted
by
Post not yet marked as solved
0 Replies
832 Views
Hello, I am working with Core bluetooth functionality incase of iOS. In one of our bluetooth hardware using pairing key to pair device. When the device is turned off and turned on again and we try to connect same device its giving us above bluetooth error of Code=14 "Peer removed pairing information" The only way to reconnect this device is to forget that from setting and reconnect. I am aware about answers regarding following above steps. But we required any other way as in our application we are connecting again device automatically and its always stopping users from background connect. In case of Android OS the Android OS is asking pairing key again and no steps required for forgetting it. So is any similar options available for iOS in latest OS or fix is pending from iOS ? Thanks
Posted
by
Post not yet marked as solved
1 Replies
390 Views
Hi There, I am currently coding an app which uses the CoreBluetooth Function to scan for nearby peripherals. I keep finding myself an error when I specifically click on my Bluetooth page. The error I am met with is: "Thread 1: "String does not represent a valid UUID"". I have tried my luck with fixing this error but can't see to find the root of the problem. Help would kindly be appreciated In finding how to fix this. Cheers, hupfawil2023
Posted
by
Post not yet marked as solved
0 Replies
359 Views
I create a gatt over br/edr link with my watch on ios 16, my watch is a peripheral device as gatts , iphone as a central device to connect my watch by gatt over br/edr , the BLE link is not connected ... my watch need to connect ancs service as gattc , done ios support gattc connection on gatt over br/edr link?
Posted
by
Post not yet marked as solved
0 Replies
448 Views
How do I use Core Bluetooth in the simplest possible way to send a value of 0 to 1 from an iOS device to a bluetooth peripheral that does nothing but interpret the value sent to it as how strongly a vibrating component on the bluetooth peripheral should vibrate. A value of zero would mean the peripheral device doesn't vibrate at all, of course. The bluetooth peripheral would be the bluetooth ***** of course, and the iOS device would be the bluetooth master. The ***** device doesn't need to send anything at all to the master iOS device, except to link to the master. I don't know if that would allow the ***** bluetooth device to be any less expensive or smaller or simpler.
Posted
by
Post not yet marked as solved
0 Replies
420 Views
Hi is it possible to advertise any data at background that can be parsed by other central device? While your app is in the background, the local name isn’t advertised and all service UUIDs are in the overflow area. How to read/parse overflow area? Thanks
Posted
by