Pixels Plugin for Unity
Enable communications with Pixels dice using Bluetooth Low Energy.
Loading...
Searching...
No Matches
SGBleCentralManagerDelegate.h
Go to the documentation of this file.
1
6#ifndef SGBleCentralManagerDelegate_h
7#define SGBleCentralManagerDelegate_h
8
9#import <Foundation/Foundation.h>
10#import <CoreBluetooth/CoreBluetooth.h>
11#import "SGBleTypes.h"
12
13NS_ASSUME_NONNULL_BEGIN
14
29@interface SGBleCentralManagerDelegate : NSObject<CBCentralManagerDelegate>
31{
32 NSObject *_startScanSync;
33 void (^_stateUpdateHandler)(CBManagerState state);
34 CBCentralManager *_centralManager;
35 NSMutableDictionary<NSUUID *,CBPeripheral *> *_peripherals;
36 NSMutableDictionary<CBPeripheral *, SGBleConnectionEventHandler> *_peripheralsConnectionEventHandlers;
37}
38
39// Property getters
40- (CBCentralManager *)centralManager;
41- (NSArray<CBPeripheral *> *)peripherals;
42- (bool)isBluetoothOn;
44
48@property(readonly, getter=centralManager) CBCentralManager *centralManager;
49
53@property(strong) SGBlePeripheralDiscoveryHandler peripheralDiscoveryHandler;
54
58@property(readonly, getter=peripherals) NSArray<CBPeripheral *> *peripherals;
59
63@property(nonatomic, readonly, getter=isBluetoothOn) bool isBluetoothOn;
64
74- (instancetype)initWithStateUpdateHandler:(nullable void (^)(CBManagerState state))stateUpdateHandler;
75
79- (void)clearPeripherals;
80
87- (nullable CBPeripheral *)peripheralForIdentifier:(NSUUID *)identifier;
88
97- (void)setConnectionEventHandler:(nullable SGBleConnectionEventHandler)peripheralConnectionEventHandler
98 forPeripheral:(CBPeripheral *)peripheral;
99
100@end
101
102NS_ASSUME_NONNULL_END
103
104#endif /* SGBleCentralManagerDelegate_h */
Definition of SGBleConnectionEvent and SGBleConnectionEventReason enumerations.
void(^ SGBleConnectionEventHandler)(CBPeripheral *_Nonnull peripheral, SGBleConnectionEvent connectionEvent, NSError *_Nullable error)
Peripheral connection event handler.
Definition SGBleTypes.h:136
void(^ SGBlePeripheralDiscoveryHandler)(CBPeripheral *_Nonnull peripheral, NSDictionary< NSString *, id > *_Nonnull advertisementData, NSNumber *_Nonnull rssi)
Peripheral discovery handler.
Definition SGBleTypes.h:130
Implementation of CBCentralManagerDelegate protocol. Stores and notifies of discovered Bluetooth Low ...
Definition SGBleCentralManagerDelegate.h:29
NSArray< CBPeripheral * > * peripherals
Gets the list of discovered peripherals.
Definition SGBleCentralManagerDelegate.h:58
CBCentralManager * centralManager
Gets the central manager associated with this instance.
Definition SGBleCentralManagerDelegate.h:48