Skip to content

Commit

Permalink
chore: refactor lawo integration (#318)
Browse files Browse the repository at this point in the history
  • Loading branch information
mint-dewit authored Jan 23, 2024
1 parent bb8a1c1 commit 54d33cf
Show file tree
Hide file tree
Showing 8 changed files with 1,294 additions and 1,560 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,20 @@ import { EventEmitter } from 'events'

export { Model, Types } from 'emberplus-connection'

const mockDo = jest.fn()
export const mockSetValue = jest.fn(async () => {
return {
sentOk: true,
response: Promise.resolve(),
}
})
export const mockInvoke = jest.fn(async () => {
return {
sentOk: true,
response: Promise.resolve({
id: 13,
}),
}
})

const instances: Array<EmberClient> = []

Expand Down Expand Up @@ -41,23 +54,32 @@ export class EmberClient extends EventEmitter {
}
}
async getElementByPath(p) {
if (p === 'Ruby.Functions.RampMotorFader') {
return {
path: p,
contents: {
type: 'FUNCTION',
value: 0,
},
}
}
return {
path: p,
contents: {
parameterType: 'PARAMETER',
type: 'PARAMETER',
value: 0,
},
}
}
async setValue() {
return {
sentOk: true,
response: Promise.resolve(),
}
}

static get mockDo() {
return mockDo
setValue = mockSetValue
invoke = mockInvoke

static get mockSetValue() {
return mockSetValue
}
static get mockInvoke() {
return mockInvoke
}
static get instances() {
return instances
Expand Down
14 changes: 3 additions & 11 deletions packages/timeline-state-resolver/src/conductor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ import {
DeviceOptionsQuantel,
DeviceOptionsHyperdeck,
DeviceOptionsPanasonicPTZ,
DeviceOptionsLawo,
} from 'timeline-state-resolver-types'

import { DoOnTime } from './devices/doOnTime'
Expand All @@ -42,7 +43,6 @@ import { CommandWithContext } from './devices/device'
import { DeviceContainer } from './devices/deviceContainer'

import { CasparCGDevice, DeviceOptionsCasparCGInternal } from './integrations/casparCG'
import { LawoDevice, DeviceOptionsLawoInternal } from './integrations/lawo'
import { PharosDevice, DeviceOptionsPharosInternal } from './integrations/pharos'
import { SisyfosMessageDevice, DeviceOptionsSisyfosInternal } from './integrations/sisyfos'
import { SingularLiveDevice, DeviceOptionsSingularLiveInternal } from './integrations/singularLive'
Expand Down Expand Up @@ -510,15 +510,6 @@ export class Conductor extends EventEmitter<ConductorEvents> {
getCurrentTime,
threadedClassOptions
)
case DeviceType.LAWO:
return DeviceContainer.create<DeviceOptionsLawoInternal, typeof LawoDevice>(
'../../dist/integrations/lawo/index.js',
'LawoDevice',
deviceId,
deviceOptions,
getCurrentTime,
threadedClassOptions
)
case DeviceType.PHAROS:
return DeviceContainer.create<DeviceOptionsPharosInternal, typeof PharosDevice>(
'../../dist/integrations/pharos/index.js',
Expand Down Expand Up @@ -605,6 +596,7 @@ export class Conductor extends EventEmitter<ConductorEvents> {
case DeviceType.HTTPSEND:
case DeviceType.HTTPWATCHER:
case DeviceType.HYPERDECK:
case DeviceType.LAWO:
case DeviceType.OBS:
case DeviceType.OSC:
case DeviceType.PANASONIC_PTZ:
Expand Down Expand Up @@ -1515,7 +1507,7 @@ export type DeviceOptionsAnyInternal =
| DeviceOptionsAbstract
| DeviceOptionsCasparCGInternal
| DeviceOptionsAtem
| DeviceOptionsLawoInternal
| DeviceOptionsLawo
| DeviceOptionsHTTPSend
| DeviceOptionsHTTPWatcher
| DeviceOptionsPanasonicPTZ
Expand Down
Loading

0 comments on commit 54d33cf

Please sign in to comment.