benjymous / MWM-for-Android

Meta Watch Manager Android SDK project for watch wrangling, remote protocol handling and notification routing for the Meta Watch wearable development systems. Includes an Intents based API for quick experiments.
www.metawatch.org
Apache License 2.0
59 stars 30 forks source link

Watch Voltage #89

Open sdemills opened 11 years ago

sdemills commented 11 years ago

Would it be possible to have a feature to enable a Watch App or Widget to obtain the watch voltage.

I have produced a Watch Widget but would need that feature before I could release it.

The MW is not very friendly in that it gives the watch voltage to 3 decimal places but doesn't indicate whether or not it's getting low and needs recharging until it suddenly becomes critical.

This Watch Widget uses starter values for Max, Min, Low and Critical voltages (supplied from research that I've done) but self-learns in that if it sees values above the Max or below the Min (but not zero!) then it will tune those values. The user can choose their own values for these things but tuning will still occur.

The Watch Widget provides: the voltage to 3 dp, the voltage as a percentage of the interval between Max and Min since that is the usable range, a worded evaluation (OK, LOW, CRITICAL), plus a graphic indicating the battery level percentage displayed. Once the level becomes critical then it sends notifications every now and then to the watch. It is a 96x32 widget.

The way it works with MWM is like this: I have tailored MWM so that if you are logging the watch voltage to a file, then every time the voltage is logged to a file then MWM raises an intent "org.metawatch.manager.BATTERYVOLTS" with a FloatExtra called "BATTERYVOLTS" which specifies the current voltage. My Watch Widget then picks up that voltage through the intent and adjusts the readings accordingly. I added a Preference Option to MWM that says whether this intent will be generated, but regardless it is only generated during logging to file.

That's a messy way of doing it because it means you have to be logging to a file to use it. Better would be a Preference Option for the interval at which to send the intent with zero meaning "don't send the intent". However it was easier for me to intercept the code that logs the watch voltage than to figure out how to get the voltage myself.

But you could easily add that? :)

Would you mind doing so? I am assuming that you'd not want me to provide a pull request for my changes as they're not really professional - although I'm always willing to share, for that's the idea of course. :)

Kind Regards Steve