uem_reader/reader/
com.rs

1//! COM port reader interface (RS232/485)
2//! Not implemented!
3
4#![allow(dead_code)]
5
6use std::{time::Duration};
7
8use crate::reader::*;
9use crate::reader::processing::*;
10
11#[derive(Debug, Default)]
12struct ReaderRs {
13    timeout: Duration,
14    port: u8,
15    ncommand: u8,
16}
17
18impl CommandsCounter for ReaderRs {
19    fn commands_count(&self) -> u8 {
20        self.ncommand
21    }
22
23    fn increment_commands(&mut self) {
24        if self.commands_count() == u8::MAX {
25            self.ncommand = 0;
26        }
27        self.ncommand += 1;
28    }
29}
30
31impl ReaderRs {
32    /// Open COM interface
33    //#![warn(missing_docs)]
34    pub fn open(&mut self) -> UemResult {
35        Ok(())
36    }        
37
38    /// close opened COM interface
39    pub fn close(&mut self) -> core::result::Result<(), UemError> {
40        Ok(())
41    }
42
43    #[allow(unused_variables)]
44    /// Send command to a reader and receive response
45    pub fn send(&mut self, command: &Vec<u8>) -> UemResultVec {
46        Ok(Vec::new())
47    }
48}
49
50/// Searches system for MicroEM readers
51/// on COM ports
52pub fn find_rs_readers() -> Vec<UemReader> {
53    Vec::new()
54}