Function novatel_oem6_api::read_thread[][src]

pub fn read_thread(
    rx_conn: Arc<Mutex<Connection>>,
    log_send: SyncSender<(Header, Vec<u8>)>,
    response_send: SyncSender<(Header, 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

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 oem = OEM6::new(bus, BaudRate::Baud9600, log_recv, response_recv).unwrap();

let rx_conn = oem.conn.clone();

thread::spawn(move || read_thread(rx_conn, log_send, response_send));