Skip to content

Add telem current location engine being used track support - #382

Closed
Guardiola31337 wants to merge 3 commits into
masterfrom
pg-telem-current-location-engine
Closed

Guardiola31337 wants to merge 3 commits into
masterfrom
pg-telem-current-location-engine

Conversation

@Guardiola31337

@Guardiola31337 Guardiola31337 commented Oct 16, 2017 •

Copy link
Copy Markdown
Contributor
  • Fixes NavigationMetricsWrapper builder methods so that include the current location engine being used

In order to merge this PR mapbox/mapbox-java#605 needs to get merged first.

TODO

👀 @zugaldia @cammace @electrostat @ericrwolfe

@danesfeder

Copy link
Copy Markdown
Contributor

@Guardiola31337 NavigationService calls most of the methods in NavigationMetricsWrapper and has the LocationEngine being used, so would we just need to add a parameter to the methods that need it?

@Guardiola31337

Copy link
Copy Markdown
Contributor Author

@danesfeder we could add a field in the SessionState so then it could be pulled in from the NavigationMetricsWrapper builder methods and then the only step missing would be changing https://github.com/mapbox/mapbox-navigation-android/pull/382/files#diff-5931fbaaadf4be3f27012c6a35a12a83R37 "placeholder" with something like sessionState.obtainLocationEngineName() which will return the LocationEngine class name being used. What do you think?

@danesfeder

Copy link
Copy Markdown
Contributor

@Guardiola31337 I added a field in SessionState for the location engine name, but it doesn't seem to update when we log the events. Not sure if I'm doing something wrong with AutoValue here

(int) routeProgress.durationRemaining(), sessionState.startTimestamp()
));
);
Timber.d("Depart Location Engine name: " + sessionState.locationEngineName());

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we remove all the logging and remove the Hashtable<String, Object> departEvent returning it back to the original?

.previousRouteDistancesCompleted(0)
.startTimestamp(new Date())
.rerouteCount(0)
.locationEngineName(locationEngine.getClass().getSimpleName())

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Be careful because this is executed before setLocationEngine so it always has the original value (LostLocationEngine).

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe adding it to the SessionState is not the best option.

if (isServiceAvailable()) {
navigationService.acquireLocationEngine();
// Update location engine name in the session state
sessionState.toBuilder().locationEngineName(locationEngine.getClass().getSimpleName());

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is currently doing nothing. the line needs to say:

sessionState = sessionState.toBuilder().locationEngineName(locationEngine.getClass().getSimpleName()).build();

if (isServiceAvailable()) {
navigationService.acquireLocationEngine();
// Update location engine name in the session state
sessionState.toBuilder().locationEngineName(locationEngine.getClass().getSimpleName());

@Guardiola31337 Guardiola31337 Oct 16, 2017 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Be careful because this not always executed.
BTW, we're not doing anything here.
Even if we do sessionState = sessionState.toBuilder().locationEngineName(locationEngine.getClass().getSimpleName()).build(); it won't work because 👉 https://github.com/mapbox/mapbox-navigation-android/pull/382/files#r144950030 and because we'll need to recreate the whole sessionState adding each value to the different parameters (toBuilder() doesn't return the current values from the object 😞).

@Guardiola31337

Guardiola31337 commented Oct 17, 2017 •

Copy link
Copy Markdown
Contributor Author

Decide where to include location engine name being used so it could be pulled in from NavigationMetricsWrapper builder methods (now there is a "placeholder")

c893437 addressed ☝️
Ready for a second round of 👀 @cammace @danesfeder

@Guardiola31337
Guardiola31337 force-pushed the pg-telem-current-location-engine branch from 4b8ba80 to c893437 Compare October 17, 2017 18:02
Timber.v("Arrived event occurred");
sessionState = sessionState.toBuilder().arrivalTimestamp(new Date()).build();
NavigationMetricsWrapper.arriveEvent(sessionState, routeProgress, location);
NavigationMetricsWrapper.arriveEvent(sessionState, routeProgress, location, locationEngineName);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@cammace would it make sense to move the arrive event to NavigationService like the rest of the events? That way most of the current changes to this class could be self contained within NavigationService. @Guardiola31337

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't immediately see any issue with moving the entire onProgressChange into NavigationService` to keep all the events in the same class. Though I think whichever path we take, we should only have 1 internal onProgressChange to keep things simple. Let's do this in a different PR and go ahead and merge this one?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@cammace @ericrwolfe
Follow up ticket 👉 #402

@Guardiola31337

Copy link
Copy Markdown
Contributor Author

Had trouble resolving the conflicts from master.
OP work is now implemented in #401
Closing here.

@Guardiola31337
Guardiola31337 deleted the pg-telem-current-location-engine branch October 19, 2017 10:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

⚠️ DO NOT MERGE PR should not be merged!

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants