Skip to main content

Channel

Struct Channel 

Source
pub struct Channel<'a> { /* private fields */ }
Expand description

A communication channel

Implementations§

Source§

impl<'a> Channel<'a>

Source

pub fn read( &self, buf: &mut [PassThruMsg], timeout: u32, ) -> Result<usize, Error>

Fills msgs with messages until timing out or until msgs is filled. Returns the slice of messages read.

§Arguments
  • msgs - The array of messages to fill.
  • timeout - The amount of time in milliseconds to wait. If set to zero, reads buffered messages and returns immediately

Returns the amount of messages read.

Source

pub fn read_once(&self, timeout: u32) -> Result<PassThruMsg, Error>

Reads a single message

Source

pub fn write( &self, msgs: &mut [PassThruMsg], timeout: u32, ) -> Result<usize, Error>

Writes msgs to the device until all messages have been written or until the timeout has been reached. Returns the amount of message written.

§Arguments
  • msgs - The array of messages to send.
  • timeout - The amount of time in milliseconds to wait. If set to zero, queues as many messages as possible and returns immediately.
Source

pub fn start_message_filter( &self, filter_type: FilterType, mask_msg: Option<&PassThruMsg>, pattern_msg: Option<&PassThruMsg>, flow_control_msg: Option<&PassThruMsg>, ) -> Result<FilterId, Error>

Sets up a network protocol filter to filter messages received by the PassThru device. There is a limit of ten filters per network layer protocol. The device blocks all receive frames by default when no filters are defined.

Returns filter ID http://www.drewtech.com/support/passthru/startmsgfilter.html

Source

pub fn stop_message_filter(&self, filter_id: FilterId) -> Result<(), Error>

Removes a message filter started with Channel::start_msg_filter

§Arguments
  • msg_id - The id of the message returned from Channel::start_msg_filter
Source

pub fn start_periodic_message( &self, msg: &PassThruMsg, time_interval: u32, ) -> Result<MessageId, Error>

Repetitively transmit network protocol messages at the specified time interval over an existing logical communication channel. There is a limit of ten periodic messages per network layer protocol. Returns a handle for the periodic message used in Channel::stop_periodic_msg

§Arguments
  • msg - The message to send
  • time_interval - The time in milliseconds to wait between sending messages. The acceptable range is between 5 and 65,535 milliseconds.
Source

pub fn stop_periodic_message(&self, msg_id: MessageId) -> Result<(), Error>

Stops a periodic mesage started with Channel::start_periodic_msg

§Arguments
  • msg_id = the id of the periodic message returned from Channel::start_periodiC_msg
Source

pub fn clear_transmit_buffer(&self) -> Result<(), Error>

Clear transmit message queue

Source

pub fn clear_periodic_messages(&self) -> Result<(), Error>

Halt continuous messages

Source

pub fn clear_receive_buffer(&self) -> Result<(), Error>

Clear receive message queue

Source

pub fn clear_message_filters(&self) -> Result<(), Error>

Removes all message filters

Source

pub fn get_config(&self, id: ConfigId) -> Result<u32, Error>

Gets a single configuration parameter.

Source

pub fn set_config(&self, id: ConfigId, value: u32) -> Result<(), Error>

Sets a single configuration parameter.

Trait Implementations§

Source§

impl<'a> Drop for Channel<'a>

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more

Auto Trait Implementations§

§

impl<'a> Freeze for Channel<'a>

§

impl<'a> RefUnwindSafe for Channel<'a>

§

impl<'a> !Send for Channel<'a>

§

impl<'a> !Sync for Channel<'a>

§

impl<'a> Unpin for Channel<'a>

§

impl<'a> UnsafeUnpin for Channel<'a>

§

impl<'a> UnwindSafe for Channel<'a>

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