dualsense-ts
Version:
The natural interface for your DualSense Classic and DualSense Access controllers, with Typescript
73 lines • 3.1 kB
TypeScript
import { AccessHIDProvider, AccessHIDState } from "./access_hid_provider";
import { AccessProfileLedMode, AccessPlayerIndicator } from "./access_hid_state";
import { FirmwareInfo } from "../firmware_info";
import { FactoryInfo } from "../factory_info";
import type { ErrorCallback, ReadyCallback, ConnectionCallback } from "../dualsense_hid";
export type AccessHIDCallback = (state: AccessHIDState) => void;
/** Coordinates an AccessHIDProvider and tracks the latest HID state */
export declare class AccessHID {
readonly provider: AccessHIDProvider;
private readonly subscribers;
private readonly errorSubscribers;
private readonly readySubscribers;
private readonly connectionSubscribers;
private identityResolved;
private identityRetryTimer?;
private identityRetryCount;
private pendingCommands;
state: AccessHIDState;
firmwareInfo: FirmwareInfo;
factoryInfo: FactoryInfo;
macAddress?: string;
private commandTimer?;
constructor(provider: AccessHIDProvider, refreshRate?: number);
dispose(): void;
get wireless(): boolean;
register(callback: AccessHIDCallback): void;
unregister(callback: AccessHIDCallback): void;
on(type: string, callback: ErrorCallback): void;
onReady(callback: ReadyCallback): () => void;
get ready(): boolean;
onConnectionChange(callback: ConnectionCallback): () => void;
get identity(): string | undefined;
private set;
private handleError;
private static readonly IDENTITY_MAX_ATTEMPTS;
private static readonly IDENTITY_BACKOFF_MS;
private loadIdentity;
private markIdentityResolved;
private cancelIdentityRetry;
private firmwareFetch?;
private factoryFetch?;
fetchFirmwareInfo(): Promise<FirmwareInfo>;
fetchFactoryInfo(): Promise<FactoryInfo>;
/**
* Build an Access output report from pending commands.
*
* USB: 32 bytes, report ID 0x02
* BT: 78 bytes, report ID 0x31, constant 0x02 at [1], CRC32 at [74-77]
*
* USB layout: [0]=reportId, [1]=mutator, [2]=scopeB, [3..31]=payload
* BT layout: [0]=0x31, [1]=0x02, [2]=mutator, [3]=scopeB, [4..73]=payload, [74-77]=CRC
*/
private static buildOutputReport;
/** Set the lightbar RGB color */
setLightbar(r: number, g: number, b: number): void;
/** Set the profile LED animation mode */
setProfileLeds(mode: AccessProfileLedMode): void;
/** Set the player indicator pattern */
setPlayerIndicator(pattern: AccessPlayerIndicator): void;
/** Set the status LED on or off */
setStatusLed(on: boolean): void;
/**
* Dismiss the BT firmware "fade to blue" LED animation.
*
* The Access controller starts a blue fade animation on BT connect that
* holds the lightbar until the host explicitly takes control. This sends
* a report with all mutator/scope bits set to release the lightbar for
* host-driven RGB commands. Equivalent to the DualSense's
* LedOptions.Both + PulseOptions.FadeOut flow.
*/
private dismissLedAnimation;
}
//# sourceMappingURL=access_hid.d.ts.map