@iotize/device-client.js
Version:
IoTize Device client for Javascript
52 lines (51 loc) • 1.94 kB
TypeScript
import { Readable, VariableInteraction } from "./variable-interaction.interface";
import { Response } from '../../client/api/response';
import { DefaultVariableMonitor } from "./monitor/default-variable-monitor";
import { TlvBundleConverter } from "../extra-converter/TlvBundleConverter";
import { BundleConfigPredefined } from "./bundle-manager";
import { VariableConfig } from "./variable";
import { VariableMonitor } from "./monitor/variable-monitor.interface";
export interface BundleValueService {
getValues(id: number): Promise<Response<Uint8Array>>;
}
export interface BundleInterface<ConfigType> {
identifier(): string;
}
export declare class UnknownVariableError extends Error {
code: string;
variableName: string;
constructor(variableName: string);
}
export declare class ReadBundleError extends Error {
code: string;
static fromResponse(bundle: Bundle<any>, response: Response<Uint8Array>): ReadBundleError;
private constructor();
}
export interface BundleConfig {
id: number;
name: string;
variables: VariableInteraction<any>[];
[key: string]: any;
}
export declare class Bundle<DataType = Record<string, any>> implements Readable<DataType> {
config: BundleConfig;
bundleService: BundleValueService;
converter: TlvBundleConverter;
protected _monitor?: DefaultVariableMonitor<DataType>;
readonly variables: VariableInteraction<any>[];
readonly identifier: string;
readonly bundleId: number;
private constructor();
static createFromConfig<T>(config: BundleConfigPredefined, bundleService: BundleValueService, variableService: VariableConfig.ServiceType): Bundle<T>;
/**
* @deprecated
*/
/**
* Get variable by id
*
* @param id
*/
variable(id: string): VariableInteraction<any>;
read(): Promise<DataType>;
monitor(): VariableMonitor<DataType>;
}