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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
//
//  TYBLECentralManager+Discovery.h
//  Pods-TYBluetooth_Example
//
//  Created by 黄凯 on 2019/4/19.
//
 
#import "TYBLECentralManager.h"
 
NS_ASSUME_NONNULL_BEGIN
 
@interface TYBLECentralManager (Discovery)
 
/**
 扫描到的设备
 */
@property (nonatomic, strong, readonly) NSArray<TYBLEPeripheral *> *discoveredDevices;
 
@property (nonatomic, assign) BOOL shouldAutoDiscoveryWhenCenteralPoweredOn;
 
/**
 添加发现代理
 
 @param delegate 发现代理
 */
- (void)addDiscoveryDelegate:(id<TYBLECentralManagerDiscoveryDelegate>)delegate;
 
/**
 移除发现代理
 
 @param delegate 发现代理
 */
- (void)removeDiscoveryDelegate:(id<TYBLECentralManagerDiscoveryDelegate>)delegate;
 
/**
 *  扫描周围所有BLE设备
 *
 *  @param timeout 超时时间
 */
- (void)scanForPeripheralsWithServices:(nullable NSArray<CBUUID *> *)serviceUUIDs options:(nullable NSDictionary<NSString *, id> *)options timeout:(NSTimeInterval)timeout;
 
/**
 *  扫描周围所有BLE设备
 *
 *  @param timeout 超时时间
 */
- (void)scanForPeripherals:(NSTimeInterval)timeout;
 
- (NSArray<CBPeripheral *> *)retrievePeripheralsWithIdentifiers:(NSArray<NSUUID *> *)identifiers;
- (NSArray<CBPeripheral *> *)retrieveConnectedPeripheralsWithServices:(NSArray<CBUUID *> *)serviceUUIDs;
 
/**
 *  停止扫描
 */
- (void)stopScan;
 
/**
 清理扫描的缓存
 */
- (void)cleanScanedCache;
 
@end
 
NS_ASSUME_NONNULL_END