예제 #1
0
        private async Task <bool> NewMfAssistMove(PinchStage stage, FloatPoint p)
        {
            ReportAction(stage, p);
            if (!autoreviewUnlocked)
            {
                autoreviewUnlocked = true;
                await TryGet("?mode=camcmd&value=autoreviewunlock");
            }

            var val2 = $"{(int)(p.X * 1000)}/{(int)(p.Y * 1000)}";

            if (stage != PinchStage.Single)
            {
                var res = await TryGetString($"?mode=camctrl&type=touch_trace&value={stage.GetString()}&value2={val2}");

                if (stage == PinchStage.Stop)
                {
                    autoreviewUnlocked = false;
                }

                return(res);
            }

            await TryGetString($"?mode=camctrl&type=touch_trace&value=start&value2={val2}");
            await TryGetString($"?mode=camctrl&type=touch_trace&value=continue&value2={val2}");
            await TryGetString($"?mode=camctrl&type=touch_trace&value=stop&value2={val2}");

            autoreviewUnlocked = false;
            return(true);
        }
예제 #2
0
 public async Task <bool> MfAssistZoom(PinchStage stage, FloatPoint p, float size)
 {
     ReportAction(stage, p, size);
     return(await OldNewAction(
                async() => await PinchZoom(stage, p, size),
                async() => await OldMfAssistZoom(stage, p, size),
                Profile.NewTouch,
                f => Profile.NewTouch = f));
 }
예제 #3
0
 public async Task <bool> MfAssistMove(PinchStage stage, FloatPoint p)
 {
     ReportAction(stage, p);
     return(await OldNewAction(
                async() => await NewMfAssistMove(stage, p),
                async() => await TryGetString($"?mode=camctrl&type=mf_asst&value={(int)(p.X * 1000)}/{(int)(p.Y * 1000)}"),
                Profile.NewTouch,
                f => Profile.NewTouch = f));
 }
예제 #4
0
        private async Task <bool> PinchZoom(PinchStage stage, FloatPoint p, float size)
        {
            try
            {
                if (!autoreviewUnlocked)
                {
                    autoreviewUnlocked = true;
                    await TryGet("?mode=camcmd&value=autoreviewunlock");
                }

                var pp1 = new IntPoint(p - size, 1000f).Clamp(0, 1000);
                var pp2 = new IntPoint(p + size, 1000f).Clamp(0, 1000);

                var url = $"?mode=camctrl&type=pinch&value={stage.GetString()}&value2={pp1.X}/{pp1.Y}/{pp2.X}/{pp2.Y}";
                Debug.WriteLine(url, "PinchZoom");
                var resstring = await http.GetString(url);

                if (resstring.StartsWith("<xml>"))
                {
                    return(false);
                }

                var csv = resstring.Split(',');
                if (csv[0] != "ok")
                {
                    return(false);
                }

                if (stage == PinchStage.Stop)
                {
                    autoreviewUnlocked = false;
                }

                return(true);
            }
            catch (LumixException)
            {
                throw;
            }
            catch (ConnectionLostException)
            {
                Debug.WriteLine("Connection lost", "Connection");
                return(false);
            }
            catch (Exception ex)
            {
                LogError("Camera action failed", ex);
                return(false);
            }
        }
예제 #5
0
 private async Task PinchZoom(PinchStage stage, FloatPoint point, float extend)
 {
     extend = (200f + extend) / 1000f;
     if (Lumix.LumixState.FocusMode != FocusMode.MF)
     {
         if (Lumix.LumixState.FocusAreas != null &&
             Lumix.LumixState.FocusAreas.Boxes.Any(b => b.Props.Type == FocusAreaType.OneAreaSelected))
         {
             await Lumix.FocusPointResize(stage, point, extend);
         }
     }
     else
     {
         await Lumix.MfAssistZoom(stage, point, extend);
     }
 }
예제 #6
0
        private async Task MoveFocusPoint(double x, double y, PinchStage stage)
        {
            var fp = ToFloatPoint(x, y);

            if (fp.IsInRange(0f, 1f) && Lumix != null)
            {
                if (Lumix.LumixState.FocusMode != FocusMode.MF)
                {
                    await Lumix.FocusPointMove(fp);
                }
                else
                {
                    await Lumix.MfAssistMove(stage, fp);
                }
            }
        }
예제 #7
0
        private async Task <bool> OldMfAssistZoom(PinchStage stage, FloatPoint floatPoint, float size)
        {
            if (stage == PinchStage.Start)
            {
                lastOldPinchSize = size;
                return(true);
            }

            if (LumixState.CameraMode != CameraMode.MFAssist)
            {
                return(await MfAssistMove(stage, floatPoint));
            }

            var val = size - lastOldPinchSize > 0 ? 10 : 5;

            Debug.WriteLine("Mag val:" + val, "MFAssist");
            return(await TryGet($"?mode=setsetting&type=mf_asst_mag&value={val}"));
        }
예제 #8
0
        public async Task <bool> FocusPointResize(PinchStage stage, FloatPoint p, float size)
        {
            ReportAction(size);
            return(await OldNewAction(
                       async() => await PinchZoom(stage, p, size),
                       async() =>
            {
                var dif = size - lastOldPinchSize;
                if (Math.Abs(dif) > 0.03f)
                {
                    lastOldPinchSize = size;
                    var val = dif > 0 ? "up" : "down";
                    await http.Get <BaseRequestResult>($"?mode=camctrl&type=touchaf_chg_area&value={val}");
                }
                if (stage == PinchStage.Stop || stage == PinchStage.Single)
                {
                    lastOldPinchSize = 0;
                }

                return true;
            },
                       Profile.NewTouch,
                       f => Profile.NewTouch = f));
        }