49 lines
725 B
C++
49 lines
725 B
C++
#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);
|
|
|
|
}
|
|
} |