import { Parameter } from './parameter'; import { DeviceRef, UiConfig, UiPdoMapping } from './types'; /** * Represents a device-specific parameter with optional metadata flags. * * Extends the base {@link Parameter} interface with additional fields * used to describe access, category, and mapping information. */ export interface DeviceParameter extends Parameter { /** * Unique identifier of the parameter. */ id: string; /** * Optional set of flags defining parameter characteristics. */ flags?: { /** * Access level of the parameter. * * - `'ro'` — Read-only (default) * - `'rw'` — Read/write * - `'wo'` — Write-only */ access?: 'ro' | 'rw' | 'wo'; /** * Category of the parameter. * * - `'m'` — Mandatory * - `'o'` — Optional (default) * - `'c'` — Conditional */ category?: 'm' | 'o' | 'c'; /** * PDO (Process Data Object) mapping type. * * - `'t'` — Transmit PDO (Inputs) * - `'r'` — Receive PDO (Outputs) * - `'tr'` — Transmit or Receive PDO */ pdoMapping?: 't' | 'r' | 'tr'; /** * Safety-related mapping type. * * - `'si'` — Safe Inputs * - `'so'` — Safe Outputs * - `'sio'` — Safe Input or Output * - `'sp'` — Safety Parameter Set */ safetyMapping?: 'si' | 'so' | 'sio' | 'sp'; }; } /** * Make device parameter id by providing a device serial number and tuple of index and subindex. * * @param serialNumber - device serial number from the hardware description file * @param tuple - an array of index and subindex * @throws {Error} if index or subindex are less than 0 * @returns combined index and subindex in uppercase hexadecimal format and device serial number, e.g. "0x60FE:02.9002-02-0000466-2339" */ export declare function makeDeviceParameterId(serialNumber: string, tuple: [number | null | undefined, number | null | undefined]): string; /** * Make device parameter id by providing a device serial number and object which has index and subindex properties. * * @param serialNumber - device serial number from the hardware description file * @param parameter - an object with optional index and subindex properties * @throws {Error} if index or subindex are less than 0 * @returns combined index and subindex in uppercase hexadecimal format and device serial number, e.g. "0x60FE:02.9002-02-0000466-2339" */ export declare function makeDeviceParameterId(serialNumber: string, parameter: { index?: number | null; subindex?: number | null; }): string; /** * Make parameter id by providing a device serial number and index and subindex. * * @param serialNumber - device serial number from the hardware description file * @param index - from 0x0000 to 0xFFFF for objects defined in ESI and >0xFFFF for custom object * @param subindex - defaults to 0 if not provided * @throws {Error} if index or subindex are less than 0 * @returns combined index and subindex in uppercase hexadecimal format and device serial number, e.g. "0x60FE:02.9002-02-0000466-2339" */ export declare function makeDeviceParameterId(serialNumber: string, index?: number | null, subindex?: number | null): string; /** * Example of device parameter id is "0x2110:1A.8502-03-0001353-2115" where: * - 0x2110 is object index in hexadecimal format * - 1A is subindex in hexadecimal format * - 8502-03-0001353-2115 is device serial number from hardware description file */ export declare const deviceParameterIdRegExp: RegExp; /** * Splits a device parameter ID string into its components: index, subindex, and device serial number. * * The expected format of the ID must match `deviceParameterIdRegExp`. * If the ID does not match the expected format, an error is thrown. * * @param id - The device parameter ID string to split. * @returns A tuple `[index, subindex, deviceSerial]` where: * - `index` is the 16-bit parameter index (parsed from hexadecimal), * - `subindex` is the 8-bit parameter subindex (parsed from hexadecimal), * - `deviceSerial` is the device serial number as a string. * * @throws {Error} If the provided ID does not match the expected regular expression. * * @example * ```ts * const id = "0x6040:00.123-ABC"; * const [deviceSerial, index, subindex] = splitDeviceParameterId(id); * // deviceSerial = "123-ABC" * // index = 0x6040 * // subindex = 0x00 * ``` */ export declare function splitDeviceParameterId(id: string): [string, number, number]; /** * Parses a 32-bit encoded PDO subitem value into its components. * * The 32-bit value is structured as follows: * ``` * Bits | Field * ------|-------- * 0–7 | Bit length (bitlen) * 8–15 | Subindex * 16–31 | Index * ``` * * @param value - The 32-bit encoded PDO subitem value. * @returns A tuple `[index, subindex, bitlen]` where: * - `index` — The 16-bit parameter index. * - `subindex` — The 8-bit parameter subindex. * - `bitlen` — The bit length of the mapped item. */ export declare function parsePdoSubItemValue(value: number): [number, number, number]; /** * Default UI configuration containing the PDO mapping. * * This configuration is used as a fallback when a device-specific UI configuration * is not available. It defines both RX (receive) and TX (transmit) PDOs with * their corresponding object dictionary entries. * * ⚠️ Important: Keep this in sync with the default PDO mapping in Motion Master * to ensure consistent behavior across devices. */ export declare const uiConfigWithDefaultPdoMapping: UiConfig; /** * Flattens a PDO mapping into an array of [deviceRef, index, subindex] entries. * * This function iterates over both RX and TX PDOs in the provided `pdoMapping` and * extracts the index and subindex from each 32-bit PDO entry using `parsePdoSubItemValue`. * * @param deviceRef - The reference to the device associated with this PDO mapping. * @param pdoMapping - The UI PDO mapping object containing RX and TX PDO entries. * @returns An array where each item is a tuple `[deviceRef, index, subindex]`. * * @example * ```ts * const deviceRef = 1; * const flatArray = flattenUiPdoMapping(deviceRef, uiPdoMapping); * // flatArray will contain tuples like [deviceRef, 0x2012, 0x01] * ``` */ export declare function flattenUiPdoMapping(deviceRef: DeviceRef, pdoMapping: UiPdoMapping): [DeviceRef, number, number][];