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
//! # `matroskin`
//!
//! WhatsMiner v3 ApiDoc: <https://apidoc.whatsminer.com>
//!
//! `matroskin` is an asynchronous Rust library designed for interacting with WhatsMiner devices.
//! It provides an actor-based API to send commands and receive responses from WhatsMiner hardware,
//! facilitating monitoring and control functionalities.
//!
//! **Warning:** This library is developed primarily for personal use and may not be
//! fully optimized or extensively tested for public production environments. Hardware
//! timeouts (300ms) remain operational risks, and no physical hardware has been verified in CI.
//!
//! Note: Creating an [`Actor`](crate::actor::Actor) requires an active Tokio runtime context,
//! as it spawns an internal background task to manage connection lifecycle and mailboxes.
//!
//! Current status: [`list of done commands`](command#list-of-commands)
//!
//! # Usage Example
//!
//! ```rust,no_run
//! use matroskin::actor::Actor;
//! use matroskin::account::Account;
//! use matroskin::password::Password;
//! use matroskin::command::get_device_info::GetDeviceInfo;
//!
//! #[tokio::main]
//! async fn main() -> Result<(), Box<dyn std::error::Error>> {
//! // 0. (Optional) init logger
//! tracing_subscriber::fmt()
//! .compact()
//! .with_max_level(tracing::Level::INFO)
//! .without_time()
//! .init();
//!
//! // 1. Initialize the actor in `Created` state (requires active Tokio runtime).
//! let actor = Actor::new("10.10.10.10:4433", Account::Super, Password::Super);
//!
//! // 2. Queue connection intent.
//! actor.connect()?;
//!
//! // 3. Send an owned command by value.
//! // The command mailbox waits until the actor establishes a Connected session.
//! let response = actor.send(GetDeviceInfo::all()).await?;
//! println!("Response: {:#?}", response);
//!
//! // 4. Graceful non-blocking shutdown intent.
//! actor.shutdown()?;
//! Ok(())
//! }
//! ```