-
Notifications
You must be signed in to change notification settings - Fork 1
/
low_level_call.rs
31 lines (24 loc) · 899 Bytes
/
low_level_call.rs
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
use coppeliasim_zmq_remote_api::{
RawRequest, RemoteAPIError, RemoteApiClient, RemoteApiClientInterface, RemoteApiClientParams,
ZmqRequest,
};
use ciborium::cbor;
fn main() -> Result<(), RemoteAPIError> {
// use the env variable RUST_LOG="trace" or RUST_LOG="debug" to observe the zmq communication
env_logger::init();
let client = RemoteApiClient::new(RemoteApiClientParams {
host: "localhost".to_string(),
..RemoteApiClientParams::default()
})?;
let request = ZmqRequest {
uuid: client.get_uuid(),
func: "sim.getStringSignal".to_string(),
args: vec![cbor!("testSignal").unwrap()],
ver: coppeliasim_zmq_remote_api::VERSION,
lang: coppeliasim_zmq_remote_api::LANG.into(),
args_l: 1,
};
let json = client.send_raw_request(request.to_raw_request())?;
println!("json: {json}");
Ok(())
}