CSerialPortData

Enum CSerialPortData 

Source
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.

Source

pub fn as_bool(&self) -> Option<bool>

Extracts the held Option bool values by those enum types. Returns None otherwise.

Source

pub fn as_bytes(&self) -> Option<Vec<u8>>

Extracts the held Option Vec u8 values by those enum types. Returns None otherwise.

Source

pub fn as_data_bits(&self) -> Option<DataBits>

Extracts the held Option DataBits values by those enum types. Returns None otherwise.

Source

pub fn as_flow_control(&self) -> Option<FlowControl>

Extracts the held Option FlowControl values by those enum types. Returns None otherwise.

Source

pub fn as_parity(&self) -> Option<Parity>

Extracts the held Option Parity values by those enum types. Returns None otherwise.

Source

pub fn as_stop_bits(&self) -> Option<StopBits>

Extracts the held Option StopBits values by those enum types. Returns None otherwise.

Source

pub fn as_timeout(&self) -> Option<Duration>

Extracts the held Option Duration values by those enum types. Returns None otherwise.

Source

pub fn as_u32(&self) -> Option<u32>

Extracts the held Option u8 by those enum types. Returns None otherwise.

Source

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.

Source§

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

Signals the CSerialPortProtocol::terminate has not been called.

Source§

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)

Closes the port connection. All transaction with the CSerialPortProtocol object will panic after this is performed.

Source§

fn id(&mut self) -> String

Identifies the protocol for debugging / reporting purposes.
Source§

impl Debug for CSerialPortData

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> ErasedDestructor for T
where T: 'static,