Leosac  0.8.0
Open Source Access Control
Leosac::Auth::AuthTarget Class Reference

Represent an object that we are authorizing against (a door). More...

#include <AuthTarget.hpp>

+ Collaboration diagram for Leosac::Auth::AuthTarget:

Public Member Functions

virtual ~AuthTarget ()=default
 
 AuthTarget (const std::string target_name)
 
const std::string & name () const
 
void name (const std::string &new_name)
 
void add_always_open_sched (const Tools::IScheduleCPtr &sched)
 
void add_always_close_sched (const Tools::IScheduleCPtr &sched)
 
bool is_always_open (const std::chrono::system_clock::time_point &tp) const
 Check whether the door is in "always open" mode at the given time point. More...
 
bool is_always_closed (const std::chrono::system_clock::time_point &tp) const
 Check whether the door is in "always closed" mode at the given time point. More...
 
void resetToExpectedState (const std::chrono::system_clock::time_point &tp)
 
Hardware::FGPIOgpio ()
 Returns the pointer to the optional FGPIO associated with the door. More...
 
void gpio (std::unique_ptr< Hardware::FGPIO > new_gpio)
 
Hardware::FGPIOexitreq_gpio ()
 
void exitreq_gpio (std::unique_ptr< Hardware::FGPIO > new_gpio)
 
std::chrono::milliseconds exitreq_duration ()
 
void exitreq_duration (std::chrono::milliseconds duration)
 
Hardware::FGPIOcontact_gpio ()
 
void contact_gpio (std::unique_ptr< Hardware::FGPIO > new_gpio)
 
std::chrono::milliseconds contact_duration ()
 
void contact_duration (std::chrono::milliseconds duration)
 

Protected Attributes

std::string name_
 
std::vector< Tools::IScheduleCPtralways_open_
 
std::vector< Tools::IScheduleCPtralways_close_
 
std::unique_ptr< Hardware::FGPIOgpio_
 Optional GPIO associated with the door. More...
 
std::unique_ptr< Hardware::FGPIOexitreq_gpio_
 Optional Exit Req GPIO associated with the door. More...
 
std::chrono::milliseconds exitreq_duration_
 Duration for the Exit Req to keep the door open. More...
 
std::unique_ptr< Hardware::FGPIOcontact_gpio_
 Optional Contact Door Sensor GPIO associated with the door. More...
 
std::chrono::milliseconds contact_duration_
 Duration for the Contact Door Sensor to be ignored before triggering an alarm. More...
 

Detailed Description

Represent an object that we are authorizing against (a door).

Definition at line 37 of file AuthTarget.hpp.

Constructor & Destructor Documentation

◆ ~AuthTarget()

virtual Leosac::Auth::AuthTarget::~AuthTarget ( )
virtualdefault

◆ AuthTarget()

AuthTarget::AuthTarget ( const std::string  target_name)
explicit

Definition at line 36 of file AuthTarget.cpp.

Member Function Documentation

◆ add_always_close_sched()

void AuthTarget::add_always_close_sched ( const Tools::IScheduleCPtr sched)

Definition at line 47 of file AuthTarget.cpp.

◆ add_always_open_sched()

void AuthTarget::add_always_open_sched ( const Tools::IScheduleCPtr sched)

Definition at line 42 of file AuthTarget.cpp.

◆ contact_duration() [1/2]

std::chrono::milliseconds Leosac::Auth::AuthTarget::contact_duration ( )

◆ contact_duration() [2/2]

void AuthTarget::contact_duration ( std::chrono::milliseconds  duration)

Definition at line 77 of file AuthTarget.cpp.

◆ contact_gpio() [1/2]

Hardware::FGPIO* Leosac::Auth::AuthTarget::contact_gpio ( )

◆ contact_gpio() [2/2]

void AuthTarget::contact_gpio ( std::unique_ptr< Hardware::FGPIO new_gpio)

Definition at line 72 of file AuthTarget.cpp.

