Example #1
0
        void MyHttpServer_EventNewrecord(string result)
        {
            WriteLog.EventLog(result);
            //result = "{\"Detail\":\"0000002686,1801490988_20180226140931_0000002687_1B.jpg,,1,90,鲁APX188,蓝牌,鲁APX188,0.00,0:0:0,1390,388,1505,428,-0.089500,100,,0,0,0;1801490988_20180226140931_0000002687_1B.jpg,鲁APX188,鲁APX188\u0000?\"}";
            var Detail = JsonUtility.JsonToObject(result, typeof(LanKaResultModel)) as LanKaResultModel;
            var model  = new LankaResultInfo(Detail.Detail);


            var device = GetDeviceInfoByDeviceID(model.DeviceId);

            if (device != null)
            {
                if (device.Image != null)
                {
                    device.Image.Dispose();
                    device.Image = null;
                }
                device.CalBackData = model;
                SDKCalBackHandler(device);
            }
            else
            {
                this.LanKaDeviceCamare.CalBackData = model;
                SDKCalBackHandler(this.LanKaDeviceCamare);
            }
            //GetPic(0);
        }
Example #2
0
        public Tuple <string, Task <Stream>, ResultCarInfo, CarTypeEnum> GetPlateNumber()
        {
            LankaResultInfo info = this.LanKaDeviceCamare.CalBackData as LankaResultInfo;
            var             task = Task.Run(() => GetPic(0));

            return(new Tuple <string, Task <Stream>, ResultCarInfo, CarTypeEnum>(info.CarNumber, task, null, CarTypeEnum.MotorVehicle));
        }
Example #3
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);
        }