Exemple #1
0
 /**
  * Initializes the tracker.
  *
  * @param minimum true for minimum initialization, false for full initialization
  * @return a message that depends on the success of the initialization
  * @throws TrackerException thrown if not connected
  */
 String initialize(boolean minimum) throws TrackerException {
   isConnected();
   trk.initialize();
   if (trk.initialized(false)) {
     return "Tracker initialized.\n";
   }
   return "Tracker failed to initialize.\n";
 }
Exemple #2
0
  /**
   * Connects to the tracker. Also checks to see if the tracker is ready to be initialized and
   * checks the measurement mode of the tracker.
   *
   * @return ready to be initialized Y/N, measurement mode
   * @throws TrackerException thrown if already connected, or if the connect attempt failed
   */
  String connect() throws TrackerException {
    String info;

    if (trk.connected()) {
      throw new TrackerException("Already connected to the tracker.\n");
    }

    trk.connect(ipAddress, name, password);
    if (trk.connected()) {
      Bookkeeper.getInstance().toggleTrkCon();
      info = "Connected to tracker on IP address: " + ipAddress + "\n";
      if (trk.initialized(false)) {
        info += "Tracker initialized.\n";
      } else {
        if (trk.readyToInitialize(false)) {
          info += "Tracker ready to be initialized.\n";
        } else {
          info += "Tracker not ready to be initialized.\n";
        }
      }
      String s = trk.distanceMeasureMode().toString();

      if (s.contains("ADM") && s.contains("Only")) {
        info += "Distance Measure Mode is ADM only.\n";
        Bookkeeper.getInstance().setTrkMeasmode(TrackerMeasureMode.ADM);
      } else if (s.contains("Interferometer")) {
        if (s.contains("ADM")) {
          info += "Distance Measure Mode is IFM set by ADM.\n";
          Bookkeeper.getInstance().setTrkMeasmode(TrackerMeasureMode.IFMBYADM);
        } else {
          info += "Distance Measure Mode is IFM.\n";
          Bookkeeper.getInstance().setTrkMeasmode(TrackerMeasureMode.IFM);
        }
      }
      return info;
    } else {
      throw new TrackerException("Connection to the tracker failed.\n");
    }
  }