ReadMe.txt
接口说明:
接口实现
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]
接受数据类
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])
8. 睡眠数据
func parseSleepData (_ content: [UInt8])
9. 电量变化自动上报
0x8010
10. 电话挂断
0x8014
11. 找手机
0x8015
底层指令组包
BleMessage+Function
匹配上面的发送的数据与接受的数据