ReadMe.txt 3.3 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]
    
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]

8. 设置触摸唤醒
    func newSetTouchSense(bool: Bool, completion: ((_ error: Int?) -> ())? = nil)
    发送: [237, 126, 0, 1, 0, 20, 0, 1, 0, 1, 1, 164, 162]
    
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]
    
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(closure: SleepClosure? = nil)
    发送: [237, 126, 0, 1, 0, 40, 0, 1, 0, 1, 6, 240, 42]
    
20. 拉取血氧数据
    func getBloodOxygenHistoryData(closure: BloodOxygenClosure? = nil)
    发送: [237, 126, 0, 1, 0, 40, 0, 1, 0, 1, 2, 176, 174]
    
21. 拉取心跳数据
    func getHeartRateHistoryData(closure: HeartRateClosure? = nil)
    发送: [237, 126, 0, 1, 0, 40, 0, 1, 0, 1, 1, 128, 205]
    
22. 拉取计步数据
    func getStepHistoryData(closure: StepClosure? = nil)
    发送: [237, 126, 0, 1, 0, 40, 0, 1, 0, 1, 3, 160, 143]
    
23. 拉取训练数据
    func getTrainHistoryData(closure: TrainClosure? = nil)
    发送: [237, 126, 0, 1, 0, 40, 0, 1, 0, 1, 7, 224, 11]
    
24. 拉取压力数据
    func getPressureHistoryData(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])
    
5. 体温数据
    func parseTemperaturData (_ content: [UInt8])
    
7. 计步数据
    func parseStepData (_ content: [UInt8])
    
8. 睡眠数据
    func parseSleepData (_ content: [UInt8])
    
9. 电量变化自动上报
    0x8010

10. 电话挂断
    0x8014

11. 找手机
    0x8015
    
    

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