/
api.ts
38 lines (34 loc) · 1.33 KB
/
api.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import { getMentalCommandActionSensitivity, setMentalCommandActionSensitivity } from "../mentalCommands";
import { loadProfile } from "../user";
import { Headset, MentalCommandAction, MentalCommandSensitivities, Profile } from ".";
export interface Callbacks {
setHasAccessRight?: (hasAccessRight: boolean) => void;
setHeadsets?: (headsets: Headset[]) => void;
setConnectedHeadset?: (headset?: Headset) => void;
setProfiles?: (profiles: Profile[]) => void;
setCurrentProfile?: (profile: Profile | null) => void;
setActiveCommands?: (commands: MentalCommandAction[]) => void;
setCommandSensitivities?: (sensitivities: MentalCommandSensitivities) => void;
setCurrentCommand?: (command: MentalCommandAction, power: number) => void;
}
export enum LogLevel {
Debug = 0,
Info = 1,
Warning = 2,
Error = 3,
None = 4,
}
export interface InitData {
clientId: string;
clientSecret: string;
logLevel?: LogLevel;
callbacks?: Callbacks;
}
export interface EmotivApi {
connect: (socketURI?: string) => void;
connectHeadset: (id: Headset["id"]) => void;
loadProfile: typeof loadProfile;
getMentalCommandActionSensitivity: typeof getMentalCommandActionSensitivity;
setMentalCommandActionSensitivity: typeof setMentalCommandActionSensitivity;
changeLogLevel: (level: LogLevel) => void;
}