Skip to main content

ados_sdk/
lib.rs

1#![doc = include_str!("../README.md")]
2
3pub mod client;
4pub mod context;
5pub mod drivers;
6pub mod http;
7pub mod lifecycle;
8pub mod msp;
9pub mod testing;
10pub mod vision;
11
12/// The `camera.control.set` request and reply ([`CameraClient::set_controls`]).
13/// The `reason` codes of a refused request are in
14/// [`ados_protocol::camera_control::reason`].
15pub use ados_protocol::camera_control::{CameraControlRequest, CameraControlResult};
16pub use client::{
17    ClientError, EventCallback, OffloadAdvertisement, PluginIpcClient, ToolHandler, WhepAnswer,
18};
19pub use context::{
20    CameraClient, CloudClient, ConfigClient, EventsClient, LifecycleClient, MavlinkClient,
21    MdnsClient, NodeClient, PeripheralClient, PluginContext, ProcessClient, SensorsClient,
22    TelemetryClient, ToolsClient, VideoClient,
23};
24pub use lifecycle::{run_plugin, run_plugin_with, Plugin, RunnerArgs, RunnerError};
25pub use vision::{Frame, FrameCallback, Odometry, Pose, VisionClient, VIO_COMPONENT_ID};
26
27/// The env var the host sets on every plugin unit to this node's profile.
28pub const NODE_PROFILE_ENV: &str = "ADOS_NODE_PROFILE";
29
30/// This node's profile (`drone`, `ground-station`, `workstation` or
31/// `compute`), as the host exported it into the plugin's environment. `drone`
32/// only when the variable is unset or empty, which a host-started plugin never
33/// sees.
34pub fn node_profile() -> String {
35    std::env::var(NODE_PROFILE_ENV)
36        .ok()
37        .map(|p| p.trim().to_string())
38        .filter(|p| !p.is_empty())
39        .unwrap_or_else(|| "drone".to_string())
40}
41
42/// The generated agent capability catalog, re-exported from `ados-protocol` so
43/// a plugin author references one source of truth for capability ids. The
44/// source of truth is `crates/ados-protocol/capabilities.toml`.
45pub mod capabilities {
46    pub use ados_protocol::capabilities::*;
47}
48
49/// The `node.info` reply types ([`NodeClient::info`]), re-exported from
50/// `ados-protocol`, which the host serializes them from.
51pub mod node_info {
52    pub use ados_protocol::node_info::{
53        BoardInfo, CameraInfo, GroundStationInfo, NodeInfo, StreamGeometry,
54    };
55}
56
57/// The `mdns.advertise` / `mdns.browse` types ([`MdnsClient`]), re-exported
58/// from `ados-protocol`, which the host decodes and serializes them with.
59pub mod mdns {
60    pub use ados_protocol::plugin_mdns::{Advertised, DiscoveredService, RESERVED_SERVICE_TYPES};
61}