2026-08-25 07:51:38 +02:00
|
|
|
/**
|
|
|
|
|
* Normalized, app-level types for the Buttplug integration. Kept separate
|
|
|
|
|
* from `buttplug`'s own types so the rest of the app (UI, API payloads, DB
|
|
|
|
|
* rows) never has to import the client library directly.
|
|
|
|
|
*/
|
|
|
|
|
|
2026-08-27 21:38:51 +02:00
|
|
|
import type { DeviceCapabilities } from "@/lib/db/schema";
|
|
|
|
|
|
2026-08-25 07:51:38 +02:00
|
|
|
export type NormalizedOutputType = "vibrate" | "rotate" | "linear";
|
|
|
|
|
export type CommandType = NormalizedOutputType | "stop";
|
|
|
|
|
|
|
|
|
|
export interface ActuatorInfo {
|
|
|
|
|
featureIndex: number;
|
|
|
|
|
outputType: NormalizedOutputType;
|
|
|
|
|
/** True for outputs (e.g. HwPositionWithDuration) that require a move duration. */
|
|
|
|
|
requiresDuration: boolean;
|
|
|
|
|
descriptor: string;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export interface ConnectedDeviceInfo {
|
|
|
|
|
index: number;
|
|
|
|
|
name: string;
|
|
|
|
|
displayName?: string;
|
|
|
|
|
actuators: ActuatorInfo[];
|
2026-08-25 17:33:48 +02:00
|
|
|
hasBattery: boolean;
|
2026-08-25 07:51:38 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/** A single dispatched command, timestamped relative to session start. */
|
|
|
|
|
export interface CommandEvent {
|
|
|
|
|
tsMs: number;
|
|
|
|
|
deviceIndex: number;
|
|
|
|
|
commandType: CommandType;
|
|
|
|
|
featureIndex: number;
|
|
|
|
|
value: number;
|
|
|
|
|
durationMs?: number;
|
|
|
|
|
}
|
2026-08-27 21:38:51 +02:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* A device that took part in a session, as needed to remap it onto a
|
|
|
|
|
* currently-connected device for replay. Computed live from that session's
|
|
|
|
|
* session_devices/devices rows - not a frozen snapshot.
|
|
|
|
|
*/
|
|
|
|
|
export interface ReplayDeviceSlot {
|
|
|
|
|
slotLabel: string;
|
|
|
|
|
recordedBleName: string;
|
|
|
|
|
deviceClass: string | null;
|
|
|
|
|
capabilities: DeviceCapabilities | null;
|
|
|
|
|
/** The session_devices.id this slot was captured from - lets the replay UI
|
|
|
|
|
* map a chosen live device back to this slot's session_events. */
|
|
|
|
|
sourceSessionDeviceId: number;
|
|
|
|
|
}
|