pub struct Reader { /* private fields */ }Implementations§
Source§impl Reader
impl Reader
Sourcepub fn new(port: &str) -> Result<Reader>
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}Sourcepub fn reader_information(&mut self) -> Result<ReaderInformation>
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}Sourcepub fn inventory(&mut self) -> Result<Vec<Vec<u8>>>
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}pub fn read_data(&mut self, read_cmd: ReadCommand) -> Result<Vec<u8>>
pub fn write_data(&mut self, write_cmd: WriteCommand) -> Result<()>
Sourcepub fn kill(&mut self, kill_cmd: KillCommand) -> Result<()>
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> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more