示例#1
0
        private void btnLENS_MINUS_MouseDown(object sender, MouseEventArgs e)
        {
            int iControlCode = 0;
            int pLockStatus  = 0;

            switch ((sender as Button).Name)
            {
            case "btnLENS_APERTURE_CLOSE":
                iControlCode = 22;
                break;

            case "btnLENS_ZOOM_OUT":
                iControlCode = 24;
                break;

            case "btnLENS_FOCAL_FAR":
                iControlCode = 26;
                break;

            default:
                break;
            }
            int iCode = IVS_API.IVS_SDK_PtzControl(ApplicationEvent.iSession, ActiveCameraCode, iControlCode, "2", "3", ref pLockStatus);

            if (iCode != 0)
            {
                log4net.WriteLogFile("IVS_SDK_PtzControl:" + iCode + " 调用失败");
                MessageBox.Show("IVS_SDK_PtzControl控制失败");
            }
        }
示例#2
0
        private void btnPTZ_Down(object sender, MouseEventArgs e)
        {
            int iControlCode = 0;
            int pLockStatus  = 0;

            switch ((sender as Button).Name)
            {
            case "btnLeft":
                iControlCode = 4;
                break;

            case "btnUP":
                iControlCode = 2;
                break;

            case "btnDown":
                iControlCode = 3;
                break;

            case "btnRight":
                iControlCode = 7;
                break;

            default:
                break;
            }
            int iCode = IVS_API.IVS_SDK_PtzControl(ApplicationEvent.iSession, ActiveCameraCode, iControlCode, "2", "3", ref pLockStatus);

            if (iCode != 0)
            {
                log4net.WriteLogFile("IVS_SDK_PtzControl控制失败");
                MessageBox.Show("IVS_SDK_PtzControl控制失败");
            }
        }
示例#3
0
        private void btnLENS_FOCAL_STOP_Click(object sender, EventArgs e)
        {
            int iControlCode = 0;
            int pLockStatus  = 0;

            switch ((sender as Button).Name)
            {
            case "btnLENS_APERTURE_STOP":
                iControlCode = 22;
                break;

            case "btnLENS_ZOOM_STOP":
                iControlCode = 24;
                break;

            case "btnLENS_FOCAL_STOP":
                iControlCode = 26;
                break;

            default:
                break;
            }
            int iCode = IVS_API.IVS_SDK_PtzControl(ApplicationEvent.iSession, ActiveCameraCode, iControlCode, "3", "3", ref pLockStatus);

            if (iCode != 0)
            {
                log4net.WriteLogFile("IVS_SDK_PtzControl" + iCode + "控制失败");
                MessageBox.Show((sender as Button).Name + "控制失败!");
            }
        }
示例#4
0
        private void btnPTZ_UP(object sender, MouseEventArgs e)
        {
            int pLockStatus = 0;
            int iCode       = IVS_API.IVS_SDK_PtzControl(ApplicationEvent.iSession, ActiveCameraCode, 1, "2", "3", ref pLockStatus);

            if (iCode != 0)
            {
                log4net.WriteLogFile("IVS_SDK_PtzControl控制失败");
                MessageBox.Show("IVS_SDK_PtzControl控制失败");
            }
        }
示例#5
0
        public int Camera_YZW_AT(string cCameraID, uint iYZWIndex)
        {
            int pLockStatus = 0;
            int iCode       = IVS_API.IVS_SDK_PtzControl(ApplicationEvent.iSession, cCameraID, 11, iYZWIndex.ToString(), "3", ref pLockStatus);

            if (iCode == 0)
            {
                MessageBox.Show("调用预置位成功!");
                return(AppConfig.SUCCESS);
            }
            else
            {
                log4net.WriteLogFile("IVS_SDK_PtzControl:" + iCode + " 调用失败");
                MessageBox.Show("调用预置位失败");
                return(AppConfig.FAILURE);
            }
        }
