A.R.G.U.S 2.1.0
Adaptive Real-Time Guardian for Unsafe Situations
Loading...
Searching...
No Matches
Classes | Public Member Functions | Static Public Member Functions | List of all members
PhysicalButtonModule Class Reference

GPIO character-device based physical button module. More...

#include <PhysicalButtonModule.hpp>

Public Member Functions

 PhysicalButtonModule ()
 Construct module from environment-derived configuration.
 
 ~PhysicalButtonModule ()
 Destroy module and release any open line descriptors.
 
 PhysicalButtonModule (const PhysicalButtonConfig &config)
 Construct module with explicit configuration.
 
bool available () const noexcept
 Check whether at least one input channel is available.
 
bool poll (PhysicalButtonEvent &event) noexcept
 Poll channels and emit a debounced semantic event if available.
 
bool waitForEvent (PhysicalButtonEvent &event, std::chrono::milliseconds timeout) noexcept
 Wait for next debounced event using blocking GPIO edge reads.
 
bool readAcknowledgePressed (bool &pressed) noexcept
 Read current acknowledge-button pressed state.
 
const char * lastErrorString () const noexcept
 Get last error string.
 
const char * statusString () const noexcept
 Get compact status summary string.
 

Static Public Member Functions

static PhysicalButtonConfig configFromEnvironment () noexcept
 Build button configuration from environment variables.
 
static const char * eventToString (PhysicalButtonEvent event) noexcept
 Convert semantic event enum to readable string.
 

Detailed Description

Definition at line 39 of file PhysicalButtonModule.hpp.

Constructor & Destructor Documentation

◆ PhysicalButtonModule() [1/2]

PhysicalButtonModule::PhysicalButtonModule ( )

Definition at line 314 of file PhysicalButtonModule.cpp.

◆ ~PhysicalButtonModule()

PhysicalButtonModule::~PhysicalButtonModule ( )

Definition at line 317 of file PhysicalButtonModule.cpp.

◆ PhysicalButtonModule() [2/2]

PhysicalButtonModule::PhysicalButtonModule ( const PhysicalButtonConfig config)
explicit

Member Function Documentation

◆ available()

bool PhysicalButtonModule::available ( ) const
noexcept
Returns
true when module has at least one active channel.

Definition at line 356 of file PhysicalButtonModule.cpp.

Referenced by AppController::runButtonTest(), and AppController::runLiveMarkerTest().

◆ configFromEnvironment()

PhysicalButtonConfig PhysicalButtonModule::configFromEnvironment ( )
staticnoexcept

◆ eventToString()

const char * PhysicalButtonModule::eventToString ( PhysicalButtonEvent  event)
staticnoexcept
Parameters
eventEvent value.
Returns
Null-terminated event label.

Definition at line 491 of file PhysicalButtonModule.cpp.

References ACK_REQUEST, ARM_REQUEST, and DISARM_REQUEST.

Referenced by AppController::runButtonTest(), and AppController::runLiveMarkerTest().

◆ lastErrorString()

const char * PhysicalButtonModule::lastErrorString ( ) const
noexcept
Returns
Null-terminated string with latest module error.

Definition at line 465 of file PhysicalButtonModule.cpp.

Referenced by AppController::runButtonTest(), and AppController::runLiveMarkerTest().

◆ poll()

bool PhysicalButtonModule::poll ( PhysicalButtonEvent event)
noexcept
Parameters
eventOutput event populated on success.
Returns
true when an event is emitted; otherwise false.

Definition at line 360 of file PhysicalButtonModule.cpp.

◆ readAcknowledgePressed()

bool PhysicalButtonModule::readAcknowledgePressed ( bool &  pressed)
noexcept
Parameters
pressedOutput flag populated on success.
Returns
true when read succeeded, otherwise false.

Definition at line 451 of file PhysicalButtonModule.cpp.

◆ statusString()

const char * PhysicalButtonModule::statusString ( ) const
noexcept
Returns
Null-terminated status string.

Definition at line 472 of file PhysicalButtonModule.cpp.

Referenced by AppController::runButtonTest(), and AppController::runLiveMarkerTest().

◆ waitForEvent()

bool PhysicalButtonModule::waitForEvent ( PhysicalButtonEvent event,
std::chrono::milliseconds  timeout 
)
noexcept
Parameters
eventOutput event populated on success.
timeoutMaximum wait duration.
Returns
true when event is received before timeout, otherwise false.

Definition at line 368 of file PhysicalButtonModule.cpp.

Referenced by AppController::runButtonTest().


The documentation for this class was generated from the following files: