type TWordOrder = 'BE' | 'LE'; /** * RegisterData wraps an array of 16-bit Modbus register values and provides * type-conversion and sub-selection methods. * * Extends Array so existing code (index access, .length, .map, etc.) * continues to work without changes. */ declare class RegisterData extends Array { /** * Creates a RegisterData from a plain number[] returned by the protocol parser. * Uses push() to avoid Array constructor ambiguity: new Array(0) creates [] * instead of [0], so spreading [0] into super() breaks. */ static from(registers: number[]): RegisterData; constructor(...args: number[]); /** * Returns a new RegisterData containing `count` registers starting at `offset`. * If `count` is omitted, selects 1 register. */ sub(offset: number, count?: number): RegisterData; /** * Returns a new RegisterData containing only the registers at the specified indices. * Indices can be non-contiguous — the order you pass determines the order in the result. * * **Important**: For multi-register conversions (UInt32, Int32, Float32, Float64), * the order of indices determines the word order. For example, `.pick(1, 0)` with * `asFloat32()` will treat register 1 as the high word and register 0 as the low word * (equivalent to word-swap / LE word order). */ pick(...indices: number[]): RegisterData; /** Each register as unsigned 16-bit (identity — same as raw values). */ asUInt16(): number[]; /** Each register as signed 16-bit (−32768 … 32767). */ asInt16(): number[]; /** Pairs of registers → unsigned 32-bit values. */ asUInt32(wordOrder?: TWordOrder): number[]; /** Pairs of registers → signed 32-bit values. */ asInt32(wordOrder?: TWordOrder): number[]; /** Pairs of registers → IEEE 754 single-precision floats. */ asFloat32(wordOrder?: TWordOrder): number[]; /** Groups of 4 registers → IEEE 754 double-precision floats. */ asFloat64(wordOrder?: TWordOrder): number[]; asUInt16Scalar(): number; asInt16Scalar(): number; asUInt32Scalar(wordOrder?: TWordOrder): number; asInt32Scalar(wordOrder?: TWordOrder): number; asFloat32Scalar(wordOrder?: TWordOrder): number; asFloat64Scalar(wordOrder?: TWordOrder): number; private _assertNonEmpty; private _assertEven; private _assertMultipleOf4; /** * Builds an ArrayBuffer with registers written as big-endian byte pairs, * optionally swapping word order within each multi-register value group. */ private _buildBuffer; } export default RegisterData;