export type DevId = { address: number; busNumber: number }; export type Version = { major: number; minor: number; patch: number; build: number }; export type Lcd = { width: number; height: number; bpp: number; sample_mode: number }; export type HardwareType = | "Cas" | "NonCas" | "CasCx" | "NonCasCx" | { Unknown: number }; // The current state of the calculator. export type RunLevel = | "Recovery" | "Os" | { Unknown: number }; export type Battery = | "Powered" | "Low" | "Ok" | { Unknown: number }; export type Info = { free_storage: number; total_storage: number; free_ram: number; total_ram: number; version: Version; boot1_version: Version; boot2_version: Version; hw_type: HardwareType; clock_speed: number; lcd: Lcd; os_extension: string; file_extension: string; name: string; id: string; run_level: RunLevel; battery: Battery; is_charging: boolean }; export type FileInfo = { path: string; isDir: boolean; date: number; size: number }; export type Progress = { remaining: number; total: number }; export type PartialCmd = { action: 'download'; path: [string, number]; dest?: string } | { action: 'upload'; path: string } & ({ src: string } | { file: File }) | { action: 'uploadOs' } & ({ src: string } | { file: File }) | { action: 'deleteFile'; path: string } | { action: 'deleteDir'; path: string } | { action: 'createDir'; path: string } | { action: 'move'; src: string; dest: string } | { action: 'copy'; src: string; dest: string }; export type Cmd = { id: number } & PartialCmd; export type Device = { name: string; isCxIi: boolean; needsDrivers: boolean; info?: Info; progress?: Progress; queue?: Cmd[]; running?: boolean }; export interface GenericDevices { devices: Record; enumerating: boolean; hasEnumerated: boolean; errorHandler?: (e: DOMException) => void; enumerate(): Promise; open(dev: string): Promise; close(dev: string): Promise; update(dev: string): Promise; listDir(dev: DevId | string, path: string): Promise; uploadFiles(dev: DevId | string, path: string, files: File[]): Promise; promptUploadFiles(dev: DevId | string, path: string): Promise; uploadOs(dev: DevId | string, filter: string): Promise; uploadOsFile(dev: DevId | string, file: File): Promise; downloadFiles(dev: DevId | string, files: [string, number][]): Promise; delete(dev: DevId | string, files: FileInfo[]): Promise; createDir(dev: DevId | string, path: string): Promise; copy(dev: DevId | string, src: string, dest: string): Promise; move(dev: DevId | string, src: string, dest: string): Promise; } declare module 'vue/types/vue' { // 3. Declare augmentation for Vue interface Vue { $devices: GenericDevices; } }