project-hermes/hermes-firebase

Users can add dives to their "dive log"

Opened this issue · 1 comments

The idea is for divers to add dives to there datasets so they can look at them better. (This needs to be fleshed out more)

  1. Sensor: publish createDive(char format, int sensorDiveId, float latStart, longStart, latEnd, longEnd, int sampleCount, timestamp epochStart, epochEnd)
  • Firebase generates new Dive document with ID firebaseDiveId (hash of properties to tolerate repeat? If not, on repeat we get two partial dives and retry)
  • Firebase: poke sensor with readyToReceive(string firebaseDiveId, int sensorDiveId)
  1. Sensor: loop publish diveAppend(char format, int sensorDiveId, timestamp firstDataTime, 41x6byte(depth,temp1,temp2))
  • Firebase determines firebaseDiveId of "active" dive to which to append via one of three options:
    • stores both sensorDiveId and firebaseDiveId as "lastDiveId_sensor" and "lastDiveId_firebase" on the Sensor object, which it Gets
    • queries Dives that are children of this Sensor for most recent LastUpdatedAt or LastCreatedAt, uses that one (and still verifies sensorDiveId match); this avoids storing state on the Sensor
    • change message formate above: sensor sends full firebaseDiveId per packet (high overhead)
  1. Sensor: with tuned backoff, publish diveDone(char format, int sensorDiveId, string firebaseDiveId)
  • Firebase: count Data collection under active Dive: if == Dive.sampleCount, poke sensor with diveComplete(string firebaseDiveId, int sensorDiveId)
    -- non-response is "not done"

if Firebase ever errors, log error info under errorId, poke sensor with stopSending(string firebaseDiveId, int sensorDiveId, string errorId)

  • if we receive enough of these or otherwise have to resend 3 times
  • Sensor: emergency REST dump dive to raw-dive-dump endpoint for manual debugging and data recovery

for format details see:
project-hermes/hermes-sensor#24