75d24c15
yangbin
123
|
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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
|
//
// Bluetooth+Types.swift
// Twear
//
// Created by yangbin on 2021/12/6.
//
import CoreFoundation
struct ScanDevice {
var peripheral: CBPeripheral
var mac: String
init(_ peripheral: CBPeripheral, mac: String) {
self.peripheral = peripheral
self.mac = mac
}
}
public struct BLEConfig {
static let ServerUUID = "C3E6FEA0-E966-1000-8000-BE99C223DF6A" //主服务UUID
static let ReadUUID = "C3E6FEA2-E966-1000-8000-BE99C223DF6A" //读取数据特征值
static let WriteUUID = "C3E6FEA1-E966-1000-8000-BE99C223DF6A" //写入数据特征值
static let MTKBasServerUUID = "0000180F-0000-1000-8000-00805F9B34FB" //mtk2502 Bas主服务UUID
static let MTKBasReadUUID = "00002A19-0000-1000-8000-00805F9B34FB" //mtk2502 Bas读取数据特征值
static let MTKBasWriteUUID = "00002A19-0000-1000-8000-00805F9B34FB" //mtk2502 Bas写入数据特征值
static let MTKServerUUID = "000018AA-0000-1000-8000-00805F9B34FB" //mtk2502主服务UUID
static let MTKReadUUID = "00002AAA-0000-1000-8000-00805F9B34FB" //mtk2502读取数据特征值
static let MTKWriteUUID = "00002AAA-0000-1000-8000-00805F9B34FB" //mtk2502写入数据特征值
static let MTKDialServerUUID = "0000180D-0000-1000-8000-00805F9B34FB" //mtk2502 Dial主服务UUID
static let MTKDialReadUUID = "00002A37-0000-1000-8000-00805F9B34FB" //mtk2502 Dial读取数据特征值
static let MTKDialWriteUUID = "00002A37-0000-1000-8000-00805F9B34FB" //mtk2502 Dial写入数据特征值
static let SyncHealthTimer = "SyncHealthDataTimer"
}
enum DistanceUnit: UInt8 {
case foot = 1
case meter = 0
}
enum TemperatureUnit: UInt8 {
case celsius = 0
case fahrenheit = 1
}
enum TimeFormat: UInt8 {
case hour_24 = 0
case hour_12 = 1
}
enum BleCmd: UInt8 {
case firmware = 0x01
case set = 0x02
case device = 0x04
case weather = 0x03
case find = 0x05
case remind = 0x06
case sync = 0x0A
}
enum SetCmd: UInt8 {
case unit = 0x01
case firmware = 0x12
case firmware_return = 0x13
case time = 0x20
case alarmClock = 0x21
case user = 0x23
case sedentary = 0x25
case menstrual = 0x26
case language = 0x27
case drink = 0x28
case push = 0x29
case dial = 0x2B
case setting = 0x2E
case weather = 0x30
|
75d24c15
yangbin
123
|
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
|
case battery = 0x40
case battery_return = 0x41
case openCamera = 0x46
case takePicture = 0x47
case exitCamera = 0x48
case wrist = 0x4A
case find_device = 0x50
case find_phone_start = 0x51
case find_phone_stop = 0x52
case disturb = 0x64
case sync = 0xA0
case set_return = 0x2F
}
enum SyncCmd: UInt8 {
case sleep = 0xA2
case step = 0xA3
case hr = 0xA4
case train = 0xA5
case bp = 0xAD
case bo = 0xAE
case hr_rt = 0xAB
case bp_rt = 0xB1
case bo_rt = 0xB2
case step_rt = 0xAC
case other = 0x00
}
enum SyncType: UInt8 {
case sleep = 0x01
case hr = 0x02
case step = 0x03
case train = 0x04
case bo = 0x05
case bp = 0x07
}
enum SyncDay: Int {
case today = 0
case yesterday = -1
case dayBeforYesterday = -2
}
//enum DeviceCmd: UInt8 {
// case openCamera = 0x46
// case exitCamera = 0x48
//}
|