Questions tagged [cbcentralmanager]

CBCentralManager is an object used by CoreBluetooth on OS X and iOS to manage peripheral devices.

CBCentralManager is an object used by CoreBluetooth on OS X and iOS to manage peripheral devices. On CBCentralManager, you can find the following methods:

Initializing a Central Manager

– initWithDelegate:queue:

– initWithDelegate:queue:options:

Establishing or Canceling Connections with Peripherals

– connectPeripheral:options:

– cancelPeripheralConnection:

Retrieving Lists of Peripherals

– retrieveConnectedPeripheralsWithServices:

– retrievePeripheralsWithIdentifiers:

– retrieveConnectedPeripherals Deprecated in iOS 7.0

– retrievePeripherals: Deprecated in iOS 7.0

Scanning or Stopping Scans of Peripherals

– scanForPeripheralsWithServices:options:

– stopScan

Monitoring Properties

state property

delegate property

235 questions
5
votes
1 answer

How to improve performance of CBCentralManager while CBPeripheralManager is active

We've created an iOS app that implements a CBCentralManager to connect to a device that we've created, that transmits data at 10Hz. It's vitally important that this data comes through and displays quickly, so we have built tight latency checks…
5
votes
2 answers

CBPeripheral advertisementData is different when discovering peripherals on OSX vs iOS (GAP/GATT)

I am hoping to port some of my CoreBluetooth code from iOS to OS X. I've set up a shared set of CoreBluetooth wrappers which are consumed by both an iOS app and an OS X app in exactly the same manner with the same BLE devices. Scanning for…
5
votes
0 answers

Error Domain=CBErrorDomain Code=7 "The specified device has disconnected from us

We need Get Data form BluetooothDevices to IOS devices.We are using core_bluetooth.frameworks. didDisconnectPeripheral call after didConnectPeripheral ever time.We got error is error is Error Domain=CBErrorDomain Code=7 "The specified device has…
5
votes
2 answers

Delegate not called on different thread

I am trying to use the CoreBluetooth framework and I have created a helper class (btHelper) to make code more maintainable and such. The problem is that in this helper class, the delegate methods are no longer being called like they were originally…
Teddy13
  • 3,824
  • 11
  • 42
  • 69
4
votes
0 answers

iOS Bluetooth Connection Stays Up if app Crashes with the Connection Active

I am facing a pretty odd issue with my users: for some reason I cannot identify so far, my app is crashing at some point when the Bluetooth connection is still active (my app is a Central Manager that connects to external Peripherals). The crash…
marcelosalloum
  • 3,481
  • 4
  • 39
  • 63
4
votes
1 answer

How do I read a peripheral's characteristic without pairing with the other device in Swift?

My app functions as both a central and a peripheral. I have the one device searching for another broadcasting my service UUID. This works fine until I connect to the peripheral. Then a "Bluetooth Pairing Request" appears on both devices asking to…
Jake
  • 319
  • 1
  • 7
  • 21
4
votes
1 answer

CBPeripheral, Get Local Peripheral Identifier

I faced a problem about CoreBluetooth Framework. As Example, I have two devices and each device performs both advertising and scanning. So, I use CBCentralManager and CBPeripheralManager on each. So, to simplify problem, let's assume that Device1 is…
Roman F
  • 135
  • 2
  • 7
4
votes
1 answer

CBPeripheral connection keep disconnecting after calling discoverServices

I'm trying to integrate the coreBluetooth within my application. Here is my code: @interface Central() @property (strong, nonatomic) CBPeripheral * activePeripheral; @property (strong, nonatomic) CBCentralManager *…
Maystro
  • 2,907
  • 8
  • 36
  • 71
4
votes
2 answers

CoreBluetooth Central --> Peripheral

I'm quite new to bluetooth communication. My first project intends to transfer data from an iOS device to a BLEshield (small chip). To test my central code, I decided to setup an iPhone as peripheral (the role the chip will have, once I got it) and…
4
votes
1 answer

scanForPeripheralsWithServices:return result twice on the same peripheral

I use the below code [centralManager scanForPeripheralsWithServices:serviceUUIDArray options:[NSDictionary dictionaryWithObject:[NSNumber numberWithBool:NO] forKey:CBCentralManagerScanOptionAllowDuplicatesKey]] to scan a…
Roby
  • 179
  • 2
  • 14
3
votes
1 answer

Scan for peripherals with services returns nothing

I'm trying to scan for a specific device by it's service uuid - in this case JBL speaker, in future cases, I would like to scan for devices inside a car. At first, I scanned for nearby peripherals with…
Keselme
  • 3,779
  • 7
  • 36
  • 68
3
votes
1 answer

Can't connect to BLE Peripheral in some iOS devices

BLE works fine on 7 Plus (iOS 14.4.2) and 6 (iOS 12). But on XR (14.4.2) and 11 connection stuck after centralManager.connect(peripheral, options: nil) (infinite connection) The peripheral is in connection mode because other smartphones cannot…
3
votes
1 answer

iOS 13 forces the app to show Bluetooth Permission Promt

I am working on a project that some of the apps require bluetooth permission and some of them do not. The ones do not require bluetoth started asking for the permissions in iOS 13. I disabled the configs that are asking for bluetooth, but still,…
jorjj
  • 1,479
  • 4
  • 20
  • 36
3
votes
1 answer

init CBCentralManager: Type of expression is ambiguous without more context

Trying to initialize a CBCentralManager in a Swift 4.2 project. Get the error shown in comment: import CoreBluetooth class SomeClass: NSObject, CBCentralManagerDelegate { // Type of expression is ambiguous without more context let manager:…
Mercutio
  • 1,152
  • 1
  • 14
  • 33
3
votes
0 answers

What is the expected behavior of CBCentralManager after it has received a an event of type .resetting

In the app that I am working on we have a mechanism in place to handle CBCentralManager's state change when func centralManagerDidUpdateState(_ central: CBCentralManager) fires and the incoming state is CBManagerState.poweredOff. We will keep track…
1
2
3
15 16