import type { Observable } from "rxjs";
import type { DeviceModel } from "@ledgerhq/types-devices";
import Transport from "@ledgerhq/hw-transport";
import { TraceContext } from "@ledgerhq/logs";
export declare const LOG_TYPE = "hw";
export type DeviceEvent = {
    type: "add" | "remove";
    id: string;
    name: string;
    deviceModel?: DeviceModel | null;
    wired: boolean;
};
export type Discovery = Observable<DeviceEvent>;
export type TransportModule = {
    id: string;
    open: (id: string, timeoutMs?: number, context?: TraceContext) => Promise<Transport> | null | undefined;
    close?: (transport: Transport, id: string) => Promise<void> | null | undefined;
    disconnect: (id: string) => Promise<void> | null | undefined;
    discovery?: Discovery;
};
export declare const registerTransportModule: (module: TransportModule) => void;
export declare const unregisterTransportModule: (moduleId: string) => void;
export declare const unregisterAllTransportModules: () => void;
export declare const discoverDevices: (accept?: (module: TransportModule) => boolean) => Discovery;
/**
 * Tries to call `open` on the 1st matching registered transport implementation
 *
 * An optional timeout `timeoutMs` can be set. It is/can be used in 2 different places:
 * - A `timeoutMs` timeout is applied directly in this function: racing between the matching Transport opening and this timeout
 * - And the `timeoutMs` parameter is also passed to the `open` method of the transport module so each transport implementation
 *  can make use of that parameter and implement their timeout mechanism internally
 *
 * Why using it in 2 places ?
 * As there is no easy way to abort a Promise (returned by `open`), the Transport will continue to try connecting to the device
 * even if this function timeout was reached. But certain Transport implementations can also use this timeout to try to stop
 * the connection attempt internally.
 *
 * @param deviceId
 * @param timeoutMs Optional timeout that limits in time the open attempt of the matching registered transport.
 * @param context Optional context to be used in logs
 * @returns a Promise that resolves to a Transport instance, and rejects with a `CantOpenDevice`
 *   if no transport implementation can open the device
 */
export declare const open: (deviceId: string, timeoutMs?: number, context?: TraceContext) => Promise<Transport>;
export declare const close: (transport: Transport, deviceId: string, context?: TraceContext) => Promise<void>;
export declare const disconnect: (deviceId: string) => Promise<void>;
//# sourceMappingURL=index.d.ts.map