Konubinix' opinionated web of thoughts

More Robust Notifications in Infinitime


Currently, InfiniTime and the associated companion apps provide a classical pub/sub mecanism to get notification.

This works well, and infinitime (at least version 1.13) does a great job at keeping the connection, but sometimes it temporarily fails, and the notification get lost. This is not enough for several kinds of events:

  1. calendar events. If the watch does not warn me at the appropriate time, I won’t trust it.
  2. important but not necessarily timed event. If I received an important message, it is not a big deal if I am warned after a few minutes, but I need to be notified soon enough.

For the former case, I don’t even need my phone. I could send all the future events for the day ahead on the morning and let the watch warn me at the appropriate time.

For the later case, I need three things:

  1. a way to be notified when the connection got lost for too long (like 5 minutes),
  2. an acknowledgment mechanism that makes the watch and the phone aware of what notification have actually been sent to the watch
    • for some kinds of events, I would even need to acknowledge that I saw the notification,
  3. a replay mechanism that makes sure that when the connection is established, all the missing event got sent back to the watch,

To me, those are the needed conditions for my watch to get from the state of funny gadget to the state of trusted system.

first: playing with the code

This was much simpler than I thought

git clone https://github.com/InfiniTimeOrg/InfiniTime
cd InfiniTime
docker run --rm -it -v ${PWD}:/sources --user $(id -u):$(id -g) infinitime/infinitime-build /opt/build.sh
rsync build/output/pinetime-mcuboot-app-dfu-1.13.0.zip myphone:/sdcard/Download/

Then, on the phone, using nrf connect, or gadget bridge, I can easily send the file and the watch will be updated.

Let’s try to apply the following patch

diff --git a/src/displayapp/screens/ApplicationList.h b/src/displayapp/screens/ApplicationList.h
index 371ee710..3e04bf80 100644
--- a/src/displayapp/screens/ApplicationList.h
+++ b/src/displayapp/screens/ApplicationList.h
@@ -46,14 +46,8 @@ namespace Pinetime {
           {Symbols::stopWatch, Apps::StopWatch, true},
           {Symbols::clock, Apps::Alarm, true},
           {Symbols::hourGlass, Apps::Timer, true},
-          {Symbols::shoe, Apps::Steps, true},
-          {Symbols::heartBeat, Apps::HeartRate, true},
           {Symbols::music, Apps::Music, true},

-          {Symbols::paintbrush, Apps::Paint, true},
-          {Symbols::paddle, Apps::Paddle, true},
-          {"2", Apps::Twos, true},
-          {Symbols::drum, Apps::Metronome, true},
           {Symbols::map, Apps::Navigation, Applications::Screens::Navigation::IsAvailable(filesystem)},
           {Symbols::none, Apps::None, false},


Then, building and updating, I could get rid of some annoying applications. So far so good.

deal with calendar events

If I understand correctly, there are two ways to send data to the watch

  1. using the simple fs,
  2. using characteristic,

I can start with the later for now. There are plenty of examples available in the repository.