feat: add partial support for wiegand reader
This commit is contained in:
parent
cb6631d6cc
commit
96cb916c5a
@ -171,9 +171,7 @@ private:
|
||||
// Todo Extract to Disarm method, and add to alarm.h
|
||||
// same in card reader
|
||||
Serial.println("[HTTP] Disarm request by server");
|
||||
status->isArmed = false;
|
||||
status->isFired = false;
|
||||
status->lastEntrance = millis();
|
||||
disarm(status);
|
||||
}
|
||||
|
||||
// Serial.print(FIELD_ALLOWED_CARDS);
|
||||
|
49
esp32/WiegandReader.h
Normal file
49
esp32/WiegandReader.h
Normal file
@ -0,0 +1,49 @@
|
||||
#include "alarm.h"
|
||||
#include "Dict.h"
|
||||
#include <Wiegand.h>
|
||||
|
||||
#define LED_PIN 6
|
||||
#define BEEP_PIN 7
|
||||
|
||||
class WiegandReader{
|
||||
private:
|
||||
WIEGAND wg;
|
||||
AlarmStatus* status;
|
||||
int data0_pin;
|
||||
int data1_pin;
|
||||
int led_pin;
|
||||
int beep_pin;
|
||||
Dictionary &users = *(new Dictionary());
|
||||
|
||||
public:
|
||||
WiegandReader(AlarmStatus* statusObj, int d0, int d1){
|
||||
Serial.println("const.");
|
||||
status = statusObj;
|
||||
data0_pin = d0;
|
||||
data1_pin = d1;
|
||||
}
|
||||
void Init()
|
||||
{
|
||||
wg.begin(data0_pin, data1_pin);
|
||||
}
|
||||
|
||||
void SetLed(int pin)
|
||||
{
|
||||
led_pin=pin;
|
||||
}
|
||||
void SetBeep(int pin)
|
||||
{
|
||||
beep_pin=pin
|
||||
}
|
||||
|
||||
void HandleReader()
|
||||
{
|
||||
if(!wg.available())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
String code = String(wg.getCode(), HEX);
|
||||
|
||||
}
|
||||
}
|
@ -19,5 +19,12 @@ struct AlarmStatus{
|
||||
long eventId=0;
|
||||
};
|
||||
|
||||
void disarm(AlarmStatus* status)
|
||||
{
|
||||
status->isArmed = false;
|
||||
status->isFired = false;
|
||||
status->lastEntrance = millis();
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user