import { ICommand } from "./device"; import { sleep } from "../util/sleep"; export interface IHarmonyDeviceProps { id: string; name: string; harmony: any; log: any; commands: { [name: string]: ICommand }; } export class HarmonyDevice { private _commands: { [name: string]: ICommand } = {}; private _on: boolean; constructor(props: IHarmonyDeviceProps) { this.id = props.id; this.name = props.name; this._on = false; this._commands = props.commands; } public id: string; public name: string; public get on(): boolean { return this._on; } public set on(value: boolean) { this._on = value; } public get commands(): { [name: string]: ICommand } { return this._commands; } //Define device methods public supportsCommand(commandName: string): boolean { let command = this._commands[commandName]; return command ? true : false; } public getCommand(commandName: string): ICommand { return this._commands[commandName]; } }