Skip to content

fix(bluetooth): report measurement save outcomes reliably - #1595

Closed
aronnoordhoek wants to merge 1 commit into
oliexdev:masterfrom
aronnoordhoek:fix/ble-save-confirmation
Closed

aronnoordhoek wants to merge 1 commit into
oliexdev:masterfrom
aronnoordhoek:fix/ble-save-confirmation

Conversation

@aronnoordhoek

Copy link
Copy Markdown
Contributor

While adding Tanita RD-545 support, I wanted the driver to wait for each stored weighing to be saved before fetching the next.

This adds an optional save callback and an explicit openScale user ID. It handles cancellation during the handoff to saving and ignores repeated completion callbacks. Existing drivers can keep using their current publish method.

It also prevents widget or vibration errors after a successful database insert from reporting the measurement as unsaved.

Includes regression tests for user assignment, save failures, cancellation and callbacks. The Tanita PR (#1592) will use this API.

Validation: 1,089 unit tests pass; the debug APK builds; instrumented tests compile; lint reports zero errors.

@oliexdev

Copy link
Copy Markdown
Owner

I've taken over the two general fixes on master: the connector no longer announces "measurement
saved" when the save failed, the timestamp was already taken, or smart user assignment dropped the
reading. saveMeasurementFromBleDevice() now reports whether a new measurement was stored and lets
a failed save through to the error message. I left out the guard around the steps after saving:
sync and image cleanup already handle their own errors, and there's no concrete case of the others
failing.

The rest is too specific to the Tanita and changes too much shared code for one scale: a save
callback in the handler API with claim/cancel handling, an explicit app user per publish, and
profileBased bypassing smart assignment and assisted weighing all reach into
ScaleDeviceHandler, the adapters, BleConnector and MeasurementFacade, which every scale goes
through. If the RD-545 really can only fetch the next stored record after the previous one is
saved, let's look at that together with #1592, with the smallest hook the handler needs. Closing
this one.

@oliexdev oliexdev closed this Nov 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants