Skip to main content

flightrelay/
lib.rs

1//! Flight Relay Protocol (FRP) — golf launch monitor event streaming.
2//!
3//! This crate provides message schemas and optional WebSocket transport for the
4//! [Flight Relay Protocol](https://github.com/flightrelay/spec).
5//!
6//! # Features
7//!
8//! - **`controller`** — [`ShotAggregator`] for accumulating shot lifecycle events
9//! - **`device`** — (reserved for future device-side helpers)
10//! - **`client`** — [`FrpClient`] WebSocket client (connects to a device)
11//! - **`server`** — [`FrpListener`] / [`FrpConnection`] WebSocket server (accepts controllers)
12
13pub mod error;
14pub mod message;
15pub mod types;
16pub mod units;
17
18#[cfg(feature = "controller")]
19pub mod accumulator;
20
21#[cfg(feature = "client")]
22pub mod client;
23
24#[cfg(feature = "server")]
25pub mod server;
26
27pub use error::FrpError;
28pub use message::{
29    DetectionMode, FrpEnvelope, FrpEvent, FrpMessage, FrpProtocolMessage, Severity,
30};
31pub use types::{BallFlight, ClubData, FaceImpact, ShotKey};
32pub use units::{Distance, Velocity};
33
34#[cfg(feature = "controller")]
35pub use accumulator::{CompletedShot, ShotAggregator};
36
37#[cfg(feature = "client")]
38pub use client::FrpClient;
39
40#[cfg(feature = "server")]
41pub use server::{FrpConnection, FrpListener};
42
43/// Recommended default port for standalone FRP connections.
44pub const DEFAULT_PORT: u16 = 5880;
45
46/// Recommended default WebSocket path for FRP connections.
47pub const DEFAULT_PATH: &str = "/frp";
48
49/// Recommended default URL for standalone FRP connections.
50pub const DEFAULT_URL: &str = "ws://localhost:5880/frp";
51
52/// The FRP spec version this crate implements.
53pub const SPEC_VERSION: &str = "0.1.0";