|
@@ -22,6 +22,45 @@ 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>
|
|
|
/// 号牌机通信类
|
|
|
/// </summary>
|
|
@@ -31,39 +70,38 @@ namespace parkMonitor.server
|
|
|
/// 刷新时间间隔与个数
|
|
|
/// </summary>
|
|
|
public const int REFRESHINGTIME = 500, FILTERINGNUMBER = 8;
|
|
|
-
|
|
|
///<summary>通过设备句柄访问pic;链接时add,系统关闭时remove</summary>
|
|
|
- private Dictionary<int, PictureBox> devPicMap = new Dictionary<int, PictureBox>();
|
|
|
+ private static Dictionary<int, PictureBox> devPicMap = new Dictionary<int, PictureBox>();
|
|
|
///<summary>通过名字获取pic对象;创建pic时add,系统关闭remove</summary>
|
|
|
- private Dictionary<string, PictureBox> namePicMap = new Dictionary<string, PictureBox>();
|
|
|
+ private static Dictionary<string, PictureBox> namePicMap = new Dictionary<string, PictureBox>();
|
|
|
///<summary>通过ip获取设备id;产生ip时创建</summary>
|
|
|
- private Dictionary<string, int> ipIdMap = new Dictionary<string, int>();
|
|
|
+ private static Dictionary<string, int> ipIdMap = new Dictionary<string, int>();
|
|
|
///<summary>通过ip获取设备句柄;产生句柄时创建</summary>
|
|
|
- private Dictionary<string, int> ipHandleMap = new Dictionary<string, int>();
|
|
|
+ private static Dictionary<string, int> ipHandleMap = new Dictionary<string, int>();
|
|
|
/// <summary>句柄到号牌回调映射</summary>
|
|
|
- private Dictionary<int, VzClientSDK.VZLPRC_PLATE_INFO_CALLBACK> handleCallbackMap = new Dictionary<int, VzClientSDK.VZLPRC_PLATE_INFO_CALLBACK>();
|
|
|
+ private static Dictionary<int, VzClientSDK.VZLPRC_PLATE_INFO_CALLBACK> handleCallbackMap = new Dictionary<int, VzClientSDK.VZLPRC_PLATE_INFO_CALLBACK>();
|
|
|
///<summary>号牌队列</summary>
|
|
|
- private Queue<NumberMachineNode> LicBuffer = new Queue<NumberMachineNode>();
|
|
|
+ private static Queue<NumberMachineNode> LicBuffer = new Queue<NumberMachineNode>();
|
|
|
///<summary>计数Map</summary>
|
|
|
- private Dictionary<string, Dictionary<NumberMachineNode, int>> filterMap = new Dictionary<string, Dictionary<NumberMachineNode, int>>();
|
|
|
+ private static Dictionary<string, Dictionary<NumberMachineNode, int>> filterMap = new Dictionary<string, Dictionary<NumberMachineNode, int>>();
|
|
|
/// <summary>筛选计数</summary>
|
|
|
- private int filterCount = 0;
|
|
|
+ private static int filterCount = 0;
|
|
|
/// <summary>系统关闭</summary>
|
|
|
- private bool isClosing = false;
|
|
|
+ private static bool isClosing = false;
|
|
|
/// <summary>开启拍照的设备</summary>
|
|
|
- private int snapshotDevHandle = -1;
|
|
|
+ private static int snapshotDevHandle = -1;
|
|
|
/// <summary>允许无号牌时拍照</summary>
|
|
|
- private bool enableEmptySnapshot = true;
|
|
|
+ private static bool enableEmptySnapshot = true;
|
|
|
|
|
|
- private NumberMachineMessage nmMsg = new NumberMachineMessage();
|
|
|
- VzClientSDK.VZLPRC_FIND_DEVICE_CALLBACK_EX find_DeviceCB = null;
|
|
|
- VzClientSDK.VZLPRC_PLATE_INFO_CALLBACK m_PlateResultCB = null;
|
|
|
+ private static NumberMachineMessage nmMsg = new NumberMachineMessage();
|
|
|
+ private static VzClientSDK.VZLPRC_FIND_DEVICE_CALLBACK_EX find_DeviceCB = null;
|
|
|
+ private static VzClientSDK.VZLPRC_PLATE_INFO_CALLBACK m_PlateResultCB = null;
|
|
|
private const int MSG_PLATE_INFO = 0x901;
|
|
|
private const int MSG_DEVICE_INFO = 0x902;
|
|
|
/// <summary>
|
|
|
/// 用于消息传递机制
|
|
|
/// </summary>
|
|
|
- public IntPtr hwndMain;
|
|
|
+ public static IntPtr hwndMain;
|
|
|
|
|
|
/// <summary>
|
|
|
/// 号牌机类构造函数
|
|
@@ -637,7 +675,7 @@ namespace parkMonitor.server
|
|
|
/// </summary>
|
|
|
public void Start()
|
|
|
{
|
|
|
- Task.Run(() =>
|
|
|
+ Task.Factory.StartNew(() =>
|
|
|
{
|
|
|
isClosing = false;
|
|
|
|
|
@@ -652,7 +690,6 @@ namespace parkMonitor.server
|
|
|
{
|
|
|
Debug.WriteLine(ex.ToString());
|
|
|
}
|
|
|
- //this.Show();
|
|
|
});
|
|
|
|
|
|
Task.Factory.StartNew(() =>
|