fundamentum_sdk_mqtt/lib.rs
1//! Rust MQTT client targeting Fundamentum IoT's MQTT broker.
2//!
3//! The Fundamentum's MQTT SDK is designed to quickly set up a Rust environment
4//! with an MQTT client, focusing on consuming Fundamentum's MQTT services.
5//!
6//! ## Example
7//!
8//! To test your environment, you can build and run a simple command-line
9//! application. Check out the [examples](./examples/) directory for code
10//! samples.
11//!
12//! ```bash
13//! $ cargo run --example pubsub -- \
14//! --private-key ./rsa_private.pem \
15//! --project-id 13 --region-id 1 --registry-id 12 \
16//! --serial 123456789
17//! # ..
18//! ```
19//!
20//! ### Examples
21//!
22//! - `pubsub`: an advanced example with heartbeat and pub/sub pattern.
23//! - `commands`: a basic example with the commands workflow.
24//! - `heartbeat`: a very simple example with the heartbeat.
25//! - `config`: a very simple example that prints the current configuration.
26
27// Enable documentation for all features on docs.rs
28#![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))]
29
30mod client;
31mod device;
32mod error;
33mod message;
34mod publish_options;
35mod publishable;
36mod publisher;
37mod security;
38
39pub use client::{
40 Client, ClientSettings, ClientStatus, ClientStatusError, ClientStatusStream,
41 MQTTOptionsOverrides,
42};
43pub use device::Device;
44pub use error::Error;
45pub use message::Message;
46pub use publish_options::PublishOptions;
47pub use publishable::Publishable;
48pub use publisher::Publisher;
49pub use rumqttc::v5::{
50 EventLoop,
51 mqttbytes::{
52 QoS,
53 // TODO: APP00009-1963: <https://dimonoff.atlassian.net/browse/APP00009-1963>
54 // Fix this major implementation details leak. As this lib does not yet encapsulate
55 // mqtt re-subscription, it forces its client to do it themselves, which entails
56 // providing those clients with the a great deal (too much) internal knowledge.
57 v5::{ConnAck, ConnectReturnCode, Packet},
58 },
59};
60pub use security::{
61 Algorithm, Security, SecurityBuilder, SecurityBuilderError, SecurityFetcher,
62 SecurityFileFetcher,
63};
64pub use serde_json::json;
65
66pub mod models;