Platforms to show: All Mac Windows Linux Cross-Platform

Back to CBCentralManagerMBS class.

CBCentralManagerMBS.DidConnectPeripheral(peripheral as CBPeripheralMBS)

Type Topic Plugin Version macOS Windows Linux iOS Targets
event Bluetooth MBS Bluetooth Plugin 18.1 ✅ Yes ❌ No ❌ No ❌ No
Invoked when a connection is successfully created with a peripheral.

peripheral: The peripheral that has been connected to the system.

This method is invoked when a call to connectPeripheral is successful. You typically implement this method to set the peripheral’s delegate and to discover its services.

Some examples using this event:

CBCentralManagerMBS.DidDisconnectPeripheral(peripheral as CBPeripheralMBS, error as NSErrorMBS)

Type Topic Plugin Version macOS Windows Linux iOS Targets
event Bluetooth MBS Bluetooth Plugin 18.1 ✅ Yes ❌ No ❌ No ❌ No
Invoked when an existing connection with a peripheral is torn down.

peripheral: The peripheral that has been disconnected.
error: If an error occurred, the cause of the failure.

This method is invoked when a peripheral connected via the connectPeripheral method is disconnected. If the disconnection was not initiated by cancelPeripheralConnection, the cause is detailed in error. After this method is called, no more methods are invoked on the peripheral device’s CBPeripheralDelegate object.
Note that when a peripheral is disconnected, all of its services, characteristics, and characteristic descriptors are invalidated.

Some examples using this event:

CBCentralManagerMBS.DidDiscoverPeripheral(peripheral as CBPeripheralMBS, advertisementData as Dictionary, RSSI as String)

Type Topic Plugin Version macOS Windows Linux iOS Targets
event Bluetooth MBS Bluetooth Plugin 18.1 ✅ Yes ❌ No ❌ No ❌ No
Invoked when the central manager discovers a peripheral while scanning.

peripheral: The discovered peripheral.
advertisementData: A dictionary containing any advertisement data.
RSSI: The current received signal strength indicator (RSSI) of the peripheral, in decibels.

The advertisement data can be accessed through the keys listed in Advertisement Data Retrieval Keys. You must retain a local copy of the peripheral if any command is to be performed on it. In use cases where it makes sense for your app to automatically connect to a peripheral that is located within a certain range, you can use RSSI data to determine the proximity of a discovered peripheral device.

Some examples using this event:

CBCentralManagerMBS.DidFailToConnectPeripheral(peripheral as CBPeripheralMBS, error as NSErrorMBS)

Type Topic Plugin Version macOS Windows Linux iOS Targets
event Bluetooth MBS Bluetooth Plugin 18.1 ✅ Yes ❌ No ❌ No ❌ No
Invoked when the central manager fails to create a connection with a peripheral.

peripheral: The peripheral that failed to connect.
error: The cause of the failure.

This method is invoked when a connection initiated via the connectPeripheral method fails to complete. Because connection attempts do not time out, a failed connection usually indicates a transient issue, in which case you may attempt to connect to the peripheral again.

Some examples using this event:

CBCentralManagerMBS.DidUpdateState

Type Topic Plugin Version macOS Windows Linux iOS Targets
event Bluetooth MBS Bluetooth Plugin 18.1 ✅ Yes ❌ No ❌ No ❌ No
Invoked when the central manager’s state is updated.

You implement this required method to ensure that Bluetooth low energy is supported and available to use on the central device. You should issue commands to the central manager only when the state of the central manager is powered on, as indicated by the CBCentralManagerStatePoweredOn constant. A state with a value lower than CBCentralManagerStatePoweredOn implies that scanning has stopped and that any connected peripherals have been disconnected. If the state moves below CBCentralManagerStatePoweredOff, all CBPeripheral objects obtained from this central manager become invalid and must be retrieved or discovered again. For a complete list and discussion of the possible values representing the state of the central manager, see the CBCentralManagerState enumeration in CBCentralManager.

CBCentralManagerMBS.WillRestoreState(dict as dictionary)

Type Topic Plugin Version macOS Windows Linux iOS Targets
event Bluetooth MBS Bluetooth Plugin 18.1 ✅ Yes ❌ No ❌ No ❌ No
Invoked when the central manager is about to be restored by the system.

dict: A dictionary containing information about the central manager that was preserved by the system at the time the app was terminated. For the available keys to this dictionary, see Central Manager State Restoration Options.

For apps that opt in to the state preservation and restoration feature of Core Bluetooth, this is the first method invoked when your app is relaunched into the background to complete some Bluetooth-related task. Use this method to synchronize the state of your app with the state of the Bluetooth system.

The items on this page are in the following plugins: MBS Bluetooth Plugin.


The biggest plugin in space...