Beispiel #1
0
        public void StartVoiceTalkbackProcess()
        {
            try
            {
                TalkbackParam para = new TalkbackParam();
                para.ProtocolType = (talkAndBroadcastUserControls.ProtocolType.SelectedIndex + 1).ToString();
                para.DirectFirst  = (bool)talkAndBroadcastUserControls.DirectFirst.IsChecked ? "1" :"0";

                var requestXml = XmlHelper.SerializeToXml(para);
                requestXml = XmlHelper.GetContentXml(requestXml);

                string responseMsg = OcxHelper.OCX.IVS_OCX_StartVoiceTalkback(requestXml, talkAndBroadcastUserControls.TalkCameraCode.Text.ToString());
                talkAndBroadcastUserControls.eSDKCodeTextBlock.Text = @"int resultCode = OcxHelper.IVS_OCX_StartVoiceTalkback(requestXml, talkAndBroadcastUserControls.TalkCameraCode.Text.ToString());";

                var ocxResult = XmlHelper.ProcessOcxResponseMsg(responseMsg);

                if (ocxResult.ResultCode != "0")
                {
                    OcxHelper.MainWin.OperationInfo.Content = StringHelper.FindLanguageResource(ocxResult.ResultCode.ToString());
                }
                else
                {
                    OcxHelper.MainWin.OperationInfo.Content = StringHelper.FindLanguageResource("StartVoiceTalkback") + StringHelper.FindLanguageResource("Success");
                    var node = ocxResult.BodyXmlNode.SelectSingleNode("TalkbackHandle");
                    talkAndBroadcastUserControls.TalkbackHandle.Text = node.InnerText.ToString();
                }
            }
            catch (Exception ex)
            {
                LogService.Error(ex.ToString());
                OcxHelper.MainWin.OperationInfo.Content = ex.ToString();
                return;
            }
        }
Beispiel #2
0
        public int SendPtz(PtzOperationType operation, int param1, int param2, string code)
        {
            string strCameracode = code;

            if (string.IsNullOrEmpty(strCameracode))
            {
                strCameracode = string.Empty;
                LogService.Info("Search request info:==>>CameraCode is null.");
                return(-1);
            }
            LogService.Info("Search request info:==>>CameraCode:" + strCameracode + ",PtzOperationType:" + operation.ToString() + ",Param1:" + param1.ToString() + ",Param2:" + param2.ToString());
            var resultValue = OcxHelper.OCX.IVS_OCX_PtzControl(strCameracode, (int)operation, param1.ToString(), param2.ToString());

            OcxResult result     = XmlHelper.ProcessOcxResponseMsg(resultValue);
            var       lockStatus = string.Empty;

            if (result.BodyXmlNode.SelectSingleNode("LockStatus") != null)
            {
                lockStatus = result.BodyXmlNode.SelectSingleNode("LockStatus").InnerText;
            }
            if (result.ResultCode != "0")
            {
                throw new Exception(result.ResultCode + "," + lockStatus);
            }
            LogService.Info("IVS_OCX_PtzControl response info:==>>" + resultValue);

            return(int.Parse(lockStatus.ToString()));
        }
 private void AddPresetProcess()
 {
     try
     {
         if (string.IsNullOrEmpty(liveVideoPtzUserControls.PresetName.Text.ToString()))
         {
             return;
         }
         VideoEntity camera      = liveVideoPtzUserControls.CameraList.SelectedItem as VideoEntity;
         string      resultValue = OcxHelper.OCX.IVS_OCX_AddPTZPreset(camera.CameraCode, liveVideoPtzUserControls.PresetName.Text.ToString());
         liveVideoPtzUserControls.eSDKCodeTextBlock.Text = @"int resultCode = OcxHelper.IVS_OCX_AddPTZPreset(camera.CameraCode, liveVideoPtzUserControls.PresetName.Text.ToString());";
         OcxResult result = XmlHelper.ProcessOcxResponseMsg(resultValue);
         if (result.ResultCode != "0")
         {
             OcxHelper.MainWin.OperationInfo.Content = StringHelper.FindLanguageResource(result.ResultCode);
         }
         else
         {
             OcxHelper.MainWin.OperationInfo.Content = StringHelper.FindLanguageResource("AddPreset") + StringHelper.FindLanguageResource("Success");
         }
     }
     catch (Exception ex)
     {
         LogService.Error(ex.ToString());
         OcxHelper.MainWin.OperationInfo.Content = ex.ToString();
         return;
     }
 }
