Skip to content

Commit 07c30df

Browse files
eriedclaude
andcommitted
Adapters: fix notifyConnectingTo to match the new return type
The base WheelAdapter signature became notifyConnectingTo(deviceName: String?): DecodeResult.ModelName? on the p6-fixes side so the InMotionV2Adapter can surface the model immediately on connect (instead of waiting for the info-bundle round trip). The 5 new adapters in more-wheels-support still had Unit returns. Each one now returns null after setting detectedModel; the CompositeWheelAdapter propagates whichever inner adapter's result through. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent d362c15 commit 07c30df

6 files changed

Lines changed: 12 additions & 7 deletions

File tree

app/src/main/java/com/eried/eucplanet/ble/BegodeAdapter.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,9 @@ class BegodeAdapter @Inject constructor() : WheelAdapter {
4141

4242
override fun bleProfile(): BleProfile = BleProfile.HM10
4343

44-
override fun notifyConnectingTo(deviceName: String?) {
44+
override fun notifyConnectingTo(deviceName: String?): DecodeResult.ModelName? {
4545
detectedModel = deviceName?.let { BegodeModel.fromReportedName(it) }
46+
return null
4647
}
4748

4849
// Begode wheels stream telemetry unsolicited — no init handshake, no poll

app/src/main/java/com/eried/eucplanet/ble/CompositeWheelAdapter.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,9 @@ class CompositeWheelAdapter @Inject constructor(
3434

3535
override fun bleProfile(): BleProfile = active.bleProfile()
3636

37-
override fun notifyConnectingTo(deviceName: String?) {
37+
override fun notifyConnectingTo(deviceName: String?): DecodeResult.ModelName? {
3838
active = pickAdapter(deviceName)
39-
active.notifyConnectingTo(deviceName)
39+
return active.notifyConnectingTo(deviceName)
4040
}
4141

4242
override fun initSequence(): List<ByteArray> = active.initSequence()

app/src/main/java/com/eried/eucplanet/ble/InMotionV1Adapter.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,9 @@ class InMotionV1Adapter @Inject constructor() : WheelAdapter {
4545

4646
override fun bleProfile(): BleProfile = BleProfile.INMOTION_V1
4747

48-
override fun notifyConnectingTo(deviceName: String?) {
48+
override fun notifyConnectingTo(deviceName: String?): DecodeResult.ModelName? {
4949
detectedModel = deviceName?.let { InMotionV1Model.fromReportedName(it) }
50+
return null
5051
}
5152

5253
/**

app/src/main/java/com/eried/eucplanet/ble/KingsongAdapter.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,9 @@ class KingsongAdapter @Inject constructor() : WheelAdapter {
3333

3434
override fun bleProfile(): BleProfile = BleProfile.HM10
3535

36-
override fun notifyConnectingTo(deviceName: String?) {
36+
override fun notifyConnectingTo(deviceName: String?): DecodeResult.ModelName? {
3737
detectedModel = deviceName?.let { KingsongModel.fromReportedName(it) }
38+
return null
3839
}
3940

4041
override fun initSequence(): List<ByteArray> = listOf(

app/src/main/java/com/eried/eucplanet/ble/NinebotAdapter.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,14 +87,15 @@ class NinebotAdapter @Inject constructor() : WheelAdapter {
8787
* the name signals legacy explicitly we flip the protocol BEFORE the
8888
* connection manager reads [bleProfile].
8989
*/
90-
override fun notifyConnectingTo(deviceName: String?) {
90+
override fun notifyConnectingTo(deviceName: String?): DecodeResult.ModelName? {
9191
val resolved = deviceName?.let { NinebotModel.fromReportedName(it) }
9292
detectedModel = resolved
9393
activeProtocol = resolved?.protocol ?: NinebotProtocol.Z
9494
parser = NinebotParser(activeProtocol)
9595
crypto.clearKey()
9696
settingsSnapshot = WheelSettings()
9797
settingsCursor = 0
98+
return null
9899
}
99100

100101
/**

app/src/main/java/com/eried/eucplanet/ble/VeteranAdapter.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,9 @@ class VeteranAdapter @Inject constructor() : WheelAdapter {
3737

3838
override fun bleProfile(): BleProfile = BleProfile.HM10
3939

40-
override fun notifyConnectingTo(deviceName: String?) {
40+
override fun notifyConnectingTo(deviceName: String?): DecodeResult.ModelName? {
4141
detectedModel = deviceName?.let { VeteranModel.fromReportedName(it) }
42+
return null
4243
}
4344

4445
// Veteran streams unsolicited telemetry as soon as notifications are

0 commit comments

Comments
 (0)