Add Watch
Making a new watch app to receive glucose values from Juggluco can in different ways. To display the most recent glucose values on a watch, it should be sent to the watch immediately when it becomes available. Kerfstok works this way. When using an xDrip web server, values are only send to the watch when the watch app asks for them.
The source of the Garmin watch app Kerfstok can be downloaded from https://www.juggluco.nl/Kerfstok/Kerfstok-source.html and you are allowed to modify it to satisfy your taste.
Juggluco (4.1.5 and up) can send every minute a broadcast with the current glucose value. Every Android app on the phone, whereupon it is running, can receive that broadcast. This can be used to send this glucose value to a smartwatch. More Information.
The watch version of Juggluco can also send a broadcast. This makes it possible to develop other watch faces for WearOS that can be used independent of the phone.
If you like to add support for a watch to Juggluco you can do so.
You can supply the following:
A static initialization procedure called at start of Juggluco.
A static function to be called very minute when a new glucose value arrives. The arguments of this function can be
Application,
Serial Number of sensor,
Glucose in mg/dL,
glucose in the unit set be the user (mg/dL or mmol/L),
the rate of change,
alarm indicator,
time in msec since 1 January 1970 GMT.
The meaning of rate of change:
Abbott Librelink arrow |
Rate of change |
Falling Quickly |
<=-2 |
Falling |
Between -2 and -1 |
Steady |
-1 to 1 |
Rising |
1 to 2 |
Rising Quickly |
>=2 |
The meaning of the alarm indicator:
Alarm type |
Value of alarm |
Too high |
6 (+8 if alarm should go off) |
Too low |
7 (+8 if alarm should go off) |
Again a value after scanning impossible |
3 |
Above highest measurable e.g. 500 mg/dL |
4 (+8 if alarm should go off) |
Below lowest measurable e.g. 40 mg/dL |
5 (+8 if alarm should go off) |
You should test yourself if you initialization was successful, before using the glucose values.
You can also supply a name to be used in settings to describe the watch and a short description to be added to the help menu.
Example of defined functions:
public class myclass { static public void initmywatch(Application app); static public void glucosetowatch(Application app,String SerialNumber,int mgdl,float myunits,float rate,int alarm,long timemsec); }; Both glucosetowatch doesn't run on the main thread. If you need to run on the main thread, you can use: static public void Applic.RunOnUiThread(Runnable action); (All these functions are Java).
Send the code plus instruction what to do with it to jaapkorthalsaltes@gmail.com. If I think the code is o.k. I will put it in Juggluco and send you an apk of Juggluco with that code added. If you test it o.k. I it will come in the next version of Juggluco at Google Play.
Juggluco incorporates besides this a xDrip web server. The watch app will only receive glucose value when it asks for them, so they are usually not immediately shown when available. For more information of on the webserver in Juggluco, see in Juggluco, Left menu->Settings->Web server->Help and webserver.html