Beispiel #4
0
        private void GetBroadcastDeviceList()
        {
            try
            {
                string responseMsg = OcxHelper.OCX.IVS_OCX_GetBroadcastCameraList();

                var ocxResult = XmlHelper.ProcessOcxResponseMsg(responseMsg);

                if (ocxResult.ResultCode == "0")
                {
                    List <VideoEntity> list = new List <VideoEntity>();

                    XmlNode     node     = ocxResult.BodyXmlNode;
                    XmlNodeList nodeList = node.SelectNodes("BroadcastList/CameraCode");

                    foreach (XmlNode xmlNode in nodeList)
                    {
                        VideoEntity video = new VideoEntity();
                        video.CameraCode = xmlNode.InnerText;
                        list.Add(video);
                    }
                    talkAndBroadcastUserControls.BroadcastDeviceList.ItemsSource = list;
                }
            }
            catch (Exception ex)
            {
                LogService.Error(ex.ToString());
                return;
            }
        }
Beispiel #5
0
        public void GetDownloadInfoCommandProcess()
        {
            try
            {
                uint downLoadHandle = Convert.ToUInt32(downloadAndCaptureUserControls.DownLoadHandle.Text.ToString());
                downloadAndCaptureUserControls.eSDKCodeTextBlock.Text = @"int resultCode = OcxHelper.OCX.IVS_OCX_GetDownloadInfo(downLoadHandle);";
                bool            fristExe = true;
                DispatcherTimer timer    = new DispatcherTimer();
                //初始化定时器
                timer.Interval  = TimeSpan.FromSeconds(1);
                timer.IsEnabled = true;
                timer.Tick     += new EventHandler((sender, args) =>
                {
                    string responseMsg = OcxHelper.OCX.IVS_OCX_GetDownloadInfo(downLoadHandle);
                    var ocxResult      = XmlHelper.ProcessOcxResponseMsg(responseMsg);

                    if (ocxResult.ResultCode != "0")
                    {
                        timer.IsEnabled = false;
                        timer.Stop();
                    }
                    else if (fristExe == true)
                    {
                        OcxHelper.MainWin.OperationInfo.Content = StringHelper.FindLanguageResource("GetDownloadInfo") + StringHelper.FindLanguageResource("Success");
                    }

                    if (ocxResult.ResultCode == "0")
                    {
                        var tempNode = XmlHelper.DeserializeToList <RecordDownloadInfoEntity>(ocxResult.BodyXmlNode);

                        downloadAndCaptureUserControls.RecordList.ItemsSource = tempNode;
                        if (tempNode[0].Progress == 100)
                        {
                            timer.IsEnabled = false;
                            timer.Stop();
                        }
                        fristExe = false;
                    }
                });

                downloadAndCaptureUserControls.eSDKCodeTextBlock.Text = @"OcxHelper.OCX.IVS_OCX_GetDownloadInfo(downLoadHandle);";
            }
            catch (Exception ex)
            {
                LogService.Error(ex.ToString());
                OcxHelper.MainWin.OperationInfo.Content = ex.ToString();
                return;
            }
        }
