@iotize/tap
Version:
IoTize Device client for Javascript
52 lines (51 loc) • 1.8 kB
TypeScript
import { CodeError } from '@iotize/common/error';
import { ComProtocol } from '@iotize/tap/protocol/api';
import { Subscription } from 'rxjs';
export declare class ComRelayError extends CodeError<ComRelayError.Code> {
static illegalArgument(message: string): ComRelayError;
constructor(code: ComRelayError.Code, msg: string);
}
export declare namespace ComRelayError {
enum Code {
IllegalArgmentError = "IllegalArgmentError"
}
}
/**
* This is an experimental feature.
*
* @experimental
*/
export declare class ComRelay {
protected _sourceProtocolSubscription?: Subscription;
protected mSourceProtocol?: ComProtocol;
protected get sourceProtocol(): ComProtocol;
protected mTargetProtocol?: ComProtocol;
protected get targetProtocol(): ComProtocol;
/**
* @param sourceProtocol protocol that will received commands
* @param targetProtocol protocol on wich commmand will be sent
*/
constructor(sourceProtocol?: ComProtocol, targetProtocol?: ComProtocol);
setSourceProtocol(protocol: ComProtocol): this;
removeSourceProtocol(): this;
setTargetProtocol(protocol: ComProtocol): this;
start(options?: {
timeout?: number;
}): Promise<void>;
/**
* Stop relay and disconnect target and source protocol according to given options
* @param options
*/
stop(options?: {
/**
* true if you don't want that ComRelay disconnect the target protocol
*/
keepTargetProtocolConnected?: boolean;
/**
* true if you don't want that ComRelay disconnect the source protocol
*/
keepSourceProtocolConnected?: boolean;
}): void;
listenToDataStream(): Promise<void>;
onStop(): this;
}