Ejemplo n.º 1
0
        private bool getParam()
        {
            int num = 0;

            for (int i = 0; i < this.grpCamera.Controls.Count; i++)
            {
                if (((CheckBox)this.grpCamera.Controls[i]).Checked)
                {
                    num = num | 1 << (i & 31);
                }
            }
            if (num == 0)
            {
                MessageBox.Show("请选择摄像头!");
                this.chkCamera1.Focus();
                return(false);
            }
            if (base.OrderCode == CmdParam.OrderCode.停止图像监控)
            {
                this.m_StopCapture.CamerasID = (byte)num;
                this.m_StopCapture.OrderCode = base.OrderCode;
                this.m_StopCapture.Flag1     = 2147483647;
                this.m_StopCapture.Flag2     = 0;
                return(true);
            }
            this.m_CaptureEx.OrderCode = base.OrderCode;
            this.m_CaptureEx.CamerasID = (byte)num;
            if (!this.chkMultiFrame.Checked)
            {
                this.m_CaptureEx.IsMultiFrame = 0;
            }
            else
            {
                this.m_CaptureEx.IsMultiFrame = 1;
            }
            if (!this.chkCapWhenStop.Checked)
            {
                this.m_CaptureEx.CapWhenStop = 0;
            }
            else
            {
                this.m_CaptureEx.CapWhenStop = 1;
            }
            int num1 = 0;
            int num2 = 0;

            if (base.OrderCode == CmdParam.OrderCode.多种条件图像监控)
            {
                foreach (CheckBox control in this.pnlWatchCondition.Controls)
                {
                    if (!control.Checked)
                    {
                        continue;
                    }
                    int num3 = int.Parse(control.Tag.ToString());
                    num1 = num1 | num3;
                    num2 = num2 | num3;
                }
            }
            else if (base.OrderCode == CmdParam.OrderCode.实时图像监控)
            {
                num2 = 1;
            }
            else if (base.OrderCode == CmdParam.OrderCode.自检)
            {
                this.grbPicParam.Visible = true;
            }
            if (!this.chkClientSave.Checked)
            {
                num1 = 0;
            }
            bool flag = this.IsSaveCapture();

            if (flag)
            {
                num1 = 1;
                num2 = 0;
            }
            if (base.OrderCode == CmdParam.OrderCode.实时图像监控)
            {
                num1 = (this.chkRealTimeClientSave.Checked ? 1 : 0);
            }
            this.m_CaptureEx.Times        = Convert.ToInt32(this.numWatchTime.Value);
            this.m_CaptureEx.Interval     = Convert.ToInt32(this.numInterval.Value);
            this.m_CaptureEx.Quality      = Convert.ToByte(this.trkQuality.Value);
            this.m_CaptureEx.Brightness   = Convert.ToByte(this.trkLight.Value);
            this.m_CaptureEx.Contrast     = Convert.ToByte(this.trkContrast.Value);
            this.m_CaptureEx.Saturation   = Convert.ToByte(this.trkSaturation.Value);
            this.m_CaptureEx.Chroma       = Convert.ToByte(this.trkChroma.Value);
            this.m_CaptureEx.CaptureFlag  = num2;
            this.m_CaptureEx.CaptureCache = num1;
            this.m_CaptureEx.Type         = this.cmbShootingType.SelectedIndex;
            this.m_CaptureEx.PSize        = this.cmbImageResolution.SelectedIndex + 1;
            if (!this.grpTime.Visible)
            {
                this.m_CaptureEx.BeginTime = string.Empty;
                this.m_CaptureEx.EndTime   = string.Empty;
            }
            else
            {
                if (!this.checkDateTime())
                {
                    MessageBox.Show("开始时间不能小于结束时间或当前时间,请修改。");
                    return(false);
                }
                if (!this.dtpStartDate.Enabled)
                {
                    CaptureEx mCaptureEx = this.m_CaptureEx;
                    DateTime  value      = this.dtpStartTime.Value;
                    mCaptureEx.BeginTime = string.Concat("000000", value.ToString("HHmmss"));
                    CaptureEx captureEx = this.m_CaptureEx;
                    DateTime  dateTime  = this.dtpEndTime.Value;
                    captureEx.EndTime = string.Concat("000000", dateTime.ToString("HHmmss"));
                }
                else
                {
                    CaptureEx mCaptureEx1 = this.m_CaptureEx;
                    string    str         = this.dtpStartDate.Value.ToString("yyMMdd");
                    DateTime  value1      = this.dtpStartTime.Value;
                    mCaptureEx1.BeginTime = string.Concat(str, value1.ToString("HHmmss"));
                    CaptureEx captureEx1 = this.m_CaptureEx;
                    string    str1       = this.dtpEndDate.Value.ToString("yyMMdd");
                    DateTime  dateTime1  = this.dtpEndTime.Value;
                    captureEx1.EndTime = string.Concat(str1, dateTime1.ToString("HHmmss"));
                }
            }
            if (base.OrderCode != CmdParam.OrderCode.多种条件图像监控 || flag || this.m_CaptureEx.Times != 0)
            {
                return(true);
            }
            MessageBox.Show("只有当只选终端保存图片时监控次数才能选0,其它条件下不能选0,请重新选择");
            this.numWatchTime.Focus();
            return(false);
        }
