blob: d316b52e3e27fe2ef55cd29acfa3ae2a15efc969 (
plain)
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
65
66
|
//
// IDOBlueDataResponse.h
// IDOBlueProtocol
//
// Created by 何东阳 on 2019/5/8.
// Copyright © 2019 何东阳. All rights reserved.
//
#import <Foundation/Foundation.h>
#import <CoreBluetooth/CoreBluetooth.h>
NS_ASSUME_NONNULL_BEGIN
@interface IDOBlueDataResponse : NSObject
/**
* 获取扫描的服务
* [manager scanForPeripheralsWithServices:services options:@{CBCentralManagerScanOptionAllowDuplicatesKey:@YES}];
* get the scan service
*/
+ (NSArray <CBUUID *>*)getScanServices;
/**
* 判断当前外围设备是否为OTA模式
* whether the current peripheral is in OTA mode
*/
+ (BOOL)isOtaModeWithPeripheral:(CBPeripheral *)peripheral;
/**
* manager :当前蓝牙管理中心
* peripheral : 当前外接设备
* serviceIndex : 当前发现服务的索引 默认传0不作服务索引判断
* current bluetooth management center
* current bluetooth peripheral
* serviceIndex : the index of the current discovered service is set to 0 by default without service index judgment
*/
+ (void)blueManager:(CBCentralManager *)manager
peripheral:(CBPeripheral *)peripheral
serviceIndex:(NSInteger)serviceIndex
didConnected:(void(^)(BOOL isOta))callback;
/**
* 连接外围设备成功后发现外围设备特征
* - (void)peripheral:(CBPeripheral *)peripheral didDiscoverCharacteristicsForService:(CBService *)service error:(NSError *)error
* after successfully connecting the peripheral device, peripheral device characteristics are found.
*/
+ (void)findCharac:(CBPeripheral *)peripheral
service:(CBService *)service;
/**
* 蓝牙接收到手环返回的数据
* - (void)peripheral:(CBPeripheral *)peripheral didUpdateValueForCharacteristic:(CBCharacteristic *)characteristic error:(NSError *)error
* bluetooth receives data from the ring
*/
+ (void)didUpdateValueForCharacteristic:(CBCharacteristic *)characteristic;
/**
* 蓝牙写完数据的回调
* - (void)peripheral:(CBPeripheral *)peripheral didWriteValueForCharacteristic:(CBCharacteristic *)characteristic error:(nullable NSError *)error
* bluetooth writes a callback to the data
*/
+ (void)didWriteValueForCharacteristic:(CBCharacteristic *)characteristic
error:(NSError *)error;
@end
NS_ASSUME_NONNULL_END
|