core-bluetooth

How To Store a CBPeripheral For Use in Other Views

孤街浪徒 提交于 2019-12-05 20:28:28
问题 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

What causes CBCentralManagerStateUnknown in iOS?

天涯浪子 提交于 2019-12-05 18:22:27
问题 Why do I get CBCentralManagerStateUnknown on an iPad 2 when using this simple code? - (BOOL)viewDidLoad { bluetoothManager = [[CBCentralManager alloc] initWithDelegate:self queue:nil]; if ([manager state] == CBCentralManagerStatePoweredOff) NSLog(@"CBCentralManagerStatePoweredOff"); if ([manager state] == CBCentralManagerStatePoweredOn) NSLog(@"CBCentralManagerStatePoweredOn"); if ([manager state] == CBCentralManagerStateResetting) NSLog(@"CBCentralManagerStateResetting"); if ([manager state]

CBPeripheralManager connection callback

心已入冬 提交于 2019-12-05 17:30:55
I'm trying to set up a bluetooth connection between two iOS devices. The idea is that one device offers a service and multiple devices connect to it: Device A (service): User slides through a presentation Device B (multiple clients): User watches the presentation, no interaction In my understanding the one which offers the service should advertise it and respectively be the peripheral by creating a CBPeripheralManager and implement the CBPeripheralManagerDelegate -> Device A On the other side, there are multiple central devices which scan for peripherals using the CBCentralManager and

CoreBluetooth: Refreshing local name of an already discovered Peripheral

∥☆過路亽.° 提交于 2019-12-05 17:10:09
问题 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? 回答1: Apple's bug. Still present in iOS 6.1. Here is the trick how to reset CB cache:

Is it possible use RFCOMM in iOS?

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-05 16:02:35
I'm relatively new in iOS development. I want to make a cross-platform Bluetooth app, in Android, I use RFCOMM to send custom data, like strings. When I googled 'iOS Bluetooth', I've found the Core Bluetooth framework in the results, it seems to be made for low-energy connections. I only want to use RFCOMM instead of other profiles because of two reasons: I use RFCOMM to send custom data, like strings. I want my app to be able to connect with non-apple devices. Is it even possible to use RFCOMM in iOS? If not, are there any workarounds to connect with non-apple devices? no, 'core bluetooth' on

Core Bluetooth slow down when sending packets

荒凉一梦 提交于 2019-12-05 15:17:23
问题 I'm experiencing an issue where the time between writing a value to a characteristic using the [peripheral writeValue:dataPacket forCharacteristic:writeChar type:CBCharacteristicWithResponse] and the iOS device actually physically sending the bluetooth packet is progressively taking longer and longer. This can be illustrated in the following output from the debugger: 2013-10-23 14:12:17.510 Test App iOS[1561:60b] Packet sent 2013-10-23 14:12:17.595 Test App iOS[1561:60b] Packet sent

iPhone: How to erase/wipe out bluetooth 4.0 data

戏子无情 提交于 2019-12-05 09:01:33
I am having some major trouble with my Bluetooth Low Energy application sometimes dont manage to connect to my device (described in thread). I need to wipe out all stored data from previous connections before running my application, and as far as I know, this can only be done by rebooting the phone. Is there any other way, preferably programatically, to do this? Thank you I am having the same issue and have found the steps to reproduce it. It is 100% reproducible when you transmit data to the peripheral with [peripheral writeValue:x forCharacteristic:y type:CBCharacteristicWriteWithoutResponse

BLE MTU higher but speed is the same

99封情书 提交于 2019-12-05 08:57:29
I'm playing around with CoreBluetooth in iOS 7, and have successfully got two devices sending quite a large amount of data between each other (one is the central, one is the peripheral). Between an iPhone 5 and 4S I had an MTU of 20 bytes, and between an iPhone 5s and iPhone 5 I had an MTU of 132 bytes. The size is much larger, so I assumed fewer individual messages would be sent and therefore the overall time of the transfer would decrease. Unfortunately the time remains pretty much the same in both scenarios (around 15 seconds). Was my original assumption incorrect or is there something I

iOS CoreBluetooth: startAdvertising() Error advertising static data

怎甘沉沦 提交于 2019-12-05 06:24:18
I want to advertise static data. I'm using Swift 2.2.1 and CoreBluetooth on iOS. My app builds bluetooth Services and their corresponding Characteristics , then calls startAdvertising() , and the peripheralManagerDidStartAdvertising90 callback returns this error: peripheralManagerDidStartAdvertising encountered an error. // Mine One or more parameters were invalid. // ...from Apple CoreBluetooth nil // ... return value from Apple CoreBluetooth callback I'm relatively new to Swift and iOS development so my guess is that I'm doing something goofy, but so far I can't figure out what. I'll attempt

iOS CoreBluetooth Simultaneous Peripheral and Central Managers

ぃ、小莉子 提交于 2019-12-05 06:16:18
问题 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.