1
|
//#ifndef _ZA_ACSPROC
|
2
|
//#define _ZA_ACSPROC
|
3
|
|
4
|
#pragma once
|
5
|
//#include "daq/daq_cmddef.h"
|
6
|
#include <string>
|
7
|
#include "thirdparty/json.h"
|
8
|
#include <vector>
|
9
|
#include <map>
|
10
|
#include "daq/daq_protocol.h"
|
11
|
#include "Axiomclient.h"
|
12
|
|
13
|
using namespace std;
|
14
|
|
15
|
//???????ݽṹ??
|
16
|
struct area {
|
17
|
int areaId; //????ID
|
18
|
string areaName; //????????
|
19
|
string areaCode; //???????
|
20
|
int parentId; //?ϼ?????ID
|
21
|
};
|
22
|
|
23
|
//?Ž??豸???ݽṹ??
|
24
|
struct device {
|
25
|
int deviceNo; //??Լ?м?¼?ĵڼ????豸
|
26
|
string deviceId; //?豸ID
|
27
|
string deviceName; //?豸????
|
28
|
int areaId; //????????ID
|
29
|
string areaName; //????????????
|
30
|
string deviceSn; //?豸???к?
|
31
|
string commAddr; //?豸IP??ַ
|
32
|
int isOnline; //?豸????״̬ 1?????? 0??????
|
33
|
string commErrorMsg; //?豸ͨ?Ŵ?????Ϣ ??????ʱ??????
|
34
|
};
|
35
|
|
36
|
|
37
|
//?????ݽṹ??
|
38
|
struct door {
|
39
|
int doorNo; //??Լ?м?¼?ĵڼ?????
|
40
|
string doorId; //??ID
|
41
|
string doorName; //??????
|
42
|
string doorAddr; //?ŵ?ַ
|
43
|
int areaId; //??????????ID
|
44
|
string areaName; //??????????????
|
45
|
string deviceId; //????????????ID
|
46
|
string deviceName; //????????????????
|
47
|
};
|
48
|
|
49
|
//ʵʱˢ????¼?ṹ??
|
50
|
struct event {
|
51
|
int eventId; //?¼?ID
|
52
|
string areaName; //????????
|
53
|
string deviceName; //?Ž??豸????
|
54
|
string subDeviceId; //??ID
|
55
|
string subDeviceName; //??????
|
56
|
string eventTime; //?¼?ʱ??
|
57
|
string eventName; //?¼?????
|
58
|
string cardNo; //????
|
59
|
string cardType; //??Ƭ????
|
60
|
int accessBlockedReason; //?ܾ?????
|
61
|
};
|
62
|
|
63
|
|
64
|
class AxionAcs : public CProtocol {
|
65
|
public:
|
66
|
void ReadIni();
|
67
|
|
68
|
virtual sint32 TxProc();
|
69
|
virtual sint32 RxProc();
|
70
|
|
71
|
virtual void Init(S_PROTOCOLCFG* pcfg);
|
72
|
|
73
|
sint32 Get_Rtuno();
|
74
|
void Put_AYx(uint16 Rtuno, uint16 YxNo, uint8 YxValue);
|
75
|
void PutSoe(int rtuno, int yxno, string time, string cardId);
|
76
|
sint32 Get_CmdNum();
|
77
|
sint32 Get_ACmd(sint32 rtuno, S_RAWCMD* cmd);
|
78
|
sint32 Del_ACmd(sint32 rtuno);
|
79
|
sint32 Rpt_AResult(sint32 rtuno, S_RAWCMD cmd);
|
80
|
string Getusername();
|
81
|
string Getpassword();
|
82
|
|
83
|
//-------------------
|
84
|
// int GetEventId(int i); //??ȡ??i???¼????¼?ID
|
85
|
string GetDoorId(int i); //??ȡ??i???¼?????ID
|
86
|
string GetEventTime(int i); //??ȡ??i???¼???ʱ??
|
87
|
string GetCardId(int i); //??ȡ??i???¼??еĿ???
|
88
|
int GetaccessBlockedReason(int i); //??ȡ??i???¼??еľܾ?????
|
89
|
int Getareas(); //??ȡ????????????
|
90
|
int GetDevices(); //??ȡ?????Ž??豸????
|
91
|
int GetDoors(); //??ȡ??????????
|
92
|
int GetDoorState(int doorNo); //??ȡ??doorNo???ŵ?״̬
|
93
|
int SetDoorOpen(int doorNo); //???Ƶ?doorNO????Ϊ??
|
94
|
int SetDoorClose(int doorNo); //???Ƶ?doorNO????Ϊ?ر?
|
95
|
int SetDoorMode(int doorNo, string mode); //???Ƶ?doorNO???ŵĹ???ģʽΪmode 0???Զ???1??ˢ????2????+???룬3?????????룬4????????5?????գ?6????????
|
96
|
int GetSwipecard(); //??ȡ?????豸??ʵʱˢ????¼
|
97
|
string Getmapdoor(int i); //??ȡ??i??Ӧ????ID
|
98
|
|
99
|
|
100
|
//------------------
|
101
|
bool rxflag;
|
102
|
bool txflag;
|
103
|
bool xxflag;
|
104
|
bool httpflag_doors; //??ȡ??״̬?????ӱ?־??Ϊtrue???????ӳɹ???false????????ʧ??
|
105
|
bool httpflag1_doors; //???γ????????Ƿ?Ϊ?״?????״̬??־??true?????״?
|
106
|
bool httpflag_devices; //??ȡ?¼??????ӱ?־
|
107
|
bool httpflag1_devices; //???γ????????Ƿ?Ϊ?״λ?ȡ?¼???־
|
108
|
|
109
|
int deviceNum; //?豸????????
|
110
|
int doorNum; //?ŵ???????
|
111
|
int lastEventId; //??һ?λ?ȡ?¼???ID
|
112
|
|
113
|
char logName[256]; //???????????Ϣ?ĵ?ַ
|
114
|
int eventid[100]; //????ȡ????˳?????¼?ID
|
115
|
int eventidex[100]; //???¼?ID?Ĵ?С??С??????eventid[]??????
|
116
|
|
117
|
// string callback_long;
|
118
|
Fclient fclient_door;
|
119
|
Fclient fclient_device;
|
120
|
|
121
|
|
122
|
protected:
|
123
|
|
124
|
vector<area> areas; //??????????????ݵ?????
|
125
|
vector<device> devices; //????????Ž??豸??Ϣ??????
|
126
|
vector<door> doors; //???????????Ϣ??????
|
127
|
vector<event> events; //???ʵʱˢ????¼??????
|
128
|
|
129
|
map<uint8, string> map_username;
|
130
|
map<uint8, string> map_password;
|
131
|
map<uint8, string> map_device; //??ŵڼ????豸???豸ID
|
132
|
map<uint8, string> map_door; //??ŵڼ????ź???ID
|
133
|
|
134
|
|
135
|
int GetNowSecond();
|
136
|
private:
|
137
|
string urls_ip;
|
138
|
string server_urls;
|
139
|
char username[128];
|
140
|
char password[128];
|
141
|
|
142
|
sint32 rxthread;
|
143
|
sint32 txthread;
|
144
|
sint32 xxthread;
|
145
|
};
|