API List Activities

.. will provide the metric db for an athlete as the
   activity list including all metrics in CSV format
   at the URL:

   http://localhost:12021/Athlete Name/

   The data is sent in chunks as it is parsed from the
   ride cache. We do not cache or maintain state so this
   call is expensive !
This commit is contained in:
Mark Liversedge
2015-09-07 15:36:29 +01:00
parent e6cc21bfbc
commit 0abbeed952
4 changed files with 147 additions and 38 deletions

View File

@@ -20,6 +20,7 @@
#include "Settings.h"
#include "GcUpgrade.h"
#include "RideDB.h"
void
APIWebService::service(HttpRequest &request, HttpResponse &response)
@@ -101,12 +102,23 @@ APIWebService::listAthletes(HttpResponse &response)
}
}
void
APIWebService::listRides(QString athlete, HttpResponse &response)
void
APIWebService::writeRideLine(RideItem &item, HttpResponse *response)
{
// list activities and associated metrics
response.setHeader("Content-Type", "text; charset=ISO-8859-1");
response.write("get athlete ride list under construction");
// date, time, filename
response->write(item.dateTime.date().toString("yyyy/MM/dd").toLocal8Bit());
response->write(",");
response->write(item.dateTime.time().toString("hh:mm:ss").toLocal8Bit());;
response->write(",");
response->write(item.fileName.toLocal8Bit());
// metrics...
foreach(double value, item.metrics()) {
response->write(",");
response->write(QString("%1").arg(value, 'f').simplified().toLocal8Bit());
}
response->write("\n");
}
void