forked from BasedHardware/omi
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtypes.ts
More file actions
70 lines (59 loc) · 1.4 KB
/
Copy pathtypes.ts
File metadata and controls
70 lines (59 loc) · 1.4 KB
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
/**
* Types for the Omi React Native SDK
*/
export enum BleAudioCodec {
PCM16 = 'pcm16',
PCM8 = 'pcm8',
OPUS = 'opus',
UNKNOWN = 'unknown',
}
export enum DeviceConnectionState {
CONNECTED = 'connected',
DISCONNECTED = 'disconnected',
CONNECTING = 'connecting',
DISCONNECTING = 'disconnecting',
}
export interface OmiDevice {
id: string;
name: string;
rssi: number;
}
export interface OmiNativeModule {
// Connection methods
connect(deviceId: string): Promise<void>;
disconnect(deviceId: string): Promise<void>;
isConnected(deviceId: string): Promise<boolean>;
// Audio methods
getAudioCodec(deviceId: string): Promise<number>;
startAudioBytesNotifications(deviceId: string): Promise<void>;
stopAudioBytesNotifications(deviceId: string): Promise<void>;
// Battery methods
getBatteryLevel(deviceId: string): Promise<number>;
// Scanning methods
startScan(): Promise<void>;
stopScan(): Promise<void>;
}
/**
* Options for audio processing
*/
export interface AudioProcessingOptions {
sampleRate?: number;
channels?: number;
bitDepth?: number;
codec?: BleAudioCodec;
}
/**
* Interface for audio data events
*/
export interface AudioDataEvent {
deviceId: string;
data: Uint8Array;
timestamp: number;
}
/**
* Interface for connection state change events
*/
export interface ConnectionStateEvent {
deviceId: string;
state: DeviceConnectionState;
}