You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
import { IObservableArray, observable } from "mobx";
|
|
|
|
import { Duration } from "./Duration";
|
|
|
|
import { Program } from "./Program";
|
|
|
|
import { Section } from "./Section";
|
|
|
|
import { SectionRunner } from "./SectionRunner";
|
|
|
|
|
|
|
|
export abstract class SprinklersDevice {
|
|
|
|
@observable
|
|
|
|
connected: boolean = false;
|
|
|
|
|
|
|
|
@observable
|
|
|
|
sections: IObservableArray<Section> = observable.array<Section>();
|
|
|
|
|
|
|
|
@observable
|
|
|
|
programs: IObservableArray<Program> = observable.array<Program>();
|
|
|
|
|
|
|
|
@observable
|
|
|
|
sectionRunner: SectionRunner;
|
|
|
|
|
|
|
|
abstract get id(): string;
|
|
|
|
|
|
|
|
abstract runSection(section: number | Section, duration: Duration): Promise<{}>;
|
|
|
|
|
|
|
|
abstract runProgram(program: number | Program): Promise<{}>;
|
|
|
|
|
|
|
|
abstract cancelSectionRunById(id: number): Promise<{}>;
|
|
|
|
|
|
|
|
abstract pauseSectionRunner(): Promise<{}>;
|
|
|
|
|
|
|
|
abstract unpauseSectionRunner(): Promise<{}>;
|
|
|
|
|
|
|
|
toString(): string {
|
|
|
|
return `SprinklersDevice{id="${this.id}", connected=${this.connected}, ` +
|
|
|
|
`sections=[${this.sections}], ` +
|
|
|
|
`programs=[${this.programs}], ` +
|
|
|
|
`sectionRunner=${this.sectionRunner} }`;
|
|
|
|
}
|
|
|
|
}
|