6102d0b3
daifengyi
feat:time format
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
//
// BleMessage+Function.swift
// HDFwear
//
// Created by daifengyi on 2023/6/27.
//
import SwiftDate
extension BleMessage {
func getTimeCmd() -> Data {
let date = DateInRegion().date
let timeBytes: [UInt8] = [UInt8(date.year%100), UInt8(date.month), UInt8(date.day), UInt8(date.hour), UInt8(date.minute), UInt8(date.second)]
// return getSendData(cmd: .set, key: .time, bytes: timeBytes)
// let a = getPackData(key: .setTime, contentBytes: timeBytes)
// let b = createDataPacket(key: .setTime, bytes: timeBytes)
return createDataPacket(key: .setTime, bytes: timeBytes)
}
func getTimeFormatCmd(format: TimeFormat) -> Data {
let bytes: [UInt8] = [format.rawValue]
return createDataPacket(key: .setTimeFormat, bytes: bytes)
}
|
50eee3a1
daifengyi
feat:temperature ...
|
24
25
26
27
28
29
30
31
32
33
34
|
func getTemperatureUnitCmd(unit: TemperatureUnit) -> Data {
let bytes: [UInt8] = [unit.rawValue]
return createDataPacket(key: .setTemperatureUnit, bytes: bytes)
}
func getDistanceUnitCmd(unit: DistanceUnit) -> Data {
let bytes: [UInt8] = [unit.rawValue]
return createDataPacket(key: .setDistanceUnit, bytes: bytes)
}
|