demo app + SDK updates:\n- Add direct ANI transfer (prepare -> transfer)\n- Add firmware update flow (fetch latest w/ x-api-key, OTA transfer)\n- Extract x-api-key to NetworkConstants\n- Rename example app to demo; move folder and entry to DemoApp\n- Switch from SPM package dependency to local framework target\n- Enable automatic Info.plist generation for framework target\n- Add placeholder test to satisfy SwiftPM test target\n- Regenerate XcodeGen project (demo.xcodeproj)
This commit is contained in:
27
Sources/DuooomiBleSDK/Models/VersionInfo.swift
Normal file
27
Sources/DuooomiBleSDK/Models/VersionInfo.swift
Normal file
@@ -0,0 +1,27 @@
|
||||
import Foundation
|
||||
|
||||
public struct VersionInfo: Sendable, Equatable {
|
||||
public let version: String
|
||||
/// 命令类型标识,设备可能返回 Int (如 7) 或 String (如 "0x07")
|
||||
public let type: String
|
||||
}
|
||||
|
||||
extension VersionInfo: Codable {
|
||||
enum CodingKeys: String, CodingKey {
|
||||
case version, type
|
||||
}
|
||||
|
||||
public init(from decoder: Decoder) throws {
|
||||
let container = try decoder.container(keyedBy: CodingKeys.self)
|
||||
version = try container.decode(String.self, forKey: .version)
|
||||
|
||||
// type may come as Int or String from different firmware versions
|
||||
if let str = try? container.decode(String.self, forKey: .type) {
|
||||
type = str
|
||||
} else if let num = try? container.decode(Int.self, forKey: .type) {
|
||||
type = "\(num)"
|
||||
} else {
|
||||
type = ""
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user