Beispiel #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);
        }
Beispiel #2
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);
            }
        }