Repository navigation
DEV-1275: report a Shimmer ready only once its connect sequence has ended - #132
Conversation
The connect sequence reads the unit's status part way through, before the battery, the BT firmware version, the calibration dump and the inquiry. On that reply, logAndStreamStatusChanged() moved the state from CONNECTING to CONNECTED, or to SDLOGGING for a unit that is logging, which also sets mIsInitialised. ShimmerBluetoothManagerAndroid and apps take either state as ready, so whatever the app did next went out in among the rest of the sequence. The Java HIL found the same defect in the driver's ShimmerPC: a configure sent then cut a Shimmer3's calibration dump short and left its accel NaN. The sequence's own end, inquiryDone() and then isReadyForStreaming(), already moves CONNECTING to CONNECTED or SDLOGGING and sends NOTIFICATION_SHIMMER_FULLY_INITIALIZED. A status reply now leaves CONNECTING to it. Once connected, a status reply still moves the state as before. This is the driver's DEV-1275 fix, ported: Shimmer overrides the status handler, so the driver's fix doesn't reach it. Unlike ShimmerPC, Shimmer also holds back SDLOGGING, because here it marks the unit initialised. AAPI_00004 hands a status reply to the driver's parser while CONNECTING, as the IO thread does while not streaming. Without the fix, the idle and the logging cases fail: the state moves to CONNECTED or SDLOGGING before the sequence ends. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Retested with driver 0.11.11_beta: the idle connect is fixed; the logging connect is not tested yet
Not tested yet: the connect to a unit that is logging. 3E36 was docked to charge, and a docked Shimmer3 acknowledges START_LOGGING but doesn't log (status Also found: Shimmer3BLEAndroid has the same defect over BLE. On a Shimmer3R it was reported ready 2.7 s early, with driver 0.11.11_beta, and this PR doesn't cover it. I'm fixing that separately. 🤖 Generated with Claude Code |
Verified on a second Shimmer3, including the connect to a logging unit (24 Oct)
So the fix is now confirmed on two Shimmer3s (3E36 and BE69), for both idle and logging connects. 🤖 Generated with Claude Code |
DEV-1275, ported from the Java driver's fix (ShimmerResearch/Shimmer-Java-Android-API#333).
Shimmeroverrides the status handler, so the driver's fix doesn't reach Android.The bug
The connect sequence reads the unit's status part way through, before the battery, the BT firmware version, the calibration dump and the inquiry. On that reply,
logAndStreamStatusChanged()moved the state from CONNECTING to CONNECTED, or to SDLOGGING for a unit that is logging, which also setsmIsInitialised.ShimmerBluetoothManagerAndroidand apps take either state as ready, so whatever the app did next went out in among the rest of the sequence. In the Java driver, a configure sent then cut a Shimmer3's calibration dump short and left its accel NaN.The fix
The sequence's own end,
inquiryDone()thenisReadyForStreaming(), already moves CONNECTING to CONNECTED or SDLOGGING and sendsNOTIFICATION_SHIMMER_FULLY_INITIALIZED. A status reply now leaves CONNECTING to it. Once connected, a status reply still moves the state as before. UnlikeShimmerPC,Shimmeralso holds back SDLOGGING, because here it marks the unit initialised.Tested
AAPI_00004_ConnectReadyAfterConnectSequenceTesthands a status reply to the parser while CONNECTING, as the IO thread does. Without the fix, the idle and the logging cases fail.connectReadyscenario from the HIL scenarios PR:🤖 Generated with Claude Code