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
//! Protocol constants. These mirror the Zendo server and must change in
//! lockstep with it.
/// First TCP port the Zendo WebSocket server tries to bind.
pub const WEBSOCKET_PORT_START: u16 = 5432;
/// Last TCP port the Zendo WebSocket server tries to bind, inclusive.
pub const WEBSOCKET_PORT_END: u16 = 5435;
/// The wire-protocol version this crate implements.
///
/// It increments on every change to the frame layout, independent of the crate
/// or app release version. The Zendo server announces it in a hello frame on
/// connect; clients require an exact match.
pub const PROTOCOL_VERSION: u16 = 1;
/// Type tag for the hello frame the server sends first on every connection.
pub const MSG_HELLO: u8 = 0x01;
/// Type tag for a body-quaternion frame.
pub const MSG_BODY_QUATERNION: u8 = 0x02;
/// Type tag for a body-landmark frame.
pub const MSG_BODY_LANDMARK: u8 = 0x03;
/// Type tag for a hand-quaternion frame.
pub const MSG_HAND_QUATERNION: u8 = 0x04;
/// Type tag for a hand-landmark frame.
pub const MSG_HAND_LANDMARK: u8 = 0x05;
/// Side byte identifying the right hand in hand frames.
pub const HAND_SIDE_RIGHT: u8 = 0;
/// Side byte identifying the left hand in hand frames.
pub const HAND_SIDE_LEFT: u8 = 1;
/// Number of joints in a body-quaternion frame.
pub const BODY_JOINT_COUNT: usize = 13;
/// Number of landmarks in a body-landmark frame (MAIA topology).
pub const BODY_LANDMARK_COUNT: usize = 19;
/// Number of joints in a hand-quaternion frame (wrist + 5 digits x MCP/PIP/DIP).
pub const HAND_JOINT_COUNT: usize = 16;
/// Number of landmarks in a hand-landmark frame (BlazePose hand topology).
pub const HAND_LANDMARK_COUNT: usize = 21;
/// Bytes per `f64` on the wire.
pub const F64_BYTES: usize = 8;
/// Bytes per quaternion or landmark tuple on the wire (4 x `f64`).
pub const TUPLE_BYTES: usize = 4 * F64_BYTES;