rxpoweredup
Version:
A Typescript RxJS-based library for controlling LEGO Powered UP hubs & peripherals.
32 lines (31 loc) • 1.24 kB
TypeScript
import { Observable, ReplaySubject } from 'rxjs';
import { IQueueTask, ITaskVisitor } from '../queue';
import { PortCommandExecutionStatus } from '../../../hub';
import { RawPortOutputCommandMessage } from '../../../types';
import { IChannel } from '../i-channel';
export declare enum PortOutputCommandTaskState {
pending = 0,
waitingForResponse = 1,
inProgress = 2
}
/**
* This class represents a task that is responsible for sending a single port output command to the hub.
*/
export declare class TaskPortOutputCommand implements IQueueTask<PortCommandExecutionStatus> {
readonly message: RawPortOutputCommandMessage;
readonly result: ReplaySubject<PortCommandExecutionStatus>;
private _state;
private readonly responseReceived;
private terminalExecutionStates;
private stateTransitions;
constructor(message: RawPortOutputCommandMessage);
get portId(): number;
get state(): PortOutputCommandTaskState;
set state(value: PortOutputCommandTaskState);
discard(): void;
emitError(error: Error): void;
setExecutionStatus(status: PortCommandExecutionStatus): void;
dispose(): void;
accept(visitor: ITaskVisitor): void;
execute(channel: IChannel): Observable<unknown>;
}