import type { HID } from "node-hid";
import { InputId } from "../id";
import { ByteArray } from "./byte_array";
import { ChargeStatus } from "./battery_state";
import { ResolvedCalibration } from "./calibration";
export * from "../id";
/** Maps a HID input of 0...n to -1...1 */
export declare function mapAxis(value: number, max?: number): number;
/** Maps a HID input of 0...255 to 0...1 */
export declare function mapTrigger(value: number): number;
/** Maps a battery level nibble (0–10) to a 0–1 intensity, clamped */
export declare function mapBatteryLevel(value: number): number;
/**
 * Maps a HID input for either gyroscope or acceleration.
 * Adapted from https://github.com/nondebug/dualsense
 */
export declare function mapGyroAccel(v0: number, v1: number): number;
/** Describes an observation of the input state of a Dualsense controller */
export interface DualsenseHIDState {
    [InputId.LeftAnalogX]: number;
    [InputId.LeftAnalogY]: number;
    [InputId.RightAnalogX]: number;
    [InputId.RightAnalogY]: number;
    [InputId.LeftTrigger]: number;
    [InputId.RightTrigger]: number;
    [InputId.Triangle]: boolean;
    [InputId.Circle]: boolean;
    [InputId.Cross]: boolean;
    [InputId.Square]: boolean;
    [InputId.Dpad]: number;
    [InputId.Up]: boolean;
    [InputId.Down]: boolean;
    [InputId.Left]: boolean;
    [InputId.Right]: boolean;
    [InputId.RightAnalogButton]: boolean;
    [InputId.LeftAnalogButton]: boolean;
    [InputId.Options]: boolean;
    [InputId.Create]: boolean;
    [InputId.RightTriggerButton]: boolean;
    [InputId.LeftTriggerButton]: boolean;
    [InputId.RightBumper]: boolean;
    [InputId.LeftBumper]: boolean;
    [InputId.Playstation]: boolean;
    [InputId.TouchButton]: boolean;
    [InputId.Mute]: boolean;
    [InputId.Status]: boolean;
    [InputId.TouchX0]: number;
    [InputId.TouchY0]: number;
    [InputId.TouchContact0]: boolean;
    [InputId.TouchId0]: number;
    [InputId.TouchX1]: number;
    [InputId.TouchY1]: number;
    [InputId.TouchContact1]: boolean;
    [InputId.TouchId1]: number;
    [InputId.GyroX]: number;
    [InputId.GyroY]: number;
    [InputId.GyroZ]: number;
    [InputId.AccelX]: number;
    [InputId.AccelY]: number;
    [InputId.AccelZ]: number;
    [InputId.SensorTimestamp]: number;
    [InputId.BatteryLevel]: number;
    [InputId.BatteryStatus]: ChargeStatus;
    [InputId.MuteLed]: boolean;
    [InputId.Microphone]: boolean;
    [InputId.Headphone]: boolean;
}
/** Default values for all inputs */
export declare const DefaultDualsenseHIDState: DualsenseHIDState;
/** Information about an available Dualsense device */
export interface DualsenseDeviceInfo {
    /** Unique device path (platform-specific) */
    path: string;
    /** Hardware serial number, if available */
    serialNumber?: string;
    /** Whether the device is connected wirelessly */
    wireless: boolean;
}
/** Supports a connection to a physical or virtual Dualsense device */
export declare abstract class HIDProvider {
    /** HID vendorId for a Dualsense controller */
    static readonly vendorId: number;
    /** HID productId for a Dualsense controller */
    static readonly productId: number;
    /** HID usagePage for a Dualsense controller */
    static readonly usagePage: number;
    /** HID usage for a Dualsense controller */
    static readonly usage: number;
    /** Global set of device paths currently claimed by a provider instance */
    static readonly claimedDevices: Set<string>;
    /** Callback to use for new input events */
    onData: (state: DualsenseHIDState) => void;
    /** Callback to use for Error events */
    onError: (error: Error) => void;
    /** Callback fired the moment a device is fully attached and ready for I/O */
    onConnect: () => void;
    /** Callback fired the moment a device detaches (cleanly or via error) */
    onDisconnect: () => void;
    /** Unique identifier for the connected device (path or serial) */
    deviceId?: string;
    /** Hardware serial number of the connected device */
    serialNumber?: string;
    /** Search for a controller and connect to it */
    abstract connect(): void | Promise<void>;
    /** Stop accepting input from the controller */
    abstract disconnect(): void;
    /** Returns true if a device is currently connected and working */
    abstract get connected(): boolean;
    /** The underlying HID device handle */
    abstract device?: HIDDevice | HID;
    /** Returns true if a device is connected wirelessly */
    abstract wireless?: boolean;
    /** Debug: The most recent HID report buffer */
    abstract buffer?: Buffer | DataView;
    /** Converts the HID report to a simpler format */
    abstract process(input: unknown): DualsenseHIDState;
    /** Write to the HID device */
    abstract write(data: Uint8Array): Promise<void>;
    /** Read a feature report from the device */
    abstract readFeatureReport(reportId: number, length?: number): Promise<Uint8Array>;
    /** Send a feature report to the device */
    abstract sendFeatureReport(reportId: number, data: Uint8Array): Promise<void>;
    /** If true, gyroscope, touchpad, accelerometer are disabled */
    limited?: boolean;
    /** Precomputed IMU calibration factors, applied during report processing */
    calibration: ResolvedCalibration;
    /**
     * Sselects the correct method for reading the report.
     * @param buffer HID report buffer
     */
    protected processReport(buffer: ByteArray): DualsenseHIDState;
    /**
     * Reset the HIDProvider state when the device is disconnected
     */
    protected reset(): void;
    /**
     * Process a bluetooth input report of type 01.
     * @param buffer the report
     */
    protected processBluetoothInputReport01(buffer: ByteArray): DualsenseHIDState;
    /** Process bluetooth input report of type 31 */
    protected processBluetoothInputReport31(buffer: ByteArray): {
        LX: number;
        LY: number;
        RX: number;
        RY: number;
        L2: number;
        R2: number;
        Triangle: boolean;
        Circle: boolean;
        Cross: boolean;
        Square: boolean;
        Dpad: number;
        Up: boolean;
        Down: boolean;
        Left: boolean;
        Right: boolean;
        L2Button: boolean;
        R2Button: boolean;
        L1: boolean;
        R1: boolean;
        Create: boolean;
        Options: boolean;
        L3: boolean;
        R3: boolean;
        Playstation: boolean;
        TouchButton: boolean;
        Mute: boolean;
        GyroX: number;
        GyroY: number;
        GyroZ: number;
        AccelX: number;
        AccelY: number;
        AccelZ: number;
        SensorTimestamp: number;
        TouchId0: number;
        TouchContact0: boolean;
        TouchX0: number;
        TouchY0: number;
        TouchId1: number;
        TouchContact1: boolean;
        TouchX1: number;
        TouchY1: number;
        Status: boolean;
        MuteLed: boolean;
        Microphone: boolean;
        Headphone: boolean;
        BatteryLevel: number;
        BatteryStatus: ChargeStatus;
    };
    /**
     * Process a USB input report of type 01.
     * @param buffer the report
     */
    protected processUsbInputReport01(buffer: ByteArray): DualsenseHIDState;
}
//# sourceMappingURL=hid_provider.d.ts.map