import { Packet } from "./packet"; import { JDService } from "./service"; import { DecodedPacket } from "./pretty"; import { JDField } from "./field"; import { JDServiceMemberNode } from "./servicemembernode"; import { JDNode } from "./node"; import { PackedValues } from "./pack"; import { PackedObject } from "./packobject"; /** * A Jacdac register client. * @category JDOM */ export declare class JDRegister extends JDServiceMemberNode { private _lastReportPkt; private _fields; private _lastSetTimestamp; private _lastGetTimestamp; private _lastGetAttempts; private _needsRefresh; /** * @internal */ constructor(service: JDService, code: number); /** * Clears all cached data from the register */ clearData(): void; /** * Returns ``REGISTER_NODE_NAME`` * @category JDOM */ get nodeKind(): string; /** * Gets the list of field, if the specification is known * @category JDOM */ get fields(): JDField[]; /** * Gets the list of fields * @category JDOM */ get children(): JDNode[]; /** * Timestamp of the last ``register set`` packet * @category Packets */ get lastSetTimestamp(): number; /** * Timestamp of the last ``register get`` packet * @category Packets */ get lastGetTimestamp(): number; /** * Clears the get timestamp * @internal * @category Packets */ clearGetTimestamp(): void; /** * Number of attempts to send a ``get`` packet without response * @category Packets */ get lastGetAttempts(): number; /** * Send a message to set the register value * @param data packed data * @param autoRefresh immediately send a ``get`` packet * @returns * @category Packets */ sendSetAsync(data: Uint8Array, autoRefresh?: boolean): Promise; /** * Requests the value of the register by sending a ``get`` packet * @returns * @category Packets */ sendGetAsync(): Promise; /** * Send a message to set the register value * @param values message to pack and send * @param autoRefresh immediately send a ``get`` packet * @category Packets */ sendSetPackedAsync(values: PackedValues, autoRefresh?: boolean): Promise; /** * Sends a message to set the register value as a bpolean * @param value * @param autoRefresh * @param autoRefresh immediately send a ``get`` packet * @category Packets */ sendSetBoolAsync(value: boolean, autoRefresh?: boolean): Promise; /** * Sends a message to set the register value as a string * @param value * @param autoRefresh * @param autoRefresh immediately send a ``get`` packet * @category Packets */ sendSetStringAsync(value: string, autoRefresh?: boolean): Promise; /** * Gets the raw data from the last report packet * @category Data */ get data(): Uint8Array; /** * Gets the timestamp when received the last report with data * @category Data */ get lastDataTimestamp(): number; /** * Get the data from the last report packet, unpacked according to the specification. * @category Data */ get unpackedValue(): PackedValues; /** * Gets the data from the last report packet, unpacked and hydrated into an object. * @category Data */ get objectValue(): PackedObject; /** * Gets the data as a signed integer * @category Data */ get intValue(): number; /** * Gets the data as a unsigned integer * @category Data */ get uintValue(): number; /** * Gets the data as a boolean * @category Data */ get boolValue(): boolean; /** * Gets the data as a string * @category Data */ get stringValue(): string; /** * Gets a pretty printed represention of the data * @category Data */ get humanValue(): string; /** * @internal */ toString(): string; /** * @internal */ get decoded(): DecodedPacket; /** * Schedules to query the value for this register */ scheduleRefresh(): void; get needsRefresh(): boolean; /** * Refresh the value of the register within a timeout * @param skipIfValue don't refresh if any data if available * @returns true if refresh OK, false if timeout or other error * @category Data */ refresh(skipIfValue?: boolean): Promise; /** * @internal */ processPacket(pkt: Packet): void; setNotImplemented(): void; private processReport; /** * @internal */ compareTo(b: JDRegister): number; } //# sourceMappingURL=register.d.ts.map