App sync after wake-up from ULPM


In my system I have a mangOH yellow that is most of the time in ULPM and is woken up by an other sensor over a GPIO. I have made a custom application that communicate with the sensor over UART and then send sensor value to Octave through DataHub app. The corresponding resource have an observations that should trigger the sending of the value to Octave cloud.

However, since I have configured the ULPM, the data is not forwarded to the cloud. When I check the log with logread, I can see that my application is communicating over uart and sending data to DataHub before CloudInterface / Router apps configure the observation for my resource. I thus suspect the observation not to be triggered.

As a provisonal solution I have delayed my stuff in my app but this is not a great solution as I want to be sure the observation is triggered no matter how long CloudInterface app take to configure itself and even more important I don’t want to spend time waiting if everything is ready and consume battery battery for nothing.

Is there a way to sync apps to wait for example that CloudInterface and cellular network is ready before performing my tasks ?

After further discussion with the support team, it seems the correct way of doing what I was trying to achieve was to :

  • Power up the device
  • wait for /cloudInterface/connected/value to be true
  • push the data
  • wait for /cloudInterface/store_forward/storage_empty to be true
  • go in ULPM

So to achieve this I have used dhubIO_GetBoolean within a function that I call in a while loop to wait for cloud to be ready:

static bool isCloudReady()
  bool retVal = false;
  double timestmp = 0;
  dhubIO_GetBoolean("/app/cloudInterface/connected/value", &timestmp, &retVal);

  return retVal;

I haven’t tested yet.