/
PeripheralDevice.ts
98 lines (73 loc) · 2.65 KB
/
PeripheralDevice.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
import { Time } from '@sofie-automation/blueprints-integration'
import { DeviceConfigManifest } from '../deviceConfig'
import { OrganizationId, PeripheralDeviceId, StudioId } from './Ids'
import {
PeripheralDeviceStatusObject,
PeripheralDeviceCategory,
PeripheralDeviceType,
PeripheralDeviceSubType,
PERIPHERAL_SUBTYPE_PROCESS,
} from '@sofie-automation/shared-lib/dist/peripheralDevice/peripheralDeviceAPI'
export {
PeripheralDeviceStatusObject,
PeripheralDeviceCategory,
PeripheralDeviceType,
PeripheralDeviceSubType,
PERIPHERAL_SUBTYPE_PROCESS,
}
import {
GenericPeripheralDeviceSettings,
IngestDeviceSecretSettings,
IngestDeviceSettings,
} from '@sofie-automation/shared-lib/dist/core/model/peripheralDevice'
export interface PeripheralDevice {
_id: PeripheralDeviceId
/** Name of the device (set by the device, modifiable by user) */
name: string
/** Name of the device (set by the device) */
deviceName: string
/** The studio this device is assigned to. Will be undefined for sub-devices */
studioId?: StudioId
category: PeripheralDeviceCategory
type: PeripheralDeviceType
subType: PeripheralDeviceSubType
parentDeviceId?: PeripheralDeviceId
/** When the device was initially created [unix-timestamp] */
created: number
status: PeripheralDeviceStatusObject
settings: IngestDeviceSettings | GenericPeripheralDeviceSettings
/** If set, this device is owned by that organization */
organizationId: OrganizationId | null
/** Versions reported from the device */
versions?: {
[libraryName: string]: string
}
/** Whether version checks should be disabled for this version */
disableVersionChecks?: boolean
lastSeen: Time // Updated continously while connected
lastConnected: Time // Updated upon connection, not continously
/** A list of last reported latencies */
latencies?: number[]
connected: boolean
connectionId: string | null // Id of the current ddp-Connection
token: string
secretSettings?: IngestDeviceSecretSettings | { [key: string]: any }
/** If the device is of category ingest, the name of the NRCS being used */
nrcsName?: string
documentationUrl?: string
/** Ignore this device when computing status in the GUI (other status reports are unaffected) */
ignore?: boolean
configManifest: DeviceConfigManifest
/** If this is an ingest gateway, the last tiem data was received */
lastDataReceived?: Time
/** If an ingest device performing an oauth flow */
accessTokenUrl?: string
}
export function getExternalNRCSName(device: PeripheralDevice | undefined): string {
if (device?.nrcsName && device.category === PeripheralDeviceCategory.INGEST) {
return device.nrcsName
} else {
// undefined NRCS:
return 'NRCS'
}
}