Simplified config parsing
This commit is contained in:
@ -1,69 +1,11 @@
|
||||
import { DeviceSetupItem } from './DeviceSetupItem';
|
||||
/**
|
||||
* Input properties.
|
||||
*/
|
||||
export interface IActivityProps {
|
||||
deviceList: Array<DeviceSetupItem>,
|
||||
controlDeviceId: string,
|
||||
volumeDeviceId: string,
|
||||
outputDeviceId: string,
|
||||
displayName: string
|
||||
useMatrix: boolean,
|
||||
}
|
||||
import { IDeviceSetupItem } from './DeviceSetupItem';
|
||||
|
||||
/**
|
||||
* Data model class to hold activity related information.
|
||||
*/
|
||||
export class Activity {
|
||||
private _volumeDeviceId: string = "";
|
||||
private _outputDeviceId: string = "";
|
||||
private _controlDeviceId: string = "";
|
||||
private _displayName: string = "";
|
||||
private _deviceSetupItems: Array<DeviceSetupItem>;
|
||||
private _useMatrix: boolean = false;
|
||||
export interface IActivity {
|
||||
OutputDevice: string;
|
||||
VolumeDevice: string;
|
||||
ControlDevice: string;
|
||||
DisplayName: string;
|
||||
DeviceSetupList: Array<IDeviceSetupItem>;
|
||||
UseMatrix: boolean;
|
||||
|
||||
constructor(props: IActivityProps) {
|
||||
this._controlDeviceId = props.controlDeviceId;
|
||||
this._outputDeviceId = props.outputDeviceId;
|
||||
this._volumeDeviceId = props.volumeDeviceId;
|
||||
this._displayName = props.displayName;
|
||||
this._deviceSetupItems = props.deviceList;
|
||||
this._useMatrix = props.useMatrix
|
||||
}
|
||||
|
||||
/**
|
||||
* The device associated with main control.
|
||||
*/
|
||||
public get controlDeviceId(): string {
|
||||
return this._controlDeviceId;
|
||||
};
|
||||
|
||||
/**
|
||||
* The device associated with the volume control.
|
||||
*/
|
||||
public get volumeDeviceId(): string {
|
||||
return this._volumeDeviceId
|
||||
};
|
||||
|
||||
/**
|
||||
* The device associated with output.
|
||||
*/
|
||||
public get outputDeviceId(): string {
|
||||
return this._outputDeviceId;
|
||||
};
|
||||
|
||||
/**
|
||||
* The display name of the activity.
|
||||
*/
|
||||
public get displayName(): string {
|
||||
return this._displayName;
|
||||
}
|
||||
|
||||
public get deviceSetupItems(): Array<DeviceSetupItem> {
|
||||
return this._deviceSetupItems
|
||||
}
|
||||
|
||||
public get useMatrix(): boolean {
|
||||
return this._useMatrix;
|
||||
}
|
||||
}
|
@ -1,25 +1,5 @@
|
||||
|
||||
export interface IDeviceSetupItemProps {
|
||||
deviceName: string,
|
||||
input: string
|
||||
}
|
||||
|
||||
/**
|
||||
* Data model to hold device setup items.
|
||||
*/
|
||||
export class DeviceSetupItem {
|
||||
private _deviceId: string = "";
|
||||
private _input: string = "";
|
||||
constructor(props: IDeviceSetupItemProps) {
|
||||
this._deviceId = props.deviceName;
|
||||
this._input = props.input;
|
||||
}
|
||||
|
||||
public get deviceName() {
|
||||
return this._deviceId;
|
||||
}
|
||||
|
||||
public get input() {
|
||||
return this._input;
|
||||
}
|
||||
export interface IDeviceSetupItem {
|
||||
DeviceName: string;
|
||||
Input: string;
|
||||
}
|
13
src/Models/IConfig.ts
Normal file
13
src/Models/IConfig.ts
Normal file
@ -0,0 +1,13 @@
|
||||
import { IMatrix } from "./Matrix";
|
||||
import { IActivity } from "./Activity";
|
||||
|
||||
export interface IControlUnit {
|
||||
DisplayName: string;
|
||||
Activities: Array<IActivity>;
|
||||
}
|
||||
|
||||
export interface IConfig {
|
||||
hubIp: string;
|
||||
Matrix: IMatrix
|
||||
ControlUnits: Array<IControlUnit>
|
||||
}
|
@ -1,42 +1,15 @@
|
||||
export interface IMatrixProps {
|
||||
inputs: Array<Input>,
|
||||
outputs: Array<Output>,
|
||||
deviceName: string,
|
||||
export interface IInput {
|
||||
InputNumber: string,
|
||||
InputDevice: string,
|
||||
}
|
||||
|
||||
export interface Input {
|
||||
inputNumber: string,
|
||||
inputDevice: string,
|
||||
export interface IOutput {
|
||||
OutputLetter: string,
|
||||
OutputDevice: string,
|
||||
}
|
||||
|
||||
export interface Output {
|
||||
outputLetter: string,
|
||||
outputDevice: string,
|
||||
}
|
||||
|
||||
/**
|
||||
* Data model to hold matrix information.
|
||||
*/
|
||||
export class Matrix {
|
||||
private _inputs: Array<Input> = [];
|
||||
private _outputs: Array<Output> = [];
|
||||
private _deviceName: string;
|
||||
|
||||
constructor(props: IMatrixProps) {
|
||||
this._inputs = props.inputs;
|
||||
this._outputs = props.outputs;
|
||||
this._deviceName = props.deviceName;
|
||||
}
|
||||
|
||||
public get inputs(): Array<Input> {
|
||||
return this._inputs
|
||||
}
|
||||
|
||||
public get outputs(): Array<Output> {
|
||||
return this._outputs;
|
||||
}
|
||||
|
||||
public get deviceName(): string {
|
||||
return this._deviceName;
|
||||
}
|
||||
export interface IMatrix {
|
||||
Inputs: Array<IInput>;
|
||||
Outputs: Array<IOutput>;
|
||||
DeviceName: string;
|
||||
}
|
Reference in New Issue
Block a user