◆ exitreq_duration() [1/2]

std::chrono::milliseconds Leosac::Auth::AuthTarget::exitreq_duration ( )

◆ exitreq_duration() [2/2]

void AuthTarget::exitreq_duration ( std::chrono::milliseconds  duration)

Definition at line 67 of file AuthTarget.cpp.

◆ exitreq_gpio() [1/2]

Hardware::FGPIO* Leosac::Auth::AuthTarget::exitreq_gpio ( )

◆ exitreq_gpio() [2/2]

void AuthTarget::exitreq_gpio ( std::unique_ptr< Hardware::FGPIO new_gpio)

Definition at line 62 of file AuthTarget.cpp.

◆ gpio() [1/2]

Leosac::Hardware::FGPIO * AuthTarget::gpio ( )

Returns the pointer to the optional FGPIO associated with the door.

It may be NULL.

Do not free or keep reference on it longer than the lifetime of the AuthTarget object. If you ever set a new gpio() pointer for this AuthTarget, the previous reference will become invalid.

Definition at line 52 of file AuthTarget.cpp.

◆ gpio() [2/2]

void AuthTarget::gpio ( std::unique_ptr< Hardware::FGPIO new_gpio)

Definition at line 57 of file AuthTarget.cpp.

◆ is_always_closed()

bool AuthTarget::is_always_closed ( const std::chrono::system_clock::time_point &  tp) const

Check whether the door is in "always closed" mode at the given time point.

Definition at line 93 of file AuthTarget.cpp.

◆ is_always_open()

bool AuthTarget::is_always_open ( const std::chrono::system_clock::time_point &  tp) const

Check whether the door is in "always open" mode at the given time point.

Definition at line 82 of file AuthTarget.cpp.

◆ name() [1/2]

const std::string & AuthTarget::name ( ) const

Definition at line 25 of file AuthTarget.cpp.

◆ name() [2/2]

void AuthTarget::name ( const std::string &  new_name)

Definition at line 30 of file AuthTarget.cpp.

◆ resetToExpectedState()

void AuthTarget::resetToExpectedState ( const std::chrono::system_clock::time_point &  tp)

Definition at line 104 of file AuthTarget.cpp.

Member Data Documentation

◆ always_close_

std::vector<Tools::IScheduleCPtr> Leosac::Auth::AuthTarget::always_close_
protected

Definition at line 98 of file AuthTarget.hpp.

◆ always_open_

std::vector<Tools::IScheduleCPtr> Leosac::Auth::AuthTarget::always_open_
protected

Definition at line 97 of file AuthTarget.hpp.

◆ contact_duration_

std::chrono::milliseconds Leosac::Auth::AuthTarget::contact_duration_
protected

Duration for the Contact Door Sensor to be ignored before triggering an alarm.

Definition at line 123 of file AuthTarget.hpp.

◆ contact_gpio_

std::unique_ptr<Hardware::FGPIO> Leosac::Auth::AuthTarget::contact_gpio_
protected

Optional Contact Door Sensor GPIO associated with the door.

Definition at line 118 of file AuthTarget.hpp.

◆ exitreq_duration_

std::chrono::milliseconds Leosac::Auth::AuthTarget::exitreq_duration_
protected

Duration for the Exit Req to keep the door open.

Definition at line 113 of file AuthTarget.hpp.

◆ exitreq_gpio_

std::unique_ptr<Hardware::FGPIO> Leosac::Auth::AuthTarget::exitreq_gpio_
protected

Optional Exit Req GPIO associated with the door.

Definition at line 108 of file AuthTarget.hpp.

◆ gpio_

std::unique_ptr<Hardware::FGPIO> Leosac::Auth::AuthTarget::gpio_
protected

Optional GPIO associated with the door.

Definition at line 103 of file AuthTarget.hpp.

◆ name_

std::string Leosac::Auth::AuthTarget::name_
protected

Definition at line 95 of file AuthTarget.hpp.


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