Exemplo n.º 1
0
 @Override
 public void onProgressChanged(SeekBar seekBar, int i, boolean b) {
   final Drone drone = Resources.drone;
   if (drone != null) {
     double value = (double) i / 100;
     try {
       drone.getActionHandler().engineFactorSlider(value, 0.0);
     } catch (DroneConnectionException e) {
       e.printStackTrace();
     }
   }
 }
Exemplo n.º 2
0
 @Override
 public void onClick(View view) {
   final Drone drone = Resources.drone;
   if (drone != null) {
     try {
       drone.getActionHandler().stop();
       ((ToggleButton) findViewById(R.id.startButton)).setChecked(false);
       ((SeekBar) findViewById(R.id.engineFactorSeekBar)).setProgress(0);
     } catch (DroneConnectionException | CommandAckFailureException e) {
       e.printStackTrace();
     }
   }
 }
Exemplo n.º 3
0
 @Override
 public void onCheckedChanged(CompoundButton compoundButton, boolean status) {
   final Drone drone = Resources.drone;
   if (drone != null)
     try {
       if (status) {
         drone.getActionHandler().start();
       } else {
         drone.getActionHandler().stop();
       }
     } catch (DroneConnectionException | CommandAckFailureException e) {
       e.printStackTrace();
       ((ToggleButton) findViewById(R.id.startButton)).setChecked(false);
       ((SeekBar) findViewById(R.id.engineFactorSeekBar)).setProgress(0);
     }
 }