import { BleController, EventMarkerEmitter, StreamOutlet } from '@neurodevs/node-lsl'; import { XdfRecorder } from '@neurodevs/node-xdf'; import { WebSocketGateway } from './BiosensorWebSocketGateway.js'; import { MuseControllerOptions } from './devices/MuseDeviceController.js'; export default class BiosensorDeviceFactory implements DeviceFactory { static Class?: DeviceFactoryConstructor; private spec; private createdDevice; private deviceSpecs; private createdBundles; protected constructor(); static Create(): DeviceFactory; createDevice(deviceName: K, options?: PerDeviceOptionsMap[K] & SessionOptions): Promise; private createDeviceByName; private get invalidNameError(); private get invalidNameErrorMessage(); createDevices(deviceSpecifications: DeviceSpecification[], options?: SessionOptions): Promise; private createAllDevices; private get createdDevices(); private get deviceStreamQueries(); private get allStreamQueries(); private CgxDeviceController; private MuseDeviceController; private ZephyrDeviceController; private XdfStreamRecorder; private BiosensorWebSocketGateway; private LslEventMarkerEmitter; } export interface DeviceFactory { createDevice(deviceName: K, options?: PerDeviceOptionsMap[K] & SessionOptions): Promise; createDevices(deviceSpecifications: DeviceSpecification[], options?: SessionOptions): Promise; } export type DeviceFactoryConstructor = new () => DeviceFactory; export interface DeviceController { connect(): Promise; startStreaming(): Promise; stopStreaming(): Promise; disconnect(): Promise; readonly outlets: StreamOutlet[]; readonly streamQueries: string[]; } export interface DeviceControllerBle extends DeviceController { readonly bleUuid: string; readonly bleName: string; } export interface DeviceControllerOptions { xdfRecordPath?: string; } export interface DeviceControllerBleOptions extends DeviceControllerOptions { bleUuid?: string; rssiIntervalMs?: number; } export type DeviceControllerConstructor = new (options?: DeviceControllerOptions) => DeviceController; export type DeviceControllerBleConstructor = new (ble: BleController, recorder?: XdfRecorder) => DeviceControllerBle; export type PerDeviceOptions = PerDeviceOptionsMap[DeviceName]; export interface PerDeviceOptionsMap { 'Cognionics Quick-20r': DeviceControllerOptions; 'Muse S Gen 2': MuseControllerOptions; 'Zephyr BioHarness 3': DeviceControllerOptions; } export type DeviceName = 'Cognionics Quick-20r' | 'Muse S Gen 2' | 'Zephyr BioHarness 3'; export interface DeviceSpecification { deviceName: DeviceName; options?: PerDeviceOptionsMap[DeviceName]; } export type CreateDeviceSpec = { [K in DeviceName]: { deviceName: K; options?: PerDeviceOptionsMap[K] & SessionOptions; }; }[DeviceName]; export interface SessionOptions { xdfRecordPath?: string; webSocketPortStart?: number; createEventMarkerEmitter?: boolean; } export interface SingleDeviceBundle { device: DeviceController; recorder?: XdfRecorder; gateway?: WebSocketGateway; emitter?: EventMarkerEmitter; } export interface MultipleDeviceBundle { devices: DeviceController[]; recorder?: XdfRecorder; gateway?: WebSocketGateway; emitter?: EventMarkerEmitter; }