@iotize/tap
Version:
IoTize Device client for Javascript
46 lines (45 loc) • 2.02 kB
TypeScript
import { TapStreamEncoderDecoder } from '@iotize/tap/client/impl';
import { Observable } from 'rxjs';
import { EditableValueDataStreamInterface, KeyTypeType } from '../utility/editable-data-stream';
import { AbstractVariable } from './abstract-variable-stream';
export declare class ConverterVariableView<DataType, KeyType extends KeyTypeType = KeyTypeType> implements EditableValueDataStreamInterface<DataType, KeyType> {
readonly id: KeyType;
context: {
/**
* The underlying variable from which the view will be created
*/
variable: AbstractVariable<any, any>;
/**
* If set to false, Tap will read the current value before editing and writing the new index
* If set to true and if Tap already know the current value, it will not perform a read before editing the value
*/
useLastKnownValueBeforeWrite?: boolean;
/**
* Defined how the extracted value should be decoded
*/
converter: TapStreamEncoderDecoder<DataType>;
};
get converter(): TapStreamEncoderDecoder<DataType>;
get valueSnapshot(): DataType | undefined;
get values(): Observable<DataType>;
constructor(id: KeyType, context: {
/**
* The underlying variable from which the view will be created
*/
variable: AbstractVariable<any, any>;
/**
* If set to false, Tap will read the current value before editing and writing the new index
* If set to true and if Tap already know the current value, it will not perform a read before editing the value
*/
useLastKnownValueBeforeWrite?: boolean;
/**
* Defined how the extracted value should be decoded
*/
converter: TapStreamEncoderDecoder<DataType>;
});
read(): Promise<DataType>;
write(value: DataType): Promise<any>;
private getCurrentValueStream;
private encodeValue;
private decodeValue;
}