private void btnSetCallback_Click(object sender, EventArgs e) { HCNetSDK.MSGCallBack_V31 plateCallBack = new HCNetSDK.MSGCallBack_V31(PlateDataCallBack); IntPtr pUser = new IntPtr(); if (HCNetSDK.NET_DVR_SetDVRMessageCallBack_V31(plateCallBack, pUser)) { MessageBox.Show("注册回调函数成功"); } }
private void button1_Click(object sender, EventArgs e) { if (HCNetSDK.NET_DVR_Init()) { NET_DVR_DEVICEINFO_V30 device = new NET_DVR_DEVICEINFO_V30(); if (HCNetSDK.NET_DVR_Login_V30(textIP.Text.Trim(), 8870, "admin", "12345", ref device) == 0) { MessageBox.Show("连接成功"); } else { MessageBox.Show("连接失败"); } } else { MessageBox.Show("初始化失败"); } }
private void btnSendTrade_Click(object sender, EventArgs e) { NET_ITS_TRANS_INFO trade = new NET_ITS_TRANS_INFO(); trade.sStartTime = new byte[20]; trade.sEndTime = new byte[20]; //int a = Marshal.SizeOf(trade); trade.nPumpID = (byte)comboNozzle.SelectedIndex; trade.nOilType = 92; trade.fTradeLitre = 3.2f; trade.fTradeMoney = 35.0f; trade.fTradePrice = 6.80f; trade.fStartRead = 1000.1f; trade.fEndRead = 1003.3f; string time = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); byte[] byTime = System.Text.Encoding.Default.GetBytes(time); Buffer.BlockCopy(byTime, 0, trade.sStartTime, 0, byTime.Length); Buffer.BlockCopy(byTime, 0, trade.sEndTime, 0, byTime.Length); HCNetSDK.NET_DVR_SendTrans(trade); }
private void btnSnap_Click(object sender, EventArgs e) { NET_DVR_MANUALSNAP snap = new NET_DVR_MANUALSNAP(); snap.byPumpID = (byte)comboNozzle.SelectedIndex; snap.byPumpStatus = (byte)comboNozzleStatus.SelectedIndex; NET_DVR_PLATE_RESULT plateResult = new NET_DVR_PLATE_RESULT(); IntPtr ret = Marshal.AllocHGlobal(Marshal.SizeOf(plateResult)); if (HCNetSDK.NET_DVR_ManualSnap(0, ref snap, ret)) { plateResult = (NET_DVR_PLATE_RESULT)Marshal.PtrToStructure(ret, typeof(NET_DVR_PLATE_RESULT)); lblPlate.Text = System.Text.Encoding.Default.GetString(plateResult.sLicense); lblPlateColor.Text = dicPlateColor[plateResult.byPlateColor]; lblCarBrand.Text = dicCarBrand[plateResult.wVehicleLogoRecog]; lblCarColor.Text = dicCarColor[plateResult.byColor]; lblCarSubBrand.Text = "未知"; lblCarType.Text = "未知"; } else { MessageBox.Show("抓拍失败"); } }
private void button2_Click(object sender, EventArgs e) { HCNetSDK.NET_DVR_Cleanup(); }