core-bluetooth

CoreBluetooth[WARNING] Unknown error: 14 on iPhone 5

僤鯓⒐⒋嵵緔 提交于 2019-12-04 02:35:35
I am able to connect to a peripheral device using BLE, but shortly after reading some characteristics, the framework returns: CoreBluetooth[WARNING] Unknown error: 14 and the peripheral is disconnected. Looking at the BT Core_V4.0 spec, I am not sure what the error means. Is the 14 a hex value? does it mean the following error according to the spec: (Part D Section 2 - Error Codes) 2.20 REMOTE DEVICE TERMINATED CONNECTION DUE TO LOW RESOURCES (0X14) The Remote Device Terminated Connection due to Low Resources error code indicates that the remote device terminated the connection because of low

CoreBluetooth: Refreshing local name of an already discovered Peripheral

我是研究僧i 提交于 2019-12-04 02:03:46
I successfully discover a Peripheral and retrieve its local name: [advertisementData objectForKey:CBAdvertisementDataLocalNameKey] But if the Peripheral stops and restarts advertising with a different local name, the Client doesn't recognise the change. I guess - (void)peripheralDidUpdateName:(CBPeripheral *)peripheral only works if the two devices are paired. Is there a way to get an update without pairing? Apple's bug. Still present in iOS 6.1. Here is the trick how to reset CB cache: BackUP device to iCloud. Reset network settings. Delete your app and install it back via Xode At this point,

How to pass self to initializer during initialization of an object in Swift?

泄露秘密 提交于 2019-12-04 00:19:04
问题 I have the following code: import CoreBluetooth class BrowserSample: NSObject, CBCentralManagerDelegate { let central : CBCentralManager init() { central = CBCentralManager(delegate: self, queue: nil, options: nil) super.init() } func centralManagerDidUpdateState(central: CBCentralManager!) { } } If I put the central = line before super.init() , then I get the error: self used before super.init() call If I put it after, I get the error: Property self.central not initialized at super.init call

iOS CoreBluetooth Simultaneous Peripheral and Central Managers

江枫思渺然 提交于 2019-12-03 21:38:04
I am developing an app to synchronize information between ios devices via bluetooth. I have tried keeping the CentralManager and PeripheralManager running simultaneously, and when one manager connects, stopping the other. This works, but only intermittantly. At some point the CentralManager seems to have trouble connecting to new peripherals, discovering services etc.I went back a started with the Apple BTLE-Transfer project, abstracting manager classes and then running thm simultaneously. Everything works well until they are both active simultaneously. This seems to be similar to what others

iOS BLE - How to keep app active in the background?

╄→尐↘猪︶ㄣ 提交于 2019-12-03 21:33:43
I am trying to find a clever way to keep a BLE app active in the background on iOS 6, without breaking any of Apple's rules. I plan to use the phone as a peripheral device and another BLE circuit as the central. My app will automatically be opened when a user arrives to a building using geofencing. After that the iPhone will connect to the first BLE central device it sees (the device will be in its white list). The user will then be able to move throughout the building switching to different BLE "nodes". My question is: What do I need to do in the background when a user is stationary at their

CoreBluetooth cannot find devices but iOS can

六月ゝ 毕业季﹏ 提交于 2019-12-03 20:37:15
I have a bluetooth barcode scanner whose spec says it's bluetooth 2.0, class 2. It is strange because my iPhone 5 (iOS7) could find and connect it. I thought iOS only connects BLE devices. But in my app I couldn't scan this device. I've no idea if this is because its bluetooth spec. I wish someone could give me some advices about how to connect this device in my app using CoreBluetooth or some other valid libs. By the way my code is correct because I could find LightBlue app on another iPhone. My code is as following: // state is PowerOn [_centeralManager scanForPeripheralsWithServices:nil

BLE Swift write characterisitc

心已入冬 提交于 2019-12-03 16:30:18
I am trying hard to get my TI sensortag temperature sensor to notify. According to http://processors.wiki.ti.com/images/a/a8/BLE_SensorTag_GATT_Server.pdf I need to set the value of the characteristic with UUID F000AA02-0451-4000-B000-000000000000 to "01:00". Here is what I do: import UIKit import CoreBluetooth class ViewController: UIViewController, CBCentralManagerDelegate, CBPeripheralDelegate{ var centralManager:CBCentralManager! var blueToothReady = false var connectingPeripheral: CBPeripheral! @IBOutlet weak var textField: UITextView! override func didReceiveMemoryWarning() { super

iOS CoreBluetooth: State Preservation and Restoration

不羁的心 提交于 2019-12-03 16:05:35
hope to get some input here. In my current iOS project I am using CoreBluetooth with swift. The app is enabled to communicate using CoreBluetooth in the background which basically works, kind of. The peripheral requires to have an active connection with the iOS device in order to work as expected. Whenever the connection breaks, the peripheral stops it current action. This also happens when the app is closed due to memory pressure. In that case the peripheral should not stop working, so there's a problem. In order to solve it, I followed apples core bluetooth programming guide to implement the

Raspberry Pi Bluetooth 4.0 Connection

£可爱£侵袭症+ 提交于 2019-12-03 13:47:52
I am trying to connect to a Raspberry Pi via iPhone using CoreBluetooth (bluetooth 4.0). I have discovered the device and send out a connection request using this code: if (peripheral != self.foundPeripheral) { NSLog(@"Try to connect to %@", peripheral.name); self.foundPeripheral = peripheral; [self.centralManager stopScan]; [self.centralManager connectPeripheral:peripheral options:nil]; } Neither the didConnectPeripheral or didFailedToConnectPeripheral are called. I also made sure to set the RPi to advertise bluetooth low energy using sudo hciconfig hci0 leadv but when I check active

CoreBluetooth advertising in background on iOS 10

a 夏天 提交于 2019-12-03 13:33:24
First: I have an iPad Air 2, and an iPhone 7. For further reading we estimate that the app is active and open on iPad and in background mode on iPhone. The app is exactly the same, even with same Bluetooth Service UUIDs and same DataLocalNameKey. I want to write an app that can advertise a bluetooth service in background and is able to discover this service (optimal in background too). As I already read I can't use apples beacon technology cause there it's only possible to get scanning/notified by beacons in near in background (I tested this, works fine) but not to advertise. So I started to