pub enum CSerialPortData {
Show 15 variants
BaudRate(Option<u32>),
DataBits(Option<DataBits>),
FlowControl(Option<FlowControl>),
Parity(Option<Parity>),
StopBits(Option<StopBits>),
Timeout(Option<Duration>),
Break(Option<bool>),
ClearBuffer(Option<ClearBuffer>),
CarrierDetect(Option<bool>),
ClearToSend(Option<bool>),
DataSetReady(Option<bool>),
DataTerminalReady(Option<bool>),
RequestToSend(Option<bool>),
RingIndicator(Option<bool>),
DataBytes(Option<Vec<u8>>),
}
Expand description
Provides the CSerialPortProtocol ability to both CSerialPortProtocol::post_message utilizing the CSerialPortData as the data wrapper and as the CSerialPortProtocol::get_message request via the CSerialPortData::get_message_request function to query the port for data.
Variants§
BaudRate(Option<u32>)
Configurable CSerialPortProtocol item.
DataBits(Option<DataBits>)
Configurable CSerialPortProtocol item.
FlowControl(Option<FlowControl>)
Configurable CSerialPortProtocol item.
Parity(Option<Parity>)
Configurable CSerialPortProtocol item.
StopBits(Option<StopBits>)
Configurable CSerialPortProtocol item.
Timeout(Option<Duration>)
Configurable CSerialPortProtocol item.
Break(Option<bool>)
Line control status of the CSerialPortProtocol.
ClearBuffer(Option<ClearBuffer>)
Line control status of the CSerialPortProtocol.
CarrierDetect(Option<bool>)
Line control status of the CSerialPortProtocol.
ClearToSend(Option<bool>)
Line control status of the CSerialPortProtocol.
DataSetReady(Option<bool>)
Line control status of the CSerialPortProtocol.
DataTerminalReady(Option<bool>)
Line control status of the CSerialPortProtocol.
RequestToSend(Option<bool>)
Line control status of the CSerialPortProtocol.
RingIndicator(Option<bool>)
Line control status of the CSerialPortProtocol.
DataBytes(Option<Vec<u8>>)
Reads a buffer from a CSerialPortProtocol.
Implementations§
Source§impl CSerialPortData
Specialization of the CSerialPortData to support the two way nature
of this enumeration as both a request / data write object.
impl CSerialPortData
Specialization of the CSerialPortData to support the two way nature of this enumeration as both a request / data write object.
Sourcepub fn as_bool(&self) -> Option<bool>
pub fn as_bool(&self) -> Option<bool>
Extracts the held Option bool values by those enum types. Returns None otherwise.
Sourcepub fn as_bytes(&self) -> Option<Vec<u8>>
pub fn as_bytes(&self) -> Option<Vec<u8>>
Extracts the held Option Vec u8 values by those enum types. Returns None otherwise.
Sourcepub fn as_data_bits(&self) -> Option<DataBits>
pub fn as_data_bits(&self) -> Option<DataBits>
Extracts the held Option DataBits values by those enum types. Returns None otherwise.
Sourcepub fn as_flow_control(&self) -> Option<FlowControl>
pub fn as_flow_control(&self) -> Option<FlowControl>
Extracts the held Option FlowControl values by those enum types. Returns None otherwise.
Sourcepub fn as_parity(&self) -> Option<Parity>
pub fn as_parity(&self) -> Option<Parity>
Extracts the held Option Parity values by those enum types. Returns None otherwise.
Sourcepub fn as_stop_bits(&self) -> Option<StopBits>
pub fn as_stop_bits(&self) -> Option<StopBits>
Extracts the held Option StopBits values by those enum types. Returns None otherwise.
Sourcepub fn as_timeout(&self) -> Option<Duration>
pub fn as_timeout(&self) -> Option<Duration>
Extracts the held Option Duration values by those enum types. Returns None otherwise.
Sourcepub fn as_u32(&self) -> Option<u32>
pub fn as_u32(&self) -> Option<u32>
Extracts the held Option u8 by those enum types. Returns None otherwise.
Sourcepub fn get_message_request(&self) -> Option<&str>
pub fn get_message_request(&self) -> Option<&str>
Provides the string representation to support the CSerialPortProtocol::get_message request string to get specific types of data from an open port.
Trait Implementations§
Source§impl CProtocolHandler<CSerialPortData> for CSerialPortProtocol
The CSerialPortProtocol implementation of the CProtocolHandler
utilizing the CSerialPortData enumeration as the bi-directional
read / write method of the protocol definition rules.
impl CProtocolHandler<CSerialPortData> for CSerialPortProtocol
The CSerialPortProtocol implementation of the CProtocolHandler utilizing the CSerialPortData enumeration as the bi-directional read / write method of the protocol definition rules.
Source§fn get_message(
&mut self,
request: Option<&str>,
) -> Result<CSerialPortData, Error>
fn get_message( &mut self, request: Option<&str>, ) -> Result<CSerialPortData, Error>
Will query the CSerialPortProtocol for the latest status / data associated/ via the request. Utilize the CSerialPortData::get_message_request to utilize the proper string.
Will panic if an invalid request is received.
Source§fn is_running(&self) -> bool
fn is_running(&self) -> bool
Signals the CSerialPortProtocol::terminate has not been called.
Source§fn post_message(&mut self, data: CSerialPortData) -> Result<(), Error>
fn post_message(&mut self, data: CSerialPortData) -> Result<(), Error>
Will write the CSerialPortData to the open serial port. The result will reflect any errors if the transmit fails. Will panic if a CSerialPortData not writable is specified or the port has been terminated.
Source§fn terminate(&mut self)
fn terminate(&mut self)
Closes the port connection. All transaction with the CSerialPortProtocol object will panic after this is performed.