pub struct RfidService {
pub capturing: Arc<AtomicBool>,
pub digits: Arc<Mutex<Vec<char>>>,
pub last_activity: Arc<Mutex<Instant>>,
pub handle: Arc<Mutex<Option<JoinHandle<()>>>>,
pub input_handle: Arc<Mutex<Option<JoinHandle<()>>>>,
}Expand description
RFID Service implementation for reading RFID data using keyboard input.
Fields§
§capturing: Arc<AtomicBool>Tracks whether the service is actively capturing RFID data.
digits: Arc<Mutex<Vec<char>>>Holds the collected digits for the current RFID sequence.
last_activity: Arc<Mutex<Instant>>Tracks the last activity time to clear digits on inactivity.
handle: Arc<Mutex<Option<JoinHandle<()>>>>Handle for the main processing task.
input_handle: Arc<Mutex<Option<JoinHandle<()>>>>Handle for the input event loop task.
Implementations§
Source§impl RfidService
impl RfidService
Sourcepub async fn stop(&self)
pub async fn stop(&self)
Stops the RFID service, including its background tasks and key bindings.
Sourcepub fn start_cleanup_task(&self)
pub fn start_cleanup_task(&self)
Starts a cleanup task to clear digits on inactivity.
Sourcepub async fn read_rfid(&self, write: WebSocketWrite, uuid: String)
pub async fn read_rfid(&self, write: WebSocketWrite, uuid: String)
Starts capturing RFID input from the keyboard and processes it asynchronously.
Trait Implementations§
Source§impl Service for RfidService
impl Service for RfidService
Source§fn run<'life0, 'async_trait>(
&'life0 self,
action: Value,
write: WebSocketWrite,
) -> Pin<Box<dyn Future<Output = (i32, String)> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn run<'life0, 'async_trait>(
&'life0 self,
action: Value,
write: WebSocketWrite,
) -> Pin<Box<dyn Future<Output = (i32, String)> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Executes an action for the service. Read more
Source§fn as_any(&self) -> &dyn Any
fn as_any(&self) -> &dyn Any
Allows dynamic casting of the service to a specific type. Read more
Source§fn stop_service(&self)
fn stop_service(&self)
Stops the service and cleans up resources. Read more
Source§fn get_version(&self) -> String
fn get_version(&self) -> String
Retrieves the version of the service. Read more
Auto Trait Implementations§
impl Freeze for RfidService
impl !RefUnwindSafe for RfidService
impl Send for RfidService
impl Sync for RfidService
impl Unpin for RfidService
impl !UnwindSafe for RfidService
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
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more