ReadMe 6.77 KB
接口说明:

接口实现
BluetoothManager+Function

发送数据类
1. 通用应答
    func response(frameNumber: [UInt8], messageId: [UInt8], success: Bool, completion: ((_ error: Int?) -> ())? = nil)

2. 查询设备信息
    func queryDeviceInfo(queryItems: [UInt8], completion: ((_ error: Int?) -> ())? = nil)
    发送: [237, 126, 0, 1, 0, 16, 0, 1, 0, 3, 2, 2, 3, 169, 70]
    接收: [237, 126, 0, 1, 128, 1, 0, 37, 0, 5, 0, 1, 0, 16, 0, 129, 5]
    
3. 设置时间
    func newSetTime(completion: ((_ error: Int?) -> ())? = nil)
    发送: [237, 126, 0, 1, 0, 9, 0, 1, 0, 6, 23, 7, 1, 17, 3, 38, 32, 36]
    接收: [237, 126, 0, 1, 128, 1, 0, 14, 0, 5, 0, 1, 0, 9, 0, 149, 41]
    
4. 设置时间格式
    func newSetTimeFormat(format: TimeFormat, completion: ((_ error: Int?) -> ())? = nil)
    发送: [237, 126, 0, 1, 0, 16, 0, 1, 0, 1, 1, 162, 3]
    接收: [237, 126, 0, 1, 128, 1, 0, 29, 0, 5, 0, 1, 0, 16, 0, 217, 3]
    
5. 设置温度单位
    func newSetTemperatureUnit(unit: TemperatureUnit, completion: ((_ error: Int?) -> ())? = nil)
    发送: [237, 126, 0, 1, 0, 17, 0, 1, 0, 1, 1, 231, 163]
    接收: [237, 126, 0, 1, 128, 1, 0, 31, 0, 5, 0, 1, 0, 17, 0, 101, 148]
    
6. 设置公英制
    func newSetDistanceUnit(unit: DistanceUnit, completion: ((_ error: Int?) -> ())? = nil)
    发送: [237, 126, 0, 1, 0, 18, 0, 1, 0, 1, 1, 41, 67]
    接收: [237, 126, 0, 1, 128, 1, 0, 30, 0, 5, 0, 1, 0, 18, 0, 119, 20]
    
7. 设置抬腕唤醒
    func newSetWristSense(bool: Bool, completion: ((_ error: Int?) -> ())? = nil)
    发送: [237, 126, 0, 1, 0, 19, 0, 1, 0, 1, 0, 124, 194]
    接收: [237, 126, 0, 1, 128, 1, 0, 32, 0, 5, 0, 1, 0, 19, 0, 156, 232]

8. 设置触摸唤醒
    func newSetTouchSense(bool: Bool, completion: ((_ error: Int?) -> ())? = nil)
    发送: [237, 126, 0, 1, 0, 20, 0, 1, 0, 1, 1, 164, 162]

9. 设置低电提醒
    func newSetLowPowerRemind(bool: Bool, completion: ((_ error: Int?) -> ())? = nil)
    发送: [237, 126, 0, 1, 0, 21, 0, 1, 0, 1, 1, 225, 2]
    
10. 设置语言
    func newSetLanguage(lan: UInt8, completion: ((_ error: Int?) -> ())? = nil)
    发送: [237, 126, 0, 1, 0, 22, 0, 1, 0, 1, 0, 63, 195]
    
11. 设置恢复出厂设置
    func newSetRestore(completion: ((_ error: Int?) -> ())? = nil)
    发送: [237, 126, 0, 1, 0, 23, 0, 1, 0, 0, 19, 107]
    
12. 设置心率过高提醒
    func newSetHeartRateHighRemind(maxHr: UInt8, completion: ((_ error: Int?) -> ())? = nil)
    发送: [237, 126, 0, 1, 0, 24, 0, 1, 0, 1, 120, 64, 255]
    接收: [237, 126, 0, 1, 128, 1, 0, 33, 0, 5, 0, 1, 0, 24, 0, 7, 193]
    
13. 设置心率过低提醒
    func newSetHeartRateLowRemind(minHr: UInt8, completion: ((_ error: Int?) -> ())? = nil)
    发送: [237, 126, 0, 1, 0, 25, 0, 1, 0, 1, 120, 5, 95]
    
14. 设置查找手表
    func newSetFindWatch(bool: Bool, completion: ((_ error: Int?) -> ())? = nil)
    发送: [237, 126, 0, 1, 0, 32, 0, 1, 0, 1, 1, 141, 143]
    接收: [237, 126, 0, 1, 128, 1, 0, 38, 0, 5, 0, 1, 0, 32, 0, 76, 229]
    
15. 设置压力自动检测
    func newSetPressureAutoDetect(bool: Bool, completion: ((_ error: Int?) -> ())? = nil)
    发送: [237, 126, 0, 1, 0, 36, 0, 1, 0, 1, 1, 139, 46]
    接收: [237, 126, 0, 1, 128, 1, 0, 34, 0, 5, 0, 1, 0, 36, 0, 143, 76]
    
