feat(drone-dock): 接通任务召唤与状态页并固定拍摄布局
接入 plane-status、tasks/create、shoot 与 shooting,保持同一任务 ID 串接、重复提交保护和只读单次刷新。拍摄任务页固定顶部参数与底部安全控制,中间状态区域适配小屏且不滚动;同步接口记录、脱敏响应及相关测试。
This commit is contained in:
@@ -0,0 +1,104 @@
|
||||
import Foundation
|
||||
|
||||
/// 朱工提供的景区无人机状态快照,推荐设备由服务端选择。
|
||||
struct DroneDockPlaneStatusResponse: Decodable, Equatable, Sendable {
|
||||
/// 本次状态所属景区,必须与请求一致。
|
||||
let scenicID: Int
|
||||
/// 当前景区的设备状态;空数组表示没有设备。
|
||||
let planes: [DroneDockPlaneStatus]
|
||||
/// 服务端推荐设备,缺失时不在客户端另选一台。
|
||||
let recommend: DroneDockPlaneStatus?
|
||||
/// 服务端是否存在空闲设备,未知时不当作 false。
|
||||
let hasIdle: Bool?
|
||||
/// 服务端是否存在拍摄中的设备。
|
||||
let hasShooting: Bool?
|
||||
/// 景区连接状态,缺失时仍为未知。
|
||||
let connected: Bool?
|
||||
/// 服务端建议的轮询间隔;实际定时由页面生命周期控制。
|
||||
let pollHintMS: Int?
|
||||
|
||||
/// 保留 plane-status 原始字段映射,不复用首页的不同状态枚举。
|
||||
private enum CodingKeys: String, CodingKey {
|
||||
case scenicID = "scenic_id", planes, recommend
|
||||
case hasIdle = "has_idle", hasShooting = "has_shooting", connected, pollHintMS = "poll_hint_ms"
|
||||
}
|
||||
|
||||
/// 校验景区和设备身份,不把缺失或错误列表当作正常空态。
|
||||
init(from decoder: Decoder) throws {
|
||||
let container = try decoder.container(keyedBy: CodingKeys.self)
|
||||
scenicID = try container.decode(DroneDockPlaneStatusInteger.self, forKey: .scenicID).value
|
||||
guard scenicID > 0 else {
|
||||
throw DecodingError.dataCorruptedError(forKey: .scenicID, in: container, debugDescription: "景区 ID 必须为正整数")
|
||||
}
|
||||
planes = try container.decode([DroneDockPlaneStatus].self, forKey: .planes)
|
||||
guard Set(planes.map(\.id)).count == planes.count else {
|
||||
throw DecodingError.dataCorruptedError(forKey: .planes, in: container, debugDescription: "无人机 ID 重复")
|
||||
}
|
||||
recommend = try container.decodeIfPresent(DroneDockPlaneStatus.self, forKey: .recommend)
|
||||
hasIdle = try container.decodeIfPresent(Bool.self, forKey: .hasIdle)
|
||||
hasShooting = try container.decodeIfPresent(Bool.self, forKey: .hasShooting)
|
||||
connected = try container.decodeIfPresent(Bool.self, forKey: .connected)
|
||||
pollHintMS = try container.decodeIfPresent(DroneDockPlaneStatusInteger.self, forKey: .pollHintMS)?.value
|
||||
}
|
||||
}
|
||||
|
||||
/// 单台无人机的工作状态和电量,仅供准备页展示,不代表召唤许可。
|
||||
struct DroneDockPlaneStatus: Decodable, Equatable, Sendable {
|
||||
/// 后端设备稳定身份。
|
||||
let id: Int
|
||||
/// 设备序列号,不作为飞行任务 ID 使用。
|
||||
let snNumber: String?
|
||||
/// 后端设备名称。
|
||||
let name: String?
|
||||
/// 0 离线、1 空闲、2 拍摄中;其他整数原样保留。
|
||||
let workStatus: Int?
|
||||
/// 后端工作状态名称。
|
||||
let workStatusLabel: String?
|
||||
/// 原始电量百分比,0 与缺失分开表示。
|
||||
let batteryPercent: Int?
|
||||
/// 后端格式化电量文案。
|
||||
let batteryLabel: String?
|
||||
/// 后端设备可飞标记,不据此启用当前订单的召唤按钮。
|
||||
let canFly: Bool?
|
||||
/// 准备页底栏优先展示的完整状态文案。
|
||||
let statusText: String?
|
||||
|
||||
/// 后端字段映射。
|
||||
private enum CodingKeys: String, CodingKey {
|
||||
case id, snNumber = "sn_number", name, workStatus = "work_status", workStatusLabel = "work_status_label"
|
||||
case batteryPercent = "battery_percent", batteryLabel = "battery_label", canFly = "can_fly", statusText = "status_text"
|
||||
}
|
||||
|
||||
/// 状态允许未知,设备身份必须明确;不从电量或工作状态推导 can_fly。
|
||||
init(from decoder: Decoder) throws {
|
||||
let container = try decoder.container(keyedBy: CodingKeys.self)
|
||||
id = try container.decode(DroneDockPlaneStatusInteger.self, forKey: .id).value
|
||||
guard id > 0 else {
|
||||
throw DecodingError.dataCorruptedError(forKey: .id, in: container, debugDescription: "无人机 ID 必须为正整数")
|
||||
}
|
||||
snNumber = try container.decodeIfPresent(String.self, forKey: .snNumber)
|
||||
name = try container.decodeIfPresent(String.self, forKey: .name)
|
||||
workStatus = try container.decodeIfPresent(DroneDockPlaneStatusInteger.self, forKey: .workStatus)?.value
|
||||
workStatusLabel = try container.decodeIfPresent(String.self, forKey: .workStatusLabel)
|
||||
batteryPercent = try container.decodeIfPresent(DroneDockPlaneStatusInteger.self, forKey: .batteryPercent)?.value
|
||||
batteryLabel = try container.decodeIfPresent(String.self, forKey: .batteryLabel)
|
||||
canFly = try container.decodeIfPresent(Bool.self, forKey: .canFly)
|
||||
statusText = try container.decodeIfPresent(String.self, forKey: .statusText)
|
||||
}
|
||||
}
|
||||
|
||||
/// 兼容整数与整数字符串,拒绝布尔值、浮点截断及非法数字。
|
||||
private struct DroneDockPlaneStatusInteger: Decodable {
|
||||
let value: Int
|
||||
|
||||
init(from decoder: Decoder) throws {
|
||||
let container = try decoder.singleValueContainer()
|
||||
if let number = try? container.decode(Int.self) {
|
||||
value = number
|
||||
} else if let text = try? container.decode(String.self), let number = Int(text) {
|
||||
value = number
|
||||
} else {
|
||||
throw DecodingError.dataCorruptedError(in: container, debugDescription: "需要整数或整数字符串")
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
import Foundation
|
||||
|
||||
/// shoot 业务成功后的原始 data 回执,不假设或构造飞机、任务及飞行阶段字段。
|
||||
struct DroneDockShootResponse: Decodable, Equatable, Sendable {
|
||||
/// 完整 data JSON;nil 表示统一客户端未提供 data,不补造 null 或空对象。
|
||||
let dataJSON: String?
|
||||
|
||||
/// 保留已格式化回执;业务成功但 data 缺失或为 null 时使用 nil。
|
||||
init(dataJSON: String?) { self.dataJSON = dataJSON }
|
||||
|
||||
/// 支持任意真实 JSON 值,保留未知结构、空数组、布尔值及原始字段类型。
|
||||
init(from decoder: Decoder) throws {
|
||||
let raw = try DroneDockHomeJSONValue(from: decoder)
|
||||
let encoder = JSONEncoder()
|
||||
encoder.outputFormatting = [.prettyPrinted, .sortedKeys, .withoutEscapingSlashes]
|
||||
dataJSON = String(decoding: try encoder.encode(DroneDockShootJSONSnapshot(value: raw)), as: UTF8.self)
|
||||
}
|
||||
}
|
||||
|
||||
/// 将现有 JSON 值解码结果格式化,完整保留 shoot 尚未约定的成功数据结构。
|
||||
private struct DroneDockShootJSONSnapshot: Encodable {
|
||||
let value: DroneDockHomeJSONValue
|
||||
|
||||
/// 按真实 JSON 类型编码,不推导任务身份或追加外层业务字段。
|
||||
func encode(to encoder: Encoder) throws {
|
||||
var container = encoder.singleValueContainer()
|
||||
switch value {
|
||||
case .object(let object): try container.encode(object.mapValues { DroneDockShootJSONSnapshot(value: $0) })
|
||||
case .array(let array): try container.encode(array.map { DroneDockShootJSONSnapshot(value: $0) })
|
||||
case .string(let text): try container.encode(text)
|
||||
case .number(let number): try container.encode(number)
|
||||
case .bool(let flag): try container.encode(flag)
|
||||
case .null: try container.encodeNil()
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,202 @@
|
||||
import Foundation
|
||||
|
||||
/// 朱工 shooting 的只读快照;完整 data 用于展示,不表示已召唤或已开始拍摄。
|
||||
struct DroneDockShootingResponse: Decodable, Equatable, Sendable {
|
||||
/// 后端若明确提供订单号则保留,不由请求上下文伪造响应身份。
|
||||
let orderNumber: String?
|
||||
/// 实测返回的订单飞行任务身份;存在时必须与请求上下文核对。
|
||||
let orderFlightTask: DroneDockShootingTaskIdentity?
|
||||
/// 实测返回的任务摘要,不以其状态推导控制动作。
|
||||
let task: DroneDockShootingTaskIdentity?
|
||||
/// 拍摄任务关联的景区信息。
|
||||
let scenic: DroneDockShootingPlace?
|
||||
/// 拍摄任务关联的点位信息。
|
||||
let scenicSpot: DroneDockShootingPlace?
|
||||
/// 拍摄任务关联的航线信息。
|
||||
let airLine: DroneDockShootingAirLine?
|
||||
/// 服务端给出的页面标题、游客及套餐文案。
|
||||
let header: DroneDockShootingHeader?
|
||||
/// 服务端给出的当前设备,不由准备页推荐设备替代。
|
||||
let currentPlane: DroneDockShootingPlane?
|
||||
/// 六项读数使用后端格式化文案,保留未知值与真实零值。
|
||||
let metrics: [DroneDockHomeMetric]
|
||||
/// 景区设备连接与轮询建议,不在客户端改选推荐飞机。
|
||||
let planeStatus: DroneDockShootingPlaneStatus?
|
||||
/// 服务端执行门禁只用于展示,本次接入不执行其动作。
|
||||
let executeGate: DroneDockShootingExecuteGate?
|
||||
/// 服务端拍摄阶段和页面提示。
|
||||
let ui: DroneDockShootingUI?
|
||||
/// 完整 data 的格式化 JSON,保留未知字段、空值及原 JSON 类型。
|
||||
let dataJSON: String
|
||||
|
||||
/// 只映射已知展示字段,不假设响应中的任务 ID 位置。
|
||||
private enum CodingKeys: String, CodingKey {
|
||||
case orderNumber = "order_number", orderFlightTask = "order_flight_task", task
|
||||
case scenic, scenicSpot = "scenic_spot", airLine = "air_line"
|
||||
case header, currentPlane = "current_plane", executeGate = "execute_gate", ui
|
||||
case metrics, planeStatus = "plane_status"
|
||||
}
|
||||
|
||||
/// 可选字段缺失或为 null 时保持未知;不把缺失执行门禁推断为允许。
|
||||
init(from decoder: Decoder) throws {
|
||||
let container = try decoder.container(keyedBy: CodingKeys.self)
|
||||
orderNumber = try container.decodeIfPresent(String.self, forKey: .orderNumber)
|
||||
orderFlightTask = try container.decodeIfPresent(DroneDockShootingTaskIdentity.self, forKey: .orderFlightTask)
|
||||
task = try container.decodeIfPresent(DroneDockShootingTaskIdentity.self, forKey: .task)
|
||||
scenic = try container.decodeIfPresent(DroneDockShootingPlace.self, forKey: .scenic)
|
||||
scenicSpot = try container.decodeIfPresent(DroneDockShootingPlace.self, forKey: .scenicSpot)
|
||||
airLine = try container.decodeIfPresent(DroneDockShootingAirLine.self, forKey: .airLine)
|
||||
header = try container.decodeIfPresent(DroneDockShootingHeader.self, forKey: .header)
|
||||
currentPlane = try container.decodeIfPresent(DroneDockShootingPlane.self, forKey: .currentPlane)
|
||||
metrics = try container.decodeIfPresent([DroneDockHomeMetric].self, forKey: .metrics) ?? []
|
||||
planeStatus = try container.decodeIfPresent(DroneDockShootingPlaneStatus.self, forKey: .planeStatus)
|
||||
executeGate = try container.decodeIfPresent(DroneDockShootingExecuteGate.self, forKey: .executeGate)
|
||||
ui = try container.decodeIfPresent(DroneDockShootingUI.self, forKey: .ui)
|
||||
let raw = try DroneDockHomeJSONValue(from: decoder)
|
||||
let encoder = JSONEncoder()
|
||||
encoder.outputFormatting = [.prettyPrinted, .sortedKeys, .withoutEscapingSlashes]
|
||||
dataJSON = String(decoding: try encoder.encode(DroneDockShootingJSONSnapshot(value: raw)), as: UTF8.self)
|
||||
}
|
||||
}
|
||||
|
||||
/// shooting 实测返回的已有任务身份和状态摘要,各身份仅在实际提供时参与核对。
|
||||
struct DroneDockShootingTaskIdentity: Decodable, Equatable, Sendable {
|
||||
/// 订单飞行任务 ID。
|
||||
let id: Int?
|
||||
/// 任务所属订单号。
|
||||
let orderNumber: String?
|
||||
/// 任务所属景区。
|
||||
let scenicID: Int?
|
||||
/// 后端原始任务状态,不与订单状态混用。
|
||||
let status: Int?
|
||||
/// 服务端任务状态文案。
|
||||
let statusLabel: String?
|
||||
/// 实测航线任务状态,与订单飞行任务状态分别保留。
|
||||
let waylineStatus: Int?
|
||||
/// 服务端航线状态文案;执行失败优先于笼统的订单任务执行中。
|
||||
let waylineStatusLabel: String?
|
||||
|
||||
/// 已确认嵌套任务字段映射。
|
||||
private enum CodingKeys: String, CodingKey {
|
||||
case id, orderNumber = "order_number", scenicID = "scenic_id", status, statusLabel = "status_label"
|
||||
case waylineStatus = "wayline_status", waylineStatusLabel = "wayline_status_label"
|
||||
}
|
||||
}
|
||||
|
||||
/// shooting 的设备轮询提示与连接结果;缺失布尔保持未知。
|
||||
struct DroneDockShootingPlaneStatus: Decodable, Equatable, Sendable {
|
||||
/// 后端实际提供的设备列表所属景区。
|
||||
let scenicID: Int?
|
||||
/// 后端景区连接状态。
|
||||
let connected: Bool?
|
||||
/// 保留后端建议间隔;当前任务页不据此安排定时请求。
|
||||
let pollHintMS: Int?
|
||||
|
||||
/// 设备快照字段映射,其余字段仍保留在完整 dataJSON 中。
|
||||
private enum CodingKeys: String, CodingKey {
|
||||
case scenicID = "scenic_id", connected, pollHintMS = "poll_hint_ms"
|
||||
}
|
||||
}
|
||||
|
||||
/// shooting 返回的景区或点位信息,缺失身份不由客户端补齐。
|
||||
struct DroneDockShootingPlace: Decodable, Equatable, Sendable {
|
||||
/// 服务端场景身份,未知时为 nil。
|
||||
let id: Int?
|
||||
/// 服务端显示名称。
|
||||
let name: String?
|
||||
}
|
||||
|
||||
/// shooting 返回的航线及其所属点位。
|
||||
struct DroneDockShootingAirLine: Decodable, Equatable, Sendable {
|
||||
/// 服务端航线身份。
|
||||
let id: Int?
|
||||
/// 服务端航线名称。
|
||||
let name: String?
|
||||
/// 航线所属点位,不用于推导当前任务 ID。
|
||||
let scenicSpotID: Int?
|
||||
|
||||
/// 航线字段映射。
|
||||
private enum CodingKeys: String, CodingKey { case id, name, scenicSpotID = "scenic_spot_id" }
|
||||
}
|
||||
|
||||
/// shooting 拍摄页的服务端摘要文案。
|
||||
struct DroneDockShootingHeader: Decodable, Equatable, Sendable {
|
||||
/// 实测摘要返回的订单身份,不能忽略其与请求订单的一致性。
|
||||
let orderNumber: String?
|
||||
/// 页面主标题。
|
||||
let title: String?
|
||||
/// 服务端提供的游客显示文案。
|
||||
let touristLabel: String?
|
||||
/// 订单套餐显示文案。
|
||||
let packageName: String?
|
||||
|
||||
/// 页面摘要字段映射。
|
||||
private enum CodingKeys: String, CodingKey {
|
||||
case orderNumber = "order_number", title, touristLabel = "tourist_label", packageName = "package_name"
|
||||
}
|
||||
}
|
||||
|
||||
/// shooting 当前设备的展示信息,不代表调用方已发送飞行指令。
|
||||
struct DroneDockShootingPlane: Decodable, Equatable, Sendable {
|
||||
/// 当前设备身份。
|
||||
let id: Int?
|
||||
/// 当前设备序列号。
|
||||
let snNumber: String?
|
||||
/// 服务端工作状态文案。
|
||||
let workStatusLabel: String?
|
||||
/// 服务端完整状态文案。
|
||||
let statusText: String?
|
||||
|
||||
/// 当前设备字段映射。
|
||||
private enum CodingKeys: String, CodingKey {
|
||||
case id, snNumber = "sn_number", workStatusLabel = "work_status_label", statusText = "status_text"
|
||||
}
|
||||
}
|
||||
|
||||
/// shooting 执行门禁的原始结果;false 与未知分别保留。
|
||||
struct DroneDockShootingExecuteGate: Decodable, Equatable, Sendable {
|
||||
/// 服务端明确的执行许可,不从文案或 action 推导。
|
||||
let canExecute: Bool?
|
||||
/// 服务端门禁原因码。
|
||||
let code: String?
|
||||
/// 服务端门禁说明。
|
||||
let message: String?
|
||||
/// 服务端建议动作,本阶段仅展示。
|
||||
let primaryAction: String?
|
||||
/// 服务端建议动作名称。
|
||||
let primaryActionLabel: String?
|
||||
|
||||
/// 门禁字段映射。
|
||||
private enum CodingKeys: String, CodingKey {
|
||||
case canExecute = "can_execute", code, message
|
||||
case primaryAction = "primary_action", primaryActionLabel = "primary_action_label"
|
||||
}
|
||||
}
|
||||
|
||||
/// shooting 返回的拍摄阶段显示信息。
|
||||
struct DroneDockShootingUI: Decodable, Equatable, Sendable {
|
||||
/// 原始阶段标识,未知值原样保留。
|
||||
let phase: String?
|
||||
/// 服务端页面提示。
|
||||
let title: String?
|
||||
/// 服务端阶段说明,不由 GET 请求成功拼造飞行进度。
|
||||
let message: String?
|
||||
}
|
||||
|
||||
/// 将现有 JSON 值解码结果重新格式化,完整保留 shooting 的未建模字段。
|
||||
private struct DroneDockShootingJSONSnapshot: Encodable {
|
||||
let value: DroneDockHomeJSONValue
|
||||
|
||||
/// 保留字符串、数字、布尔、null 及嵌套结构,不添加外层业务包裹。
|
||||
func encode(to encoder: Encoder) throws {
|
||||
var container = encoder.singleValueContainer()
|
||||
switch value {
|
||||
case .object(let object): try container.encode(object.mapValues { DroneDockShootingJSONSnapshot(value: $0) })
|
||||
case .array(let array): try container.encode(array.map { DroneDockShootingJSONSnapshot(value: $0) })
|
||||
case .string(let text): try container.encode(text)
|
||||
case .number(let number): try container.encode(number)
|
||||
case .bool(let flag): try container.encode(flag)
|
||||
case .null: try container.encodeNil()
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
import Foundation
|
||||
|
||||
/// 张工创建待飞任务的回执,保留最新订单摘要和完整 data 字段供联调展示。
|
||||
struct DroneDockCreatedTask: Decodable, Equatable, Sendable {
|
||||
/// 后端创建的订单飞行任务 ID,后续召唤应复用该任务。
|
||||
let taskID: Int
|
||||
/// 创建后的权威订单摘要,待飞任务不由客户端扣减次数。
|
||||
let order: DroneDockHomeOrder
|
||||
/// 格式化后的完整 data JSON;不添加或伪造外层 code、msg、time。
|
||||
let dataJSON: String
|
||||
|
||||
/// 创建任务回执的必需身份字段。
|
||||
private enum CodingKeys: String, CodingKey { case taskID = "task_id" }
|
||||
|
||||
/// 任务身份允许整数字符串,但必须为正整数;额外字段保留原 JSON 类型。
|
||||
init(from decoder: Decoder) throws {
|
||||
let container = try decoder.container(keyedBy: CodingKeys.self)
|
||||
if let value = try? container.decode(Int.self, forKey: .taskID) {
|
||||
taskID = value
|
||||
} else if let text = try? container.decode(String.self, forKey: .taskID), let value = Int(text) {
|
||||
taskID = value
|
||||
} else {
|
||||
throw DecodingError.dataCorruptedError(forKey: .taskID, in: container, debugDescription: "创建任务未返回有效任务 ID")
|
||||
}
|
||||
guard taskID > 0 else {
|
||||
throw DecodingError.dataCorruptedError(forKey: .taskID, in: container, debugDescription: "创建任务返回的任务 ID 必须为正整数")
|
||||
}
|
||||
order = try DroneDockHomeOrder(from: decoder)
|
||||
let rawData = try DroneDockHomeJSONValue(from: decoder)
|
||||
let encoder = JSONEncoder()
|
||||
encoder.outputFormatting = [.prettyPrinted, .sortedKeys, .withoutEscapingSlashes]
|
||||
dataJSON = String(decoding: try encoder.encode(DroneDockTaskJSONSnapshot(value: rawData)), as: UTF8.self)
|
||||
}
|
||||
}
|
||||
|
||||
/// 复用现有 JSON 值解码器,将回执 data 格式化,保留未建模字段和空值。
|
||||
private struct DroneDockTaskJSONSnapshot: Encodable {
|
||||
let value: DroneDockHomeJSONValue
|
||||
|
||||
/// JSON 类型保持不变,数字使用 Decimal 避免先转换为 Double 丢失精度。
|
||||
func encode(to encoder: Encoder) throws {
|
||||
var container = encoder.singleValueContainer()
|
||||
switch value {
|
||||
case .object(let object):
|
||||
try container.encode(object.mapValues { DroneDockTaskJSONSnapshot(value: $0) })
|
||||
case .array(let array):
|
||||
try container.encode(array.map { DroneDockTaskJSONSnapshot(value: $0) })
|
||||
case .string(let text): try container.encode(text)
|
||||
case .number(let number): try container.encode(number)
|
||||
case .bool(let flag): try container.encode(flag)
|
||||
case .null: try container.encodeNil()
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
import Foundation
|
||||
|
||||
/// 真实任务页的显示阶段;未确认或冲突数据保持未知,不代表客户端已发送控制指令。
|
||||
enum DroneDockTaskDisplayPhase: String, Equatable, Sendable {
|
||||
/// 正在读取任务。
|
||||
case loading
|
||||
/// 服务端明确正在前往拍摄点。
|
||||
case navigating
|
||||
/// 服务端明确已到达且允许开始。
|
||||
case ready
|
||||
/// 服务端明确正在拍摄。
|
||||
case shooting
|
||||
/// 服务端明确已暂停。
|
||||
case paused
|
||||
/// 服务端明确正在返航。
|
||||
case returning
|
||||
/// 服务端明确任务已完成。
|
||||
case completed
|
||||
/// 已确认的任务或航线执行失败。
|
||||
case failed
|
||||
/// 服务端阻止执行或任务已取消。
|
||||
case blocked
|
||||
/// 尚无足够信息确定阶段。
|
||||
case unknown
|
||||
/// 当前读取失败,不能沿用旧阶段。
|
||||
case readError
|
||||
}
|
||||
|
||||
/// 任务状态区可呈现的动作;开始与恢复在本轮仅禁用展示,不发送飞控。
|
||||
enum DroneDockTaskDisplayAction: Equatable, Sendable {
|
||||
/// 重新读取同一任务。
|
||||
case refresh
|
||||
/// 开始拍摄占位动作,本轮禁用。
|
||||
case start
|
||||
/// 恢复拍摄占位动作,本轮禁用。
|
||||
case resume
|
||||
/// 查看已明确完成任务的订单素材。
|
||||
case materials
|
||||
/// 当前无主动作。
|
||||
case none
|
||||
}
|
||||
|
||||
/// 状态区的纯展示数据,供固定区域布局使用,不依赖 UIKit 或虚构进度。
|
||||
struct DroneDockTaskPresentation: Equatable, Sendable {
|
||||
/// 当前可信显示阶段。
|
||||
let phase: DroneDockTaskDisplayPhase
|
||||
/// 阶段标题。
|
||||
let title: String
|
||||
/// 服务端说明或读取错误,完整文字可由界面展开。
|
||||
let message: String
|
||||
/// 当前任务设备的状态文案。
|
||||
let deviceStatus: String
|
||||
/// 本轮允许展示的主动作。
|
||||
let action: DroneDockTaskDisplayAction
|
||||
/// 主动作名称,无动作时为 nil。
|
||||
let actionTitle: String?
|
||||
/// 是否可触发动作;未对接的开始和恢复始终为 false。
|
||||
let isActionEnabled: Bool
|
||||
}
|
||||
Reference in New Issue
Block a user