Ejemplo n.º 1
0
        /// <summary>
        /// 停止云台控制,摄像头控制
        /// </summary>
        /// <param name="cameraNo">摄像头编号</param>
        /// <param name="ptzCommandType">命令类型</param>
        /// <returns></returns>
        public SmcErr StopControlPtz(string cameraNo, PtzCommandType ptzCommandType)
        {
            NLogEx.LoggerEx logEx = new NLogEx.LoggerEx(log);
            logEx.Trace("Enter: T28181VideoMonitor.StopControlPtz({0}).", cameraNo);

            SmcErr err = new CgwError();

            //将ptz命令转换成T28181的命令
            T28181PTZCmd cmd    = new T28181PTZCmd(ptzCommandType, 0);
            string       ptzCmd = cmd.ToString();

            //控制权限级别设为1
            int result = sipStack.PtzControl(cameraNo, ptzCmd, "1");

            //如果为0,表示成功
            if (result == CgwConst.IVS_SDK_SUCCESS_TAG)
            {
                logEx.Info("Stop control ptz success.Camera No:{0}.", cameraNo);
            }
            else
            {
                //直接将IVS的错误码返回
                err.SetErrorNo(CgwError.STOP_CONTROL_PTZ_FAILED);
                logEx.Error("Stop control ptz failed.Camera No:{0}.Ivs sdk error code:{1}.", cameraNo, result);
                return(err);
            }
            return(err);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 开始云台控制,摄像头控制
        /// </summary>
        /// <param name="cameraNo">摄像头编号</param>
        /// <param name="ptzCommandType">命令类型</param>
        /// <param name="param">命令参数,速度或倍数</param>
        /// <returns></returns>
        public SmcErr StartControlPtz(string cameraNo, PtzCommandType ptzCommand, int param)
        {
            NLogEx.LoggerEx logEx = new NLogEx.LoggerEx(log);
            logEx.Trace("Enter: T28181VideoMonitor.StartControlPtz({0},{1},{2}).", cameraNo, ptzCommand, param);
            SmcErr err = new CgwError();

            //将ptz命令转换成T28181的命令
            T28181PTZCmd cmd    = new T28181PTZCmd(ptzCommand, param);
            string       ptzCmd = cmd.ToString();

            logEx.Trace("Call T28181VideoMonitor.StartPtzControl({0},{1},{2}).", cameraNo, Enum.GetName(typeof(PtzCommandType), (int)ptzCommand), param);
            //控制权限级别设为1
            int result = sipStack.PtzControl(cameraNo, ptzCmd, "1");

            //如果为0,表示成功
            if (result == CgwConst.IVS_SDK_SUCCESS_TAG)
            {
                logEx.Info("Start control ptz success.Camera No:{0}.", cameraNo);
            }
            else
            {
                err.SetErrorNo(CgwError.START_CONTROL_PTZ_FAILED);
                logEx.Error("Start control ptz failed.Camera No:{0}.T28181VideoMonitor error code:{1}.", cameraNo, result);
                return(err);
            }

            return(err);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 停止云台控制,摄像头控制
        /// </summary>
        /// <param name="cameraNo">摄像头编号</param>
        /// <param name="ptzCommandType">命令类型</param>
        /// <returns></returns>
        public SmcErr StopControlPtz(string cameraNo, PtzCommandType ptzCommandType)
        {
            NLogEx.LoggerEx logEx = new NLogEx.LoggerEx(log);
            logEx.Trace("Enter: T28181VideoMonitor.StopControlPtz({0}).", cameraNo);

            SmcErr err = new CgwError();

            //将ptz命令转换成T28181的命令
            T28181PTZCmd cmd = new T28181PTZCmd(ptzCommandType, 0);
            string ptzCmd = cmd.ToString();

            //控制权限级别设为1
            int result = sipStack.PtzControl(cameraNo, ptzCmd, "1");
            //如果为0,表示成功
            if (result == CgwConst.IVS_SDK_SUCCESS_TAG)
            {
                logEx.Info("Stop control ptz success.Camera No:{0}.", cameraNo);
            }
            else
            {
                //直接将IVS的错误码返回
                err.SetErrorNo(CgwError.STOP_CONTROL_PTZ_FAILED);
                logEx.Error("Stop control ptz failed.Camera No:{0}.Ivs sdk error code:{1}.", cameraNo, result);
                return err;
            }
            return err;
        }
Ejemplo n.º 4
0
        /// <summary>
        /// 开始云台控制,摄像头控制
        /// </summary>
        /// <param name="cameraNo">摄像头编号</param>
        /// <param name="ptzCommandType">命令类型</param>
        /// <param name="param">命令参数,速度或倍数</param>
        /// <returns></returns>
        public SmcErr StartControlPtz(string cameraNo, PtzCommandType ptzCommand, int param)
        {
            NLogEx.LoggerEx logEx = new NLogEx.LoggerEx(log);
            logEx.Trace("Enter: T28181VideoMonitor.StartControlPtz({0},{1},{2}).", cameraNo, ptzCommand, param);
            SmcErr err = new CgwError();

            //将ptz命令转换成T28181的命令
            T28181PTZCmd cmd = new T28181PTZCmd(ptzCommand, param);
            string ptzCmd = cmd.ToString();

            logEx.Trace("Call T28181VideoMonitor.StartPtzControl({0},{1},{2}).", cameraNo, Enum.GetName(typeof(PtzCommandType), (int)ptzCommand), param);
            //控制权限级别设为1
            int result = sipStack.PtzControl(cameraNo, ptzCmd, "1");

            //如果为0,表示成功
            if (result == CgwConst.IVS_SDK_SUCCESS_TAG)
            {
                logEx.Info("Start control ptz success.Camera No:{0}.", cameraNo);
            }
            else
            {
                err.SetErrorNo(CgwError.START_CONTROL_PTZ_FAILED);
                logEx.Error("Start control ptz failed.Camera No:{0}.T28181VideoMonitor error code:{1}.", cameraNo, result);
                return err;
            }

            return err;
        }