Exemplo n.º 1
0
 public PiCarConnection()
 {
     Name               = "Default";
     ipAddress          = "127.0.0.1";
     Mode               = ModeRequest.Types.Mode.Idle;
     currentlyMirroring = false;
 }
Exemplo n.º 2
0
 public PiCarConnection(string name, string ipAddress)
 {
     this.Name          = name;
     this.ipAddress     = ipAddress;
     _channel           = new Channel(ipAddress + ":50051", ChannelCredentials.Insecure);
     _client            = new PiCarClient(new PiCar.PiCarClient(_channel));
     Mode               = ModeRequest.Types.Mode.Idle; //Start in Idle mode
     currentlyMirroring = false;
 }
Exemplo n.º 3
0
        private void SetVehicleMode(ModeRequest.Types.Mode mode)
        {
            var picar = SelectedPiCar();

            if (picar is null)
            {
                return;
            }
            SetVehicleMode(picar, mode);
        }
Exemplo n.º 4
0
 private void SetVehicleMode(PiCarConnection picar, ModeRequest.Types.Mode mode)
 {
     try
     {
         picar.SetMode(mode);
         DeviceStatus.Text = picar.Mode.ToString();
         LogField.AppendText(DateTime.Now + ":\tSetting " + picar + "to " + picar.Mode.ToString() + "\n");
         LogField.ScrollToEnd();
     }
     catch (Exception e)
     {
         DisconnectCar(picar);
         Console.WriteLine(e);
     }
 }
Exemplo n.º 5
0
        private void SetVehicleMode(ModeRequest.Types.Mode mode)
        {
            var picar = (PiCarConnection)_mainWindow.DeviceListMn.SelectedItem;

            try
            {
                picar.SetMode(mode);
                _mainWindow.DeviceStatus.Text = picar.Mode.ToString();
                _mainWindow.LogField.AppendText(DateTime.Now + ":\tSetting " + picar + "to " + picar.Mode.ToString() + "\n");
                _mainWindow.LogField.ScrollToEnd();
            }
            catch (Exception e)
            {
                DisconnectCar();
                Console.WriteLine(e);
            }
        }
Exemplo n.º 6
0
            //Set the mode of the PiCar, return success
            public bool SetMode(ModeRequest.Types.Mode mode)
            {
                try
                {
                    var request = new ModeRequest {
                        Mode = mode
                    };
                    var ack = _client.SwitchMode(request);

                    return(ack.Success);
                }
                catch (RpcException e)
                {
                    Console.Write("RPC failed " + e);
                    throw;
                }
            }
Exemplo n.º 7
0
 public override void SetMode(ModeRequest.Types.Mode mode)
 {
     Mode = mode;
 }
Exemplo n.º 8
0
 public virtual void SetMode(ModeRequest.Types.Mode mode)
 {
     _client.SetMode(mode);
     Mode = mode;
 }