trunk_recorder_plugin/lib.rs
1//! Plugins for Trunk Recorder Pro.
2//!
3//! A plugin is a program of its own that the recorder starts, sends events to
4//! (calls starting, ending and landing on disk; radios registering; live
5//! audio; status) and stops. It only watches: nothing it does changes what is
6//! recorded. The [`protocol`] is JSON lines over stdin/stdout, so a plugin
7//! can be written in anything; this crate is the Rust side of it.
8//!
9//! ```no_run
10//! use trunk_recorder_plugin::{topic, ConcludedCall, Host, Manifest, NoConfig, Plugin, Setup};
11//!
12//! struct Hello { host: Host }
13//!
14//! impl Plugin for Hello {
15//! type Config = NoConfig;
16//! type SystemConfig = NoConfig;
17//! fn manifest() -> Manifest {
18//! Manifest { name: "Hello".into(), subscribe: vec![topic::CALL_CONCLUDED.into()], ..trunk_recorder_plugin::manifest!() }
19//! }
20//! fn start(host: Host, _: Setup<NoConfig, NoConfig>) -> Result<Self, String> {
21//! Ok(Hello { host })
22//! }
23//! fn call_concluded(&mut self, call: ConcludedCall) {
24//! self.host.info(format!("TG {} for {} s", call.call.talkgroup, call.call.call_length));
25//! }
26//! }
27//!
28//! fn main() {
29//! trunk_recorder_plugin::run::<Hello>();
30//! }
31//! ```
32
33#[cfg(feature = "sdk")]
34pub mod filter;
35mod multipart;
36pub mod protocol;
37#[cfg(feature = "sdk")]
38mod queue;
39#[cfg(feature = "sdk")]
40pub mod schema;
41#[cfg(feature = "sdk")]
42mod sdk;
43#[cfg(feature = "sdk")]
44pub mod testing;
45#[cfg(feature = "sdk")]
46pub use filter::TalkgroupFilter;
47#[cfg(feature = "sdk")]
48pub use queue::{Attempt, CallQueue, QueueOptions};
49
50pub use multipart::Multipart;
51pub use protocol::*;
52#[cfg(feature = "sdk")]
53pub use sdk::*;