pub enum NfcEvent {
Reading(NfcReading),
ReadError {
serial_number: String,
},
Written {
serial_number: String,
records: Vec<NdefRecord>,
},
MadeReadOnly {
serial_number: String,
},
Rejected {
reason: NfcRejection,
message: String,
},
}Expand description
What an NFC reader reports, in DeviceEvent::Nfc.
use hardless_core::NfcEvent;
let event = NfcEvent::ReadError { serial_number: "04:a2".into() };
assert_eq!(
serde_json::to_value(&event).unwrap(),
serde_json::json!({ "type": "read-error", "serialNumber": "04:a2" })
);Variants§
Reading(NfcReading)
A card was tapped and read; the bridge’s nfc-reading message.
ReadError
A card was tapped but could not be read; the bridge’s nfc-error message.
Written
The app wrote records to the card on the reader.
MadeReadOnly
The app made the card on the reader read-only.
Rejected
A write or lock was refused.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for NfcEvent
impl<'de> Deserialize<'de> for NfcEvent
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl Eq for NfcEvent
impl StructuralPartialEq for NfcEvent
Auto Trait Implementations§
impl Freeze for NfcEvent
impl RefUnwindSafe for NfcEvent
impl Send for NfcEvent
impl Sync for NfcEvent
impl Unpin for NfcEvent
impl UnsafeUnpin for NfcEvent
impl UnwindSafe for NfcEvent
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