示例#6
0
        private void timPreset_Tick(object sender, EventArgs e)
        {
            timPreset.Enabled = false;
            int iCode = 0;

            try
            {
                Boolean AllowWait = false;
                int     idx       = -1;
                if (YWZ_VAL_LIST.Count > 0)
                {
                    idx = YWZ_VAL_LIST.Count - 1;

                    IVS_PTZ_PRESET vPreset = (IVS_PTZ_PRESET)YWZ_VAL_LIST[idx];
                    YWZ_VAL_LIST.RemoveAt(idx);
                    YWZ_TXT_LIST.Items.RemoveAt(idx);
                    int pLockStatus = 0;
                    iCode = IVS_API.IVS_SDK_PtzControl(ApplicationEvent.iSession, ActiveCameraCode, 11, vPreset.cPresetName, "3", ref pLockStatus);
                    if (iCode > 0)
                    {
                        log4net.WriteLogFile("调用预置位失败");
                        return;
                    }
                    else
                    {
                        AllowWait = true;
                    }
                }
                if (AllowWait)
                {
                    Boolean isAbort = false;
                    int     iORD    = 0;
                    while (!isAbort)
                    {
                        Application.DoEvents();
                        Thread.Sleep(200);
                        iORD++;
                        if (iORD > 15)
                        {
                            isAbort = true;
                        }
                    }
                }
                isPlay = true;
                String cAppDir = INIConfig.ReadString("ALARM", "FILE_PATH", "");
                if (Directory.Exists(cAppDir))
                {
                    Directory.CreateDirectory(cAppDir);
                }

                int    iPRESET_ID = 9999;
                String cKeyID     = "";
                string cKeyGuid   = "";
                if (idx != -1)
                {
                    cKeyID     = AutoID.getAutoID() + "_" + String.Format("{0:0#00}", idx);
                    cKeyGuid   = ActiveCameraCode + "X" + String.Format("{0:0#00}", idx);
                    iPRESET_ID = idx;
                }
                else
                {
                    cKeyID     = AutoID.getAutoID() + "_0000";
                    cKeyGuid   = ActiveCameraCode + "X" + "0000";
                    iPRESET_ID = 9999;
                }

                cAppDir = cAppDir + cKeyID.Substring(0, 8);
                if (Directory.Exists(cAppDir))
                {
                    Directory.CreateDirectory(cAppDir);
                }

                String cFileName = cAppDir + "\\" + cKeyID + ".jpg";
                Application.DoEvents();
                iCode = IVS_API.IVS_SDK_LocalSnapshot(ApplicationEvent.iSession, (UInt32)ulRealPlayHandle, 1, cFileName);

                if (iCode == 0)
                {
                    cAppDir = INIConfig.ReadString("ANALYSE", "FILE_PATH", "");
                    String cAnalyseFile = cAppDir + cKeyID + ".jpg";
                    try
                    {
                        String cFilePath = Path.GetDirectoryName(cAnalyseFile);
                        if (!Directory.Exists(cFilePath))
                        {
                            Directory.CreateDirectory(cFilePath);
                        }
                        File.Copy(cFileName, cAnalyseFile);
                    }
                    catch (Exception ex)
                    {
                        log4net.WriteLogFile(ex.Message);
                    }

                    log4net.WriteLogFile("IVS_SDK_LocalSnapshot成功!" + cFileName);
                    String cKeyText = IMGAI.getImageText(cFileName);

                    List <String> sqls     = new List <string>();
                    String        cDayTime = DateTime.Now.ToString("yyyyMMddHHmmss");
                    JActiveTable  aMaster  = new JActiveTable();
                    aMaster.TableName = "XT_IMG_REC";
                    aMaster.AddField("REC_ID", cKeyID);
                    aMaster.AddField("CAMERA_ID", ActiveCameraCode);
                    aMaster.AddField("PRESET_ID", iPRESET_ID);

                    aMaster.AddField("AI_FLAG", 0);
                    aMaster.AddField("ALARM_FLAG", 0);
                    aMaster.AddField("ALARM_CHECKED", 0);
                    aMaster.AddField("IMAGE_REDRAW", 0);


                    if (!String.IsNullOrEmpty(cKeyText))
                    {
                        aMaster.AddField("P", IMGAI.getP(cKeyText));
                        aMaster.AddField("T", IMGAI.getT(cKeyText));
                        aMaster.AddField("X", IMGAI.getX(cKeyText));
                    }
                    aMaster.AddField("FILE_URL", "/dfs/" + cKeyID.Substring(0, 8) + "/" + cKeyID + ".jpg");
                    aMaster.AddField("CREATE_TIME", cDayTime);
                    aMaster.AddField("UPLOAD_FLAG", 1);

                    String       cMasterSQL = aMaster.getInsertSQL();
                    JActiveTable aSlave     = new JActiveTable();
                    aSlave.TableName = "XT_CAMERA_STATUS";
                    aSlave.AddField("UPDATE_TIME", cDayTime);
                    String cSlaveSQL = aSlave.getUpdateSQL("CAMERA_ID = '" + ActiveCameraCode + "' ");

                    sqls.Add(cMasterSQL);
                    sqls.Add(cSlaveSQL);
                    iCode = WebSQL.ExecSQL(sqls);
                    if (iCode > 0)
                    {
                        log4net.WriteLogFile(cKeyID + "插入数据库成功");
                    }
                }
                Application.DoEvents();
            }
            catch (Exception ex)
            {
                log4net.WriteLogFile("Camera_YZW_List失败!" + ex.Message);
            }
            finally
            {
                if (YWZ_VAL_LIST.Count > 0)
                {
                    timPreset.Enabled = true;
                }
                else if (YWZ_VAL_LIST.Count == 0)
                {
                    timAfter.Enabled = true;
                }
            }
        }