|
@@ -22,44 +22,6 @@ using parkMonitor.LOG;
|
|
|
|
|
|
namespace parkMonitor.server
|
|
|
{
|
|
|
- public class NumMachineManager : IEquipments
|
|
|
- {
|
|
|
- public static NumMachineLinker ins;
|
|
|
- public AbstractMessage GetMessage()
|
|
|
- {
|
|
|
- return ins.GetMessage();
|
|
|
- }
|
|
|
-
|
|
|
- public void SetMessage(AbstractMessage message)
|
|
|
- {
|
|
|
- ins.SetMessage(message);
|
|
|
- }
|
|
|
-
|
|
|
- public void Start()
|
|
|
- {
|
|
|
- Task.Factory.StartNew(() =>
|
|
|
- {
|
|
|
- ins = new NumMachineLinker();
|
|
|
- Task.Factory.StartNew(()=>{
|
|
|
- ins.Start();
|
|
|
- ins.Bounds = new Rectangle(0, 0, 0, 0);
|
|
|
- ins.ShowDialog();
|
|
|
- });
|
|
|
-
|
|
|
- //ins.WindowState = FormWindowState.Minimized;
|
|
|
- ins.Hide();
|
|
|
- });
|
|
|
- }
|
|
|
-
|
|
|
- public void Stop()
|
|
|
- {
|
|
|
- Task.Factory.StartNew(() =>
|
|
|
- {
|
|
|
- ins.Close();
|
|
|
- ins.Stop();
|
|
|
- });
|
|
|
- }
|
|
|
- }
|
|
|
|
|
|
/// <summary>
|
|
|
/// 号牌机通信类
|
|
@@ -170,7 +132,6 @@ namespace parkMonitor.server
|
|
|
}
|
|
|
|
|
|
//******************************************************************************************************************
|
|
|
-
|
|
|
private void UpdateStatus(NumberMachineNode nmn)
|
|
|
{
|
|
|
while (!isClosing)
|
|
@@ -258,84 +219,7 @@ namespace parkMonitor.server
|
|
|
VzClientSDK.VZ_LPR_DEVICE_INFO device_info = new VzClientSDK.VZ_LPR_DEVICE_INFO();
|
|
|
device_info.device_ip = pStrDev;
|
|
|
device_info.serial_no = serialNO;
|
|
|
-
|
|
|
- int size = Marshal.SizeOf(device_info);
|
|
|
- IntPtr intptr = Marshal.AllocHGlobal(size);
|
|
|
- Marshal.StructureToPtr(device_info, intptr, true);
|
|
|
-
|
|
|
- //发送message,输出设备信息
|
|
|
- Win32API.PostMessage(hwndMain, MSG_DEVICE_INFO, (int)intptr, 0);
|
|
|
- }
|
|
|
-
|
|
|
- ///<summary>停止播放与设备句柄关联的视频</summary>
|
|
|
- private void StopPlay(int handleInput)
|
|
|
- {
|
|
|
- if (handleInput != 0)
|
|
|
- {
|
|
|
- int ret = VzClientSDK.VzLPRClient_StopRealPlay(handleInput);
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- ///<summary>强制获取号牌</summary>
|
|
|
- private void ActivateSnap(int handle)
|
|
|
- {
|
|
|
- if (handle > 0)
|
|
|
- {
|
|
|
- VzClientSDK.VzLPRClient_ForceTrigger(handle);
|
|
|
- }
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- ///<summary>信息自动处理</summary>
|
|
|
- protected override void DefWndProc(ref Message m)
|
|
|
- {
|
|
|
- IntPtr intptr;
|
|
|
- VzClientSDK.VZ_LPR_MSG_PLATE_INFO plateInfo;
|
|
|
- VzClientSDK.VZ_LPR_DEVICE_INFO deviceInfo;
|
|
|
-
|
|
|
- int handle = 0;
|
|
|
-
|
|
|
- switch (m.Msg)
|
|
|
- {
|
|
|
- case MSG_PLATE_INFO:
|
|
|
-
|
|
|
- intptr = (IntPtr)m.WParam.ToInt32();
|
|
|
- handle = m.LParam.ToInt32();
|
|
|
- if (intptr != null)
|
|
|
- {
|
|
|
- //根据句柄获取设备IP
|
|
|
- string strIP = Get_IP(handle);
|
|
|
- plateInfo = (VzClientSDK.VZ_LPR_MSG_PLATE_INFO)Marshal.PtrToStructure(intptr, typeof(VzClientSDK.VZ_LPR_MSG_PLATE_INFO));
|
|
|
- SetDetail(plateInfo, strIP);
|
|
|
-
|
|
|
- Marshal.FreeHGlobal(intptr);
|
|
|
- }
|
|
|
-
|
|
|
- break;
|
|
|
-
|
|
|
- case MSG_DEVICE_INFO:
|
|
|
- intptr = (IntPtr)m.WParam.ToInt32();
|
|
|
- if (intptr != null)
|
|
|
- {
|
|
|
- deviceInfo = (VzClientSDK.VZ_LPR_DEVICE_INFO)Marshal.PtrToStructure(intptr, typeof(VzClientSDK.VZ_LPR_DEVICE_INFO));
|
|
|
- DeviceLink(deviceInfo.device_ip, deviceInfo.serial_no);
|
|
|
- Marshal.FreeHGlobal(intptr);
|
|
|
-
|
|
|
- }
|
|
|
- break;
|
|
|
-
|
|
|
- default:
|
|
|
- base.DefWndProc(ref m);
|
|
|
- break;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- ///<summary>ip+port字符串转ipe</summary>
|
|
|
- private void GetIpEndPoint(string ipp, out IPEndPoint ipe)
|
|
|
- {
|
|
|
- IPAddress myIP = IPAddress.Parse(ipp.Remove(ipp.LastIndexOf(':')) + "");
|
|
|
- string myPort = ipp.Substring(ipp.IndexOf(':') + 1);
|
|
|
- ipe = new IPEndPoint(myIP, int.Parse(myPort));
|
|
|
+ DeviceLink(pStrDev, serialNO);
|
|
|
}
|
|
|
|
|
|
///<summary>与设备连接,启动更新设备状态线程,输出视频</summary>
|
|
@@ -451,10 +335,11 @@ namespace parkMonitor.server
|
|
|
if (eResultType != VzClientSDK.VZ_LPRC_RESULT_TYPE.VZ_LPRC_RESULT_REALTIME)
|
|
|
{
|
|
|
VzClientSDK.TH_PlateResult result = (VzClientSDK.TH_PlateResult)Marshal.PtrToStructure(pResult, typeof(VzClientSDK.TH_PlateResult));
|
|
|
- string strLicense = new string(result.license);
|
|
|
+ string strLicense = (new string(result.license)).Split('\0')[0];
|
|
|
|
|
|
VzClientSDK.VZ_LPR_MSG_PLATE_INFO plateInfo = new VzClientSDK.VZ_LPR_MSG_PLATE_INFO();
|
|
|
plateInfo.plate = strLicense;
|
|
|
+ SetDetail(plateInfo, Get_IP(handle));
|
|
|
|
|
|
//根据setMessage中通过id信息找到的handle保存图片
|
|
|
if (handle == snapshotDevHandle)
|
|
@@ -482,18 +367,11 @@ namespace parkMonitor.server
|
|
|
}
|
|
|
snapshotDevHandle = -1;
|
|
|
}
|
|
|
- int size = Marshal.SizeOf(plateInfo);
|
|
|
- IntPtr intptr = Marshal.AllocHGlobal(size);
|
|
|
- Marshal.StructureToPtr(plateInfo, intptr, true);
|
|
|
-
|
|
|
- //发送消息,号牌信息
|
|
|
- Win32API.PostMessage(hwndMain, MSG_PLATE_INFO, (int)intptr, handle);
|
|
|
}
|
|
|
|
|
|
return 0;
|
|
|
}
|
|
|
|
|
|
-
|
|
|
///<summary>记录车牌,时间,状态信息;刷新本地entity,并且入buffer</summary>
|
|
|
private void SetDetail(VzClientSDK.VZ_LPR_MSG_PLATE_INFO plateInformation, string strIP)
|
|
|
{
|
|
@@ -520,7 +398,7 @@ namespace parkMonitor.server
|
|
|
{
|
|
|
found = true;
|
|
|
//号牌不为空
|
|
|
- if (!(plateInformation.plate == "_无_"))
|
|
|
+ if (!(plateInformation.plate.Contains("_无_")))
|
|
|
{
|
|
|
nmn.SetLic(strIP, nmn.id, plateInformation.plate, DateTime.Now.ToLocalTime().ToString("yyyy-MM-dd HH:mm:ss"), GetStatus(strIP));
|
|
|
FilterLic(strIP, (NumberMachineNode)nmn.Clone());
|
|
@@ -537,7 +415,7 @@ namespace parkMonitor.server
|
|
|
{
|
|
|
lock (ipIdMap)
|
|
|
{
|
|
|
- if (!(plateInformation.plate == "_无_") && ipIdMap.TryGetValue(strIP, out id))
|
|
|
+ if (!(plateInformation.plate.Contains("_无_")) && ipIdMap.TryGetValue(strIP, out id))
|
|
|
{
|
|
|
NumberMachineNode nmn = new NumberMachineNode(strIP, id, plateInformation.plate, DateTime.Now.ToLocalTime().ToString("yyyy-MM-dd HH:mm:ss"), GetStatus(strIP));
|
|
|
NumberMachineNode nmnc = (NumberMachineNode)nmn.Clone();
|
|
@@ -614,6 +492,33 @@ namespace parkMonitor.server
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ ///<summary>停止播放与设备句柄关联的视频</summary>
|
|
|
+ private void StopPlay(int handleInput)
|
|
|
+ {
|
|
|
+ if (handleInput != 0)
|
|
|
+ {
|
|
|
+ int ret = VzClientSDK.VzLPRClient_StopRealPlay(handleInput);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ ///<summary>强制获取号牌</summary>
|
|
|
+ private void ActivateSnap(int handle)
|
|
|
+ {
|
|
|
+ if (handle > 0)
|
|
|
+ {
|
|
|
+ VzClientSDK.VzLPRClient_ForceTrigger(handle);
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ ///<summary>ip+port字符串转ipe</summary>
|
|
|
+ private void GetIpEndPoint(string ipp, out IPEndPoint ipe)
|
|
|
+ {
|
|
|
+ IPAddress myIP = IPAddress.Parse(ipp.Remove(ipp.LastIndexOf(':')) + "");
|
|
|
+ string myPort = ipp.Substring(ipp.IndexOf(':') + 1);
|
|
|
+ ipe = new IPEndPoint(myIP, int.Parse(myPort));
|
|
|
+ }
|
|
|
+
|
|
|
///<summary>创建新pic并记录在picNameMap</summary>
|
|
|
private bool CreatePic(int index, out PictureBox pb)
|
|
|
{
|
|
@@ -660,11 +565,6 @@ namespace parkMonitor.server
|
|
|
return strIP;
|
|
|
}
|
|
|
|
|
|
- private void flowLayoutPanel1_Paint(object sender, PaintEventArgs e)
|
|
|
- {
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
private bool NodeValidation(NumberMachineNode node)
|
|
|
{
|
|
|
return (node != null && node.ip != null && node.ip != "" && node.ip != "used" && node.LicenseNum != null && node.LicenseNum != "") ? true : false;
|
|
@@ -856,91 +756,43 @@ namespace parkMonitor.server
|
|
|
|
|
|
}
|
|
|
}
|
|
|
- /// <summary>
|
|
|
- /// 消息发送api
|
|
|
- /// </summary>
|
|
|
- public class Win32API
|
|
|
- {
|
|
|
- [DllImport("User32.dll", EntryPoint = "FindWindow")]
|
|
|
- public static extern IntPtr FindWindow(string lpClassName, string lpWindowName);
|
|
|
|
|
|
- [DllImport("User32.dll", EntryPoint = "FindWindowEx")]
|
|
|
- public static extern IntPtr FindWindowEx(IntPtr hwndParent, IntPtr hwndChildAfter, string lpClassName, string lpWindowName);
|
|
|
-
|
|
|
- /// <summary>
|
|
|
- /// 自定义的结构
|
|
|
- /// </summary>
|
|
|
- public struct My_lParam
|
|
|
- {
|
|
|
- public int i;
|
|
|
- public string s;
|
|
|
- }
|
|
|
- /// <summary>
|
|
|
- /// 使用COPYDATASTRUCT来传递字符串
|
|
|
- /// </summary>
|
|
|
- [StructLayout(LayoutKind.Sequential)]
|
|
|
- public struct COPYDATASTRUCT
|
|
|
- {
|
|
|
- public IntPtr dwData;
|
|
|
- public int cbData;
|
|
|
- [MarshalAs(UnmanagedType.LPStr)]
|
|
|
- public string lpData;
|
|
|
- }
|
|
|
- //消息发送API
|
|
|
- [DllImport("User32.dll", EntryPoint = "SendMessage")]
|
|
|
- public static extern int SendMessage(
|
|
|
- IntPtr hWnd, // 信息发往的窗口的句柄
|
|
|
- int Msg, // 消息ID
|
|
|
- int wParam, // 参数1
|
|
|
- int lParam //参数2
|
|
|
- );
|
|
|
-
|
|
|
-
|
|
|
- //消息发送API
|
|
|
- [DllImport("User32.dll", EntryPoint = "SendMessage")]
|
|
|
- public static extern int SendMessage(
|
|
|
- IntPtr hWnd, // 信息发往的窗口的句柄
|
|
|
- int Msg, // 消息ID
|
|
|
- int wParam, // 参数1
|
|
|
- ref My_lParam lParam //参数2
|
|
|
- );
|
|
|
-
|
|
|
- //消息发送API
|
|
|
- [DllImport("User32.dll", EntryPoint = "SendMessage")]
|
|
|
- public static extern int SendMessage(
|
|
|
- IntPtr hWnd, // 信息发往的窗口的句柄
|
|
|
- int Msg, // 消息ID
|
|
|
- int wParam, // 参数1
|
|
|
- ref COPYDATASTRUCT lParam //参数2
|
|
|
- );
|
|
|
-
|
|
|
- //消息发送API
|
|
|
- [DllImport("User32.dll", EntryPoint = "PostMessage")]
|
|
|
- public static extern int PostMessage(
|
|
|
- IntPtr hWnd, // 信息发往的窗口的句柄
|
|
|
- int Msg, // 消息ID
|
|
|
- int wParam, // 参数1
|
|
|
- int lParam // 参数2
|
|
|
- );
|
|
|
-
|
|
|
-
|
|
|
- //消息发送API
|
|
|
- [DllImport("User32.dll", EntryPoint = "PostMessage")]
|
|
|
- public static extern int PostMessage(
|
|
|
- IntPtr hWnd, // 信息发往的窗口的句柄
|
|
|
- int Msg, // 消息ID
|
|
|
- int wParam, // 参数1
|
|
|
- ref My_lParam lParam //参数2
|
|
|
- );
|
|
|
-
|
|
|
- //异步消息发送API
|
|
|
- [DllImport("User32.dll", EntryPoint = "PostMessage")]
|
|
|
- public static extern int PostMessage(
|
|
|
- IntPtr hWnd, // 信息发往的窗口的句柄
|
|
|
- int Msg, // 消息ID
|
|
|
- int wParam, // 参数1
|
|
|
- ref COPYDATASTRUCT lParam // 参数2
|
|
|
- );
|
|
|
+ //public class NumMachineManager : IEquipments
|
|
|
+ //{
|
|
|
+ // public static NumMachineLinker ins;
|
|
|
+ // public AbstractMessage GetMessage()
|
|
|
+ // {
|
|
|
+ // return ins.GetMessage();
|
|
|
+ // }
|
|
|
+
|
|
|
+ // public void SetMessage(AbstractMessage message)
|
|
|
+ // {
|
|
|
+ // ins.SetMessage(message);
|
|
|
+ // }
|
|
|
+
|
|
|
+ // public void Start()
|
|
|
+ // {
|
|
|
+ // Task.Factory.StartNew(() =>
|
|
|
+ // {
|
|
|
+ // ins = new NumMachineLinker();
|
|
|
+ // Task.Factory.StartNew(() => {
|
|
|
+ // ins.Start();
|
|
|
+ // //ins.Bounds = new Rectangle(0, 0, 0, 0);
|
|
|
+ // //ins.ShowDialog();
|
|
|
+ // });
|
|
|
+ // //ins.WindowState = FormWindowState.Minimized;
|
|
|
+ // ins.Hide();
|
|
|
+ // });
|
|
|
+ // }
|
|
|
+
|
|
|
+ // public void Stop()
|
|
|
+ // {
|
|
|
+ // Task.Factory.StartNew(() =>
|
|
|
+ // {
|
|
|
+ // ins.Close();
|
|
|
+ // ins.Stop();
|
|
|
+ // });
|
|
|
+ // }
|
|
|
+ //}
|
|
|
|
|
|
- }
|
|
|
}
|