| Crates.io | moto-hses-mock |
| lib.rs | moto-hses-mock |
| version | 0.0.2 |
| created_at | 2025-09-21 23:15:37.199447+00 |
| updated_at | 2025-09-21 23:54:00.94132+00 |
| description | Mock HSES UDP server for testing and development |
| homepage | https://github.com/masayuki-kono/moto-hses |
| repository | https://github.com/masayuki-kono/moto-hses |
| max_upload_size | |
| id | 1849298 |
| size | 126,342 |
Mock HSES UDP server for testing and development.
This crate provides a mock implementation of the Yaskawa High-Speed Ethernet Server (HSES) protocol for testing and development purposes. It simulates a real Yaskawa robot's HSES server, allowing you to test your client applications without requiring actual hardware.
Add this to your Cargo.toml:
[dev-dependencies]
moto-hses-mock = "0.0.2"
tokio = { version = "1.0", features = ["full"] }
use moto_hses_mock::{MockServer, MockServerBuilder};
use moto_hses_proto::Alarm;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
// Start mock server with custom configuration using builder pattern
let server = MockServerBuilder::new()
.host("192.168.1.100")
.robot_port(20000)
.file_port(20001)
.with_alarm(Alarm::new(1001, 0, 0, "2024-01-01 12:00:00".to_string(), "Test alarm".to_string()))
.with_io_state(1, true)
.build()
.await?;
// Server will run until the program exits
server.run().await?;
Ok(())
}
The mock server supports all major HSES operations:
The crate includes examples demonstrating various usage patterns:
mock_basic_usage.rs - Basic mock server usagemoto-hses-client for end-to-end testing# Run the basic usage example
cargo run --example mock_basic_usage
# Run with custom address and port
cargo run --example mock_basic_usage -- 192.168.1.100 10040 10041
This project is licensed under the Apache License, Version 2.0. See the LICENSE file for details.
moto-hses-proto - Protocol definitions and serializationmoto-hses-client - Async UDP client for HSES communication