-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Balte de Wit
committed
Sep 21, 2019
1 parent
14bb340
commit e7c47d4
Showing
2 changed files
with
48 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters