示例#1
0
 @edu.umd.cs.findbugs.annotations.SuppressWarnings(value = "IS2_INCONSISTENT_SYNC")
 // Called from synchronised code
 public boolean isZTCModePossible() {
   if (sv.hasZTCMode()) {
     return true;
   } else {
     return false;
   }
 }
示例#2
0
  public synchronized void notifyVersion(SprogVersion v) {
    sv = v;
    if (log.isDebugEnabled()) {
      log.debug("Found: " + sv.toString());
    }
    if (sv.sprogType.isSprog() == false) {
      // Didn't recognize a SPROG so check if it is in boot mode already
      JOptionPane.showMessageDialog(
          null, "SPROG prompt not found", "SPROG Console", JOptionPane.ERROR_MESSAGE);
    } else {
      if (sv.sprogType.sprogType > SprogType.SPROGIIv3) {
        currentTextField.setToolTipText("Enter new current limit in milliAmps (less than 2500)");
      }
      // We know what we're connected to
      setTitle(title() + " - Connected to " + sv.toString());

      // Enable blueline & firmware unlock check boxes
      if (isBlueLineSupportPossible()) {
        if (log.isDebugEnabled()) {
          log.debug("Enable blueline check box");
        }
        blueCheckBox.setEnabled(true);
        if (log.isDebugEnabled()) {
          log.debug(Boolean.toString(blueCheckBox.isEnabled()));
        }
      }
      if (isFirmwareUnlockPossible()) {
        if (log.isDebugEnabled()) {
          log.debug("Enable firmware check box");
        }
        unlockCheckBox.setEnabled(true);
        if (log.isDebugEnabled()) {
          log.debug(Boolean.toString(unlockCheckBox.isEnabled()));
        }
      }

      ztcCheckBox.setEnabled(isZTCModePossible());

      // Get Current Limit if available
      if (isCurrentLimitPossible() && sm.getInUseCount() == 0) {
        state = State.CURRENTQUERYSENT;
        msg = new SprogMessage(1);
        msg.setOpCode('I');
        nextLine("cmd: \"" + msg + "\"\n", "");
        tc.sendSprogMessage(msg, this);
      } else {
        // Set default and get the mode word
        currentLimit = (SprogConstants.DEFAULT_I * 4880) / 470;
        currentTextField.setText(String.valueOf(SprogConstants.DEFAULT_I));

        // Only send this if we have zero active slots in slot manager
        // in command mode
        if (sm.getInUseCount() == 0) {
          state = State.MODEQUERYSENT;
          msg = new SprogMessage(1);
          msg.setOpCode('M');
          nextLine("cmd: \"" + msg + "\"\n", "");
          tc.sendSprogMessage(msg, this);
        } else {
          state = State.IDLE;
        }
      }
    }
  }