|
|
@@ -186,114 +186,46 @@ namespace DeviceCenter
|
|
|
{
|
|
|
TypeMap.EventMinorTypeMap(struFileInfo, csTmp);
|
|
|
}
|
|
|
-
|
|
|
- String szInfo = new String(csTmp).TrimEnd('\0');
|
|
|
- String szInfoBuf = null;
|
|
|
- szInfoBuf = szInfo;
|
|
|
- /**************************************************/
|
|
|
- String name = System.Text.Encoding.UTF8.GetString(struAcsAlarmInfo.sNetUser).TrimEnd('\0');
|
|
|
- for (int i = 0; i < struAcsAlarmInfo.sNetUser.Length; i++)
|
|
|
- {
|
|
|
- if (struAcsAlarmInfo.sNetUser[i] == 0)
|
|
|
- {
|
|
|
- name = name.Substring(0, i);
|
|
|
- break;
|
|
|
- }
|
|
|
- }
|
|
|
- /**************************************************/
|
|
|
- szInfoBuf = string.Format("{0} time:{1,4}-{2:D2}-{3} {4:D2}:{5:D2}:{6:D2}, [{7}]({8})",
|
|
|
- szInfo,
|
|
|
- struAcsAlarmInfo.struTime.dwYear,
|
|
|
- struAcsAlarmInfo.struTime.dwMonth,
|
|
|
- struAcsAlarmInfo.struTime.dwDay,
|
|
|
- struAcsAlarmInfo.struTime.dwHour,
|
|
|
- struAcsAlarmInfo.struTime.dwMinute,
|
|
|
- struAcsAlarmInfo.struTime.dwSecond,
|
|
|
- struAcsAlarmInfo.struRemoteHostAddr.sIpV4,
|
|
|
- name);
|
|
|
-
|
|
|
+ string eventType = new String(csTmp).TrimEnd('\0');
|
|
|
+ string time = $"{struAcsAlarmInfo.struTime.dwYear:D4}-{struAcsAlarmInfo.struTime.dwMonth:D2}-{struAcsAlarmInfo.struTime.dwDay:D2} {struAcsAlarmInfo.struTime.dwHour:D2}:{struAcsAlarmInfo.struTime.dwMinute:D2}:{struAcsAlarmInfo.struTime.dwSecond:D2}";
|
|
|
+ string cardNo = null;
|
|
|
+ string employNo = null;
|
|
|
+ string doorNo = null;
|
|
|
+ string cardType = null;
|
|
|
+ string readerNo = null;
|
|
|
+ string accessChannel = null;
|
|
|
+ string path = null;
|
|
|
if (struAcsAlarmInfo.struAcsEventInfo.byCardNo[0] != 0)
|
|
|
{
|
|
|
- szInfoBuf = szInfoBuf + "+Card Number:" + System.Text.Encoding.UTF8.GetString(struAcsAlarmInfo.struAcsEventInfo.byCardNo).TrimEnd('\0');
|
|
|
- }
|
|
|
- String[] szCardType = { "normal card", "disabled card", "blacklist card", "night watch card", "stress card", "super card", "guest card" };
|
|
|
- byte byCardType = struAcsAlarmInfo.struAcsEventInfo.byCardType;
|
|
|
-
|
|
|
- if (byCardType != 0 && byCardType <= szCardType.Length)
|
|
|
- {
|
|
|
- szInfoBuf = szInfoBuf + "+Card Type:" + szCardType[byCardType - 1];
|
|
|
- }
|
|
|
-
|
|
|
- if (struAcsAlarmInfo.struAcsEventInfo.dwCardReaderNo != 0)
|
|
|
- {
|
|
|
- szInfoBuf = szInfoBuf + "+Card Reader Number:" + struAcsAlarmInfo.struAcsEventInfo.dwCardReaderNo;
|
|
|
- }
|
|
|
- if (struAcsAlarmInfo.struAcsEventInfo.dwDoorNo != 0)
|
|
|
- {
|
|
|
- szInfoBuf = szInfoBuf + "+Door Number:" + struAcsAlarmInfo.struAcsEventInfo.dwDoorNo;
|
|
|
- }
|
|
|
- if (struAcsAlarmInfo.struAcsEventInfo.dwVerifyNo != 0)
|
|
|
- {
|
|
|
- szInfoBuf = szInfoBuf + "+Multiple Card Authentication Serial Number:" + struAcsAlarmInfo.struAcsEventInfo.dwVerifyNo;
|
|
|
- }
|
|
|
- if (struAcsAlarmInfo.struAcsEventInfo.dwAlarmInNo != 0)
|
|
|
- {
|
|
|
- szInfoBuf = szInfoBuf + "+Alarm Input Number:" + struAcsAlarmInfo.struAcsEventInfo.dwAlarmInNo;
|
|
|
- }
|
|
|
- if (struAcsAlarmInfo.struAcsEventInfo.dwAlarmOutNo != 0)
|
|
|
- {
|
|
|
- szInfoBuf = szInfoBuf + "+Alarm Output Number:" + struAcsAlarmInfo.struAcsEventInfo.dwAlarmOutNo;
|
|
|
+ cardNo = System.Text.Encoding.UTF8.GetString(struAcsAlarmInfo.struAcsEventInfo.byCardNo).TrimEnd('\0');
|
|
|
}
|
|
|
if (struAcsAlarmInfo.struAcsEventInfo.dwCaseSensorNo != 0)
|
|
|
{
|
|
|
- szInfoBuf = szInfoBuf + "+Event Trigger Number:" + struAcsAlarmInfo.struAcsEventInfo.dwCaseSensorNo;
|
|
|
+ employNo = struAcsAlarmInfo.struAcsEventInfo.dwEmployeeNo.ToString();
|
|
|
}
|
|
|
- if (struAcsAlarmInfo.struAcsEventInfo.dwRs485No != 0)
|
|
|
+ if (struAcsAlarmInfo.struAcsEventInfo.dwDoorNo != 0)
|
|
|
{
|
|
|
- szInfoBuf = szInfoBuf + "+RS485 Channel Number:" + struAcsAlarmInfo.struAcsEventInfo.dwRs485No;
|
|
|
+ doorNo = struAcsAlarmInfo.struAcsEventInfo.dwDoorNo.ToString();
|
|
|
}
|
|
|
- if (struAcsAlarmInfo.struAcsEventInfo.dwMultiCardGroupNo != 0)
|
|
|
+ String[] szCardType = { "normal card", "disabled card", "blacklist card", "night watch card", "stress card", "super card", "guest card" };
|
|
|
+ byte byCardType = struAcsAlarmInfo.struAcsEventInfo.byCardType;
|
|
|
+ if (byCardType != 0 && byCardType <= szCardType.Length)
|
|
|
{
|
|
|
- szInfoBuf = szInfoBuf + "+Multi Recombinant Authentication ID:" + struAcsAlarmInfo.struAcsEventInfo.dwMultiCardGroupNo;
|
|
|
+ cardType = szCardType[byCardType - 1];
|
|
|
}
|
|
|
- if (struAcsAlarmInfo.struAcsEventInfo.byCardReaderKind != 0)
|
|
|
+ if (struAcsAlarmInfo.struAcsEventInfo.dwCardReaderNo != 0)
|
|
|
{
|
|
|
- szInfoBuf = szInfoBuf + "+CardReaderKind:" + struAcsAlarmInfo.struAcsEventInfo.byCardReaderKind.ToString();
|
|
|
+ readerNo = struAcsAlarmInfo.struAcsEventInfo.dwCardReaderNo.ToString();
|
|
|
}
|
|
|
if (struAcsAlarmInfo.struAcsEventInfo.wAccessChannel >= 0)
|
|
|
{
|
|
|
- szInfoBuf = szInfoBuf + "+wAccessChannel:" + struAcsAlarmInfo.struAcsEventInfo.wAccessChannel;
|
|
|
- }
|
|
|
- if (struAcsAlarmInfo.struAcsEventInfo.dwEmployeeNo != 0)
|
|
|
- {
|
|
|
- szInfoBuf = szInfoBuf + "+EmployeeNo:" + struAcsAlarmInfo.struAcsEventInfo.dwEmployeeNo;
|
|
|
- }
|
|
|
- if (struAcsAlarmInfo.struAcsEventInfo.byDeviceNo != 0)
|
|
|
- {
|
|
|
- szInfoBuf = szInfoBuf + "+byDeviceNo:" + struAcsAlarmInfo.struAcsEventInfo.byDeviceNo.ToString();
|
|
|
- }
|
|
|
- if (struAcsAlarmInfo.struAcsEventInfo.wLocalControllerID >= 0)
|
|
|
- {
|
|
|
- szInfoBuf = szInfoBuf + "+wLocalControllerID:" + struAcsAlarmInfo.struAcsEventInfo.wLocalControllerID;
|
|
|
- }
|
|
|
- if (struAcsAlarmInfo.struAcsEventInfo.byInternetAccess >= 0)
|
|
|
- {
|
|
|
- szInfoBuf = szInfoBuf + "+byInternetAccess:" + struAcsAlarmInfo.struAcsEventInfo.byInternetAccess.ToString();
|
|
|
- }
|
|
|
- if (struAcsAlarmInfo.struAcsEventInfo.byType >= 0)
|
|
|
- {
|
|
|
- szInfoBuf = szInfoBuf + "+byType:" + struAcsAlarmInfo.struAcsEventInfo.byType.ToString();
|
|
|
- }
|
|
|
- if (struAcsAlarmInfo.struAcsEventInfo.bySwipeCardType != 0)
|
|
|
- {
|
|
|
- szInfoBuf = szInfoBuf + "+bySwipeCardType:" + struAcsAlarmInfo.struAcsEventInfo.bySwipeCardType.ToString();
|
|
|
+ accessChannel = struAcsAlarmInfo.struAcsEventInfo.wAccessChannel.ToString();
|
|
|
}
|
|
|
//其它消息先不罗列了......
|
|
|
if (struAcsAlarmInfo.dwPicDataLen > 0)
|
|
|
{
|
|
|
- string path = null;
|
|
|
Random rand = new Random(unchecked((int)DateTime.Now.Ticks));
|
|
|
- path = string.Format(@"{0}Picture/ACS_LocalTime{1}_{2}.bmp", AppDomain.CurrentDomain.BaseDirectory, szInfo, rand.Next());
|
|
|
+ path = string.Format(@"{0}Picture/acs_{1}_{2}.bmp", AppDomain.CurrentDomain.BaseDirectory, DateTime.Now.ToString("yyyy-MM-dd_HH-mm-ss"), rand.Next());
|
|
|
using (FileStream fs = new FileStream(path, FileMode.Create))
|
|
|
{
|
|
|
int iLen = (int)struAcsAlarmInfo.dwPicDataLen;
|
|
|
@@ -302,33 +234,27 @@ namespace DeviceCenter
|
|
|
fs.Write(by, 0, iLen);
|
|
|
fs.Close();
|
|
|
}
|
|
|
- szInfoBuf = szInfoBuf + "SavePath:" + path;
|
|
|
}
|
|
|
- log.Info("userid:" + pAlarmer.lUserID + "," + ip + " received alerm::");
|
|
|
- log.Info(szInfoBuf);
|
|
|
-
|
|
|
+ log.Info($"{ip}[{userId}] {eventType} {time} doorNo:{doorNo} channel:{accessChannel} readerNo:{readerNo} cardNo:{cardNo} cardType:{cardType} employNo:{employNo} path:{path}");
|
|
|
|
|
|
try
|
|
|
{
|
|
|
- if (szInfoBuf.Contains("MINOR_FACE_VERIFY_PASS") || szInfoBuf.Contains("MINOR_FACE_VERIFY_FAIL"))
|
|
|
+ if ("MINOR_FACE_VERIFY_PASS".Equals(eventType) || "MINOR_FACE_VERIFY_FAIL".Equals(eventType))
|
|
|
{
|
|
|
- string cardNo = AcsUtil.getCardNo(szInfoBuf);
|
|
|
- string doorNo = AcsUtil.getDoorNo(szInfoBuf);
|
|
|
- string readerNo = AcsUtil.getCardReaderNo(szInfoBuf);
|
|
|
- string channel = AcsUtil.getChannel(szInfoBuf);
|
|
|
- string picture = AcsUtil.getPicturePath(szInfoBuf);
|
|
|
Dictionary<string, string> data = new Dictionary<string, string>();
|
|
|
|
|
|
- data.Add("pass", szInfoBuf.Contains("MINOR_FACE_VERIFY_PASS").ToString());
|
|
|
+ data.Add("pass", "MINOR_FACE_VERIFY_PASS".Equals(eventType).ToString());
|
|
|
data.Add("cardNo", cardNo);
|
|
|
+ data.Add("employNo", employNo);
|
|
|
data.Add("doorNo", doorNo);
|
|
|
data.Add("readerNo", readerNo);
|
|
|
- data.Add("channel", channel);
|
|
|
+ data.Add("channel", accessChannel);
|
|
|
data.Add("ip", ip);
|
|
|
data.Add("direction", direction.ToString());
|
|
|
- if (picture != null)
|
|
|
+ data.Add("time", time);
|
|
|
+ if (path != null)
|
|
|
{
|
|
|
- data.Add("pic", Convert.ToBase64String(file_get_byte_contents(picture)));
|
|
|
+ data.Add("pic", Convert.ToBase64String(file_get_byte_contents(path)));
|
|
|
}
|
|
|
http.post<string>("staffAccess/access", data);
|
|
|
|
|
|
@@ -421,6 +347,7 @@ namespace DeviceCenter
|
|
|
{
|
|
|
List<AcsEvent> events = ProcessEvent(m_lGetAcsEventHandle);
|
|
|
EventUploadReq req = new EventUploadReq(ip, start.ToString("yyyy-MM-dd HH:mm:ss"), end.ToString("yyyy-MM-dd HH:mm:ss"), events);
|
|
|
+ http.postJson<string>("staffAccess/uploadEvent", req);
|
|
|
});
|
|
|
m_pDisplayListThread.Start();
|
|
|
Marshal.FreeHGlobal(ptrCond);
|