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.
31 lines
979 B
31 lines
979 B
import { ConnectionState } from "./ConnectionState"; |
|
import { SprinklersDevice } from "./SprinklersDevice"; |
|
|
|
export abstract class SprinklersRPC { |
|
abstract readonly connectionState: ConnectionState; |
|
abstract readonly connected: boolean; |
|
|
|
abstract start(): void; |
|
|
|
/** |
|
* Acquires a reference to a device. This reference must be released by calling |
|
* SprinklersDevice#release for every time this method was called |
|
* @param id The id of the device |
|
*/ |
|
acquireDevice(id: string): SprinklersDevice { |
|
const device = this.getDevice(id); |
|
device.acquire(); |
|
return device; |
|
} |
|
|
|
/** |
|
* Forces a device to be released. The device will no longer be updated. |
|
* |
|
* This should not be used normally, instead SprinklersDevice#release should be called to manage |
|
* each reference to a device. |
|
* @param id The id of the device to remove |
|
*/ |
|
abstract releaseDevice(id: string): void; |
|
|
|
protected abstract getDevice(id: string): SprinklersDevice; |
|
}
|
|
|