|
| 1 | +package com.mapbox.navigation.core.adasis |
| 2 | + |
| 3 | +import com.mapbox.navigation.base.ExperimentalPreviewMapboxNavigationAPI |
| 4 | + |
| 5 | +/** |
| 6 | + * Data sending configuration |
| 7 | + * |
| 8 | + * @param messageBinaryFormat binary format in which Adasis message will be sent |
| 9 | + * @param messageIntervalMs interval between sending messages in milliseconds |
| 10 | + * @param messagesInPackage number of messages in one package (one message is 8 bytes) |
| 11 | + * @param metadataCycleSeconds time in seconds between repetition of META-DATA message |
| 12 | + * @param enableRetransmission if true, retransmission will be enabled |
| 13 | + * (package will be appended with retransmission data, messages from previous cycles) |
| 14 | + * @param retransmissionMeters after passing this distance, messages will not be retransmitted |
| 15 | + */ |
| 16 | +@ExperimentalPreviewMapboxNavigationAPI |
| 17 | +class AdasisConfigDataSending( |
| 18 | + val messageBinaryFormat: AdasisMessageBinaryFormat, |
| 19 | + val messageIntervalMs: Int = 80, |
| 20 | + val messagesInPackage: Int = 20, |
| 21 | + val metadataCycleSeconds: Int = 5, |
| 22 | + val enableRetransmission: Boolean = true, |
| 23 | + val retransmissionMeters: Int = 300, |
| 24 | +) { |
| 25 | + |
| 26 | + @JvmSynthetic |
| 27 | + internal fun toNativeAdasisConfigDataSending(): com.mapbox.navigator.AdasisConfigDataSending { |
| 28 | + return com.mapbox.navigator.AdasisConfigDataSending( |
| 29 | + messageBinaryFormat.toNativeMessageBinaryFormat(), |
| 30 | + messageIntervalMs, |
| 31 | + messagesInPackage, |
| 32 | + metadataCycleSeconds, |
| 33 | + enableRetransmission, |
| 34 | + retransmissionMeters, |
| 35 | + ) |
| 36 | + } |
| 37 | + |
| 38 | + /** |
| 39 | + * Indicates whether some other object is "equal to" this one. |
| 40 | + */ |
| 41 | + override fun equals(other: Any?): Boolean { |
| 42 | + if (this === other) return true |
| 43 | + if (javaClass != other?.javaClass) return false |
| 44 | + |
| 45 | + other as AdasisConfigDataSending |
| 46 | + |
| 47 | + if (messageBinaryFormat != other.messageBinaryFormat) return false |
| 48 | + if (messageIntervalMs != other.messageIntervalMs) return false |
| 49 | + if (messagesInPackage != other.messagesInPackage) return false |
| 50 | + if (metadataCycleSeconds != other.metadataCycleSeconds) return false |
| 51 | + if (enableRetransmission != other.enableRetransmission) return false |
| 52 | + if (retransmissionMeters != other.retransmissionMeters) return false |
| 53 | + |
| 54 | + return true |
| 55 | + } |
| 56 | + |
| 57 | + /** |
| 58 | + * Returns a hash code value for the object. |
| 59 | + */ |
| 60 | + override fun hashCode(): Int { |
| 61 | + var result = messageIntervalMs |
| 62 | + result = 31 * result + messageBinaryFormat.hashCode() |
| 63 | + result = 31 * result + messagesInPackage |
| 64 | + result = 31 * result + metadataCycleSeconds.hashCode() |
| 65 | + result = 31 * result + enableRetransmission.hashCode() |
| 66 | + result = 31 * result + retransmissionMeters.hashCode() |
| 67 | + return result |
| 68 | + } |
| 69 | + |
| 70 | + /** |
| 71 | + * Returns a string representation of the object. |
| 72 | + */ |
| 73 | + override fun toString(): String { |
| 74 | + return "AdasisConfigDataSending(" + |
| 75 | + "messageBinaryFormat=$messageBinaryFormat, " + |
| 76 | + "messageIntervalMs=$messageIntervalMs, " + |
| 77 | + "messagesInPackage=$messagesInPackage, " + |
| 78 | + "messagesInPackage=$messagesInPackage, " + |
| 79 | + "metadataCycleSeconds=$metadataCycleSeconds, " + |
| 80 | + "enableRetransmission=$enableRetransmission, " + |
| 81 | + "retransmissionMeters=$retransmissionMeters" + |
| 82 | + ")" |
| 83 | + } |
| 84 | +} |
0 commit comments