Example #1
0
 public void setPower(boolean power) {
   if (!car.getPhone().getOnCall()) {
     if (power) {
       if (currentStation == null) setNextStation();
       startDate = new Date();
       radioStartTime = System.currentTimeMillis();
     } else {
       makeStationLog();
       car.addRadioLog(new RadioLog(user.getUserName(), startDate, radioStartTime));
       currentStation = null;
       startDate = null;
       radioStartTime = 0;
     }
     radioOn = power;
   } else {
     if (radioOn) {
       makeStationLog();
       car.addRadioLog(new RadioLog(user.getUserName(), startDate, radioStartTime));
       currentStation = null;
       startDate = null;
       radioStartTime = 0;
     }
     radioOn = false;
   }
 }
Example #2
0
 public void updateLocation() {
   location = car.getCurrentRoute().getLocation();
 }