com.here.msdkui.guidance.base

## Class BaseGuidancePresenter

- java.lang.Object
- - com.here.msdkui.guidance.base.BaseGuidancePresenter

- Direct Known Subclasses:
    GuidanceEstimatedArrivalViewPresenter, GuidanceManeuverPresenter, GuidanceNextManeuverPresenter, GuidanceSpeedPresenter, GuidanceStreetLabelPresenter

      public class BaseGuidancePresenter
      extends java.lang.Object

  Base class for guidance presenters.

  The class interacts with `NavigationManager` and `PositioningManager` to support easier handling of guidance events.

- - ### Constructor Summary

    Constructors
    Modifier | Constructor and Description
    --- | ---
    `protected` | `BaseGuidancePresenter(com.here.android.mpa.guidance.NavigationManager navigationManager, com.here.android.mpa.routing.Route route)` Constructs a new instance using a `NavigationManager` instance and a route to follow during guidance.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected void` | `disableSpeedWarnings()` Called to de-register speed warnings listener.
    `protected void` | `enableSpeedWarnings()` Enable listening to speed limit warnings.
    `com.here.android.mpa.routing.Maneuver` | `getAfterNextManeuver()` Gets the `Maneuver` after next `Maneuver`.
    `long` | `getDestinationDistance()` Gets distance to the destination.
    `java.util.Date` | `getEta()` Gets estimated arrival date.
    `com.here.android.mpa.routing.Maneuver` | `getNextManeuver()` Gets the next `Maneuver`.
    `long` | `getNextManeuverDistance()` Gets the distance to the next `Maneuver`.
    `com.here.android.mpa.routing.Route` | `getRoute()` Gets the route that was set to be used for guidance.
    `java.lang.Integer` | `getTimeToArrival()` Gets time to arrive at the destination.
    `protected void` | `handleGpsLost()` Notifies when GPS signal is lost.
    `protected void` | `handleGpsRestore()` Notifies when GPS signal is restored.
    `protected void` | `handleManeuverEvent()` Called after resuming the presenter.
    `protected void` | `handleNewInstructionEvent()` Notifies on new instruction events generated by `NavigationManager`.
    `protected void` | `handlePositionUpdate()`
    `protected void` | `handleRerouteBegin()` Notifies when rerouting begins.
    `protected void` | `handleRerouteEnd(com.here.android.mpa.routing.RouteResult routeResult)` Notifies when rerouting ends with success.
    `protected void` | `handleRerouteFailed(com.here.android.mpa.routing.RoutingError error)` Notifies when rerouting ends with failure.
    `protected void` | `handleSpeedExceeded(float speedLimit)` Notifies when driving over speed limit.
    `protected void` | `handleSpeedExceededEnd(float speedLimit)` Notifies when no longer driving over speed limit.
    `void` | `pause()` Pauses presenter to stop listening to navigation events.
    `void` | `resume()` Resumes presenter to start listening to navigation events.
    `void` | `setRoute(com.here.android.mpa.routing.Route route)` Sets a new route that should be used for guidance.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### BaseGuidancePresenter

          protected BaseGuidancePresenter(@NonNull
                                          com.here.android.mpa.guidance.NavigationManager navigationManager,
                                          com.here.android.mpa.routing.Route route)

      Constructs a new instance using a `NavigationManager` instance and a route to follow during guidance.
      Parameters:
        `navigationManager` - a `NavigationManager`.
        `route` - a route to be used for guidance.

  - ### Method Detail

    - #### resume

          public void resume()

      Resumes presenter to start listening to navigation events.

    - #### pause

          public void pause()

      Pauses presenter to stop listening to navigation events.

    - #### enableSpeedWarnings

          protected final void enableSpeedWarnings()

      Enable listening to speed limit warnings.

    - #### disableSpeedWarnings

          protected final void disableSpeedWarnings()

      Called to de-register speed warnings listener.

    - #### handleManeuverEvent

          protected void handleManeuverEvent()

      Called after resuming the presenter. Subclasses may override for custom needs.

    - #### handleNewInstructionEvent

          protected void handleNewInstructionEvent()

      Notifies on new instruction events generated by `NavigationManager`. Subclasses may override the method if they are interested in the events forwarded by `NavigationManager.NewInstructionEventListener`.

    - #### handleGpsLost

          protected void handleGpsLost()

      Notifies when GPS signal is lost.

    - #### handleGpsRestore

          protected void handleGpsRestore()

      Notifies when GPS signal is restored.

    - #### handleRerouteBegin

          protected void handleRerouteBegin()

      Notifies when rerouting begins.

    - #### handleRerouteEnd

          protected void handleRerouteEnd(com.here.android.mpa.routing.RouteResult routeResult)

      Notifies when rerouting ends with success.
      Parameters:
        `routeResult` - `RouteResult` object containing `Route` as result of route calculation.

    - #### handleRerouteFailed

          protected void handleRerouteFailed(com.here.android.mpa.routing.RoutingError error)

      Notifies when rerouting ends with failure.
      Parameters:
        `error` - rerouting error.

    - #### handlePositionUpdate

          protected void handlePositionUpdate()

    - #### handleSpeedExceeded

          protected void handleSpeedExceeded(float speedLimit)

      Notifies when driving over speed limit.
      Parameters:
        `speedLimit` - current speed limit.

    - #### handleSpeedExceededEnd

          protected void handleSpeedExceededEnd(float speedLimit)

      Notifies when no longer driving over speed limit.
      Parameters:
        `speedLimit` - current speed limit.

    - #### getNextManeuver

          public com.here.android.mpa.routing.Maneuver getNextManeuver()

      Gets the next `Maneuver`.
      Returns:
        next `Maneuver`.

    - #### getAfterNextManeuver

          public com.here.android.mpa.routing.Maneuver getAfterNextManeuver()

      Gets the `Maneuver` after next `Maneuver`.
      Returns:
        after-next `Maneuver`.

    - #### getNextManeuverDistance

          public long getNextManeuverDistance()

      Gets the distance to the next `Maneuver`.
      Returns:
        distance to next `Maneuver`.

    - #### getRoute

          public com.here.android.mpa.routing.Route getRoute()

      Gets the route that was set to be used for guidance.
      Returns:
        a route.

    - #### setRoute

          public void setRoute(com.here.android.mpa.routing.Route route)

      Sets a new route that should be used for guidance.
      Parameters:
        `route` - a route.

    - #### getEta

          @Nullable
          public java.util.Date getEta()

      Gets estimated arrival date.
      Returns:
        a `Date` of arrival at the destination.

    - #### getDestinationDistance

          public long getDestinationDistance()

      Gets distance to the destination.
      Returns:
        distance in meters.

    - #### getTimeToArrival

          public java.lang.Integer getTimeToArrival()

      Gets time to arrive at the destination.
      Returns:
        time to arrive in seconds or -1 if time couldn't be retrieved.