Exemplo n.º 1
0
  public void guideStart(Guide guide) {
    this.mGuide = guide;

    // set location listener
    LocationState.addLocationChangeListener(this);
    // call one onLocationChange, to update actual values imediately
    onLocationChanged(LocationState.getLocation());
    // Logger.d(TAG, "X");
    Thread thread =
        new Thread(
            new Runnable() {
              public void run() {
                try {
                  while (mGuide != null) {
                    if (PreferenceItems.getGuidingSound()) {
                      mGuide.manageDistanceSoundsBeeping(mDistanceToTarget);
                    }
                    Thread.sleep(100); // kann man das nicht reduzieren??? 200,300,500,700???
                  }
                } catch (Exception e) {
                  Logger.e(TAG, "guideStart(" + mGuide + ")", e);
                }
              }
            });
    thread.start();

    for (GuidingListener list : listeners) {
      list.guideStart();
    }
  }
Exemplo n.º 2
0
  public void onLocationChanged(Location location) {
    // Logger.d(TAG, "onLocationChanged(" + location + ")");

    if (mGuide != null) {
      boolean bContinue = true;

      if (location != null) {
        bContinue = mGuide.actualizeState(location);
        mTargetName = mGuide.getTargetName();
        mAzimuthToTarget = mGuide.getAzimuthToTaget();
        mDistanceToTarget = mGuide.getDistanceToTarget();
      } else {
        bContinue = true;
        mTargetName = null;
        mAzimuthToTarget = 0.0f;
        mDistanceToTarget = 0.0f;
      }

      if (bContinue == true) {
        for (GuidingListener list : listeners) {
          list.receiveGuideEvent(mGuide, mTargetName, mAzimuthToTarget, mDistanceToTarget);
        }
      } else {
        A.getGuidingContent().guideStop();
      }
    }
  }
Exemplo n.º 3
0
  public void guideStop() {
    this.mGuide = null;

    LocationState.removeLocationChangeListener(this);

    for (GuidingListener list : listeners) {
      list.guideStop();
    }
  }
Exemplo n.º 4
0
 protected void trackGuideCallRecalculate() {
   for (GuidingListener list : listeners) {
     list.trackGuideCallRecalculate();
   }
 }