UNPKG

@robotical/roboticaljs

Version:

Javascript/TS library for Robotical products

44 lines (43 loc) 1.63 kB
import { RaftConnEventFn, RaftMsgHandler } from '@robotical/raftjs'; import { RICLEDPatternCheckerColour, RICLedLcdColours } from './RICTypes'; export default class RICLEDPatternChecker { private _ledPatternTimeoutMs; private _ledPatternRefreshTimer; private _ledColours; private _lcdColours; private _bleVerifActive; private _msgHandler; private _onConnEvent; private _isConnectedFn; /** * Start checking correct RIC using LED pattern * * @param {RICLedLcdColours} ricLedLcdColours - available colours * @param {RaftMsgHandler} msgHandler - message handler * @param {RaftConnEventFn} onConnEvent - connection event handler * @param {() => boolean} isConnectedFn - function to check if connected * @return boolean - true if started ok * */ checkCorrectRICStart(ricLedLcdColours: RICLedLcdColours, msgHandler: RaftMsgHandler, onConnEvent: RaftConnEventFn, isConnectedFn: () => boolean): Promise<boolean>; /** * Stop checking correct RIC * @param {boolean} confirmCorrectRIC - true if user confirmed correct RIC * @return void * */ checkCorrectRICStop(confirmCorrectRIC: boolean): Promise<boolean>; /** * Refresh LED pattern on RIC * * @return boolean - true if checking still active * */ _checkCorrectRICRefreshLEDs(): Promise<boolean>; _clearLedPatternRefreshTimer(): void; isActive(): boolean; clear(): void; setupColours(availableColors: RICLEDPatternCheckerColour[]): string[]; setRICColors(): Promise<boolean>; clearRICColors(): Promise<void>; }