Leosac  0.8.0
Open Source Access Control
Leosac::Cred::RFIDCard Class Reference

An RFID card credential. More...

#include <RFIDCard.hpp>

+ Inheritance diagram for Leosac::Cred::RFIDCard:
+ Collaboration diagram for Leosac::Cred::RFIDCard:

Public Member Functions

 MAKE_VISITABLE_FALLBACK (IRFIDCard)
 
 RFIDCard ()=default
 
 RFIDCard (const std::string &card_id, int nb_bits)
 Construct an RFIDCard by specifying the card_id and the number of meaningful bits. More...
 
virtual const std::string & card_id () const override
 
virtual int nb_bits () const override
 
virtual uint64_t to_int () const override
 Returns the integer representation of the card ID. More...
 
virtual uint64_t to_raw_int () const override
 Convert the bits of the card to an integer. More...
 
void nb_bits (int i) override
 
void card_id (const std::string &string) override
 
- Public Member Functions inherited from Leosac::Cred::IRFIDCard
 MAKE_VISITABLE_FALLBACK (ICredential)
 
- Public Member Functions inherited from Leosac::Cred::ICredential
 MAKE_VISITABLE ()
 
- Public Member Functions inherited from Leosac::Tools::IVisitable
virtual void accept (::Leosac::Tools::BaseVisitor &)=0
 Accept a visitor that may mutate this. More...
 
virtual void accept (::Leosac::Tools::BaseVisitor &) const =0
 Accept a visitor that will not mutate this. More...
 
- Public Member Functions inherited from Leosac::Cred::Credential
 Credential ()
 
virtual Auth::UserLPtr owner () const override
 Retrieve the owner of the credential. More...
 
virtual void owner (Auth::UserLPtr ptr) override
 Set a new owner for the credential. More...
 
virtual std::string alias () const override
 An alias for the credential. More...
 
virtual CredentialId id () const override
 Retrieve the identifier of the credential. More...
 
virtual void id (const CredentialId &new_id) override
 Manually set the identifier of a credential. More...
 
virtual size_t odb_version () const override
 Credentials are "optimistic" object (wrt ODB). More...
 
virtual Auth::UserId owner_id () const override
 Returns the id of the owner, or 0 if there is no owner (or the owner has no id). More...
 
virtual void alias (const std::string &id) override
 Set the alias for the credential. More...
 
virtual std::string description () const override
 An optional description / notes for the credential. More...
 
virtual void description (const std::string &str) override
 Set a description for this credential. More...
 
virtual void validity (const Auth::ValidityInfo &info) override
 Provide the validity info object to the credential. More...
 
virtual const Auth::ValidityInfovalidity () const override
 Retrieve validity status from the credential. More...
 
virtual std::vector< Tools::ScheduleMappingLWPtrlazy_schedules_mapping () const override
 Retrieve the lazy_weak_ptr to ScheduleMapping that map this credential. More...
 
void schedule_mapping_added (const Tools::ScheduleMappingPtr &sched_mapping)
 The credential has been mapped by a schedule. More...
 

Protected Attributes

int nb_bits_
 
std::string card_id_
 
- Protected Attributes inherited from Leosac::Cred::Credential
CredentialId id_
 
Auth::UserLPtr owner_
 
std::string alias_
 
std::string description_
 
Auth::ValidityInfo validity_
 
std::vector< Tools::ScheduleMappingLWPtrschedules_mapping_
 
size_t odb_version_
 

Private Member Functions

uint64_t to_wiegand_26 () const
 Extract the card ID, assuming the format to be Wiegand26. More...
 
uint64_t to_wiegand_34 () const
 Extract the card ID, assuming the format to be Wiegand34. More...
 

Friends

class odb::access
 

Additional Inherited Members

- Static Protected Member Functions inherited from Leosac::Tools::IVisitable
template<class T >
static bool visitor_dispatch (T &visited, BaseVisitor &visitor, bool abort_on_failure)
 

Detailed Description

An RFID card credential.

Definition at line 33 of file RFIDCard.hpp.

Constructor & Destructor Documentation

◆ RFIDCard() [1/2]

Leosac::Cred::RFIDCard::RFIDCard ( )
default

◆ RFIDCard() [2/2]

RFIDCard::RFIDCard ( const std::string &  card_id,
int  nb_bits 
)

Construct an RFIDCard by specifying the card_id and the number of meaningful bits.

Parameters
card_id
nb_bits

Definition at line 28 of file RFIDCard.cpp.

Member Function Documentation

◆ card_id() [1/2]

const std::string & RFIDCard::card_id ( ) const
overridevirtual

Implements Leosac::Cred::IRFIDCard.

Definition at line 34 of file RFIDCard.cpp.

◆ card_id() [2/2]

void RFIDCard::card_id ( const std::string &  string)
overridevirtual

Implements Leosac::Cred::IRFIDCard.

Definition at line 105 of file RFIDCard.cpp.

◆ MAKE_VISITABLE_FALLBACK()

Leosac::Cred::RFIDCard::MAKE_VISITABLE_FALLBACK ( IRFIDCard  )

◆ nb_bits() [1/2]

int RFIDCard::nb_bits ( ) const
overridevirtual

Implements Leosac::Cred::IRFIDCard.

Definition at line 39 of file RFIDCard.cpp.

◆ nb_bits() [2/2]

void RFIDCard::nb_bits ( int  i)
overridevirtual

Implements Leosac::Cred::IRFIDCard.

Definition at line 99 of file RFIDCard.cpp.

◆ to_int()

uint64_t RFIDCard::to_int ( ) const
overridevirtual

Returns the integer representation of the card ID.

The format (Wiegand 26, 32, ....) is used to build the card number. If no format is recognized, fallback to to_raw_int()

Implements Leosac::Cred::IRFIDCard.

Definition at line 58 of file RFIDCard.cpp.

◆ to_raw_int()

uint64_t RFIDCard::to_raw_int ( ) const
overridevirtual

Convert the bits of the card to an integer.

The format (Wiegand26, 32, ...) is ignored: all bits are used to build the number.

Implements Leosac::Cred::IRFIDCard.

Definition at line 44 of file RFIDCard.cpp.

◆ to_wiegand_26()

uint64_t RFIDCard::to_wiegand_26 ( ) const
private

Extract the card ID, assuming the format to be Wiegand26.

Definition at line 73 of file RFIDCard.cpp.

◆ to_wiegand_34()

uint64_t RFIDCard::to_wiegand_34 ( ) const
private

Extract the card ID, assuming the format to be Wiegand34.

Definition at line 86 of file RFIDCard.cpp.

Friends And Related Function Documentation

◆ odb::access

friend class odb::access
friend

Definition at line 75 of file RFIDCard.hpp.

Member Data Documentation

◆ card_id_

std::string Leosac::Cred::RFIDCard::card_id_
protected

Definition at line 62 of file RFIDCard.hpp.

◆ nb_bits_

int Leosac::Cred::RFIDCard::nb_bits_
protected

Definition at line 61 of file RFIDCard.hpp.


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