Pixels Plugin for Unity
Enable communications with Pixels dice using Bluetooth Low Energy.
Loading...
Searching...
No Matches
SGBleCentralManagerDelegate Class Reference

Implementation of CBCentralManagerDelegate protocol. Stores and notifies of discovered Bluetooth Low Energy (BLE) peripherals, also notifies of peripherals connection events and of the host device Bluetooth radio state changes. More...

#include <SGBleCentralManagerDelegate.h>

Inheritance diagram for SGBleCentralManagerDelegate:

Instance Methods

(instancetype) - initWithStateUpdateHandler:
 Initializes a SGBleCentralManagerDelegate instance with a Bluetooth state update handler.
 
(void) - clearPeripherals
 Clear the list of discovered peripherals.
 
(nullable CBPeripheral *) - peripheralForIdentifier:
 Gets the discovered CBPeripheral for the given UUID.
 
(void) - setConnectionEventHandler:forPeripheral:
 Sets the handler for notifying of the given peripheral's connection events.
 

Properties

CBCentralManager * centralManager
 Gets the central manager associated with this instance.
 
SGBlePeripheralDiscoveryHandler peripheralDiscoveryHandler
 Gets or set the handler for notifying of discovered peripherals.
 
NSArray< CBPeripheral * > * peripherals
 Gets the list of discovered peripherals.
 
bool isBluetoothOn
 Indicates whether the host device Bluetooth radio is turned on and accessible.
 

Detailed Description

Implementation of CBCentralManagerDelegate protocol. Stores and notifies of discovered Bluetooth Low Energy (BLE) peripherals, also notifies of peripherals connection events and of the host device Bluetooth radio state changes.

Upon SGBleCentralManagerDelegate initialization, an instance of this class creates a CBCentralManager object and set itself as the manager's delegate. The central manager is available through the centralManager property.

Method Documentation

◆ initWithStateUpdateHandler:

- (instancetype) initWithStateUpdateHandler: (nullable void(^)(CBManagerState state))  stateUpdateHandler

Initializes a SGBleCentralManagerDelegate instance with a Bluetooth state update handler.

Creates a CBCentralManager object and set itself as the manager's delegate. The manager is available through the centralManager property.

Parameters
stateUpdateHandlerThe handler for notifying of the host device Bluetooth state changes.
Returns
The initialized SGBleCentralManagerDelegate instance.

◆ peripheralForIdentifier:

- (CBPeripheral *) peripheralForIdentifier: (NSUUID *)  identifier

Gets the discovered CBPeripheral for the given UUID.

Parameters
identifierThe UUID assigned by the system to a BLE peripheral.
Returns
The CBPeripheral for the given UUID.

◆ setConnectionEventHandler:forPeripheral:

- (void) setConnectionEventHandler: (nullable SGBleConnectionEventHandler peripheralConnectionEventHandler
forPeripheral: (CBPeripheral *)  peripheral 

Sets the handler for notifying of the given peripheral's connection events.

Replace any handler previously set for this peripheral.

Parameters
peripheralConnectionEventHandlerThe handler for notifying connection events.
peripheralThe peripheral to watch for connection events.

The documentation for this class was generated from the following files: