AfRApay/AfRApay.MateCard/src/readers/rdm6300.cpp

47 lines
920 B
C++

#include <Arduino.h>
#include "rdm6300.h"
#include "utils.h"
#include "readers.h"
RDM6300Reader::RDM6300Reader(int pin) {
this->pin = pin;
rdm6300 = new Rdm6300;
}
bool RDM6300Reader::isNewCardPresent() {
return rdm6300->get_new_tag_id();
}
String RDM6300Reader::getCardUid() {
auto uid = rdm6300->get_tag_id();
char buf[16];
sprintf(buf, "%010u", uid);
return {buf};
}
void RDM6300Reader::begin(){
}
void RDM6300Reader::end(){
}
void RDM6300Reader::reset() {
/*
* We don't need to do anything here
* RDM6300 readers don't report a new card as present til the old card is removed and re-presented
*/
}
inline bool RDM6300Reader::canHaveUnstableIdentifier() {
// As far as I am aware, there are no 125khz tags with unstable identifiers
return false;
}
void RDM6300Reader::init() {
rdm6300->begin(pin);
rdm6300->set_tag_timeout(65);
}
String RDM6300Reader::getReaderName() {
return "rdm6300";
}