Skip to main content

moto_hses_client/
lib.rs

1//! moto-hses-client - HSES (High Speed Ethernet Server) client implementation
2//!
3//! This crate provides an async UDP client for communicating with Yaskawa robot controllers
4//! using the High-Speed Ethernet Server (HSES) protocol.
5//!
6//! # Thread Safety
7//!
8//! The crate provides two ways to use the client:
9//!
10//! - [`HsesClient`]: The basic client, suitable for single-task usage
11//! - [`SharedHsesClient`]: A thread-safe wrapper that can be shared across multiple tasks
12//!
13//! Both implement the [`HsesClientOps`] trait, allowing generic code to work with either.
14//!
15//! # Example
16//!
17//! ```ignore
18//! use moto_hses_client::{HsesClient, SharedHsesClient, HsesClientOps};
19//!
20//! #[tokio::main]
21//! async fn main() -> Result<(), Box<dyn std::error::Error>> {
22//!     // Create a basic client
23//!     let client = HsesClient::new("192.168.1.1:10040").await?;
24//!
25//!     // Wrap it for thread-safe access
26//!     let shared_client = SharedHsesClient::new(client);
27//!
28//!     // Use from multiple tasks
29//!     let client1 = shared_client.clone();
30//!     let client2 = shared_client.clone();
31//!
32//!     let handle1 = tokio::spawn(async move {
33//!         client1.read_status().await
34//!     });
35//!
36//!     let handle2 = tokio::spawn(async move {
37//!         client2.read_position(0).await
38//!     });
39//!
40//!     let (status, position) = tokio::try_join!(handle1, handle2)?;
41//!     Ok(())
42//! }
43//! ```
44
45#[macro_use]
46extern crate log;
47
48pub mod connection;
49pub mod convenience;
50mod impl_traits;
51pub mod protocol;
52pub mod shared;
53pub mod traits;
54pub mod types;
55
56// Re-export main types for convenience
57pub use shared::SharedHsesClient;
58pub use traits::HsesClientOps;
59pub use types::{ClientConfig, ClientError, HsesClient};
60
61// Re-export protocol types that are commonly used
62pub use moto_hses_proto::{Alarm, ExecutingJobInfo, HsesPayload, Position, Status, TextEncoding};