Beispiel #6
0
        public void StartPlatformDownloadCommandProcess()
        {
            try
            {
                RecordDownloadParam recordDownloadParam = XmlHelper.DeserializeToEntity <RecordDownloadParam>(downloadAndCaptureUserControls.DownLoadPara.Text);
                recordDownloadParam.SavePath = downloadAndCaptureUserControls.SaveFileName.Text.ToString();
                if (!downloadAndCaptureUserControls.CameraCode.Text.Contains("#"))
                {
                    return;
                }

                recordDownloadParam.NVRCode = downloadAndCaptureUserControls.CameraCode.Text.Split('#')[1];



                var requestXml = XmlHelper.SerializeToXml(recordDownloadParam);
                requestXml = "<?xml version='1.0' encoding='utf-8'?>" + XmlHelper.GetContentXml(requestXml);

                DateTime realStartTime = DateTime.ParseExact(downloadAndCaptureUserControls.StartTime.Text.ToString(), "yyyyMMddHHmmss", Thread.CurrentThread.CurrentCulture);
                string   startTime     = realStartTime.ToUniversalTime().ToString("yyyyMMddHHmmss");

                DateTime realEndTime = DateTime.ParseExact(downloadAndCaptureUserControls.EndTime.Text.ToString(), "yyyyMMddHHmmss", Thread.CurrentThread.CurrentCulture);
                string   endTime     = realEndTime.ToUniversalTime().ToString("yyyyMMddHHmmss");

                string responseMsg = OcxHelper.OCX.IVS_OCX_StartPlatformDownload(downloadAndCaptureUserControls.CameraCode.Text.ToString(), startTime, endTime, requestXml);
                downloadAndCaptureUserControls.eSDKCodeTextBlock.Text = @"int resultCode = OcxHelper.OCX.IVS_OCX_StartPlatformDownload(downloadAndCaptureUserControls.CameraCode.Text.ToString(), downloadAndCaptureUserControls.StartTime.Text.ToString(), downloadAndCaptureUserControls.EndTime.Text.ToString(), requestXml);";

                var ocxResult = XmlHelper.ProcessOcxResponseMsg(responseMsg);
                if (ocxResult.ResultCode != "0")
                {
                    OcxHelper.MainWin.OperationInfo.Content = StringHelper.FindLanguageResource(ocxResult.ResultCode.ToString());
                }
                else
                {
                    OcxHelper.MainWin.OperationInfo.Content = StringHelper.FindLanguageResource("StartPlatformDownload") + StringHelper.FindLanguageResource("Success");
                    var node = ocxResult.BodyXmlNode.SelectSingleNode("DownloadHandle");
                    downloadAndCaptureUserControls.DownLoadHandle.Text = node.InnerText.ToString();
                }
                downloadAndCaptureUserControls.eSDKCodeTextBlock.Text = @"OcxHelper.OCX.IVS_OCX_StartPlatformDownload(downloadAndCaptureUserControls.CameraCode.Text.ToString(), startTime, endTime, requestXml);";
            }
            catch (Exception ex)
            {
                LogService.Error(ex.ToString());
                OcxHelper.MainWin.OperationInfo.Content = ex.ToString();
                return;
            }
        }
Beispiel #7
0
        public List <VideoEntity> LoadDeviceInfoByUser()
        {
            List <VideoEntity> deviceList = new List <VideoEntity>();

            try
            {
                string resultXml = OcxHelper.OCX.IVS_OCX_GetDeviceList((uint)IVSDeviceType.DEVICE_TYPE_CAMERA, (uint)1, (uint)PageSize);

                OcxResult ocxResult = XmlHelper.ProcessOcxResponseMsg(resultXml);
                if (ocxResult.ResultCode != "0")
                {
                    OcxHelper.MainWin.OperationInfo.Content = StringHelper.FindLanguageResource("GetCameraList") + StringHelper.FindLanguageResource(ocxResult.ResultCode);
                }
                else
                {
                    OcxHelper.MainWin.OperationInfo.Content = StringHelper.FindLanguageResource("GetCameraList") + StringHelper.FindLanguageResource("Success");
                    XmlNode     node     = ocxResult.BodyXmlNode;
                    XmlNodeList nodeList = node.SelectNodes("VideoInChanList/VideoInChanInfo");

                    foreach (XmlNode xmlNode in nodeList)
                    {
                        VideoEntity video = new VideoEntity();
                        video.CameraCode = xmlNode.SelectSingleNode("CameraCode").InnerXml.ToString();
                        video.AliasName  = xmlNode.SelectSingleNode("CameraName").InnerXml.ToString();

                        string cameraType = xmlNode.SelectSingleNode("CameraType").InnerXml.ToString();
                        video.CameraType = cameraType.Equals("FIX") ? CameraType.FIX : cameraType.Equals("PTZ") ? CameraType.PTZ : cameraType.Equals("DOME") ?
                                           CameraType.DOME : cameraType.Equals("HALFDOME") ? CameraType.HALFDOME : cameraType.Equals("DOME") ? CameraType.DOME : CameraType.None;

                        video.IsOnline = xmlNode.SelectSingleNode("IsOnline").InnerXml.Equals("ON") ? true : false;
                        deviceList.Add(video);
                    }
                }
            }
            catch (Exception ex)
            {
                LogService.Error(ex.ToString());
                OcxHelper.MainWin.OperationInfo.Content = ex.ToString();
                return(null);
            }
            return(deviceList);
        }
        private void QueryPresetProcess()
        {
            try
            {
                VideoEntity camera      = liveVideoPtzUserControls.CameraList.SelectedItem as VideoEntity;
                var         resultValue = OcxHelper.OCX.IVS_OCX_GetPTZPresetList(camera.CameraCode);
                liveVideoPtzUserControls.eSDKCodeTextBlock.Text = @"int resultCode = OcxHelper.IVS_OCX_GetPTZPresetList(CameraCode);";
                OcxResult result = XmlHelper.ProcessOcxResponseMsg(resultValue);
                if (result.ResultCode != "0")
                {
                    throw new Exception(result.ResultCode);
                }

                var returnCameraCode = result.BodyXmlNode.SelectSingleNode("CameraCode").InnerText;
                List <PTZPresetEntity> preSetLocationEntityList = XmlHelper.DeserializeToList <PTZPresetEntity>(result.BodyXmlNode.SelectSingleNode("PresetPTZList"));

                foreach (PTZPresetEntity Preset in preSetLocationEntityList)
                {
                    Preset.CameraCode = camera.CameraCode;
                }
                liveVideoPtzUserControls.PresetList.ItemsSource = preSetLocationEntityList;

                if (result.ResultCode != "0")
                {
                    OcxHelper.MainWin.OperationInfo.Content = StringHelper.FindLanguageResource(result.ResultCode);
                }
                else
                {
                    OcxHelper.MainWin.OperationInfo.Content = StringHelper.FindLanguageResource("QueryPreset") + StringHelper.FindLanguageResource("Success");
                }
            }
            catch (Exception ex)
            {
                LogService.Error(ex.ToString());
                OcxHelper.MainWin.OperationInfo.Content = ex.ToString();
                return;
            }
        }
