Expand description
RemoteXY library for Rust
This library provides a simple way to connect your Rust application to the RemoteXY app. You can use it to control and monitor your Rust application from your smartphone via a graphical interface you create yourself. Connection is established via TCP/IP with your smartphone as the client. The graphical interface is generated with the RemoteXY online editor. You have to convert the generated C-structs into Rust-structs and provide the config buffer which is also generated on the website.
Example:
use remote_xy::remote_xy;
use remote_xy::RemoteXY;
use serde::Deserialize;
use serde::Serialize;
const CONF_BUF: &[u8] = &[
255, 2, 0, 2, 0, 59, 0, 16, 31, 1, 4, 0, 44, 10, 10, 78, 2, 26, 2, 0, 9, 77, 22, 11, 2, 26, 31,
31, 79, 78, 0, 79, 70, 70, 0, 72, 12, 9, 16, 23, 23, 2, 26, 140, 38, 0, 0, 0, 0, 0, 0, 200, 66,
0, 0, 0, 0, 70, 16, 16, 63, 9, 9, 26, 37, 0,
];
#[derive(Serialize, Deserialize, Default)]
#[repr(C)]
struct InputData {
// input variables
slider_1: i8, // =0..100 slider position
switch_1: u8, // =1 if switch ON and =0 if OFF
}
#[derive(Serialize, Deserialize, Default)]
#[repr(C)]
struct OutputData {
// output variables
circularbar_1: i8, // from 0 to 100
led_1: u8, // led state 0 .. 1
// do not include the `connect_flag` variable
}
#[tokio::main]
async fn main() {
// start server on port 6377
let remotexy = remote_xy!(InputData, OutputData, "[::]:6377", CONF_BUF).await.unwrap();
// Add an Ethernet device in the RemoteXY app
// Do something with remotexy
}
Macros
This macro takes the InputData and OutputData types, the server address and the config buffer in order to
create a new RemoteXY struct.
The server is directly started.
Structs
RemoteXY struct that provides the interface to the RemoteXY app.