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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
//! aws-iot-core-sdk-rust aims to be a well-functioning and easy to use AWS IoT device SDK.
//! At its core it uses the pure Rust MQTT client rumqttc. The name is chosen to match its C, C++, Python and JS counterparts.
//! * Use this to easily connect your IoT devices to AWS IoT Core.
//! * Publish and subscribe to any topic you want.
//! * Implement the AWSEventHandler trait for your struct.
//!
//! The crate re-exports Mqtt311s Quality of Service enum. These are used when subscribing and
//! publish. The variants are:
//! * AtMostOnce (0)
//! * AtLeastOnce (1)
//! * ExactlyOnce (2)
//!
//! ## Publish and subscribe
//! ```no_run
//!#[tokio::main]
//!async fn main() -> Result<(), Box<dyn std::error::Error>> {
//! let aws_settings = aws_iot_device_sdk_rust::AWSIoTSettings::new(
//! "clientid".to_owned(),
//! "AmazonRootCA1.pem".to_owned(),
//! "cert.crt".to_owned(),
//! "key.pem".to_owned(),
//! "endpoint.amazonaws.com".to_owned(),
//! None
//! );
//!
//! let (iot_core_client, eventloop_stuff) = aws_iot_device_sdk_rust::AWSIoTAsyncClient::new(aws_settings).await?;
//!
//! iot_core_client.subscribe("test".to_string(), rumqttc::QoS::AtMostOnce).await?;
//! iot_core_client.publish("topic".to_string(), rumqttc::QoS::AtMostOnce, "hey").await?;
//!
//! let mut receiver1 = iot_core_client.get_receiver().await;
//! let mut receiver2 = iot_core_client.get_receiver().await;
//!
//! let recv1_thread = tokio::spawn(async move {
//! loop {
//! match receiver1.recv().await {
//! Ok(event) => {
//! match event {
//! rumqttc::Packet::Publish(p) => println!("Received message {:?} on topic: {}", p.payload, p.topic),
//! _ => println!("Got event on receiver1: {:?}", event),
//! }
//!
//! },
//! Err(_) => (),
//! }
//! }
//! });
//!
//! let recv2_thread = tokio::spawn(async move {
//! loop {
//! match receiver2.recv().await {
//! Ok(event) => println!("Got event on receiver2: {:?}", event),
//! Err(_) => (),
//! }
//! }
//! });
//!
//! let listen_thread = tokio::spawn(async move {
//! aws_iot_device_sdk_rust::async_client::async_event_loop_listener(eventloop_stuff).await.unwrap();
//! });
//!
//! tokio::join!(
//! recv1_thread,
//! recv2_thread,
//! listen_thread);
//! Ok(())
//!}
//!
//!```
pub use ;
pub use ;
pub use ;
pub use AsyncClient;
pub use ;
pub use BusReader;
pub use ;