LETransceiver.h
1.36 KB
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
//
// LETransceiver.h
// ActsBluetoothSpeed
//
// Created by inidhu on 2019/3/15.
// Copyright © 2019 Actions. All rights reserved.
//
#import <Foundation/Foundation.h>
#import <CoreBluetooth/CoreBluetooth.h>
NS_ASSUME_NONNULL_BEGIN
#define KeyWriteServiceUUID @"kWriteServiceUUID"
#define KeyIndicateServiceUUID @"kIndicateServiceUUID"
#define KeyWriteCharacteristicUUID @"kWriteCharacteristicUUID"
#define KeyIndicateCharacteristicUUID @"kIndicateCharacteristicUUID"
@protocol LEConnctionDelegate <NSObject>
@required
- (void)onFoundPeripheral:(CBPeripheral *) peripheral advertisementData:(NSDictionary *) advertisementData;
@optional
- (void)onConnectedPeripheral:(CBPeripheral *) peripheral;
- (void)onDisconnectedPeripheral:(CBPeripheral *) peripheral;
@end
@protocol LEDataDelegate <NSObject>
@optional
- (void)onDataReceive:(NSData *) data;
@end
@interface LETransceiver : NSObject<CBPeripheralDelegate, CBCentralManagerDelegate>
@property (weak, nonatomic) id<LEConnctionDelegate> connectionDelegate;
@property (weak, nonatomic) id<LEDataDelegate> dataDelegate;
- (void)setUUIDs:(NSDictionary *) uuids;
- (void)scanStart;
- (void)scanStop;
- (void)connect:(CBPeripheral *)peripheral;
- (void)disconnect:(CBPeripheral *)peripheral;
- (void)write:(NSData *) data;
- (void)write:(NSData *) data index:(int) i;
@end
NS_ASSUME_NONNULL_END