import { PhygridDataChannel, PhygridMediaStream, MediaStreamOptions, MediaStreamResponderOptions, DataChannelResponderOptions, MediaStreamCallback, DataChannelCallback } from '../services/webrtc/types'; import { DescriptorValidator } from '../advisory-validation'; import { HardwareIdScope } from '../scoped-hardware-id'; export declare enum TwinTypeEnum { Device = "Device", Screen = "Screen", Edge = "Edge", Cloud = "Cloud", Web = "Web", Peripheral = "Peripheral" } export declare enum TwinStatusEnum { Offline = "Offline", Online = "Online", Starting = "Starting", Exited = "Exited", ImageNotFound = "ImageNotFound" } export interface WifiNetwork { ssid: string; bssid: string; mode?: string; channel: number; frequency: number; signalLevel: number; quality: number; security: string[]; wpaFlags?: string[]; rsnFlags?: string[]; } interface WifiConnection { id: string; iface: string; model: string; ssid: string; bssid?: string; channel: number; frequency: number; type: string; security: string[]; signalLevel: number; quality: number; txRate: number; } export interface Baseboard { manufacturer: string; model: string; version: string; serial: string; assetTag: string; memMax: number; memSlots: number; } export interface Battery { hasBattery: boolean; cycleCount: number; isCharging: boolean; designedCapacity: number; maxCapacity: number; currentCapacity: number; voltage: number; capacityUnit: string; percent: number; timeRemaining: number; acConnected: boolean; type: string; model: string; manufacturer: string; serial: string; } export interface GraphicsController { vendor: string; model: string; bus: string; vramDynamic: boolean; vram: number | null; deviceId: string; vendorId: string; external: boolean; cores: string; metalVersion: string; } export interface Display { vendor: string; vendorId: string; model: string; productionYear: string; serial: string; displayId: string; main: boolean; builtin: boolean; connection: string | null; sizeX: number | null; sizeY: number | null; pixelDepth: number | null; resolutionX: number; resolutionY: number; currentResX: number; currentResY: number; positionX: number; positionY: number; currentRefreshRate: number; } export interface Graphics { controllers: GraphicsController[]; displays: Display[]; } export interface Chassis { manufacturer: string; model: string; type: string; version: string; serial: string; assetTag: string; sku: string; } export interface Bios { vendor: string; version: string; releaseDate: string; revision: string; } export interface Cache { l1d: number; l1i: number; l2: number; l3: number | null; } export interface CPU { manufacturer: string; brand: string; vendor: string; family: string; model: string; stepping: string; revision: string; voltage: string; speed: number; speedMin: number; speedMax: number; governor: string; cores: number; physicalCores: number; performanceCores: number; efficiencyCores: number; processors: number; socket: string; flags: string; virtualization: boolean; cache: Cache; } export interface Memory { total: number; free: number; used: number; active: number; available: number; buffers: number; cached: number; slab: number; buffcache: number; swaptotal: number; swapused: number; swapfree: number; writeback: number | null; dirty: number | null; } export interface CpuCurrentSpeed { min: number; max: number; avg: number; cores: number[]; } export interface CPUUsage { load: number; loadUser: number; loadSystem: number; loadNice: number; loadIdle: number; loadIrq: number; loadSteal: number; loadGuest: number; rawLoad: number; rawLoadUser: number; rawLoadSystem: number; rawLoadNice: number; rawLoadIdle: number; rawLoadIrq: number; rawLoadSteal: number; rawLoadGuest: number; } export interface CurrentLoad { avgLoad: number; currentLoad: number; currentLoadUser: number; currentLoadSystem: number; currentLoadNice: number; currentLoadIdle: number; currentLoadIrq: number; currentLoadSteal: number; currentLoadGuest: number; rawCurrentLoad: number; rawCurrentLoadUser: number; rawCurrentLoadSystem: number; rawCurrentLoadNice: number; rawCurrentLoadIdle: number; rawCurrentLoadIrq: number; rawCurrentLoadSteal: number; rawCurrentLoadGuest: number; cpus: CPUUsage[]; } export interface NetworkInterface { iface: string; ifaceName: string; default: boolean; ip4: string; ip4subnet: string; ip6: string; ip6subnet: string; mac: string; internal: boolean; virtual: boolean; operstate: string; type: string; duplex: string; mtu: number; speed: number | null; dhcp: boolean; dnsSuffix: string; ieee8021xAuth: string; ieee8021xState: string; carrierChanges: number; } export interface NetworkStats { iface: string; operstate: string; rx_bytes: number; rx_dropped: number; rx_errors: number; tx_bytes: number; tx_dropped: number; tx_errors: number; rx_sec: number; tx_sec: number; ms: number; } export interface MemLayout { size: number; bank: string; type: string; ecc: boolean; clockSpeed: number; formFactor: string; manufacturer: string; partNum: string; serialNum: string; voltageConfigured: number | null; voltageMin: number | null; voltageMax: number | null; } export interface FsSize { fs: string; type: string; size: number; used: number; available: number; use: number; mount: string; rw: boolean; } export interface FsStats { rx: number; wx: number; tx: number; rx_sec: number; wx_sec: number; tx_sec: number; ms: number; } export interface UUID { os: string; hardware: string; macs: string[]; } export interface TimeStatus { current: number; uptime: number; timezone: string; timezoneName: string; } export interface System { manufacturer: string; model: string; version: string; serial: string; uuid: string; sku: string; virtual: boolean; } export interface WifiInterface { iface: string; id: string; model: boolean; vendor: string; mac: string; } export interface DeviceTwinReportedProperties { ip: DeviceIp[]; os: { osVersion: string; }; env: { gridEnv: string; }; phydeviceVersion: string; baseboard: Baseboard; battery: Battery; graphics: Graphics; chassis: Chassis; bios: Bios; cpu: CPU; mem: Memory; inetLatency: number; cpuCurrentSpeed: CpuCurrentSpeed; currentLoad: CurrentLoad; networkInterfaces: NetworkInterface[]; wifiInterfaces: WifiInterface[]; networkStats: NetworkStats[]; memLayout: MemLayout[]; fsSize: FsSize[]; fsStats: FsStats; wifiNetworks: WifiNetwork[]; wifiConnections: WifiConnection[]; uuid: UUID; time: TimeStatus; users: any[]; system: System; } export interface EdgeTwinReportedProperties { lastError?: { message: string; errorObject?: Object; timestamp: Date; }; } export interface ScreenTwinReportedProperties { screenshot?: string; sound?: Record; crash?: { count?: number; reason?: string; }; } interface TwinCreatePayloadBase { deviceId: string; tenantId: string; } export interface DeviceTwinCreatePayload extends TwinCreatePayloadBase { displayName: string; accessKey: string; env: string; spaceId: string; serialNumber: string; } interface TwinDocumentBase { deviceId: string; tenantId: string; type: TwinTypeEnum; isDeleted: boolean; properties: unknown; version: number; createdAt: Date; updatedAt: Date; lastStatusUpdatedAt: Date; status: TwinStatusEnum; notes: string; deletedAt?: Date; } export interface ScreenTwinDesiredProperties { url: string; screen_resolution: string; sound_output: string; sound_input: string; scale: string; screen_orientation: string; enable_debug: boolean; installationId: string; } export interface ScreenTwinDesiredPropertiesResponse { url: string; screen_resolution: string; sound_output: string; sound_input: string; scale: string; screen_orientation: string; enable_debug: boolean; installationId: string; } export interface EdgeTwinDesiredProperties { image: string; containerCreateOptions: Record; credentials: { address: string; username?: string; password?: string; }; installationId: string; } export interface EdgeTwinDesiredPropertiesResponse { image: string; containerCreateOptions: Record; credentials: { address: string; username?: string; password?: string; }; installationId: string; settings: Record; } export interface CloudTwinDesiredProperties { installationId: string; appRegistrationId: string; appName?: string; appVersion?: string; buildId?: string; spaceId?: string; tenantId?: string; settings?: Record; $version?: number; } export interface CloudTwinDesiredPropertiesResponse extends CloudTwinDesiredProperties { } export interface WebTwinDesiredProperties { installationId: string; } export interface WebTwinDesiredPropertiesResponse { installationId: string; } export interface DeviceAccessControl { password: string; } export interface DeviceTwinDesiredProperties { spaceId: string; env: string; displayName: string; deviceSerial: string; externalId?: string; accessKey: string; deviceAccessControl?: DeviceAccessControl; } export interface DeviceTwinDesiredPropertiesResponse { spaceId: string; env: string; displayName: string; deviceSerial: string; externalId?: string; accessKey: string; installationId: string; settings: any; appName: string; timezone?: string; deviceAccessControl?: DeviceAccessControl; } interface ScreenTwinDocument extends TwinDocumentBase { type: TwinTypeEnum.Screen; properties: { desired: ScreenTwinDesiredProperties; reported: ScreenTwinReportedProperties; }; } interface EdgeTwinDocument extends TwinDocumentBase { type: TwinTypeEnum.Edge; properties: { desired: EdgeTwinDesiredProperties; reported: EdgeTwinReportedProperties; }; } interface CloudTwinDocument extends TwinDocumentBase { type: TwinTypeEnum.Cloud; properties: { desired: CloudTwinDesiredProperties; reported: Record; }; } interface WebTwinDocument extends TwinDocumentBase { type: TwinTypeEnum.Web; properties: { desired: WebTwinDesiredProperties; reported: Record; }; } interface DeviceTwinDocument extends TwinDocumentBase { type: TwinTypeEnum.Device; properties: { desired: DeviceTwinDesiredProperties; reported: DeviceTwinReportedProperties; }; } export type TwinDocument = ScreenTwinDocument | EdgeTwinDocument | CloudTwinDocument | WebTwinDocument | DeviceTwinDocument; export interface TwinResponseBase { id: string; deviceId: string; tenantId: string; instanceId?: string; type: TwinTypeEnum; status: TwinStatusEnum; version: number; notes: string; createdAt: Date; updatedAt: Date; lastStatusUpdatedAt: Date; properties: { desired: unknown; reported: unknown; }; descriptors?: Record; } export interface ScreenTwinResponse extends TwinResponseBase { type: TwinTypeEnum.Screen; properties: { reported: ScreenTwinReportedProperties; desired: ScreenTwinDesiredPropertiesResponse; }; } export interface EdgeTwinResponse extends TwinResponseBase { type: TwinTypeEnum.Edge; properties: { reported: EdgeTwinReportedProperties; desired: EdgeTwinDesiredPropertiesResponse; }; } export interface CloudTwinResponse extends TwinResponseBase { type: TwinTypeEnum.Cloud; properties: { reported: Record; desired: CloudTwinDesiredPropertiesResponse; }; } export interface WebTwinResponse extends TwinResponseBase { type: TwinTypeEnum.Web; properties: { reported: Record; desired: WebTwinDesiredPropertiesResponse; }; } export interface DeviceTwinResponse extends TwinResponseBase { type: TwinTypeEnum.Device; properties: { reported: DeviceTwinReportedProperties; desired: DeviceTwinDesiredPropertiesResponse; }; } export interface PeripheralTwinDesiredProperties { peripheralName: string; hardwareId: string; instanceId: string; settings?: Record; } export interface PeripheralTwinReportedProperties { lastError?: { message: string; errorObject?: Object; timestamp: Date; }; status?: { connected: boolean; lastConnected?: Date; metadata?: Record; }; [key: string]: any; } export interface PeripheralTwinResponse extends TwinResponseBase { type: TwinTypeEnum.Peripheral; properties: { reported: Record; desired: PeripheralTwinDesiredProperties; }; } export interface PeripheralInstance { twinId: string; peripheralTwinResponse: TwinResponse | null; emit: { (type: string, payload: any): void; (type: string, payload: any, callback: (response: TwinMessageResult) => void): Promise; }; on: (type: string, callback: (message: any, respond?: (result: TwinMessageResult) => void) => void) => () => void; off: (type: string, callback: (message: any, respond?: (result: TwinMessageResult) => void) => void) => boolean; to: (targetTwinId: string) => { emit: { (type: string, payload: any): void; (type: string, payload: any, callback: (response: TwinMessageResult) => void): Promise; }; }; getDataChannel: (channelName?: string) => Promise; onDataChannel: (callback: DataChannelCallback, options?: DataChannelResponderOptions) => Promise<() => void>; getMediaStream: (options?: MediaStreamOptions) => Promise<{ stream: PhygridMediaStream; close: () => void; }>; onMediaStream: (callback: MediaStreamCallback, options?: MediaStreamResponderOptions) => Promise<() => void>; answerMediaOffer: (offerSdp: string, options: { viewerId: string; channelName?: string; }) => Promise; updateReported: (properties: Record) => Promise; onUpdateReported: (callback: (reportedProperties: Record) => void) => () => void; updateDesired: (properties: Record) => Promise; onUpdateDesired: (callback: (desiredProperties: Record) => void) => () => void; enableAdvisoryValidation: (validator: DescriptorValidator) => void; onOwnershipLost: (callback: (loss: PeripheralOwnershipLoss) => void) => void; remove: () => Promise; } export interface Instance { emit: (type: string, payload: any) => void; on: (type: string, callback: (message: any, respond?: (result: TwinMessageResult) => void) => void) => () => void; off: (type: string, callback: (message: any, respond?: (result: TwinMessageResult) => void) => void) => boolean; to: (twinId: string) => { emit: { (type: string, payload: any): void; (type: string, payload: any, callback: (response: TwinMessageResult) => void): Promise; }; }; createPeripheralTwin: (peripheralName: string, hardwareId: string, desiredProperties?: Record, descriptors?: Record) => Promise; createPeripheralTwinDetailed: (peripheralName: string, hardwareId: string, desiredProperties?: Record, descriptors?: Record) => Promise; generateScopedHardwareId: (id: string, scope?: HardwareIdScope) => Promise; getPeripheralTwins: (twinId?: string) => Promise; getDataChannel: (targetTwinId: string, channelName?: string) => Promise; onDataChannel: (callback: DataChannelCallback, options?: DataChannelResponderOptions) => Promise<() => void>; updateReported: (properties: Record) => Promise; getMediaStream: (targetTwinId: string, options?: MediaStreamOptions) => Promise<{ stream: PhygridMediaStream; close: () => void; }>; onMediaStream: (callback: MediaStreamCallback, options?: MediaStreamResponderOptions) => Promise<() => void>; [key: string]: any; } export type TwinResponse = DeviceTwinResponse | ScreenTwinResponse | EdgeTwinResponse | CloudTwinResponse | WebTwinResponse | PeripheralTwinResponse; export type TwinDesiredPropertiesResponse = DeviceTwinDesiredPropertiesResponse | ScreenTwinDesiredPropertiesResponse | EdgeTwinDesiredPropertiesResponse | CloudTwinDesiredPropertiesResponse | WebTwinDesiredPropertiesResponse; interface TwinCreateDocumentBase { deviceId: string; tenantId: string; type: unknown; properties: { desired: unknown; }; } export interface DeviceTwinCreateDocument extends TwinCreateDocumentBase { type: TwinTypeEnum.Device; properties: { desired: DeviceTwinDesiredProperties; }; } export interface ScreenTwinCreateDocument extends TwinCreateDocumentBase { type: TwinTypeEnum.Screen; properties: { desired: ScreenTwinDesiredProperties; }; } export interface EdgeTwinCreateDocument extends TwinCreateDocumentBase { type: TwinTypeEnum.Edge; properties: { desired: EdgeTwinDesiredProperties; }; } export type TwinCreateDocument = DeviceTwinCreateDocument | ScreenTwinCreateDocument | EdgeTwinCreateDocument; export interface TwinsGroupedByDeviceId { _id: string; twins: TwinDocument[]; } export interface TwinsGroupedByDeviceIdResponse { _id: string; twins: TwinResponse[]; } export type InstanceTwinReportedProperties = EdgeTwinReportedProperties | DeviceTwinReportedProperties | ScreenTwinReportedProperties; export interface DeviceTwinUpdatePayload { spaceId?: string; env?: string; displayName?: string; notes?: string; } export interface DeviceTwinUpdateDocument { status?: TwinStatusEnum; lastStatusUpdatedAt?: Date; notes?: string; properties?: { reported?: DeviceTwinReportedProperties; desired?: { spaceId?: string; env?: string; displayName?: string; }; }; } export interface InstanceTwinUpdateDocument { status?: TwinStatusEnum; lastStatusUpdatedAt?: Date; properties?: { reported?: InstanceTwinReportedProperties; }; } export type TwinUpdateDocument = DeviceTwinUpdateDocument | InstanceTwinUpdateDocument; export interface DeviceIp { interface: string; ipv4: string; ipv6: string; } export interface DeviceStatus { status: string; isConnected: string; deviceId: string; accessKey: string; deviceSerial: string; gridEnv: string; osVersion: string; provisioningCode: string; displayName: string; deviceEnv: string; spaceId: string; tenantId: string; dataResidency: string; socketConnected: boolean; socketAuthenticated: boolean; ip: DeviceIp[]; twins: Record; } export interface EventPayload { twinId?: string; sourceTwinId?: string; method?: string; targetMethod?: string; targetInstanceId?: string; data?: T; } export declare enum EventAckStatus { Success = "success", Error = "error" } export interface PeripheralHandover { previousDeviceId?: string; previousInstanceId?: string; } export interface PeripheralOwnershipLoss { newOwnerDeviceId?: string; newOwnerInstanceId?: string; } export interface EventAckResponse { status: EventAckStatus; message: string; twin?: TwinResponse; twins?: TwinResponse[]; errorType?: string; } export interface PeripheralCreateOrUpdateAckResponse extends EventAckResponse { created?: boolean; handover?: PeripheralHandover; } export interface PeripheralCreateResult { twin: TwinResponse; created: boolean; handover?: PeripheralHandover; } export interface MediaOptions { localStream?: MediaStream; isMediaConnection?: boolean; mediaDirection?: string; } export declare enum TwinMessageResultStatus { Success = "success", Error = "error", Warning = "warning" } export interface TwinMessageResult { status: TwinMessageResultStatus; message: string; data?: unknown; } export {}; //# sourceMappingURL=twin.types.d.ts.map