43 <<
" but we expected 26)");
51 for (
int i = 9; i < 26; ++i)
53 unsigned int v = ((
reader_->
buffer()[i / 8] >> (7 - i % 8)) & 0x01);
54 n |= v << (15 - (i - 9));
59 WARN(
"Invalid Pin Code");
62 pin_ = std::to_string(n);
74 assert(
pin_.length());
virtual void signal(zmqpp::socket &sock) override
Tells the strategy implementation to send a message to the application containing the received creden...
An implementation class that represents a Wiegand Reader.
Interface for a strategy that read a PIN code.
virtual const std::string & get_pin() const override
Retrieve the pin code that was read from the reader.
WiegandReaderImpl * reader_
int counter() const
Returns the number of bits read.
virtual void timeout() override
This is called when the module detect a timeout.
Message formatting when using a simple PIN code.
WiegandPinBuffered(WiegandReaderImpl *reader)
Create a strategy that read 4bits-per-key PIN code.
void read_reset()
Reset the "read state" of the reader, effectively cleaning the wiegand-bit-buffer and resetting the c...
Provide support for Wiegand devices.
const unsigned char * buffer() const
Return a pointer to internal buffer memory.
const std::string & name() const
Returns the name of this reader.
virtual bool completed() const override
Did the strategy gather needed data? If this function returns true, that means that the strategy impl...
virtual void reset() override
Reset the strategy, meaning that the next time timeout() is called the behavior should be the same th...