Ejemplo n.º 2
0
        public long icar_SetCaptureEx(CmdParam.ParamType ParamType, string SimNum, string CarPw, CmdParam.CommMode CommMode, CaptureEx captureEx, string PicTime, string CarID)
        {
            long num = (long)0;

            this.logMsg.FunctionName = "icar_SetCaptureEx";
            this.logMsg.Msg          = string.Concat("发送:类型-", ParamType.ToString(), ",车辆-", SimNum);
            object[] picTime = new object[] { "抓拍时间-", PicTime, ",是否多帧-", captureEx.IsMulitFramebool, ",监控次数-", captureEx.Times, ",间隔时间-", (double)captureEx.Interval * 0.1, ",图像质量-", captureEx.Quality, ",图像亮度-", captureEx.Brightness, ",图像对比度-", captureEx.Contrast, ",图像饱和度-", captureEx.Saturation, ",图像色度", captureEx.Chroma, ",停车是否拍照-", captureEx.IsCapWhenStop };
            string   str     = string.Concat(picTime);
            LogMsg   logMsg  = this.logMsg;

            logMsg.Msg = string.Concat(logMsg.Msg, ",", str);
            this.log.WriteLog(this.logMsg);
            if (!this.isStartCommon())
            {
                num = (long)-1;
            }
            else
            {
                try
                {
                    if (captureEx.ProtocolName == "JTBGPS")
                    {
                        int    newOrderId = DownData.CarCmdSend.GetNewOrderId();
                        string str1       = "";
                        captureEx.TransformCode = CmdParam.TrafficProtocolCodeExchange2((int)captureEx.OrderCode);
                        if (captureEx.Quality == 0)
                        {
                            captureEx.Quality = 1;
                        }
                        if (captureEx.CaptureCache == 1)
                        {
                            captureEx.CaptureCache = -1;
                        }
                        string xmlString = captureEx.ToXmlString(this.CalOrderId(this.WorkId, newOrderId), SimNum, captureEx.ProtocolName, (int)CommMode, "SetCapture", ref str1);
                        num = DownData.CarCmdSend.icar_SendCmdXML(this.WorkId, newOrderId, SimNum, captureEx.ProtocolName, captureEx.TransformCode, (int)CommMode, xmlString);
                    }
                    else
                    {
                        int newOrderId = DownData.CarCmdSend.GetNewOrderId();
                        num = DownData.CarCmdSend.icar_SetCaptureEx(this.WorkId, newOrderId, SimNum, captureEx.IsMultiFrame, captureEx.CamerasID, captureEx.CaptureFlag, captureEx.CaptureCache, captureEx.Times, captureEx.Interval, captureEx.Quality, captureEx.Brightness, captureEx.Contrast, captureEx.Saturation, captureEx.Chroma, captureEx.CapWhenStop);
                    }
                    if (num == (long)0)
                    {
                        ReadDataFromDB.execSaveGpsLogTable(this.WorkId, DownData.CarCmdSend.OrderId, CarID, 18, "定时拍照");
                    }
                    else
                    {
                        AlarmMsg alarmMsg = new AlarmMsg()
                        {
                            ClassName    = "GpsPicDownData",
                            FunctionName = "icar_SetCaptureEx"
                        };
                        object[] workId = new object[] { "workid-", this.WorkId, ",simNum-", SimNum, ",OrderCode-", captureEx.OrderCode };
                        alarmMsg.AlarmText = string.Concat(workId);
                        alarmMsg.Code      = num.ToString();
                        this.log.WriteAlarm(alarmMsg);
                    }
                }
                catch (Exception exception1)
                {
                    Exception exception = exception1;
                    ErrorMsg  errorMsg  = new ErrorMsg()
                    {
                        ClassName = "GpsPicDownData",
                        ErrorText = "下发消息指令时发生错误!"
                    };
                    this.log.WriteError(errorMsg, exception);
                    num = (long)-1;
                }
            }
            return(num);
        }