Beispiel #9
0
        private void QueryProcess()
        {
            try
            {
                var result = new RecordQueryResultEntity();

                PageInfo pageInfo = new PageInfo();
                pageInfo.FromIndex      = 1;
                pageInfo.PageSize       = 200;
                pageInfo.ToIndex        = 200;
                pageInfo.QueryCondition = new QueryCondition();

                QueryField startTime = new QueryField();//开始时间
                startTime.Field     = "FromTime";
                startTime.QueryType = QueryType.Exact;

                DateTime realFromTime = DateTime.ParseExact(replayUserControls.StartTime.Text.ToString(), "yyyyMMddHHmmss", Thread.CurrentThread.CurrentCulture);
                startTime.Value = DateTimeExtensions.ToDstUtcTime(realFromTime, true).ToString("yyyyMMddHHmmss");
                pageInfo.QueryCondition.QueryFieldList.Add(startTime);

                QueryField endTime = new QueryField();//结束时间
                endTime.Field     = "ToTime";
                endTime.QueryType = QueryType.Exact;

                DateTime realEndTime = DateTime.ParseExact(replayUserControls.EndTime.Text.ToString(), "yyyyMMddHHmmss", Thread.CurrentThread.CurrentCulture);
                endTime.Value = DateTimeExtensions.ToDstUtcTime(realEndTime, false).ToString("yyyyMMddHHmmss");
                pageInfo.QueryCondition.QueryFieldList.Add(endTime);

                QueryField cameraCode = new QueryField();//摄像机编号
                cameraCode.Field     = "CameraCode";
                cameraCode.QueryType = QueryType.Exact;
                cameraCode.Value     = replayUserControls.CameraCode.Text.ToString();
                pageInfo.QueryCondition.QueryFieldList.Add(cameraCode);

                QueryField recordMethod = new QueryField();//录像方式
                recordMethod.Field     = "RecordMethod";
                recordMethod.QueryType = QueryType.Exact;
                recordMethod.Value     = replayUserControls.RecordType.SelectedIndex.ToString();
                pageInfo.QueryCondition.QueryFieldList.Add(recordMethod);

                QueryField recordType = new QueryField();//录像类型
                recordType.Field     = "RecordType";
                recordType.QueryType = QueryType.Exact;
                recordType.Value     = "111";
                pageInfo.QueryCondition.QueryFieldList.Add(recordType);

                QueryField queryType = new QueryField();//查询方式
                queryType.Field     = "QueryType";
                queryType.QueryType = QueryType.Exact;
                queryType.Value     = "0";
                pageInfo.QueryCondition.QueryFieldList.Add(queryType);

                QueryField alarmTypeList = new QueryField();//告警类型列表
                alarmTypeList.Field     = "AlarmTypeList";
                alarmTypeList.QueryType = QueryType.Exact;
                alarmTypeList.Value     = "ALARM_TYPE_DI,ALARM_NO_SIGNAL,ALARM_SHIELD,ALARM_TYPE_MOVE_DECTION,ALARM_VIDEO_G,ALARM_REVERSE_DETECTION,ALARM_INTRUSION,ALARM_TRIP_LINE,ALARM_OBJECT_ABANDONED,ALARM_OBJECT_REMOVAL,ALARM_PRESENCE,ALARM_PATH,ALARM_DIRECTION_MOVE,ALARM_SPEED,ALARM_SPEED_MONITOR,ALARM_OBJECT_WANDER,ALARM_DENSITY_MONITOR,ALARM_FACE_RECOGNITION_WARNING,ALARM_FACE_RECOGNITION,ALARM_FACE_CAPTURE,ALARM_MAU_VQD_BRIGHTNESS,ALARM_MAU_VQD_DARKNESS,ALARM_MAU_VQD_BLUR,ALARM_MAU_VQD_SNOWNOISE,ALARM_MAU_VQD_COLORCAST,ALARM_MAU_VQD_STRIPENOISE,ALARM_MAU_VQD_FRAMEFROZEN,ALARM_MAU_VQD_SHAKE,ALARM_MAU_VQD_CAMERACOVERD,ALARM_MAU_VIDEO_LOST,EXSYS_ALARM_EMERGENCY_ON,EXSYS_ALARM_FIRE_ALERT_ON,EXSYS_ALARM_ROBBERY_ON,EXSYS_ALARM_STEAL_ON,EXSYS_ALARM_ALERT_ON,EXSYS_ALARM_MONITOR_ON,EXSYS_ALARM_FAILURE_ON,EXSYS_ALARM_DEFENCE_ON,EXSYS_ALARM_REMOTE_CONTROL_ON,EXSYS_ALARM_ENTER_EXIT_ON,EXSYS_ALARM_STATUS_ON,EXSYS_ALARM_SHUTDOWN_ON,EXSYS_ALARM_BYPASS_ON,EXSYS_ALARM_TEST_ON,EXSYS_ALARM_USER_OPERATION_ON,EXSYS_ALARM_ERROR_ON,SCADA_ALARM";
                pageInfo.QueryCondition.QueryFieldList.Add(alarmTypeList);

                QueryField operatorID = new QueryField();//执行查询操作的用户ID
                operatorID.Field     = "OperatorID";
                operatorID.QueryType = QueryType.Exact;
                operatorID.Value     = LoginInfo.CurrentLoginInfo.UserId;
                pageInfo.QueryCondition.QueryFieldList.Add(operatorID);

                QueryField operatorDomain = new QueryField();//
                operatorDomain.Field     = "OperatorDomain";
                operatorDomain.QueryType = QueryType.Exact;
                operatorDomain.Value     = LoginInfo.CurrentLoginInfo.OperatorDomain;
                pageInfo.QueryCondition.QueryFieldList.Add(operatorDomain);

                var requestXml = XmlHelper.SerializeToXml(pageInfo);
                requestXml = XmlHelper.GetContentXml(requestXml);

                var responseMsg = OcxHelper.OCX.IVS_OCX_QueryRecordList(requestXml);

                var ocxResult = XmlHelper.ProcessOcxResponseMsg(responseMsg);

                if (ocxResult.ResultCode != "0")
                {
                    OcxHelper.MainWin.OperationInfo.Content = StringHelper.FindLanguageResource(ocxResult.ResultCode.ToString());
                }
                else
                {
                    OcxHelper.MainWin.OperationInfo.Content = StringHelper.FindLanguageResource("Query") + StringHelper.FindLanguageResource("Success");
                }

                var node = ocxResult.BodyXmlNode.SelectSingleNode("PageInfo");

                if (node != null)
                {
                    var tempNode = XmlHelper.DeserializeToEntity <PageInfo>(node);
                    result.PageInfo = tempNode;
                }

                node = ocxResult.BodyXmlNode.SelectSingleNode("RecordDataList");

                if (node != null)
                {
                    var tempNode = XmlHelper.DeserializeToList <RecordDataInfoEntity>(node);

                    foreach (RecordDataInfoEntity info in tempNode)
                    {
                        info.CameraCode = replayUserControls.CameraCode.Text.ToString();

                        info.LocalStartTime = DateTime.ParseExact(info.StartTime, "yyyyMMddHHmmss", Thread.CurrentThread.CurrentCulture).ToLocalTime().ToString();
                        info.LocalEndTime   = DateTime.ParseExact(info.EndTime, "yyyyMMddHHmmss", Thread.CurrentThread.CurrentCulture).ToLocalTime().ToString();
                    }
                    replayUserControls.RecordList.ItemsSource = tempNode;
                }
                else
                {
                    replayUserControls.RecordList.ItemsSource = null;
                }
                replayUserControls.eSDKCodeTextBlock.Text = @"var responseMsg = OcxHelper.OCX.IVS_OCX_QueryRecordList(requestXml);";
            }
            catch (Exception ex)
            {
                LogService.Error("Server Record Search Error Code:" + ex.ToString());
            }
        }