The ServiceClient API allows a Rust application to call eCAL services, either generically or per-instance.
use rustecal::service::client::ServiceClient;
let client = ServiceClient::new("mirror")?;use rustecal::service::types::ServiceRequest;
let request = ServiceRequest {
payload: b"stressed".to_vec(),
};
let response = client.call("echo", request, Some(1000));To call all connected instances:
for instance in client.get_client_instances() {
let response = instance.call("reverse", request.clone(), Some(1000));
}match response {
Some(res) if res.success => {
println!("Response: {}", String::from_utf8_lossy(&res.payload));
}
Some(res) => {
println!("Error: {}", res.error_msg.unwrap_or("Unknown error".into()));
}
None => {
println!("No response or timeout.");
}
}This API matches the usage and behavior of mirror_client.cpp in the eCAL C++ samples.