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

Structure for commands controlling a reader itself

Implementations§

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;
}

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;
}

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;
}

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;
}

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);
    }
}

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§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.