UemCommandsReader

Struct UemCommandsReader 

Source
pub struct UemCommandsReader<'a> { /* private fields */ }
Expand description

Structure for commands controlling a reader itself

Implementations§

Source§

impl<'a> UemCommandsReader<'a>

Source

pub fn beep(&mut self, count: u8) -> UemResult

Make short sound signals of specific count

§Arguments
  • count - Number of beeps to perform
§Returns

Ok(()) on success, otherwise returns an error.

§Example
// Beep 5 times
if uem_reader.commands().reader()
    .beep(5)
.is_err() {
    return;
}
Source

pub fn led( &mut self, count: u8, color: UemColor, post_color: UemColor, ) -> UemResult

Blink count times with led of specific color and remain with other color switched on

§Arguments
  • count - Number of blinks to perform
  • color - color to blink with
  • post_color - color to leave on
§Returns

Ok(()) on success, otherwise returns an error.

§Example
    UemReaderInternal,
    usb::find_usb_readers};
// Blink 3 times with green and remain yellow
if uem_reader.commands().reader()
    .led(3, UemColor::Green, UemColor::Yellow)
.is_err() {
    return;
}
Source

pub fn power_radio(&mut self, on: bool) -> UemResult

Turn radio chip on

§Arguments
  • on - true if needed to power on the radio, otherwise false
§Returns

Ok(()) on success, otherwise returns an UemError.

§Example
let mut uem_cmds = uem_reader.commands();
let mut uem_cmds_reader = uem_cmds.reader();
if uem_cmds_reader.power_radio(true).is_err() {
    return;
}
Source

pub fn radio_off_on(&mut self, duration: u16) -> UemResult

Switch radio field off for a specified duration

By switching off radio field, cards in the field are beind unpowered and thus reset.

§Arguments
  • duration - Number of milliseconds to switch off radio field. If set to 0, the field will be switched off permanently. The field can be switched on again with the same command and non-zero duration.
§Returns

Ok(()) on success, otherwise returns an error.

§Example
// Switch off radio for 10 ms
if uem_reader.commands().reader()
    .radio_off_on(10)
.is_err() {
    return;
}
Source

pub fn get_version(&mut self) -> UemResultVec

Read reader version

Reader version is a 6 bytes vector

§Returns

Ok(Vec<u8>) containing the version, otherwise UemError.

§Example
match uem_reader.commands().reader()
.get_version() {
    Ok(ver) => assert_eq!(ver.len(), 6),
    Err(err) => {
        uem_reader.close();
        println!("{:?}", err);
        assert!(false);
    }
}
Source

pub fn get_serial(&mut self) -> UemResultVec

Read reader serial

Reader serial is a 4 bytes vector

§Returns

Ok(Vec<u8>) containing the serial, otherwise UemError.

§Example
match uem_reader.commands().reader()
.get_serial() {
    Ok(ser) => assert_eq!(ser.len(), 4),
    Err(err) => {
        uem_reader.close();
        println!("{:?}", err);
        assert!(false);
    }
}

Auto Trait Implementations§

§

impl<'a> Freeze for UemCommandsReader<'a>

§

impl<'a> RefUnwindSafe for UemCommandsReader<'a>

§

impl<'a> Send for UemCommandsReader<'a>

§

impl<'a> Sync for UemCommandsReader<'a>

§

impl<'a> Unpin for UemCommandsReader<'a>

§

impl<'a> UnwindSafe for UemCommandsReader<'a>

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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V