Skip to content

Commit

Permalink
Platform types for adasis
Browse files Browse the repository at this point in the history
  • Loading branch information
DzmitryFomchyn committed Sep 28, 2023
1 parent cb8e205 commit 0af7c18
Show file tree
Hide file tree
Showing 17 changed files with 984 additions and 6 deletions.
146 changes: 145 additions & 1 deletion libnavigation-core/api/current.txt
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ package com.mapbox.navigation.core {
method @com.mapbox.navigation.base.ExperimentalPreviewMapboxNavigationAPI public void resetAdasisMessageCallback();
method @Deprecated public void resetTripSession();
method public void resetTripSession(com.mapbox.navigation.core.TripSessionResetCallback callback);
method @com.mapbox.navigation.base.ExperimentalPreviewMapboxNavigationAPI public void setAdasisMessageCallback(com.mapbox.navigator.ADASISv2MessageCallback callback, com.mapbox.navigator.AdasisConfig adasisConfig);
method @com.mapbox.navigation.base.ExperimentalPreviewMapboxNavigationAPI public void setAdasisMessageCallback(com.mapbox.navigation.core.adasis.ADASISv2MessageCallback callback, com.mapbox.navigation.core.adasis.AdasisConfig adasisConfig);
method public void setArrivalController(com.mapbox.navigation.core.arrival.ArrivalController? arrivalController = com.mapbox.navigation.core.arrival.AutoArrivalController());
method public void setArrivalController();
method public void setNavigationRoutes(java.util.List<com.mapbox.navigation.base.route.NavigationRoute> routes, int initialLegIndex = 0, com.mapbox.navigation.core.RoutesSetCallback? callback = null);
Expand Down Expand Up @@ -192,6 +192,150 @@ package com.mapbox.navigation.core {

}

package com.mapbox.navigation.core.adasis {

@com.mapbox.navigation.base.ExperimentalPreviewMapboxNavigationAPI public final class ADASISv2Message {
method public long toBigEndian();
method public java.util.List<java.lang.Byte> toFlatBuffer();
method public String toHex();
method public String toJson();
method public long toLittleEndian();
}

@com.mapbox.navigation.base.ExperimentalPreviewMapboxNavigationAPI public interface ADASISv2MessageCallback {
method public void onMessage(com.mapbox.navigation.core.adasis.ADASISv2Message message);
}

@com.mapbox.navigation.base.ExperimentalPreviewMapboxNavigationAPI public final class AdasisConfig {
ctor public AdasisConfig(com.mapbox.navigation.core.adasis.AdasisConfigCycleTimes cycleTimes, com.mapbox.navigation.core.adasis.AdasisConfigDataSending dataSending, com.mapbox.navigation.core.adasis.AdasisConfigPathsConfigs pathsOptions);
method public com.mapbox.navigation.core.adasis.AdasisConfigCycleTimes getCycleTimes();
method public com.mapbox.navigation.core.adasis.AdasisConfigDataSending getDataSending();
method public com.mapbox.navigation.core.adasis.AdasisConfigPathsConfigs getPathsOptions();
property public final com.mapbox.navigation.core.adasis.AdasisConfigCycleTimes cycleTimes;
property public final com.mapbox.navigation.core.adasis.AdasisConfigDataSending dataSending;
property public final com.mapbox.navigation.core.adasis.AdasisConfigPathsConfigs pathsOptions;
}

@com.mapbox.navigation.base.ExperimentalPreviewMapboxNavigationAPI public final class AdasisConfigCycleTimes {
ctor public AdasisConfigCycleTimes(int metadataCycleOnStartMs, int metadataCycleSeconds, int positionCycleMs);
method public int getMetadataCycleOnStartMs();
method public int getMetadataCycleSeconds();
method public int getPositionCycleMs();
property public final int metadataCycleOnStartMs;
property public final int metadataCycleSeconds;
property public final int positionCycleMs;
}

@com.mapbox.navigation.base.ExperimentalPreviewMapboxNavigationAPI public final class AdasisConfigDataSending {
ctor public AdasisConfigDataSending(int messageIntervalMs, int messagesInPackage, boolean sortProfileshortsByOffset, boolean sortProfilelongsByOffset, boolean enableRetransmission);
method public boolean getEnableRetransmission();
method public int getMessageIntervalMs();
method public int getMessagesInPackage();
method public boolean getSortProfilelongsByOffset();
method public boolean getSortProfileshortsByOffset();
property public final boolean enableRetransmission;
property public final int messageIntervalMs;
property public final int messagesInPackage;
property public final boolean sortProfilelongsByOffset;
property public final boolean sortProfileshortsByOffset;
}

@com.mapbox.navigation.base.ExperimentalPreviewMapboxNavigationAPI public final class AdasisConfigMessageOptions {
ctor public AdasisConfigMessageOptions(boolean enable, int radiusMeters, int repetitionMeters);
method public boolean getEnable();
method public int getRadiusMeters();
method public int getRepetitionMeters();
property public final boolean enable;
property public final int radiusMeters;
property public final int repetitionMeters;
}

@com.mapbox.navigation.base.ExperimentalPreviewMapboxNavigationAPI public final class AdasisConfigPathLevelOptions {
ctor public AdasisConfigPathLevelOptions(com.mapbox.navigation.core.adasis.Stub stub, com.mapbox.navigation.core.adasis.Segment segment, com.mapbox.navigation.core.adasis.ProfileShort profileShort, com.mapbox.navigation.core.adasis.ProfileLong profileLong);
method public com.mapbox.navigation.core.adasis.ProfileLong getProfileLong();
method public com.mapbox.navigation.core.adasis.ProfileShort getProfileShort();
method public com.mapbox.navigation.core.adasis.Segment getSegment();
method public com.mapbox.navigation.core.adasis.Stub getStub();
property public final com.mapbox.navigation.core.adasis.ProfileLong profileLong;
property public final com.mapbox.navigation.core.adasis.ProfileShort profileShort;
property public final com.mapbox.navigation.core.adasis.Segment segment;
property public final com.mapbox.navigation.core.adasis.Stub stub;
}

@com.mapbox.navigation.base.ExperimentalPreviewMapboxNavigationAPI public final class AdasisConfigPathsConfigs {
ctor public AdasisConfigPathsConfigs(com.mapbox.navigation.core.adasis.AdasisConfigPathLevelOptions mpp, com.mapbox.navigation.core.adasis.AdasisConfigPathLevelOptions level1, com.mapbox.navigation.core.adasis.AdasisConfigPathLevelOptions level2);
method public com.mapbox.navigation.core.adasis.AdasisConfigPathLevelOptions getLevel1();
method public com.mapbox.navigation.core.adasis.AdasisConfigPathLevelOptions getLevel2();
method public com.mapbox.navigation.core.adasis.AdasisConfigPathLevelOptions getMpp();
property public final com.mapbox.navigation.core.adasis.AdasisConfigPathLevelOptions level1;
property public final com.mapbox.navigation.core.adasis.AdasisConfigPathLevelOptions level2;
property public final com.mapbox.navigation.core.adasis.AdasisConfigPathLevelOptions mpp;
}

@com.mapbox.navigation.base.ExperimentalPreviewMapboxNavigationAPI public final class AdasisConfigProfileLongTypeOptions {
ctor public AdasisConfigProfileLongTypeOptions(boolean lat, boolean lon, boolean alt, boolean trafficSign, boolean extendedLane);
method public boolean getAlt();
method public boolean getExtendedLane();
method public boolean getLat();
method public boolean getLon();
method public boolean getTrafficSign();
property public final boolean alt;
property public final boolean extendedLane;
property public final boolean lat;
property public final boolean lon;
property public final boolean trafficSign;
}

@com.mapbox.navigation.base.ExperimentalPreviewMapboxNavigationAPI public final class AdasisConfigProfileShortTypeOptions {
ctor public AdasisConfigProfileShortTypeOptions(boolean slopeStep, boolean slopeLinear, boolean curvature, boolean routeNumTypes, boolean roadCondition, boolean roadAccessibility, boolean variableSpeedSign, boolean headingChange);
method public boolean getCurvature();
method public boolean getHeadingChange();
method public boolean getRoadAccessibility();
method public boolean getRoadCondition();
method public boolean getRouteNumTypes();
method public boolean getSlopeLinear();
method public boolean getSlopeStep();
method public boolean getVariableSpeedSign();
property public final boolean curvature;
property public final boolean headingChange;
property public final boolean roadAccessibility;
property public final boolean roadCondition;
property public final boolean routeNumTypes;
property public final boolean slopeLinear;
property public final boolean slopeStep;
property public final boolean variableSpeedSign;
}

@com.mapbox.navigation.base.ExperimentalPreviewMapboxNavigationAPI public final class ProfileLong {
ctor public ProfileLong(com.mapbox.navigation.core.adasis.AdasisConfigMessageOptions options, com.mapbox.navigation.core.adasis.AdasisConfigProfileLongTypeOptions types);
method public com.mapbox.navigation.core.adasis.AdasisConfigMessageOptions getOptions();
method public com.mapbox.navigation.core.adasis.AdasisConfigProfileLongTypeOptions getTypes();
property public final com.mapbox.navigation.core.adasis.AdasisConfigMessageOptions options;
property public final com.mapbox.navigation.core.adasis.AdasisConfigProfileLongTypeOptions types;
}

@com.mapbox.navigation.base.ExperimentalPreviewMapboxNavigationAPI public final class ProfileShort {
ctor public ProfileShort(com.mapbox.navigation.core.adasis.AdasisConfigMessageOptions options, com.mapbox.navigation.core.adasis.AdasisConfigProfileShortTypeOptions types);
method public com.mapbox.navigation.core.adasis.AdasisConfigMessageOptions getOptions();
method public com.mapbox.navigation.core.adasis.AdasisConfigProfileShortTypeOptions getTypes();
property public final com.mapbox.navigation.core.adasis.AdasisConfigMessageOptions options;
property public final com.mapbox.navigation.core.adasis.AdasisConfigProfileShortTypeOptions types;
}

@com.mapbox.navigation.base.ExperimentalPreviewMapboxNavigationAPI public final class Segment {
ctor public Segment(com.mapbox.navigation.core.adasis.AdasisConfigMessageOptions options);
method public com.mapbox.navigation.core.adasis.AdasisConfigMessageOptions getOptions();
property public final com.mapbox.navigation.core.adasis.AdasisConfigMessageOptions options;
}

@com.mapbox.navigation.base.ExperimentalPreviewMapboxNavigationAPI public final class Stub {
ctor public Stub(com.mapbox.navigation.core.adasis.AdasisConfigMessageOptions options);
method public com.mapbox.navigation.core.adasis.AdasisConfigMessageOptions getOptions();
property public final com.mapbox.navigation.core.adasis.AdasisConfigMessageOptions options;
}

}

package com.mapbox.navigation.core.arrival {

public interface ArrivalController {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ import com.mapbox.navigation.base.trip.notification.NotificationAction
import com.mapbox.navigation.base.trip.notification.TripNotification
import com.mapbox.navigation.base.trip.notification.TripNotificationInterceptor
import com.mapbox.navigation.core.accounts.BillingController
import com.mapbox.navigation.core.adasis.ADASISv2Message
import com.mapbox.navigation.core.adasis.ADASISv2MessageCallback
import com.mapbox.navigation.core.adasis.AdasisConfig
import com.mapbox.navigation.core.arrival.ArrivalController
import com.mapbox.navigation.core.arrival.ArrivalObserver
import com.mapbox.navigation.core.arrival.ArrivalProgressObserver
Expand Down Expand Up @@ -136,8 +139,6 @@ import com.mapbox.navigation.utils.internal.logD
import com.mapbox.navigation.utils.internal.logE
import com.mapbox.navigation.utils.internal.logI
import com.mapbox.navigation.utils.internal.monitorChannelWithException
import com.mapbox.navigator.ADASISv2MessageCallback
import com.mapbox.navigator.AdasisConfig
import com.mapbox.navigator.AlertsServiceOptions
import com.mapbox.navigator.ConfigHandle
import com.mapbox.navigator.ElectronicHorizonOptions
Expand Down Expand Up @@ -1979,16 +1980,17 @@ class MapboxNavigation @VisibleForTesting internal constructor(
}

/**
* TODO use platform types?
*
* Sets a callback for ADASIS messages
*
* @param callback Message callback
* @param adasisConfig Adasis config
*/
@ExperimentalPreviewMapboxNavigationAPI
fun setAdasisMessageCallback(callback: ADASISv2MessageCallback, adasisConfig: AdasisConfig) {
navigator.setAdasisMessageCallback(callback, adasisConfig)
navigator.setAdasisMessageCallback(
{ message -> callback.onMessage(ADASISv2Message(message)) },
adasisConfig.toNativeAdasisConfig()
)
}

/**
Expand Down
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()
}
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)
}
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" +
")"
}
}
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" +
")"
}
}
Loading

0 comments on commit 0af7c18

Please sign in to comment.