DuooomiBleConfig 新增 frameIntervalMs,BleProtocolService 构造期注入。 顺手清死代码 FrameConstants.frameIntervalNanos、修 sendFrames 0.035 字面量 (统一走 config)。demo 加可调输入框 + UserDefaults 持久化。 越界 warn 不抛错,使用点 min/max 兜底。 设计稿:docs/superpowers/specs/2026-05-20-frame-interval-config-design.md Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
34 lines
1.0 KiB
Swift
34 lines
1.0 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
|
|
public static let screenSize = 360
|
|
}
|
|
|
|
public enum CommandType: UInt8 {
|
|
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
|
|
}
|