Ejemplo n.º 1
0
        private Stream GetPic(int count)
        {
            if (this.LanKaDeviceCamare.Image != null)
            {
                return(LanKaDeviceCamare.Image);
            }
            CameraInfoBase  dev    = this.LanKaDeviceCamare; //calBackParames as CameraInfoBase;
            Stream          stream = new MemoryStream();
            LankaResultInfo info   = dev.CalBackData as LankaResultInfo;

            if (count < 10)
            {
                string imgPath = "Image/" + DateTime.Now.ToString("yyyyMMdd") + "/" + info.DeviceId + "/" + info.ImgName;
                if (File.Exists(imgPath))
                {
                    FileStream fs = new FileStream(imgPath, FileMode.Open);
                    fs.Position = 0;
                    //fs.Seek(0, SeekOrigin.Begin);
                    fs.CopyTo(stream);
                    fs.Close();
                    WriteLog.EventLog(imgPath);
                }
                else
                {
                    //JinQuLogs.LogHelper.Info("Not Exists " + imgPath);
                    Task.Delay(10);
                    count++;
                    return(GetPic(count));
                }
            }
            LanKaDeviceCamare.Image = stream;
            return(stream);
        }
Ejemplo n.º 2
0
 public LanKaControl(Action <CameraInfoBase> SDKCalBackHandler, Action <CameraInfoBase> ChangeStatusHandler, Action <StringBuilder> DeiveLogHandler, CameraInfoBase LanKaDeviceCamare, Action <int> OpenSDKCalBack = null, Func <string, CameraInfoBase> GetDeviceInfoByDeviceID = null, Action <IntPtr, string> LanKaRealPlayCalBack = null, Action <IntPtr> StopPlay = null)
 {
     this.LanKaDeviceCamare       = LanKaDeviceCamare;
     this.SDKCalBackHandler       = SDKCalBackHandler;
     this.ChangeStatusHandler     = ChangeStatusHandler;
     this.DeiveLogHandler         = DeiveLogHandler;
     this.OpenSDKCalBack          = OpenSDKCalBack;
     this.GetDeviceInfoByDeviceID = GetDeviceInfoByDeviceID;
     this.LanKaRealPlayCalBack    = LanKaRealPlayCalBack;
     this.StopPlay = StopPlay;
 }
Ejemplo n.º 3
0
 public LanKaControl(SDKControlParametes controlParametes)
 {
     this.LanKaDeviceCamare    = controlParametes?.CameraInfoBase;
     this.SDKCalBackHandler    = controlParametes?.SDKCalBackHandler;
     this.LanKaRealPlayCalBack = (x, y) =>
     {
         try
         {
             var ax = Form.FromHandle(x) as AxBLC_IPNC;
             if (ax != null)
             {
                 ax.PlayS("rtsp://" + y + ":8557/H.264");
             }
         }
         catch (Exception e)
         {
             WriteLog.EventLog("PlayCalBack error " + e.Message);
         }
     };
     this.GetDeviceInfoByDeviceID = controlParametes.GetDeviceInfoByDeviceID;
 }