-
Notifications
You must be signed in to change notification settings - Fork 0
/
spr332v2.h
55 lines (41 loc) · 1016 Bytes
/
spr332v2.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
/*
https://files.identiv.com/products/smart-card-readers/contact/spr332/SPR332v2_Product_Manual.pdf
https://tech.springcard.com/2013/scardcontrol-linux-and-java/
https://support.identiv.com/spr332/
*/
#include <string>
extern "C" {
#ifdef __APPLE__
#include <pcsc/winscard.h>
#include <pcsc/wintypes.h>
#else
#include <reader.h>
#include <winscard.h>
#endif
}
namespace spr {
const size_t USER_AREA_SIZE = 249;
typedef std::vector<uint8_t> Buffer;
typedef std::vector<std::string> StringList;
enum LED : BYTE {
RED = 0x00,
GREEN = 0x01,
};
class Pinpad {
public:
static StringList readers();
static std::string pick_reader();
Pinpad(const std::string &reader);
~Pinpad();
bool buzzer_enable();
bool buzzer_disable();
bool led_fw_ctrl_enable();
bool led_fw_ctrl_disable();
bool led_ctrl(LED led, bool state);
bool nvread(Buffer &buf);
bool nvwrite(Buffer &buf);
private:
SCARDHANDLE m_card;
SCARDCONTEXT m_ctx;
};
} // namespace spr