WellDone/MoMo-Firmware — pull request #113 by amcgee (2014-07-21 16:46:41+00:00)
Title: Log reports and retry failed reports

To hopefully avoid losing failed reports forever, log them to flash and retry sending if they fail.

This is a work in progress. Report logging works well, but retrying has some issues still.

Implemented reportinator features:
* `reportinator log count` - returns the number of reports in the report log
* `reportinator log clear` - (use at your own risk) - clears all entries from the report log
* `reportinator log read ` - read the lates entries from the report log and print them in Base64. If is not specified, print all logged reports.

Note: These have not yet been implemented in the new universal momo command line tool or shell.

Retry behavior:
The intended design is this:
* When a report succeeds or fails, the gsm_module sends an RPC indicating success or failure to the controller.
* If a report fails, the controller schedules a retry for some time in the future (namely: one scheduling interval smaller than the reporting interval. i.e. ten minutes if reports are sent every hour.)
* If a report is retried multiple times (RETRY_MAX defined in report_comm_stream.c), the report is abandoned.
* If a new report starts before the retry has begun, the retry is abandoned.
* If a new report tries to start streaming before the current one has finished, the controller tells the comm module to abandon the current stream (a new mib endpoint was added to the comm feature for this purpose)

The issue now seems to be that xc8 is optimizing legitimate logic out of the gsm_module, and so the pic calls gsm_off before waiting for the success or failure response from module. I'm still investigating this.