version: answer 1.7 to head units offering 4.x and 6.x too, as they accept it

This commit is contained in:
Seb3thehacker committed 2026-10-21 12:30:38 -07:00
1 parent 6efdad5e53
commit c7077f2a57
3 files changed
+15 -6

No files matched your search

@@ -1,6 +1,10 @@
package app.seb3thehacker.gearslip
/** Advertises our supported 1.x version, as Android Auto does for older head units. */
/**
* Advertises our supported 1.x version, as Android Auto does for older head units. Head units that
* offer a newer major version (LIVI asks for 6.1, a RAV4 and the DHU for 4.2) still accept a 1.x
* answer, so only a major version of 0 is refused.
*/
internal object ProtocolVersion {
data class Response(val major: Int, val minor: Int, val supported: Boolean) {
val bytes: ByteArray get() = byteArrayOf(
@@ -9,5 +13,5 @@ internal object ProtocolVersion {
)
}
fun respond(major: Int, minor: Int): Response = Response(1, 7, major == 1 && minor in 0..0xffff)
fun respond(major: Int, minor: Int): Response = Response(1, 7, major >= 1 && minor in 0..0xffff)
}