import type { ITransport, TRSMode } from '../../../types/public.js'; import type { TransportRegistry } from '../registry/TransportRegistry.js'; /** * Interface for the Transport Router. */ export interface ITransportRouter { select(slaveId: number, requiredRSMode: TRSMode): ITransport | null; } /** * Handles the logic of selecting the most appropriate transport for a given request. * Prioritizes explicitly assigned transports that are connected, then falls back to compatible transports. */ export declare class TransportRouter implements ITransportRouter { private readonly _registry; /** * @param {TransportRegistry} _registry - The registry to query for available transports. */ constructor(_registry: TransportRegistry); /** * Selects an optimal transport for the given Slave ID and Interface mode. * * Routing Logic: * 1. Finds transports explicitly assigned to the Slave ID that are currently 'connected'. * 2. If no direct match is found, looks for a fallback transport that is connected/connecting * and matches the required RSMode (useful for buses like RS485). * * @param {number} slaveId - The target Modbus Slave/Unit ID. * @param {TRSMode} requiredRSMode - The required physical mode (RS485, RS232, or TCP/IP). * @returns {ITransport | null} The selected transport instance or null if none are available. */ select(slaveId: number, requiredRSMode: TRSMode): ITransport | null; }