-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add predicted iob data to broadcastservice #2294
Add predicted iob data to broadcastservice #2294
Conversation
@@ -495,6 +527,9 @@ protected Bundle prepareBgBundle(BroadcastModel broadcastModel) { | |||
bundle.putLong("treatment.timeStamp", treatment.timestamp); | |||
} | |||
|
|||
predictedIOB = ""; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMHO this always sets the variables to an empty string which does not change till line 569. Maybe you should initialize the strings to ""
in line 84/85?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a place where the variable resets in case if the iob data would not be updated in BgGraphBuilder.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But in case if settings.isDisplayGraph() is false, the predictedIOB and predictedBWP always would be empty. Maybe it would be better to transfer iob only if graph is enabled.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The only location where predictedIOB
and predictedBWP
are set to likely non-empty value is in the statusReceiver
onReceive
event. The next use is bundle.putString("predict.IOB", predictedIOB);
but right before the if condition these two variables will be emptied. Hence, an empty string is always passed to bundle.putString
. That's my main concern. Did I oversee anything?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. the variables are filled via statusReceiver by receiving the broadcast messages. And those broadcast messages can be triggered by bgGraphBuilder.defaultLines(false)
function which calls addBgReadingValues(simple) and the last one function calls Home.updateStatusLine("iob", df.format(iob.iob))
. So when the code reaches to the bundle.putString
, the iob and wpb values would be filled with the valid data.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@tolot27 as i understand this pr was stuck because the "bwp" and "iob" broadcast data which is generated in BgGraphBuilder transfers with help of sendBroadcast finction which is runs asynchronously. Maybe to resolve this problem we can change sendBroadcast in updateStatusLine to sendBroadcastSync which should block the execution of the thread .
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about using the keystore data like is done with bwp_last_insulin
in PebbleDisplayTrend
? I could easily add more keystore fields if this doesn't include everything needed. Then you don't need to worry about asynchronous broadcasts.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep. I guess this should help to transfer data across different parts of the application. It is enough to add bwp_update data (but maybe better to divide the current string inot two separate variables with the carb and insulin info). And a separate keystore for "iob" which is declared by this line Home.updateStatusLine("iob", df.format(iob.iob));
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have added both, let me know if this helps: 094b09c
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. Now works fine, added appropriate code changes
so what exactly is blocking the merge of this PR ? |
@bigdigital Your last post in this PR is a question. Do you believe this PR is ready as is? If this PR is merged, what else could WatchDrip need in the future that would require another change to xDrip? Or, is that not practical? If that is not practical, can you think of any other parameters that may become required in the future and include them right now in this same PR? Please note none of my comments are needed to be answered and addressed. I am just hoping to help the conversation flowing. |
Please could this be added to xDrip? This would enable so much. Many thanks @bigdigital for proposing it and @4RK4N for seconding it |
The last time i tested it, it works fine.
Maybe a small fix to transfer the dismissed snooze alarms action to the watch bigdigital/watchdrip#4
This would be of course great, but as i know there is no such global variable store, where you can get all those values. For example, predicated IOB and BWP are not stored anywhere. And updates only by graph update. |
adding parsed iob cob and maybe tbr data from the external status line aaps sends into xdrip would be good. i have a hacky modification doing that right now. for a proper PR the ExternalStatusService.java would need a getCOB() added and maybe some testing on getTBR(), getIOB() and getAbsoluteBR() if they output the desired result. many xdrip users also use aaps and in turn the xdrip predictions are not as good as aaps predictions. which is totally ok since that's not the primary purpose of xdrip. but to have the aaps external status data sent by the broadcastservice would help aaps users a lot. EDIT UPDATE: EDIT UPDATE 2: |
Thank you. @jamorham |
Some people would like to see predicted(simulated) iob data on the watch. So this PR extends the broadcast data with a predicted IOB and BWP info.
Also it enables not simple mode in defaultLines function in order to receive simulated data including predicted lgraph lines.
The 28.01.2023 updates.
added cancel_alarm not notify remote devices in case alert were stopped
added external status line in extra key as string + timeStamp