Files
duooomi-ios-sdk/Sources/DuooomiBleSDK/Protocol/ProtocolConstants.swift
km2023 1a7bbdc625 feat: 重写 SDK 支持 iOS 12.2,移除 async/await 和 Combine
- 所有公开 API 改为 completion handler (Result<T, Error>)
- 状态通知改为 DuooomiBleSDKDelegate 协议
- 移除 Sendable、@MainActor、AsyncStream、CheckedContinuation
- 网络请求改为 URLSession.dataTask 回调
- BLE 通信改为 delegate + 闭包模式
- deployment target 降至 iOS 12.2

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-16 16:59:39 +08:00

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 {
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
}