-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathprotocol.js
46 lines (41 loc) · 1.32 KB
/
protocol.js
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
const DeviceStatus = {
// Device is disconnected
DISCONNECTED: "disconnected",
// We're not sure what the device is doing
UNKNOWN: "unknown",
// The device server is running but doing busywork
BUSY: "busy",
// The device won't work because there's a hardware problem
// Maybe a mic is unplugged or the emitter battery is dead
HARDWARE_UNAVAILABLE: "hardware-unavailable",
// Ready to go!
READY: "ready",
};
const RemoteStatus = {
NO_SOCKET: "no-socket",
DISCONNECTED: "disconnected",
};
const DirectMessage = {
DEVICE_STATUS: "device-status",
UPDATE_PULSE: "update-pulse",
SET_RECORD_DURATION: "set-record-duration",
TRIGGER_PULSE: "trigger-pulse",
UPDATE_OVERRIDES: "update-overrides",
RESTART_DEVICE: "restart-device",
AUDIO: "audio",
ASSIGN_PULSE: "assign-pulse",
UPDATE_LABEL: "update-label",
HANDSHAKE_REMOTE: "handshake-remote",
HANDSHAKE_DEVICE: "handshake-device",
}
const ServerMessage = {
CONNECT: "connect",
DISCONNECT: "disconnect",
DEVICE_LISTING: "device-listing",
CHOOSE_DEVICE: "choose-device",
DEVICE_REMOTE_CONNECT: "device-remote-connect",
DEVICE_REMOTE_DISCONNECT: "device-remote-disconnect",
DEVICE_CHOICE_SUCCESSFUL: "device-choice-successful",
}
const Message = { ...DirectMessage, ...ServerMessage };
module.exports = { DeviceStatus, RemoteStatus, DirectMessage, ServerMessage, Message };