You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(bluetooth): report measurement save outcomes reliably - #1595
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.
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.