pub struct Channel<'a> { /* private fields */ }Expand description
A communication channel
Implementations§
Source§impl<'a> Channel<'a>
impl<'a> Channel<'a>
Sourcepub fn read(
&self,
buf: &mut [PassThruMsg],
timeout: u32,
) -> Result<usize, Error>
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.
Sourcepub fn write(
&self,
msgs: &mut [PassThruMsg],
timeout: u32,
) -> Result<usize, Error>
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.
Sourcepub fn start_message_filter(
&self,
filter_type: FilterType,
mask_msg: Option<&PassThruMsg>,
pattern_msg: Option<&PassThruMsg>,
flow_control_msg: Option<&PassThruMsg>,
) -> Result<FilterId, Error>
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
Sourcepub fn stop_message_filter(&self, filter_id: FilterId) -> Result<(), Error>
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 fromChannel::start_msg_filter
Sourcepub fn start_periodic_message(
&self,
msg: &PassThruMsg,
time_interval: u32,
) -> Result<MessageId, Error>
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 sendtime_interval- The time in milliseconds to wait between sending messages. The acceptable range is between 5 and 65,535 milliseconds.
Sourcepub fn stop_periodic_message(&self, msg_id: MessageId) -> Result<(), Error>
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
Sourcepub fn clear_transmit_buffer(&self) -> Result<(), Error>
pub fn clear_transmit_buffer(&self) -> Result<(), Error>
Clear transmit message queue
Sourcepub fn clear_periodic_messages(&self) -> Result<(), Error>
pub fn clear_periodic_messages(&self) -> Result<(), Error>
Halt continuous messages
Sourcepub fn clear_receive_buffer(&self) -> Result<(), Error>
pub fn clear_receive_buffer(&self) -> Result<(), Error>
Clear receive message queue
Sourcepub fn clear_message_filters(&self) -> Result<(), Error>
pub fn clear_message_filters(&self) -> Result<(), Error>
Removes all message filters