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
//
//  TYBLECentralManager+Connection.h
//  Pods-TYBluetooth_Example
//
//  Created by 黄凯 on 2019/4/19.
//
 
#import <Foundation/Foundation.h>
#import "TYBLECentralManager.h"
#import "TYBLECentralManagerProtocol.h"
 
NS_ASSUME_NONNULL_BEGIN
 
@class TYBLEPeripheral;
@interface TYBLECentralManager (Connection)
 
/**
 添加连接代理
 
 @param delegate 代理
 */
- (void)addConnectionDelegate:(id<TYBLECentralManagerSessionDelegate>)delegate;
 
/**
 移除连接代理
 
 @param delegate 代理
 */
- (void)removeConnectionDelegate:(id<TYBLECentralManagerSessionDelegate>)delegate;
 
/**
 *  连接peripheral
 *
 *  @param peripheral 待连接的peripheral对象
 *  @param timeout 超时时间
 */
- (void)connectPeripheral:(TYBLEPeripheral *)peripheral timeout:(NSTimeInterval)timeout;
 
/**
 连接peripheral
 
 @param peripheral 待连接的peripheral对象
 @param options 连接选项
 @param timeout 超时时间
 */
- (void)connectPeripheral:(TYBLEPeripheral *)peripheral options:(nullable NSDictionary<NSString *, id> *)options timeout:(NSTimeInterval)timeout;
 
/**
 断开对peripheral的连接
 
 @param peripheral 连接的peripheral
 @param timeout 超时时间
 */
- (void)disconnectPeripheral:(TYBLEPeripheral *)peripheral timeout:(NSTimeInterval)timeout;
 
/**
 *  断开所有peripheral的链接
 */
- (void)disconnectAllPeripherals;
 
@end
 
NS_ASSUME_NONNULL_END