Summary

Extensible cross-platform GUI application for controlling lab instruments over the network using SCPI commands. → GitHub

Goals:

Screenshots

Demo gif
Demo
Setting screen
Settings screen
Command screen
Command screen

How to send SCPI commands via TCP/IP in Rust

First of all, SCPI commands are no magic like other proprietory protocols or the mere presenceof some vendor tools might suggest – instead they are simple ASCII characters terminated by a newline.

What does that mean for our Rust implementation?

Well, the bytestream to send as an SCPI command over TCP can be defined as simply as b"OUTput1 on\n", where the leading "b" tells the Rust compiler to treat the entered characters as bytes, i. e., return a &[u8]. The TcpStream struct by Rust's standard library implements the std:io::Write trait that incorporates awrite() function – which fortunately accepts a buf: &[u8] argument. Great!

So our code to turn the output for channel 1 on would look like this:

let mut stream = std::net::TcpStream::connect("10.10.10.10:5555")?;
stream.write(b"OUTput1 on\n")?;

Future work