cbcentralmanager

Can BLE iOS device be peripheral and central at the same time?

倖福魔咒の 提交于 2019-12-11 04:52:44
问题 Is there any possibility to have both peripheral and central mode available at the same time? In that case we are advertising as peripheral while listening for advertisements of other devices. Thanks 回答1: Yes - You can Althpough the same device being central and peribheral at the same time is not standard as pe Bluetooth current specification, iOS currently supports it 来源: https://stackoverflow.com/questions/14599784/can-ble-ios-device-be-peripheral-and-central-at-the-same-time

Objective-c bluetooth says it's connected but CBCentralManager does not discover it

走远了吗. 提交于 2019-12-11 04:33:12
问题 In my app, I search for previously connected devices with the delegate method retrieveConnectedPeripheralsWithServices first, then scan for nearby devices if nothing is found. Here is the code - (void)searchForPeripherals { NSLog(@"*** scanning for Bluetooth peripherals... ***"); //Check to see if any devices were connected already if(self.ourPeripheral != nil) { [self connectToDevice]; } else { //Search for previously paired devices... bool foundPairedDevices = [self

CoreBluetooth - Writing data from Central to Peripheral

China☆狼群 提交于 2019-12-10 12:13:25
问题 I referred Sample app provided by Apple for CoreBluetooth and I succeeded in sending Data from Peripheral to Central, Now I need to write Data from Central to Peripheral. After Googling i found that It can be done using [_discoveredPeripheral writeValue:aData forCharacteristic:charc type:CBCharacteristicWriteWithResponse]; Following is my Implementation of Central, to send Message to peripheral: -(void)sendMessage:(NSString *)strMessage{ NSData *aData = [strMessage dataUsingEncoding

How to convert value of Type 'CBManagerState' to expected type 'CBCentralManagerState' after conversion to Swift 3.0 syntax?

*爱你&永不变心* 提交于 2019-12-10 11:36:50
问题 I am working on an iOS App which uses the CoreBluetooth Central Manager. The app was working as expected, until I updated to xCode 8. This update somehow forced me to convert the code from Swift 2.3 to Swift 3.0 with the conversion manager. After this, I got the error message 'cannot convert value of Type 'CBManagerState' to expected argument type 'CBCentralManagerState' and I was searching for an answer, but due to the reason the update is new, there aren't any helpful issues or

When would CBCentralManager's state ever be powered on but still give me a “not powered on” warning?

ぐ巨炮叔叔 提交于 2019-12-09 02:27:46
问题 I keep getting this error when I run my app that uses CoreBluetooth on an iPhone 5: <CBConcreteCentralManager: 0x2007d590> is not powered on But when I call state on my program's one and only CBCentralManager object, it returns 5, which is CBCentralManagerStatePoweredOn. So it's powered on, yet I get this error. The iPhone's Bluetooth is also enabled. Just in general, when would this ever happen? I don't even know what is going on when the program runs because I'm getting what looks like

How to find the specific BLE 4.0 peripheral from two devices with same service UUID

瘦欲@ 提交于 2019-12-08 07:35:57
问题 For BLE 4.0, it provides API to discover peripherals with array of service UUID. I just want to find the specific one. How to achieve this ? If need assign the identifier to the specific device, how to do it ? (I think my question need some context of core bluetooth of iOS. ) 回答1: The process for reconnecting to known peripherals is described in the Core Bluetooth Programming Guide. Essentially if you know the UUID of the device you want to reconnect to (which is the identifier property of

How to send RGB signal to BLE device using iPhone application?

一个人想着一个人 提交于 2019-12-07 12:38:28
We are working on iOS application and in which we need to pass the RGB signal to the BLE device and based on RGB code the device LED will glow. We are doing the connection using CBCentralManager for the CBPeripheral object of Bluetooth Framework in iOS app. We are setting the characteristic and descriptor UUID but still we are not able to send the signal on the BLE device. Here is the code we are using to pass RGB data in hex bytes format. - (void)centralManager:(CBCentralManager )central didConnectPeripheral:(CBPeripheral )peripheral { NSLog(@"connect peripheral"); unsigned char bytes[] = {

A way to uniquely identify a BTLE device

大憨熊 提交于 2019-12-07 04:23:10
问题 Is there a way to uniquely identify a BTLE device (something like hardware ID)? I have 2 hardware BTLE devices and 2 soft BTLE devices (using CBCentralManager). All these devices are sending same UUID. I want to identify the exact BTLE device when all the devices are lying near me. Any clue? 回答1: The devices should have unique Bluetooth addresses. If they don't then you wouldn't be able to properly connect to them without them interfering with each other. However, with BTLE it's possible for

centralManagerDidUpdateState returns power off iOS 11-Beta 4

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-06 08:39:40
问题 I'm working with CoreBluetooth and I'm using CBCentralManager and its delegates. But the problem is that when I run my code in iOS 11-Beta 4 I get power off state in delegate - (void)centralManagerDidUpdateState:(CBCentralManager *)central while bluetooth is ON. When I turn bluetooth off and then turn it back to on, it returns power on. Also it is working fine in iOS 10 and 9. The peripheral is working fine too and it is discoverable using LightBlue application in iOS 11-Beta 4. I'm not sure

Peripheral transmit queue issue

£可爱£侵袭症+ 提交于 2019-12-06 08:38:22
问题 I’m working on a simple wrapper around CoreBluetooth to send any data to any device. During developing I encountered a lot of bugs in framework, they were very annoying and to make my wrapper stable I had to shorten some of functionality for reliability. For now I’m working on sending data from peripheral. Ok, so I have following case: Client asks for value of dynamic characteristic I get a callback on server-side - peripheral:didReceiveReadRequest:. Note : I need to respond to this