36 lines
1.1 KiB
Swift
36 lines
1.1 KiB
Swift
import CoreBluetooth
|
|
|
|
public enum BleUUIDs {
|
|
public static let service = CBUUID(string: "000002c4-0000-1000-8000-00805f9b34fb")
|
|
public static let writeCharacteristic = CBUUID(string: "000002c5-0000-1000-8000-00805f9b34fb")
|
|
public static let readCharacteristic = CBUUID(string: "000002c6-0000-1000-8000-00805f9b34fb")
|
|
public static let broadcastCharacteristic = CBUUID(string: "000002c1-0000-1000-8000-00805f9b34fb")
|
|
}
|
|
|
|
public enum FrameHead: UInt8 {
|
|
case appToDevice = 0xC7
|
|
case deviceToApp = 0xB0
|
|
}
|
|
|
|
public enum FrameConstants {
|
|
public static let maxDataSize = 496
|
|
public static let headerSize = 8
|
|
public static let footerSize = 1
|
|
/// Inter-frame delay in nanoseconds (35ms)
|
|
public static let frameIntervalNanos: UInt64 = 35_000_000
|
|
public static let screenSize = 360
|
|
}
|
|
|
|
public enum CommandType: UInt8, Sendable {
|
|
case otaPackage = 0x02
|
|
case transferBootAnimation = 0x03
|
|
case transferAniVideo = 0x05
|
|
case transferJpegImage = 0x06
|
|
case getDeviceVersion = 0x07
|
|
case getDeviceInfo = 0x0D
|
|
case bindDevice = 0x0F
|
|
case unbindDevice = 0x12
|
|
case deleteFile = 0x13
|
|
case prepareTransfer = 0x14
|
|
}
|