1
wei
2021-01-21 62d098cb78296feaa6f786a20748921338db838c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
//
//  TYBLECentralManagerProtocol.h
//  TYBluetooth
//
//  Created by 黄凯 on 2019/6/5.
//
 
#ifndef TYBLECentralManagerProtocol_h
#define TYBLECentralManagerProtocol_h
 
#import <CoreBluetooth/CoreBluetooth.h>
 
typedef NS_ENUM(NSInteger, TYBLECentralManagerState) {
//    TYBLECentralManagerStateUnknown = 0,
//    TYBLECentralManagerStateResetting,
//    TYBLECentralManagerStateUnsupported,
    TYBLECentralManagerStateUnauthorized = 3, // 未打开应用蓝牙权限
    TYBLECentralManagerStatePoweredOff, // 系统蓝牙关闭
    TYBLECentralManagerStatePoweredOn, // 系统蓝牙打开
};
 
@class TYBLECentralManager;
@class TYBLEPeripheral;
@protocol TYBLECentralManagerDiscoveryDelegate <NSObject>
 
@property (nonatomic, copy, readonly) BOOL(^scanFilter)(NSDictionary *advertisementData, NSNumber *rssi);
 
- (void)centralManager:(TYBLECentralManager *)central didUpdateState:(BOOL)isPoweredOn;
 
- (void)centralManager:(TYBLECentralManager *)central didUpdateCentralState:(TYBLECentralManagerState)state;
 
- (void)centralManager:(TYBLECentralManager *)central didDiscoverPeripheral:(TYBLEPeripheral *)peripheral advertisementData:(NSDictionary *)advertisementData RSSI:(NSNumber *)RSSI;
 
@end
 
@protocol TYBLECentralManagerSessionDelegate <NSObject>
 
- (void)centralManager:(TYBLECentralManager *)central didConnectPeripheral:(TYBLEPeripheral *)peripheral;
- (void)centralManager:(TYBLECentralManager *)central didDisconnectPeripheral:(TYBLEPeripheral *)peripheral error:(NSError *)error;
- (void)centralManager:(TYBLECentralManager *)central didFailToConnectPeripheral:(TYBLEPeripheral *)peripheral error:(NSError *)error;
 
@end
 
#endif /* TYBLECentralManagerProtocol_h */