private bool ProcessAction(string requestPath, NameValueCollection parameters)
        {
            try {
                switch (requestPath)
                {
                case "/motor/forward":
                    _vehiclePrecise.Forward(Convert.ToSByte(parameters.Get("speed")), Convert.ToUInt32(parameters.Get("steps")));
                    return(true);

                case "/motor/backward":
                    _vehiclePrecise.Backward(Convert.ToSByte(parameters.Get("speed")), Convert.ToUInt32(parameters.Get("steps")));
                    return(true);

                case "/motor/left":
                    _vehicle.SpinLeft(Convert.ToSByte(parameters.Get("speed")), Convert.ToUInt32(parameters.Get("degrees")), true);
                    return(true);

                case "/motor/right":
                    _vehicle.SpinRight(Convert.ToSByte(parameters.Get("speed")), Convert.ToUInt32(parameters.Get("degrees")), true);
                    return(true);

                case "/motor/brake":
                    _vehicle.Brake();
                    return(true);

                case "/motor/leftforward":
                    _vehicle.TurnLeftForward(Convert.ToSByte(parameters.Get("speed")), Convert.ToSByte(parameters.Get("turnPrecent")));
                    Thread.Sleep(Convert.ToInt32(parameters.Get("delay")));
                    _vehicle.Brake();
                    return(true);

                case "/motor/leftbackward":
                    _vehicle.TurnLeftReverse(Convert.ToSByte(parameters.Get("speed")), Convert.ToSByte(parameters.Get("turnPrecent")));
                    Thread.Sleep(Convert.ToInt32(parameters.Get("delay")));
                    _vehicle.Brake();
                    return(true);

                case "/motor/rightforward":
                    _vehicle.TurnRightForward(Convert.ToSByte(parameters.Get("speed")), Convert.ToSByte(parameters.Get("turnPrecent")));
                    Thread.Sleep(Convert.ToInt32(parameters.Get("delay")));
                    _vehicle.Brake();
                    return(true);

                case "/motor/rightbackward":
                    _vehicle.TurnRightReverse(Convert.ToSByte(parameters.Get("speed")), Convert.ToSByte(parameters.Get("turnPrecent")));
                    Thread.Sleep(Convert.ToInt32(parameters.Get("delay")));
                    _vehicle.Brake();
                    return(true);

                case "/hefvork/reset":
                    _hefVork.Reset();
                    return(true);

                case "/hefvork/fullyDown":
                    _hefVork.MoveDown(Convert.ToInt32(parameters.Get("precent")));
                    return(true);

                case "/hefvork/down":
                    _hefVork.MoveDown(Convert.ToInt32(parameters.Get("precent")));
                    return(true);

                case "/hefvork/up":
                    _hefVork.MoveUp(Convert.ToInt32(parameters.Get("precent")));
                    return(true);
                }
            } catch (Exception e) {
                MonoBrickFirmware.Display.LcdConsole.WriteLine(e.Message);
            }

            return(false);
        }
Exemple #2
0
 public void Step1()
 {
     _hefVork.Reset();
     _hefVork.MoveDown(100);
 }