import { DeviceLogLine } from './device-log-line'; import { HardwareDescription, StackInfo } from './hardware-description'; import { IntegroVariant } from './integro-variant'; import { UIFeaturesConfig } from './parameter'; import { DeviceRef, DeviceRefObj, PlantModel } from './types'; export declare const filenamePartRegExp: RegExp; /** * Represents a single device with extended metadata beyond what the Motion Master API provides. * * Some properties—such as the serial number, hardware description, and variant—must be retrieved * through additional file requests from Motion Master. */ export interface Device { /** * The EtherCAT alias of the device, if configured. */ alias?: number; /** * The device address assigned by the EtherCAT master. * * Used when sending commands to Motion Master. Since the address changes after each * power cycle, the client library uses {@link DeviceRef} as a stable reference. */ deviceAddress: number; /** * The product ID of the device. * Example: `8506` */ deviceProductId?: string; /** * Firmware ID used to identify and resolve the firmware package for the device. */ fwid?: string; /** * Parsed `.hardware_description` file containing hardware details. */ hardwareDescription?: HardwareDescription; /** * Unique identifier of the device, typically its serial number. */ id: string; /** * Identifier of the image associated with this device. * Retrieved from the assembly or device entries of the hardware description file. */ imageId?: string; /** * Parsed `.variant` file describing variant-specific information. */ integroVariant?: IntegroVariant; /** * Device position in the EtherCAT topology. * * - SOEM: positions start at 1 (0 is broadcast) * - IgH EtherCAT Master: positions start at 0 */ position?: number; /** * Product ID of the device or its assembly. * Example: `6000` */ productId?: string; /** * Serial number read from the hardware description file. */ serialNumber?: string; /** * Parsed `.stack_info.json` file with stack-related metadata. */ stackInfo?: StackInfo; /** * Device type: * - `0`: UNSPECIFIED * - `1`: SOMANET_CIA401_ETHERCAT * - `2`: SOMANET_CIA402_ETHERCAT */ type?: number; /** * UI configuration for device-specific features. */ uiFeaturesConfig?: UIFeaturesConfig; /** * Product ID and revision combined. * Example: `8506-01` */ versionedDeviceProductId?: string; /** * Product or assembly ID and revision combined. * Example: `6000-01` */ versionedProductId?: string; } /** * Returns the first defined value from a {@link DeviceRefObj}. */ export declare function getDeviceRefFromDeviceRefObj(deviceRefObj: DeviceRefObj): string | number | null; /** * Ensures that a {@link DeviceRef} is numeric if possible. * * If the value is numeric-like, it is converted to a number; otherwise the original string is returned. */ export declare function ensureDeviceRef(deviceRef: DeviceRef): DeviceRef; /** * Converts a {@link DeviceRef} into a structured {@link DeviceRefObj}. * * - Numbers ≤ `0xffff` are treated as device positions. * - Larger numbers are treated as device addresses. * - Strings are treated as serial numbers. */ export declare function makeDeviceRefObj(deviceRef: DeviceRef): DeviceRefObj; /** * Type guard verifying that a value is a valid {@link DeviceRef}. */ export declare function isDeviceRef(deviceRef: any): deviceRef is DeviceRef; /** * Validates the structure of a {@link DeviceRefObj}. */ export declare function isValidDeviceRefObj(obj: DeviceRefObj): boolean; /** * Parses a single device log line. * * Expected format: * `HH:MM:SS.mmm LEVEL|MESSAGE` */ export declare function parseDeviceLog(line: string): DeviceLogLine | undefined; /** * Parses multi-line log content into an array of {@link DeviceLogLine}. */ export declare function parseDeviceLogContent(content: string): DeviceLogLine[]; /** * Computes the "zero home offset" given a home offset and the current device position. */ export declare function computeZeroHomeOffsetFromPosition(homeOffset: number, position: number): number; /** * Name of the FoE file used to unlock protected filesystem operations. * * Sending a FoE read command with this filename allows writing or deleting * protected files (i.e., files whose names start with a dot). */ export declare const stackUnlockFilename = "fs-stackunlock=DD1317"; /** * Base64-encoded empty firmware image used during Factory Reset * to remove the currently installed firmware. */ export declare const emptyAppBase64 = "UEsDBBQACAAIABBye08AAAAAAAAAAAAAAAANACAAYXBwX2VtcHR5LmJpblVUDQAHMHfeXTB33l0wd95ddXgLAAEE6AMAAAToAwAAAwBQSwcIAAAAAAIAAAAAAAAAUEsBAhQDFAAIAAgAEHJ7TwAAAAACAAAAAAAAAA0AIAAAAAAAAAAAAKSBAAAAAGFwcF9lbXB0eS5iaW5VVA0ABzB33l0wd95dMHfeXXV4CwABBOgDAAAE6AMAAFBLBQYAAAAAAQABAFsAAABdAAAAAAA="; /** * Returns `true` if the filename represents a multi-part ZIP file. */ export declare function isFilenamePart(filename: string): boolean; /** * Default set of files preserved during Factory Reset. */ export declare const factoryResetDefaultFilesToKeep: string[]; /** * Computes the effective mechanical gear ratio between motor revolutions and * shaft revolutions. The returned value represents: * * gearRatio = motorRevolutions / shaftRevolutions * * Special handling is applied when both the torque controller and the position * controller use the same encoder source. In that case, there is no physical * external gearing, meaning both controllers observe identical positions, so * the gear ratio is considered to be 1. * * If shaft revolutions equals 0 (invalid or unavailable data), a default gear * ratio of 1 is returned as a safe fallback. * * @param props Object containing: * - `motorRevolutions` Number of motor-side revolutions defined in device parameters. * - `shaftRevolutions` Number of shaft-side revolutions defined in device parameters. * - `torqueControllerEncoderSource` Encoder source used by the torque controller. A value of 0 means no assigned encoder. * - `positionControllerEncoderSource` Encoder source used by the position controller. A value of 0 means no assigned encoder. * * @returns The computed gear ratio. Produces: * - `1` if both controllers use the same encoder source, or if shaftRevolutions is `0`. * - `(motorRevolutions / shaftRevolutions)` otherwise. */ export declare function computeGearRatio(props: { motorRevolutions: number; shaftRevolutions: number; torqueControllerEncoderSource: number; positionControllerEncoderSource: number; }): number; /** * Converts a commutation angle offset from encoder counts * to electrical degrees. * * The input value is assumed to be in the range `[0, 4095]`, * representing a full electrical revolution. The result is * rounded to the nearest integer degree. * * @param value - Commutation angle offset in encoder counts * @returns Commutation angle in electrical degrees (0–360) */ export declare function convertCommutationAngleOffsetToElectricalDegrees(value: number): number; /** * Parses a CSV representation of a plant model into a `PlantModel` object. * * The CSV is expected to have up to three lines: * 1. Numerator coefficients (comma-separated) * 2. Denominator coefficients (comma-separated), with the last two values representing friction and inertia * 3. Optional chirp signal parameters: startFrequency, endFrequency, torqueAmplitude, duration, signalType * * If `content` is null, undefined, or empty, a `PlantModel` with default values is returned. * * @param content - The CSV content as a string or Uint8Array. Can be null or undefined. * @returns A `PlantModel` object with the parsed numerator, denominator, friction, inertia, * and optional chirp signal parameters (`startFrequency`, `endFrequency`, * `torqueAmplitude`, `durationSeconds`, `signalType`). */ export declare function parsePlantModelCsv(content: Uint8Array | string | null | undefined): PlantModel;