Skip to content

Commit

Permalink
feat: configuration command
Browse files Browse the repository at this point in the history
  • Loading branch information
Balte de Wit committed Sep 21, 2019
1 parent 14bb340 commit e7c47d4
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 0 deletions.
47 changes: 47 additions & 0 deletions src/commands/configuration.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
import { SynchronousCode } from '../codes'
import { ResponseMessage, NamedMessage } from '../message'
import { AbstractCommand } from './abstractCommand'

export interface ConfigurationCommandResponse {
videoInput: string
audioInput: string
fileFormat: string
}

export class ConfigurationCommand extends AbstractCommand {
expectedResponseCode = SynchronousCode.DeviceInfo

videoInput?: string
audioInput?: string
fileFormat?: string

deserialize (msg: ResponseMessage) {
const res: ConfigurationCommandResponse = {
videoInput: msg.params['video input'],
audioInput: msg.params['audio input'],
fileFormat: msg.params['file format']
}
return res
}

constructor (videoInput?: string, audioInput?: string, fileFormat?: string) {
super()

this.videoInput = videoInput
this.audioInput = audioInput
this.fileFormat = fileFormat
}

serialize () {
const res: NamedMessage = {
name: 'jog',
params: {}
}

if (this.videoInput) res.params.videoInput = this.videoInput
if (this.audioInput) res.params.audioInput = this.audioInput
if (this.fileFormat) res.params.fileFormat = this.fileFormat

return res
}
}
1 change: 1 addition & 0 deletions src/commands/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
export { AbstractCommand, ErrorResponse } from './abstractCommand'

export * from './connect'
export * from './configuration'
export * from './deviceInfo'
export * from './format'
export * from './notify'
Expand Down

0 comments on commit e7c47d4

Please sign in to comment.