Skip to content

Commit 685862b

Browse files
committed
chore: review comments
1 parent 3f71257 commit 685862b

File tree

3 files changed

+21
-12
lines changed

3 files changed

+21
-12
lines changed

packages/mos-gateway/src/CoreMosDeviceHandler.ts

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,10 @@ interface IStoryItemChange {
6262
itemDiff: PartialDeep<IMOSItem>
6363
}
6464

65+
export interface CoreMosDeviceHandlerOptions {
66+
openMediaHotStandby?: boolean
67+
}
68+
6569
/**
6670
* Represents a connection between a mos-device and Core
6771
*/
@@ -76,15 +80,20 @@ export class CoreMosDeviceHandler {
7680
private _pendingStoryItemChanges: Array<IStoryItemChange> = []
7781
private _pendingChangeTimeout: number = 60 * 1000
7882
private mosTypes: MosTypes
79-
private _openMediaHotStandby: boolean
83+
private _options: CoreMosDeviceHandlerOptions
8084

8185
private _messageQueue: Queue
8286

83-
constructor(parent: CoreHandler, mosDevice: IMOSDevice, mosHandler: MosHandler, openMediaHotStandby: boolean) {
87+
constructor(
88+
parent: CoreHandler,
89+
mosDevice: IMOSDevice,
90+
mosHandler: MosHandler,
91+
options: CoreMosDeviceHandlerOptions
92+
) {
8493
this._coreParentHandler = parent
8594
this._mosDevice = mosDevice
8695
this._mosHandler = mosHandler
87-
this._openMediaHotStandby = openMediaHotStandby
96+
this._options = options
8897

8998
this._messageQueue = new Queue()
9099

@@ -141,7 +150,7 @@ export class CoreMosDeviceHandler {
141150
let statusCode: StatusCode
142151
const messages: Array<string> = []
143152

144-
if (this._openMediaHotStandby) {
153+
if (this._options.openMediaHotStandby) {
145154
// OpenMedia treats secondary server as hot-standby
146155
// And thus is not considered as a warning if it's not connected
147156
if (connectionStatus.PrimaryConnected) {

packages/mos-gateway/src/coreHandler.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import { MosHandler } from './mosHandler'
1818
import { DeviceConfig } from './connector'
1919
import { MOS_DEVICE_CONFIG_MANIFEST } from './configManifest'
2020
import { getVersions } from './versions'
21-
import { CoreMosDeviceHandler } from './CoreMosDeviceHandler'
21+
import { CoreMosDeviceHandler, CoreMosDeviceHandlerOptions } from './CoreMosDeviceHandler'
2222
import { PeripheralDeviceCommandId } from '@sofie-automation/shared-lib/dist/core/model/Ids'
2323

2424
export interface CoreConfig {
@@ -145,10 +145,10 @@ export class CoreHandler {
145145
async registerMosDevice(
146146
mosDevice: IMOSDevice,
147147
mosHandler: MosHandler,
148-
openMediaHotStandby: boolean
148+
deviceOptions: CoreMosDeviceHandlerOptions
149149
): Promise<CoreMosDeviceHandler> {
150150
this.logger.info('registerMosDevice -------------')
151-
const coreMos = new CoreMosDeviceHandler(this, mosDevice, mosHandler, openMediaHotStandby)
151+
const coreMos = new CoreMosDeviceHandler(this, mosDevice, mosHandler, deviceOptions)
152152

153153
this._coreMosHandlers.push(coreMos)
154154
return coreMos.init().then(() => {

packages/mos-gateway/src/mosHandler.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -243,11 +243,11 @@ export class MosHandler {
243243

244244
if (!this._coreHandler) throw Error('_coreHandler is undefined!')
245245

246-
const coreMosHandler = await this._coreHandler.registerMosDevice(
247-
mosDevice,
248-
this,
249-
mosDevice.idSecondary ? this._openMediaHotStandby[mosDevice.idSecondary] : false
250-
)
246+
const coreMosHandler = await this._coreHandler.registerMosDevice(mosDevice, this, {
247+
openMediaHotStandby: mosDevice.idSecondary
248+
? this._openMediaHotStandby[mosDevice.idSecondary]
249+
: false,
250+
})
251251
// this._logger.info('mosDevice registered -------------')
252252
// Setup message flow between the devices:
253253

0 commit comments

Comments
 (0)