MedM DeviceKit
BluetoothState.h
Go to the documentation of this file.
1 //
2 // BluetoothState.h
3 // MedMDeviceKit
4 //
5 // Copyright © 2022 MedM. All rights reserved.
6 //
7 
8 #ifndef BluetoothState_h
9 #define BluetoothState_h
10 
11 #import <CoreBluetooth/CoreBluetooth.h>
12 
13 typedef NS_ENUM(int, BluetoothStateValue) {
14  BluetoothStateUnknown NS_SWIFT_NAME(unknown),
15  BluetoothStateOn NS_SWIFT_NAME(on),
16  BluetoothStateOff NS_SWIFT_NAME(off),
17  BluetoothStateUnauthorized NS_SWIFT_NAME(unauthorized)
18 } NS_SWIFT_NAME(BluetoothState.Value);
19 
20 @protocol BluetoothStateListener<NSObject>
21 
22 -(void)onStateChanged:(BluetoothStateValue)state;
23 
24 @end
25 
29 @interface BluetoothState : NSObject<CBCentralManagerDelegate>
30 {
31 @private
32  NSMutableArray<id<BluetoothStateListener>>* m_listeners;
33  CBCentralManager* m_manager;
34 }
35 
36 -(void)addListener:(id<BluetoothStateListener>)listener;
37 -(void)removeListener:(id<BluetoothStateListener>)listener;
38 
40 -(BluetoothStateValue)getValue;
41 
42 @end
43 
44 #endif /* BluetoothState_h */
Object that allows listening of the current bluetooth state.
Definition: BluetoothState.h:29
Definition: BluetoothState.h:14
Definition: BluetoothState.h:20
Definition: BluetoothState.h:17
BluetoothStateValue
Definition: BluetoothState.h:13
Definition: BluetoothState.h:15
Definition: BluetoothState.h:16