//
//  SonyPTPCommands.swift
//  otg_swift
//
//  Created by hanqiu on 2026/7/3.
//

import Foundation

/// 索尼 SDIO / SDIE 扩展 PTP 命令码、属性码与事件码常量。
enum SonyPTPCommand {
    // MARK: - SDIO 命令

    /// SDIO Connect (0x9201)，握手阶段多次调用，参数区分阶段
    static let sdioConnect: UInt16 = 0x9201
    /// GetExtDeviceInfo (0x9202)，获取扩展设备能力
    static let sdioGetExtDeviceInfo: UInt16 = 0x9202
    /// SetExtDevicePropValue (0x9205)，写入单个扩展属性
    static let sdioSetExtDevicePropValue: UInt16 = 0x9205
    /// GetAllExtDevicePropInfo (0x9209)，读取全部或 diff 扩展属性
    static let sdioGetAllExtDevicePropInfo: UInt16 = 0x9209

    // MARK: - 扩展设备属性

    /// Position_Key_Setting (0xD25A)，设为 PC Remote 模式
    static let positionKeySetting: UInt16 = 0xD25A
    /// Still_Image_Save_Destination (0xD222)，保存目标含 Host PC
    static let stillImageSaveDestination: UInt16 = 0xD222
    /// Still_Image_Trans_Size (0xD268)，传输尺寸（0xFFFFFFFF = 原图）
    static let stillImageTransSize: UInt16 = 0xD268
    /// Shooting_File_Info (0xD215)；值 > 0x8000 表示 PC Remote 缓冲区可能有新片
    static let shootingFileInfo: UInt16 = 0xD215

    /// PC Remote 虚拟对象句柄，GetObjectInfo/GetObject 用于 Probe 与下载
    static let shotObjectHandle: UInt32 = 0xFFFF_C001
    /// 静态影像保存到 Host PC 的属性枚举值
    static let saveDestinationHostPC: UInt16 = 1
    /// D215 超过此阈值视为 shot buffer 就绪
    static let shotBufferReadyThreshold: Int64 = 0x8000

    // MARK: - PTP Events (Sony SDIE)

    /// ObjectAdded (0xC201)，虚拟对象已加入设备侧 catalog
    static let sdieObjectAdded: UInt16 = 0xC201
    /// ObjectRemoved (0xC202)，对象从 catalog 移除
    static let sdieObjectRemoved: UInt16 = 0xC202
    /// DevicePropChanged (0xC203)；ZV-E10 快门后常见，需配合 D215/Probe
    static let sdieDevicePropChanged: UInt16 = 0xC203
    /// CapturedEvent (0xC206)，拍摄完成事件
    static let sdieCapturedEvent: UInt16 = 0xC206
}
