-
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
1 parent
cb8e205
commit 0af7c18
Showing
17 changed files
with
984 additions
and
6 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
37 changes: 37 additions & 0 deletions
37
libnavigation-core/src/main/java/com/mapbox/navigation/core/adasis/ADASISv2Message.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,37 @@ | ||
package com.mapbox.navigation.core.adasis | ||
|
||
import com.mapbox.navigation.base.ExperimentalPreviewMapboxNavigationAPI | ||
|
||
/** | ||
* Describes a class holding methods for ADASISv2 messages. | ||
*/ | ||
@ExperimentalPreviewMapboxNavigationAPI | ||
class ADASISv2Message internal constructor( | ||
private val nativeMessage: com.mapbox.navigator.ADASISv2Message | ||
) { | ||
|
||
/** | ||
* Converts this message to list of bytes | ||
*/ | ||
fun toFlatBuffer(): List<Byte> = nativeMessage.toFlatBuffer() | ||
|
||
/** | ||
* Converts this message to JSON | ||
*/ | ||
fun toJson(): String = nativeMessage.toJson() | ||
|
||
/** | ||
* Converts this message to hex string | ||
*/ | ||
fun toHex(): String = nativeMessage.toHex() | ||
|
||
/** | ||
* Converts this message to big endian | ||
*/ | ||
fun toBigEndian(): Long = nativeMessage.toBigEndian() | ||
|
||
/** | ||
* Converts this message to little endian | ||
*/ | ||
fun toLittleEndian(): Long = nativeMessage.toLittleEndian() | ||
} |
16 changes: 16 additions & 0 deletions
16
...avigation-core/src/main/java/com/mapbox/navigation/core/adasis/ADASISv2MessageCallback.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,16 @@ | ||
package com.mapbox.navigation.core.adasis | ||
|
||
import com.mapbox.navigation.base.ExperimentalPreviewMapboxNavigationAPI | ||
|
||
/** | ||
* Callback which is getting called to report ADASISv2Message | ||
*/ | ||
@ExperimentalPreviewMapboxNavigationAPI | ||
interface ADASISv2MessageCallback { | ||
|
||
/** | ||
* Called when ADASIS message is available | ||
* @param message ADASIS message | ||
*/ | ||
fun onMessage(message: ADASISv2Message) | ||
} |
64 changes: 64 additions & 0 deletions
64
libnavigation-core/src/main/java/com/mapbox/navigation/core/adasis/AdasisConfig.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,64 @@ | ||
package com.mapbox.navigation.core.adasis | ||
|
||
import com.mapbox.navigation.base.ExperimentalPreviewMapboxNavigationAPI | ||
|
||
/** | ||
* Configuration of ADASISv2 feature. | ||
* | ||
* @param cycleTimes message generation cycle times configuration | ||
* @param dataSending data sending configuration | ||
* @param pathsOptions ADASISv2 path level specific configurations | ||
*/ | ||
@ExperimentalPreviewMapboxNavigationAPI | ||
class AdasisConfig( | ||
val cycleTimes: AdasisConfigCycleTimes, | ||
val dataSending: AdasisConfigDataSending, | ||
val pathsOptions: AdasisConfigPathsConfigs, | ||
) { | ||
|
||
@JvmSynthetic | ||
internal fun toNativeAdasisConfig(): com.mapbox.navigator.AdasisConfig { | ||
return com.mapbox.navigator.AdasisConfig( | ||
cycleTimes.toNativeAdasisConfigCycleTimes(), | ||
dataSending.toNativeAdasisConfigDataSending(), | ||
pathsOptions.toNativeAdasisConfigPathsConfigs(), | ||
) | ||
} | ||
|
||
/** | ||
* Indicates whether some other object is "equal to" this one. | ||
*/ | ||
override fun equals(other: Any?): Boolean { | ||
if (this === other) return true | ||
if (javaClass != other?.javaClass) return false | ||
|
||
other as AdasisConfig | ||
|
||
if (cycleTimes != other.cycleTimes) return false | ||
if (dataSending != other.dataSending) return false | ||
if (pathsOptions != other.pathsOptions) return false | ||
|
||
return true | ||
} | ||
|
||
/** | ||
* Returns a hash code value for the object. | ||
*/ | ||
override fun hashCode(): Int { | ||
var result = cycleTimes.hashCode() | ||
result = 31 * result + dataSending.hashCode() | ||
result = 31 * result + pathsOptions.hashCode() | ||
return result | ||
} | ||
|
||
/** | ||
* Returns a string representation of the object. | ||
*/ | ||
override fun toString(): String { | ||
return "AdasisConfig(" + | ||
"cycleTimes=$cycleTimes, " + | ||
"dataSending=$dataSending, " + | ||
"pathsOptions=$pathsOptions" + | ||
")" | ||
} | ||
} |
64 changes: 64 additions & 0 deletions
64
libnavigation-core/src/main/java/com/mapbox/navigation/core/adasis/AdasisConfigCycleTimes.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,64 @@ | ||
package com.mapbox.navigation.core.adasis | ||
|
||
import com.mapbox.navigation.base.ExperimentalPreviewMapboxNavigationAPI | ||
|
||
/** | ||
* Message generation cycle times configuration | ||
* | ||
* @param metadataCycleOnStartMs time in milliseconds between sending metadata message on start | ||
* @param metadataCycleSeconds time in seconds between repetition of metadata message | ||
* @param positionCycleMs time in milliseconds between sending position message | ||
*/ | ||
@ExperimentalPreviewMapboxNavigationAPI | ||
class AdasisConfigCycleTimes( | ||
val metadataCycleOnStartMs: Int, | ||
val metadataCycleSeconds: Int, | ||
val positionCycleMs: Int, | ||
) { | ||
|
||
@JvmSynthetic | ||
internal fun toNativeAdasisConfigCycleTimes(): com.mapbox.navigator.AdasisConfigCycleTimes { | ||
return com.mapbox.navigator.AdasisConfigCycleTimes( | ||
metadataCycleOnStartMs, | ||
metadataCycleSeconds, | ||
positionCycleMs | ||
) | ||
} | ||
|
||
/** | ||
* Indicates whether some other object is "equal to" this one. | ||
*/ | ||
override fun equals(other: Any?): Boolean { | ||
if (this === other) return true | ||
if (javaClass != other?.javaClass) return false | ||
|
||
other as AdasisConfigCycleTimes | ||
|
||
if (metadataCycleOnStartMs != other.metadataCycleOnStartMs) return false | ||
if (metadataCycleSeconds != other.metadataCycleSeconds) return false | ||
if (positionCycleMs != other.positionCycleMs) return false | ||
|
||
return true | ||
} | ||
|
||
/** | ||
* Returns a hash code value for the object. | ||
*/ | ||
override fun hashCode(): Int { | ||
var result = metadataCycleOnStartMs | ||
result = 31 * result + metadataCycleSeconds | ||
result = 31 * result + positionCycleMs | ||
return result | ||
} | ||
|
||
/** | ||
* Returns a string representation of the object. | ||
*/ | ||
override fun toString(): String { | ||
return "AdasisConfigCycleTimes(" + | ||
"metadataCycleOnStartMs=$metadataCycleOnStartMs, " + | ||
"metadataCycleSeconds=$metadataCycleSeconds, " + | ||
"positionCycleMs=$positionCycleMs" + | ||
")" | ||
} | ||
} |
Oops, something went wrong.