Compiles and runs. Devices appearing in home kit.
This commit is contained in:
69
src/Models/Activity.ts
Normal file
69
src/Models/Activity.ts
Normal file
@ -0,0 +1,69 @@
|
||||
import { DeviceSetupItem } from './DeviceSetupItem';
|
||||
/**
|
||||
* Input properties.
|
||||
*/
|
||||
export interface IActivityProps {
|
||||
deviceList: Array<DeviceSetupItem>,
|
||||
controlDeviceId: string,
|
||||
volumeDeviceId: string,
|
||||
outputDeviceId: string,
|
||||
displayName: string
|
||||
useMatrix: boolean,
|
||||
}
|
||||
|
||||
/**
|
||||
* 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;
|
||||
|
||||
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 outputDeviceId(): string {
|
||||
return this._outputDeviceId;
|
||||
};
|
||||
|
||||
/**
|
||||
* The display name of the activity.
|
||||
*/
|
||||
public get displayName(): string {
|
||||
return this._displayName;
|
||||
}
|
||||
|
||||
public get deviceSetupItem(): Array<DeviceSetupItem> {
|
||||
return this._deviceSetupItems
|
||||
}
|
||||
|
||||
public get useMatrix(): boolean {
|
||||
return this._useMatrix;
|
||||
}
|
||||
}
|
22
src/Models/DeviceSetupItem.ts
Normal file
22
src/Models/DeviceSetupItem.ts
Normal file
@ -0,0 +1,22 @@
|
||||
|
||||
export interface IDeviceSetupItemProps {
|
||||
deviceId: string,
|
||||
input: string
|
||||
}
|
||||
|
||||
export class DeviceSetupItem {
|
||||
private _deviceId: string = "";
|
||||
private _input: string = "";
|
||||
constructor(props: IDeviceSetupItemProps) {
|
||||
this._deviceId = props.deviceId;
|
||||
this._input = props.input;
|
||||
}
|
||||
|
||||
public get deviceId() {
|
||||
return this._deviceId;
|
||||
}
|
||||
|
||||
public get input() {
|
||||
return this._input;
|
||||
}
|
||||
}
|
32
src/Models/Matrix.ts
Normal file
32
src/Models/Matrix.ts
Normal file
@ -0,0 +1,32 @@
|
||||
export interface IMatrixProps {
|
||||
inputs: Array<Input>,
|
||||
outputs: Array<Output>,
|
||||
}
|
||||
|
||||
export interface Input {
|
||||
inputNumber: string,
|
||||
inputDevice: string,
|
||||
}
|
||||
|
||||
export interface Output {
|
||||
outputLetter: string,
|
||||
outputDevice: string,
|
||||
}
|
||||
|
||||
export class Matrix {
|
||||
private _inputs: Array<Input> = [];
|
||||
private _outputs: Array<Output> = [];
|
||||
|
||||
constructor(props: IMatrixProps) {
|
||||
this._inputs = props.inputs;
|
||||
this._outputs = props.outputs;
|
||||
}
|
||||
|
||||
public get inputs(): Array<Input> {
|
||||
return this._inputs
|
||||
}
|
||||
|
||||
public get outputs(): Array<Output> {
|
||||
return this._outputs;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user