-
Notifications
You must be signed in to change notification settings - Fork 319
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
72 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
51 changes: 51 additions & 0 deletions
51
libnavigation-core/src/main/java/com/mapbox/navigation/core/adasis/AdasisMessageContext.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
package com.mapbox.navigation.core.adasis | ||
|
||
/** | ||
* Context of an adasis message. | ||
* | ||
* @param positionMonotonicTimestampNanoseconds the monotonic time of a position message within a message batch. | ||
* This time is determined based on the monotonic time of the previous location and the lookAhead time. | ||
* If the lookAhead is set to 0, then the positionMonotonicTimestampNanoseconds will be the monotonic time | ||
* of the last location update. | ||
*/ | ||
class AdasisMessageContext internal constructor( | ||
val positionMonotonicTimestampNanoseconds: Long?, | ||
) { | ||
|
||
override fun equals(other: Any?): Boolean { | ||
if (this === other) return true | ||
if (javaClass != other?.javaClass) return false | ||
|
||
other as AdasisMessageContext | ||
|
||
if (positionMonotonicTimestampNanoseconds != other.positionMonotonicTimestampNanoseconds) return false | ||
|
||
return true | ||
} | ||
|
||
override fun hashCode(): Int { | ||
return positionMonotonicTimestampNanoseconds.hashCode() | ||
} | ||
|
||
override fun toString(): String { | ||
return "AdasisMessageContext(positionMonotonicTimestampNanoseconds=$positionMonotonicTimestampNanoseconds)" | ||
} | ||
|
||
/** | ||
* Temporary method to track NN changes. When NN adds a property to their object, | ||
* this method's compilation will fail. | ||
* In that case conversion both from and to native object should be adjusted. | ||
*/ | ||
private fun toNative(): com.mapbox.navigator.AdasisMessageContext { | ||
return com.mapbox.navigator.AdasisMessageContext(this.positionMonotonicTimestampNanoseconds) | ||
} | ||
|
||
internal companion object { | ||
|
||
fun fromNative( | ||
nativeContext: com.mapbox.navigator.AdasisMessageContext | ||
): AdasisMessageContext { | ||
return AdasisMessageContext(nativeContext.positionMessageTimestamp) | ||
} | ||
} | ||
} |