pub struct SerialEndpoint { /* private fields */ }Expand description
Endpoint for serial connections
// get all available ports
let all_ports = SerialEndpoint::find_serial_ports();
// open connection
let endpoint = SerialEndpoint::from(all_ports, 115200);
endpoint.open().unwrap();
// send first message
// and read responses
endoint.write("$I").unwrap();
let response = endpoint.read_new_messages(Duration::from_millis(100));
// close connection after
endpoint.close();Implementations§
Source§impl SerialEndpoint
impl SerialEndpoint
Sourcepub fn find_serial_ports() -> Vec<SerialPortInfo>
pub fn find_serial_ports() -> Vec<SerialPortInfo>
Returns list of all usb devices
Sourcepub fn from(port_name: &str, baud_rate: u32) -> SerialEndpoint
pub fn from(port_name: &str, baud_rate: u32) -> SerialEndpoint
Creates a new serial endpoint configuration
Sourcepub fn write_sync(&mut self) -> Result<(), String>
pub fn write_sync(&mut self) -> Result<(), String>
Writes a sync command
Is required for issuing simulator commands
Trait Implementations§
Source§impl Drop for SerialEndpoint
impl Drop for SerialEndpoint
Auto Trait Implementations§
impl Freeze for SerialEndpoint
impl !RefUnwindSafe for SerialEndpoint
impl Send for SerialEndpoint
impl !Sync for SerialEndpoint
impl Unpin for SerialEndpoint
impl !UnwindSafe for SerialEndpoint
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more