[−][src]Function novatel_oem6_api::read_thread
pub fn read_thread(
rx_conn: &Arc<Mutex<Connection>>,
log_send: &SyncSender<(Header, Vec<u8>)>,
response_send: &SyncSender<(Header, Vec<u8>)>,
response_abbrv_send: &SyncSender<Vec<u8>>
)
Continually read messages from the OEM6 device
Messages will either be a response to a previously sent command, or a log message. The function will detect the type and then forward the message to the appropriate channel receiver.
Arguments
- rx_conn - UART connection stream to use for communication
- log_send - SyncSender for forwarding received log messages
- response_send - SyncSender for forwarding recieved response messages
Examples
use novatel_oem6_api::*; use std::thread; use std::sync::mpsc::sync_channel; let bus = "/dev/ttyS5"; let (log_send, log_recv) = sync_channel(5); let (response_send, response_recv) = sync_channel(5); let (response_abbrv_send, response_abbrv_recv) = sync_channel(5); let oem = OEM6::new(bus, BaudRate::Baud9600, log_recv, response_recv, response_abbrv_recv).unwrap(); let rx_conn = oem.conn.clone(); thread::spawn(move || read_thread(&rx_conn, &log_send, &response_send, &response_abbrv_send));