mirror of
https://github.com/twinksoftware/Gearslip.git
synced 2026-11-10 16:02:25 +01:00
wireless: the version reply names the Wi-Fi channel type the car asked for
Strict head units, Toyota's among them, wait for more than a bare status before they send the StartRequest.
This commit is contained in:
1 parent
aadca6019e
commit
dc8544794e
1 file changed
+5
-1
@@ -190,14 +190,18 @@ object WirelessLink {
|
||||
log.hex(" version", body)
|
||||
// Laid out the way a real phone's reply is (aa-proxy-rs and LIVI both
|
||||
// parse it from real phones): 1 and 2 the version, echoing the car's;
|
||||
// 3 a serial; 4 the status; 6 the device's ids.
|
||||
// 3 a serial; 4 the status; 5 the Wi-Fi channel type the car asked for;
|
||||
// 6 the device's ids. Strict head units, such as Toyota's, hold back the
|
||||
// StartRequest until the reply carries more than the status.
|
||||
val f = Wire.fields(body)
|
||||
val serial = deviceId(context)
|
||||
val ids = Protobuf.stringField(1, serial) + Protobuf.stringField(2, UUID.randomUUID().toString())
|
||||
val channelType = Wire.varint(f, 3)
|
||||
val reply = Protobuf.varintField(1, Wire.varint(f, 1) ?: 1) +
|
||||
Protobuf.varintField(2, Wire.varint(f, 2) ?: 0) +
|
||||
Protobuf.stringField(3, serial) +
|
||||
Protobuf.varintField(4, STATUS_SUCCESS) +
|
||||
(channelType?.let { Protobuf.varintField(5, it) } ?: ByteArray(0)) +
|
||||
Protobuf.varint(((6 shl 3) or 2).toLong()) + Protobuf.varint(ids.size.toLong()) + ids
|
||||
send(output, MSG_VERSION_RESPONSE, reply)
|
||||
log.i("-> VersionResponse")
|
||||
|
||||
Reference in new issue
Block a user