16. 设置血氧自动检测
    func newSetBloodOxygenAutoDetect(bool: Bool, completion: ((_ error: Int?) -> ())? = nil)
    发送: [237, 126, 0, 1, 0, 37, 0, 1, 0, 1, 1, 206, 142]
    接收: [237, 126, 0, 1, 128, 1, 0, 35, 0, 5, 0, 1, 0, 37, 0, 251, 174]
    
17. 设置用户信息
    func newSetUserInfo(_ user: UserInfoModel, completion: ((_ error: Int?) -> ())? = nil)
    发送: [237, 126, 0, 1, 0, 38, 0, 1, 0, 5, 0, 65, 0, 175, 1, 41, 211]

18. 设置勿扰模式
    func newSetNotDisturb(remind: RemindModel, weekflag:[WeekFlag], isRepeat:Bool, completion: @escaping(_ error: Int?) -> ())
    发送: [237, 126, 0, 1, 0, 39, 0, 1, 0, 7, 0, 1, 33, 22, 0, 22, 0, 159, 5]
    
19. 拉取睡眠数据
    func getSleepHistoryData(day: SyncDay = .today, closure: SleepClosure? = nil)
    发送: [237, 126, 0, 1, 0, 40, 0, 1, 0, 1, 6, 240, 42]
    
20. 拉取血氧数据
    func getBloodOxygenHistoryData(day: SyncDay = .today, closure: BloodOxygenClosure? = nil)
    发送: [237, 126, 0, 1, 0, 40, 0, 1, 0, 1, 2, 176, 174]
    
21. 拉取心跳数据
    func getHeartRateHistoryData(day: SyncDay = .today, closure: HeartRateClosure? = nil)
    发送: [237, 126, 0, 1, 0, 40, 0, 1, 0, 1, 1, 128, 205]
    
22. 拉取计步数据
    func getStepHistoryData(day: SyncDay = .today, closure: StepClosure? = nil)
    发送: [237, 126, 0, 1, 0, 40, 0, 1, 0, 1, 3, 160, 143]
    
23. 拉取训练数据
    func getTrainHistoryData(day: SyncDay = .today, closure: TrainClosure? = nil)
    发送: [237, 126, 0, 1, 0, 40, 0, 1, 0, 1, 7, 224, 11]
    
24. 拉取压力数据
    func getPressureHistoryData(day: SyncDay = .today, closure: PressureClosure? = nil)
    发送: [237, 126, 0, 1, 0, 40, 0, 1, 0, 1, 5, 192, 73]
    
接受数据类
1. 通用返回数据
    private func parseDefaultResponseData(_ bytes: [UInt8])
    接收: [237, 126, 0, 1, 128, 1, 0, 14, 0, 5, 0, 1, 0, 9, 0, 149, 41]
    
2. 设备信息数据
    private func parseDeviceInfoData (_ content:[UInt8])
    
3. 心跳数据
    func parseHeartRateData (_ content: [UInt8])
    接收: [237, 126, 0, 1, 128, 22, 0, 7, 0, 200, 100, 157, 163, 180, 112, 100, 157, 170, 188, 247, 100, 157, 177, 196, 6, 100, 157, 184, 204, 0, 100, 157, 191, 212, 22, 100, 157, 198, 220, 249, 100, 157, 205, 228, 6, 100, 157, 212, 236, 0, 100, 157, 219, 244, 0, 100, 157, 226, 252, 251, 100, 157, 234, 4, 6, 100, 157, 241, 12, 0, 100, 157, 248, 20, 229, 100, 157, 255, 28, 253, 100, 158, 6, 36, 6, 100, 158, 13, 44, 0, 100, 158, 20, 52, 197, 100, 158, 27, 60, 255, 100, 158, 34, 68, 6, 100, 158, 41, 76, 0, 100, 158, 48, 84, 180, 100, 158, 55, 92, 1, 100, 158, 62, 100, 7, 100, 158, 69, 108, 0, 100, 158, 76, 116, 158, 100, 158, 83, 124, 2, 100, 158, 90, 132, 7, 100, 158, 97, 140, 0, 100, 158, 104, 148, 131, 100, 158, 111, 156, 4, 100, 158, 118, 164, 7, 100, 158, 125, 172, 0, 100, 158, 132, 180, 114, 100, 158, 139, 188, 6, 100, 158, 146, 196, 7, 100, 158, 153, 204, 0, 100, 158, 160, 212, 87, 100, 158, 167, 220, 8, 100, 158, 174, 228, 7, 100, 158, 181, 236, 20, 23, 62]
    
4. 血氧数据
    func parseBlooodOxygenData (_ content: [UInt8])
    
5. 体温数据
    func parseTemperaturData (_ content: [UInt8])
    
6. 压力数据
    func parsePressureData (_ content: [UInt8])
    
7. 计步数据
    func parseStepData (_ content: [UInt8])
    
8. 睡眠数据
    func parseSleepData (_ content: [UInt8])
    
9. 电量变化自动上报
    0x8010

10. 电话挂断
    0x8014

11. 找手机
    0x8015
    
12. 遥控拍照
    0x8022
    
    

底层指令组包
BleMessage+Function
匹配上面的发送的数据与接受的数据