Exemplo n.º 1
0
Arquivo: Form1.cs Projeto: dusong7/--1
        ///  新上传处理函数
        private void ProcessCommAlarm_ITSPlate(ref HKSDK.NET_DVR_ALARMER pAlarmer, IntPtr pAlarmInfo, uint dwBufLen, IntPtr pUser)
        {
            HKSDK.NET_ITS_PLATE_RESULT struITSPlateResult = new HKSDK.NET_ITS_PLATE_RESULT();
            uint dwSize = (uint)Marshal.SizeOf(struITSPlateResult);

            //PtrToStructure返回托管对象  将非托管对象封送到新分配的指定类型的托管
            struITSPlateResult = (HKSDK.NET_ITS_PLATE_RESULT)Marshal.PtrToStructure(pAlarmInfo, typeof(HKSDK.NET_ITS_PLATE_RESULT));
            //保存抓拍图片
            for (int i = 0; i < struITSPlateResult.dwPicNum; i++)
            {
                if (struITSPlateResult.struPicInfo[i].dwDataLen != 0)
                {
                    pictureBox1.Image = Image.FromFile("");
                    if (InvokeRequired) //非当前线程
                    {
                        pictureBox1.BeginInvoke(new UpdateListBoxCallback(UpdateClientList));
                    }
                    else
                    {    //当前线程
                        //   UpdateClientList(0,0);
                    }
                    //    pictureBox1.Image = Image.FromFile(@"D:\卡口\20150416\20150416163914627.jpg");
                }
            }
        }
Exemplo n.º 2
0
Arquivo: Form1.cs Projeto: dusong7/--1
        private void ProcessCommAlarm_Plate(ref HKSDK.NET_DVR_ALARMER pAlarmer, IntPtr pAlarmInfo, uint dwBufLen, IntPtr pUser)
        {
            try
            {
                HKSDK.NET_DVR_PLATE_RESULT struPlateResultInfo = new HKSDK.NET_DVR_PLATE_RESULT();

                uint dwSize = (uint)Marshal.SizeOf(struPlateResultInfo);

                struPlateResultInfo = (HKSDK.NET_DVR_PLATE_RESULT)Marshal.PtrToStructure(pAlarmInfo, typeof(HKSDK.NET_DVR_PLATE_RESULT));
                if (struPlateResultInfo.byResultType == 1 && struPlateResultInfo.dwPicLen > 0)
                {
                    byte[] by = new byte[struPlateResultInfo.dwPicLen];
                    Marshal.Copy(struPlateResultInfo.pBuffer1, by, 0, (int)struPlateResultInfo.dwPicLen);


                    MemoryStream ms          = new MemoryStream(by, 0, (int)struPlateResultInfo.dwPicLen);
                    Image        returnImage = Image.FromStream(ms);
                    pictureBox1.Image = returnImage;
                    if (filepath.Text != "")
                    {
                        returnImage.Save(filepath.Text + vehnum.ToString() + ".jpg");
                        vehnum++;
                    }
                }
            }
            catch (System.Exception ex)
            {
            }
        }
Exemplo n.º 3
0
Arquivo: Form1.cs Projeto: dusong7/--1
        public void MsgCallback(int lCommand, ref HKSDK.NET_DVR_ALARMER pAlarmer, IntPtr pAlarmInfo, uint dwBufLen, IntPtr pUser)
        {
            //通过lCommand来判断接收到的报警信息类型,不同的lCommand对应不同的pAlarmInfo内容
            switch (lCommand)
            {
            case HKSDK.COMM_UPLOAD_PLATE_RESULT:     //旧上传
                ProcessCommAlarm_Plate(ref pAlarmer, pAlarmInfo, dwBufLen, pUser);
                break;

            case HKSDK.COMM_ITS_PLATE_RESULT:     //新上传
                ProcessCommAlarm_ITSPlate(ref pAlarmer, pAlarmInfo, dwBufLen, pUser);
                break;

            default:
                break;
            }
        }