Struct Reader

Source
pub struct Reader { /* private fields */ }

Implementations§

Source§

impl Reader

Source

pub fn new(port: &str) -> Result<Reader>

Examples found in repository?
examples/reader.rs (line 7)
5fn main() {
6    let args: Vec<String> = env::args().collect();
7    let mut reader = ru5102::Reader::new(&args[1]).unwrap();
8    println!("Reader info: {:?}", reader.reader_information().unwrap());
9    loop {
10        let inv = reader.inventory().unwrap();
11        if inv.len() > 0 {
12            for epc in inv.iter() {
13                println!("Found tag: {:?}", epc);
14                /*
15                let read_cmd = ru5102::ReadCommand {
16                    epc: epc.to_vec(),
17                    location: ru5102::ReadLocation::TID,
18                    start_address: 0,
19                    count: 100,
20                    password: None,
21                    mask_address: None,
22                    mask_length: None
23                };
24                let data = reader.read_data(read_cmd).unwrap();
25                println!("Tag data: {:?}", data);
26                */
27                println!("");
28            }
29        }
30    }
31}
Source

pub fn reader_information(&mut self) -> Result<ReaderInformation>

Fetch information on the reader in a ReaderInformation structure

Examples found in repository?
examples/reader.rs (line 8)
5fn main() {
6    let args: Vec<String> = env::args().collect();
7    let mut reader = ru5102::Reader::new(&args[1]).unwrap();
8    println!("Reader info: {:?}", reader.reader_information().unwrap());
9    loop {
10        let inv = reader.inventory().unwrap();
11        if inv.len() > 0 {
12            for epc in inv.iter() {
13                println!("Found tag: {:?}", epc);
14                /*
15                let read_cmd = ru5102::ReadCommand {
16                    epc: epc.to_vec(),
17                    location: ru5102::ReadLocation::TID,
18                    start_address: 0,
19                    count: 100,
20                    password: None,
21                    mask_address: None,
22                    mask_length: None
23                };
24                let data = reader.read_data(read_cmd).unwrap();
25                println!("Tag data: {:?}", data);
26                */
27                println!("");
28            }
29        }
30    }
31}
Source

pub fn inventory(&mut self) -> Result<Vec<Vec<u8>>>

Inventory all tags in the reader’s range.

Returns a vector of tag IDs.

Examples found in repository?
examples/reader.rs (line 10)
5fn main() {
6    let args: Vec<String> = env::args().collect();
7    let mut reader = ru5102::Reader::new(&args[1]).unwrap();
8    println!("Reader info: {:?}", reader.reader_information().unwrap());
9    loop {
10        let inv = reader.inventory().unwrap();
11        if inv.len() > 0 {
12            for epc in inv.iter() {
13                println!("Found tag: {:?}", epc);
14                /*
15                let read_cmd = ru5102::ReadCommand {
16                    epc: epc.to_vec(),
17                    location: ru5102::ReadLocation::TID,
18                    start_address: 0,
19                    count: 100,
20                    password: None,
21                    mask_address: None,
22                    mask_length: None
23                };
24                let data = reader.read_data(read_cmd).unwrap();
25                println!("Tag data: {:?}", data);
26                */
27                println!("");
28            }
29        }
30    }
31}
Source

pub fn read_data(&mut self, read_cmd: ReadCommand) -> Result<Vec<u8>>

Source

pub fn write_data(&mut self, write_cmd: WriteCommand) -> Result<()>

Source

pub fn kill(&mut self, kill_cmd: KillCommand) -> Result<()>

 Send a KillCommand

Auto Trait Implementations§

§

impl Freeze for Reader

§

impl RefUnwindSafe for Reader

§

impl Send for Reader

§

impl Sync for Reader

§

impl Unpin for Reader

§

impl UnwindSafe for Reader

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.