@robotical/ricjs
Version:
Javascript/TS library for Robotical RIC
63 lines (62 loc) • 2.58 kB
TypeScript
import { Dictionary, RICHWElem, RICReportMsg } from "./RICTypes";
import RICAddOnBase from "./RICAddOnBase";
import { ROSSerialAddOnStatus } from "./RICROSSerial";
export declare type RICAddOnCreator = (name: string, addOnFamily: string, whoAmI: string, whoAmITypeCode: string) => RICAddOnBase;
declare class AddOnFactoryElem {
typeName: string;
addOnFamily: string;
whoAmI: string;
factoryFn: RICAddOnCreator;
constructor(typeName: string, addOnFamily: string, whoAmI: string, factoryFn: RICAddOnCreator);
}
export interface RICAddOnRegistry {
registerHWElemType(typeName: string, addOnFamily: string, whoAmI: string, factoryFn: RICAddOnCreator): void;
}
/**
* RICAddOnManager
*
* @description
* Handles the creation and management of RIC Add-Ons
*
*/
export default class RICAddOnManager implements RICAddOnRegistry {
_addOnFactoryMap: Dictionary<AddOnFactoryElem>;
_configuredAddOns: Dictionary<RICAddOnBase>;
registerHWElemType(typeName: string, addOnFamily: string, whoAmI: string, factoryFn: RICAddOnCreator): void;
/**
* @function getStaticAddonIds
* Get the ids of the add-ons that are static
* (their data do not get published from ricjs, eg buspixel ledeyes)
* @returns {Array<number>} the ids of the static add-ons
*/
getStaticAddonIds(): Array<number>;
/**
* @function getStaticAddons
* Get the add-ons that are static
* (their data do not get published from ricjs, eg buspixel ledeyes)
* @returns {Array<RICAddOnBase>} the static add-ons unprocessed
*/
getStaticAddons(): Array<RICAddOnBase>;
/**
* @function getProcessedStaticAddons
* Get the add-ons that are static
* (their data do not get published from ricjs, eg buspixel ledeyes)
* @returns {Array<ROSSerialAddOnStatus>} the static add-ons processed
*/
getProcessedStaticAddons(): Array<ROSSerialAddOnStatus>;
/**
* @function setHWElems
* Set the hardware elements from a list of RICHWElem
* @param hwElems
*
*/
setHWElems(hwElems: Array<RICHWElem>): void;
clear(): void;
configureAddOns(hwElems: Array<RICHWElem>): Dictionary<RICAddOnBase>;
getHWElemTypeStr(whoAmITypeCode: string | undefined, whoAmI: string | undefined): string;
processPublishedData(addOnID: number, statusByte: number, rawData: Uint8Array): ROSSerialAddOnStatus | null;
getIDNoFromName(name: string): string | null;
getInitCmds(): Array<string>;
processReportMsg(reportMsgs: Array<RICReportMsg>, timeInitStart: number): void;
}
export {};