core-bluetooth

Xcode 8.0 CBCentralManager Issue

試著忘記壹切 提交于 2019-12-04 05:37:42
问题 I recently downloaded Xcode 8.0 and trying to run my previous project which uses core bluetooth. I have enabled Use Legacy Swift Language Version in build setting for compatibility in swift 2.3 everything works, but one Issue occured, func centralManagerDidUpdateState(central: CBCentralManager) { print("state is \(central.state.rawValue)") if (central.state == CBCentralManagerState.PoweredOn) { self.centralManager?.scanForPeripheralsWithServices([serviceUUID], options: nil) } else { // do

iOS Detect Bluetooth connection/disconnection

谁说我不能喝 提交于 2019-12-04 04:28:03
Is it possible to be notified when a Bluetooth Device is connected or disconnected from iOS even when my app is in background ? On Android, I use the ACTION_ACL_CONNECTED and ACTION_ACL_DISCONNECTED events. But I cannot find equivalents for iOS. I found the CBCentralManager that can be used to monitor Bluetooth events, but my functions aren't called when a bluetooth device is connected/disconnected, only when I enable/disable the bluetooth. Is it an error on my side or is it normal ? I also found the doc about Audio Route changes, that can also be an idea to detect the bluetooth connections

Core Bluetooth doesn't find peripherals when scanning for specific CBUUID

孤者浪人 提交于 2019-12-04 04:26:13
It seems this question was "answered" here , but without any code to show what they did differently I'm having to ask a new question. I have my own code with the same behaviour, where scanning for specific CBUUIDs using Core Bluetooth's CBCentralManager on OS X doesn't discover an iOS device acting as a peripheral with CBPeripheralManager (unless it and its services have previously been discovered). To see if it's something wrong in my code, I downloaded Apple's sample code . Running the sample code on two iOS devices works as intended, however when copying the CBCentralManager code to an OS X

Connection Interval Core Bluetooth

我是研究僧i 提交于 2019-12-04 04:24:27
问题 Is there any way to change connection interval through Core Bluetooth? I am transferring chunks of data to Peripheral and it's talking much time to transfer the data. I want to reduce this time. Please let me know, if it is possible to write or update the connection interval from iOS using core bluetooth. Thank You 回答1: Only by sending connection parameter update from your Peripheral to iOS. Min:20ms (parameter=16) Max:40 (parameter=32) is best legal parameters according to CoreBluetooth.

CoreBluetooth in Background at Scheduled Time

 ̄綄美尐妖づ 提交于 2019-12-04 04:16:33
Problem: I need to remain disconnected from a BLE peripheral but send data it's data to a server for processing as often as possible, as it is potentially time-critical. In other words, I want to connect every so often and send the synced data to an API, while remaining disconnected at all other times to save battery life. Failed Attempt: Setting the UIBackgroundModes field of my app's Info.plist file to bluetooth-central only gives me background execution while I am connected. I want to remain disconnected, but reconnect at predefined intervals, as well as schedule an alarm from background

How to get the list of the paired devices through Bluetooth in iOS?

家住魔仙堡 提交于 2019-12-04 03:47:27
问题 It's for AppStore, so I don't want any private framework. I want to get the list of the paired(even not connected). There are Core Bluetooth and External Accessary frameworks in iOS. I tried both of these, but nothing listed. 回答1: Tyr to use this one but i'm not sure its working or not for offline devices. Create EAAccessory object and initialize it. And then call the property name on your accessory object NSArray *accessories = [[EAAccessoryManager sharedAccessoryManager]

How To Store a CBPeripheral For Use in Other Views

谁说我不能喝 提交于 2019-12-04 03:07:36
I setup a few BLE connections in my view controller, SViewController, and I need to store the peripherals for use in other view controllers. I've tried creating an NSUserDefault object and storing the peripherals in there, but I got the error "Attempt to insert non-property value" , and it never inserted. I then tried wrapping it up in an NSData object and storing it in NSUserDefaults, but got the error "-[CBConcretePeripheral encodeWithCoder:]: unrecognized selector sent" and the app crashed. So that definitely did not work. I've also tried making the three CBPeripheral variables global, but

What, exactly, is a BLE connected device on iOS?

我是研究僧i 提交于 2019-12-04 03:03:51
问题 The CBCentralManager retrieveConnectedPeripherals method says it gets "the list of the peripherals currently connected to the system." The definition of system is a bit ambiguous here. Does this mean I get a list of peripherals connected to my app, or a list of peripherals connected to any app? If I can get peripherals connected to another app, does this also mean multiple apps can connect to the same peripheral? Can this only happen if the app is in the foreground, or do I need to allow for

Parse Characterstic.Value to byte integer format

别来无恙 提交于 2019-12-04 02:45:09
问题 I am doing the Core Bluetooth application. I am able to connect the peripheral and read, write value from it. I need to parse the data which I am receiving through characteristic.value to integer format. I had the characteristic value as <011f6d00 00011100 00000000 04050701 05000569 07df0203 020b0d21 02ff33> . I have divided the data as per understanding. Please help me with the sample code for converting the data. As I am new to iOS observed many links but did not find the exact answer

iOS8 and BTLE | CBCentralManager unable to find peripherals

泪湿孤枕 提交于 2019-12-04 02:38:57
I have an iOS app that is connecting to a device (arduino) using a BTLE. Everything is working fine on my iPad iOS 7. After upgrading to iOS 8, the CBCentralManager is not finding any peripherals. - (void)startScanningForSupportedUUIDs { [self.centralManager scanForPeripheralsWithServices:nil options:nil]; } I don't know what can be the problem. I have the solution, for some reason in iOS 8 there is some delay after instantiate your CBManager. You need to start to scan when the CBCentralManager is on, in this method: -(void)centralManagerDidUpdateState:(CBCentralManager *)central{ switch