示例#1
0
 public bool StartRecord1(CameraEquipment camera, IntPtr hWnd, String filePath, out string errMsg)
 {
     errMsg = "";
     //1、SDK初始化
     CameraClient.Init();
     if (cameraClient == null || cameraClient.lLogin < 0)
     {
         //2、登录网络设备
         cameraClient = new CameraClient();
         int error = cameraClient.Login(camera.IP, ushort.Parse(camera.Port.ToString()), camera.UserName, camera.PassWord, 0, "");
         if (error > 0)
         {
             errMsg = "登录失败";
         }
     }
     if (cameraClient.lLogin > 0)//登录成功
     {
         //FileHelper.CreateDirByFile(filePath);
         //3、启动实时监视或多画面预览(参数如何填写)
         myPlayHandle = cameraClient.RealPlay(1, hWnd, 0, 0);
         if (myPlayHandle >= 0)
         {
             videoRecord = cameraClient.StartRecord(myPlayHandle, filePath);
         }
     }
     return(videoRecord);
 }
示例#2
0
        public bool Initialize(ParameterBase Parameters)
        {
            CameraClient.Init();
            this.cameraParameter = Parameters as IPCameraParameter;
            this.cameraClient    = new CameraClient();
            int error = this.cameraClient.Login(this.cameraParameter.Address, this.cameraParameter.Port, this.cameraParameter.UserName, this.cameraParameter.Password, this.cameraParameter.DeviceSpecification, this.cameraParameter.DeviceSN);

            return(error <= 0);
        }
示例#3
0
 /// <summary>
 /// 开启视频
 /// </summary>
 /// <param name="camera"></param>
 /// <param name="hWnd"></param>
 /// <param name="errMsg"></param>
 private bool openVideo(CameraEquipment camera, IntPtr hWnd, out string errMsg)
 {
     errMsg = "";
     if (myPlayHandle >= 0)
     {
         return(true);
     }
     //1、SDK初始化
     CameraClient.Init();
     if (cameraClient == null || cameraClient.lLogin < 0)
     {
         try
         {
             //2、登录网络设备
             cameraClient = new CameraClient();
             int error = cameraClient.Login(camera.IP, ushort.Parse(camera.Port.ToString()), camera.UserName, camera.PassWord, 0, "");
             if (error > 0)
             {
                 errMsg = "登录失败";
             }
         }
         catch (Exception ex)
         {
             errMsg = "登录失败";
         }
     }
     if (cameraClient.lLogin >= 0)//登录成功
     {
         //3、启动实时监视或多画面预览(参数如何填写)
         myPlayHandle = cameraClient.RealPlay(1, hWnd, 0, 0);
         if (myPlayHandle >= 0)
         {
             videoShow = true;
         }
         else
         {
             videoShow = false;
         }
     }
     return(videoShow);
 }