pub struct TCSClient {
pub socket: Option<TcpStream>,
}Fields§
§socket: Option<TcpStream>Implementations§
Source§impl TCSClient
Creates a new TCSClient instance without an active socket
impl TCSClient
Creates a new TCSClient instance without an active socket
pub fn new() -> TCSClient
Sourcepub fn connect(&mut self, ip: &str, timeout: Option<f64>) -> Result<(), Error>
pub fn connect(&mut self, ip: &str, timeout: Option<f64>) -> Result<(), Error>
Attempts to connect to the specified robot
§Arguments
ip- IP address of the robottimeout- Optional timeout setting for all socket read/write attempts
Sourcepub fn send_command<'a>(
&mut self,
command: TCSCommand,
command_args: Option<Vec<&str>>,
wait_for_response: bool,
read_timeout: Option<f64>,
) -> Result<Vec<String>, RobotError>
pub fn send_command<'a>( &mut self, command: TCSCommand, command_args: Option<Vec<&str>>, wait_for_response: bool, read_timeout: Option<f64>, ) -> Result<Vec<String>, RobotError>
Generates and sends the command payload to the robot
§Arguments
command- Selected command to run from the TCSCommand enumcommand_args- Optional command argumentswait_for_response- A boolean option should any commands not require waiting for a responseread_timeout- Optional argument to set the read timeout on the socket
Sourcepub fn disconnect(&mut self) -> Result<(), Error>
pub fn disconnect(&mut self) -> Result<(), Error>
Closes the socket only
Trait Implementations§
Auto Trait Implementations§
impl Freeze for TCSClient
impl RefUnwindSafe for TCSClient
impl Send for TCSClient
impl Sync for TCSClient
impl Unpin for TCSClient
impl UnwindSafe for TCSClient
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