Ejemplo n.º 1
0
        /// <summary>
        /// 刷新监控摄像头列表
        /// </summary>
        /// <returns></returns>
        public SmcErr RefreshMonitorCamera()
        {
            SmcErr err = new CgwError();

            NLogEx.LoggerEx logEx = new NLogEx.LoggerEx(log);

            err = CheckSession(currentSessionID);
            //调任何接口前 需要判断监控平台是否加载成功
            if (err.IsSuccess())
            {
                Thread th = new Thread(new ThreadStart(() =>
                {
                    VideoMonitorManage.Instance().RefreshMonitorCamera();
                }));
                th.Start();
            }

            if (err.IsSuccess())
            {
                logEx.Info("MonitorManageService RefreshMonitorCamera  Successful,Current Cgw IP is : {0}", CgwConst.ClientIp);
            }
            else
            {
                logEx.Error("MonitorManageService RefreshMonitorCamera failed,ErrNo :{0}", err.ErrNo);
            }
            return(err);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 停止预览摄像头视频,并清理命名管道
        /// </summary>
        /// <param name="cameraNo"></param>
        /// <returns></returns>
        public SmcErr StopReceiveVideoByPipe(string cameraNo)
        {
            SmcErr err = new CgwError();

            NLogEx.LoggerEx logEx = new NLogEx.LoggerEx(log);

            err = CheckSession(currentSessionID);
            //调任何接口前 需要判断监控平台是否加载成功
            if (err.IsSuccess())
            {
                err = VideoMonitorManage.Instance().StopReceiveVideo(cameraNo);
                VideoPipe videoPipe = VideoPipeManage.Instance().DeleteVideoPipe(cameraNo);
                if (videoPipe == null)
                {
                    logEx.Error("MonitorManageService StopReceiveVideoByPipe failed,VideoPipe is null,cameraNo = {0}", cameraNo);
                    err.SetErrorNo(CgwError.STOP_RECEIVE_VIDEO_FAILED);
                }
                else
                {
                    videoPipe.Stop();
                }
            }
            if (err.IsSuccess())
            {
                logEx.Info("MonitorManageService StopReceiveVideoByPipe  Successful,Current Cgw IP is : {0}", CgwConst.ClientIp);
            }
            else
            {
                logEx.Error("MonitorManageService StopReceiveVideoByPipe failed,ErrNo :{0}", err.ErrNo);
            }
            return(err);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 获取监控摄像头列表刷新状态,返回结果为0是表示刷新完毕,为1是刷新操作中。当查询刷新状态为0时,可调用获取监控摄像头列表接口,获取刷新后监控摄像头列表
        /// </summary>
        /// <param name="refreshStatus"></param>
        /// <returns></returns>
        public SmcErr GetRefreshStatus(out SmcErr refreshStatus)
        {
            SmcErr err = new CgwError();

            NLogEx.LoggerEx logEx = new NLogEx.LoggerEx(log);
            refreshStatus       = new SmcErr();
            refreshStatus.ErrNo = CgwError.ERR_DEVICE_LIST_REFRESH_STATUS_END;
            err = CheckSession(currentSessionID);
            //调任何接口前 需要判断监控平台是否加载成功
            if (err.IsSuccess())
            {
                err = VideoMonitorManage.Instance().GetRefreshStatus(out refreshStatus);
            }
            else
            {
                refreshStatus.ErrNo = CgwError.ERR_DEVICE_LIST_REFRESH_STATUS_FAILED;
            }
            if (err.IsSuccess())
            {
                logEx.Info("MonitorManageService GetRefreshStatus  Successful,Current Cgw IP is : {0}", CgwConst.ClientIp);
            }
            else
            {
                logEx.Error("MonitorManageService GetRefreshStatus failed,ErrNo :{0}", err.ErrNo);
            }
            return(err);
        }
Ejemplo n.º 4
0
        /// <summary>
        /// 获取摄像头列表及分组信息
        /// </summary>
        /// <param name="fromMonitorSys">如果该值为true,则实时从监控平台获取,否则从融合网关缓存获取</param>
        /// <param name="cameraList">摄像头列表</param>
        /// <param name="groupList">组信息</param>
        /// <param name="nodeRelationList">分组关系</param>
        /// <returns></returns>
        public SmcErr GetAllCameras(PlatformType platformType, PagesParam pageParam, out List <Camera> cameraList, out List <CameraGroup> groupList, out List <NodeRelation> nodeRelationList, out PageInfo pagesInfo, PlatformLicenseInfo licenseInfo = null)
        {
            SmcErr err = new CgwError();

            NLogEx.LoggerEx logEx = new NLogEx.LoggerEx(log);
            cameraList       = null;
            groupList        = null;
            nodeRelationList = null;
            pagesInfo        = null;

            err = CheckSession(currentSessionID);
            //调任何接口前 需要判断监控平台是否加载成功
            if (err.IsSuccess())
            {
                err = VideoMonitorManage.Instance().GetAllCameras(pageParam, out cameraList, out groupList, out nodeRelationList, out pagesInfo, licenseInfo);
            }
            if (err.IsSuccess())
            {
                logEx.Info("MonitorManageService QueryMonitorCamera  Successful,Current Cgw IP is : {0}", CgwConst.ClientIp);
            }
            else
            {
                logEx.Error("MonitorManageService QueryMonitorCamera failed,ErrNo :{0}", err.ErrNo);
            }
            return(err);
        }
Ejemplo n.º 5
0
        /// <summary>
        /// 停止服务
        /// </summary>
        protected override void OnStop()
        {
            NLogEx.LoggerEx logEx = new NLogEx.LoggerEx(log);
            logEx.Info("Enter MonitorManageService.OnStop");

            if (this.serviceHost != null)
            {
                VideoMonitorManage.Instance().Unload();
                this.serviceHost.Close();
                logEx.Info("MonitorManageService Close Success");
            }
        }
Ejemplo n.º 6
0
        /// <summary>
        /// 预览摄像头视频,使用命名管道方式接收数据
        /// </summary>
        /// <param name="cameraNo"></param>
        /// <param name="pipeName"></param>
        /// <returns></returns>
        public SmcErr StartReceiveVideoByPipe(string cameraNo, out string pipeName)
        {
            SmcErr err = new CgwError();

            NLogEx.LoggerEx logEx = new NLogEx.LoggerEx(log);
            pipeName = string.Empty;
            err      = CheckSession(currentSessionID);
            //调任何接口前 需要判断监控平台是否加载成功
            if (err.IsSuccess())
            {
                err = VideoMonitorManage.Instance().StartReceiveVideo(cameraNo);

                //开始监控平台成功、开始通过管道发送数据
                if (err.IsSuccess())
                {
                    VideoPipeManage.Instance().DeleteVideoPipe(cameraNo);
                    VideoPipe videoPipe = VideoPipeManage.Instance().AddVideoPipe(cameraNo);
                    if (videoPipe != null)
                    {
                        pipeName = videoPipe.PipeName;
                        videoPipe.Run();

                        logEx.Info("MonitorManageService StartReceiveVideoByPipe  Successful,Current Cgw IP is : {0}", CgwConst.ClientIp);
                    }
                    else
                    {
                        logEx.Error("MonitorManageService AddVideoPipe failed.cameraNo = {0}", cameraNo);
                        err.SetErrorNo(CgwError.START_RECEIVE_VIDEO_FAILED);
                        StopReceiveVideoByPipe(cameraNo);
                    }
                }
                else
                {
                    logEx.Error("MonitorManageService StartReceiveVideoByPipe failed,ErrNo :{0}", err.ErrNo);
                }
            }
            else
            {
                logEx.Error("MonitorManageService StartReceiveVideoByPipe failed,ErrNo :{0}", err.ErrNo);
            }
            return(err);
        }
Ejemplo n.º 7
0
        /// <summary>
        /// 线程加载cgw
        /// </summary>
        /// <returns></returns>
        public SmcErr Load()
        {
            SmcErr err = new SmcErr();

            NLogEx.LoggerEx logEx = new NLogEx.LoggerEx(log);
            //初始化监控平台
            err = VideoMonitorManage.Instance().Load();
            VideoMonitorManage.Instance().SetDataCallBackFunc(DataCallBackFunc);
            if (err.IsSuccess())
            {
                logEx.Trace("Load CgwMonitorManage Successful !");
                isLoadSuccess = true;
            }
            else
            {
                logEx.Fatal("Load CgwMonitorManage Failed, ErrNo : {0}!", err.ErrNo);
            }

            return(err);
        }
Ejemplo n.º 8
0
        /// <summary>
        /// 设置摄像头麦克风状态
        /// </summary>
        /// <param name="cameraNo">摄像头编号</param>
        /// <param name="isOn">麦克风是否开启</param>
        /// <returns></returns>
        public SmcErr SetMic(string cameraNo, bool isOn)
        {
            SmcErr err = new CgwError();

            NLogEx.LoggerEx logEx = new NLogEx.LoggerEx(log);

            err = CheckSession(currentSessionID);
            //调任何接口前 需要判断监控平台是否加载成功
            if (err.IsSuccess())
            {
                err = VideoMonitorManage.Instance().SetMic(cameraNo, isOn);
            }
            if (err.IsSuccess())
            {
                logEx.Info("MonitorManageService SetMic  Successful,Current Cgw IP is : {0}", CgwConst.ClientIp);
            }
            else
            {
                logEx.Error("MonitorManageService SetMic failed,ErrNo :{0}", err.ErrNo);
            }
            return(err);
        }
Ejemplo n.º 9
0
        /// <summary>
        /// 停止云台控制,摄像头控制
        /// </summary>
        /// <param name="cameraNo">摄像头编号</param>
        /// <param name="ptzCommandType">命令类型</param>
        /// <returns></returns>
        public SmcErr StopControlPtz(string cameraNo, PtzCommandType ptzCommandType)
        {
            SmcErr err = new CgwError();

            NLogEx.LoggerEx logEx = new NLogEx.LoggerEx(log);

            err = CheckSession(currentSessionID);
            //调任何接口前 需要判断监控平台是否加载成功
            if (err.IsSuccess())
            {
                err = VideoMonitorManage.Instance().StopControlPtz(cameraNo, ptzCommandType);
            }
            if (err.IsSuccess())
            {
                logEx.Info("MonitorManageService StopControlPtz  Successful,Current Cgw IP is : {0}", CgwConst.ClientIp);
            }
            else
            {
                logEx.Error("MonitorManageService StopControlPtz failed,ErrNo :{0}", err.ErrNo);
            }
            return(err);
        }