hardware_cmd.h
1.83 KB
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
#ifndef ETRADECLIENT_HARDWARE_HARDWARE_CMD_H_INCLUDED
#define ETRADECLIENT_HARDWARE_HARDWARE_CMD_H_INCLUDED
#include <string>
#include <boost/property_tree/ptree.hpp>
class HardwareCmd
{
// Return a boost ptree node as a reply data, we don't return reply as "std::string" type because
// it will cause some trouble when construct a result JSON string if the data is alreay a JSON string.
// It will add redundant back slash character ("\") in the JSON string.
typedef boost::property_tree::ptree ReplyData;
public:
struct Reply
{
ReplyData data;
std::string error_code;
};
virtual ~HardwareCmd() {}
/*Exception will be thrown if any error happens.*/
virtual Reply Execute(const std::string& input) = 0;
};
class ReadPINPadCmd : public HardwareCmd
{
public:
virtual Reply Execute(const std::string& input) override;
};
class ReadIDCardCmd : public HardwareCmd
{
public:
virtual Reply Execute(const std::string& input) override;
};
class ActivateDILICardCmd : public HardwareCmd
{
public:
virtual Reply Execute(const std::string& input) override;
};
class ResetDILICardCmd : public HardwareCmd
{
public:
virtual Reply Execute(const std::string& input) override;
};
class ReadDILICardBasicInfoCmd : public HardwareCmd
{
public:
virtual Reply Execute(const std::string& input) override;
};
class ReadDILICardServiceInfoCmd : public HardwareCmd
{
public:
virtual Reply Execute(const std::string& input) override;
};
class WriteDILICardServiceInfoCmd : public HardwareCmd
{
public:
virtual Reply Execute(const std::string& input) override;
};
class ReadBankCardNumCmd : public HardwareCmd
{
public:
virtual Reply Execute(const std::string& input) override;
};
//½âÃÜɨÂëǹÊý¾Ý
class DecodeScannerCmd : public HardwareCmd
{
public:
virtual Reply Execute(const std::string& input) override;
};
#endif // ETRADECLIENT_HARDWARE_HARDWARE_CMD_H_INCLUDED