Exemple #1
0
 /// <summary>
 /// 返回实时流数据
 /// </summary>
 /// <param name="device"></param>
 /// <param name="plateforms"></param>
 public bool SendByteRealData(CameraEquipment camera)
 {
     //CameraClient.Init();
     //CameraEquipment equipment = camera as CameraEquipment;
     /////用于摄像头回调
     //FRealDataCallBack fRealDataCallBack = new FRealDataCallBack(ReadDataCallBack);
     //if (cameraClient == null || cameraClient.lLogin < 0)
     //{
     //    //2、登录网络设备
     //    cameraClient = new CameraClient();
     //    int error = cameraClient.Login(equipment.IP, ushort.Parse(equipment.Port), equipment.UserName, equipment.PassWord, 0, "");
     //    if (error > 0)
     //    {
     //        return false;
     //    }
     //}
     //if (cameraClient.lLogin >= 0)//登录成功
     //{
     //    //3、启动实时监视或多画面预览
     //    int hPlayHandle = cameraClient.RealPlay(1, IntPtr.Zero, 0, 0);
     //    if (hPlayHandle >= 0)
     //    {
     //        cameraClient.RealDataCallBack(hPlayHandle, fRealDataCallBack);
     //        return true;
     //    }
     //}
     return(false);
 }
Exemple #2
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);
 }
Exemple #3
0
 /// <summary>
 /// 启动实时监控
 /// </summary>
 /// <param name="camera"></param>
 /// <param name="plateform"></param>
 /// <param name="hWnd"></param>
 public bool StartVideoPreview(CameraEquipment camera, IntPtr hWnd, out string errMsg)
 {
     errMsg = "";
     if (!videoShow)
     {
         videoShow = openVideo(camera, hWnd, out errMsg);
     }
     return(videoShow);
 }
Exemple #4
0
 public bool SavePic(CameraEquipment camera, IntPtr hWnd, string fileName, out string errMsg)
 {
     openVideo(camera, hWnd, out errMsg);
     if (myPlayHandle >= 0)
     {
         bool result = cameraClient.CapturePicture(myPlayHandle, fileName);
         closeVideo();
         return(result);
     }
     closeVideo();
     return(false);
 }
Exemple #5
0
 /// <summary>
 /// 保存实时数据,包括(图片,视频)
 /// </summary>
 /// <param name="camera"></param>
 /// <param name="plateform"></param>
 /// <param name="filePath"></param>
 public bool StartRecord(CameraEquipment camera, IntPtr hWnd, String filePath, out string errMsg)
 {
     errMsg = "";
     if (!videoRecord)
     {
         //FileHelper.CreateDirByFile(filePath);
         bool result = openVideo(camera, hWnd, out errMsg);
         if (result)
         {
             videoRecord = cameraClient.StartRecord(myPlayHandle, filePath);
         }
     }
     return(videoRecord);
 }
Exemple #6
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);
 }