Mercurial > hg > soniczoomios
diff eventLogger.h @ 29:fabb3a5cdfc9
Timed session improvements. Desperate pathetic attempts to send a simple HTTP POST.
author | Robert Tubb <rt300@eecs.qmul.ac.uk> |
---|---|
date | Fri, 22 Feb 2013 17:41:38 +0000 |
parents | e2c62db1e265 |
children | c0a6f7c66719 |
line wrap: on
line diff
--- a/eventLogger.h Mon Feb 18 11:45:05 2013 +0000 +++ b/eventLogger.h Fri Feb 22 17:41:38 2013 +0000 @@ -25,17 +25,18 @@ #include "json.h" #include "testApp.h" - - - +#import "ServerComms.h" + #define EVENT_THIN_FACTOR 10 #define EVENT_LOG_FILENAME "log.json" -#define SERVER_URL "http://127.0.0.1:8080/testservice/" -#define UPLOAD_CHUNK_SIZE 500 +//#define LOGGING_SERVER_URL "http://www.isophonics.net/datacollector/" +#define LOGGING_SERVER_URL "http://127.0.0.1:8080/testservice/" +#define UPLOAD_CHUNK_SIZE 100 + #define QUESTIONNAIRE_ENABLE_TIME 100000 // milliseconds -#define APP_CREATION_TIME 381429000000 // milliseconds to the time i wrote this wee blighter +#define APP_CREATION_TIME 381429000000 // milliseconds to the time i wrote this wee blighter saves digits -#define PROGRAM_VERSION 1.0 // IMPORTANT TOCHNAGE! +#define PROGRAM_VERSION 0.1 // IMPORTANT TOCHNAGE! // can add but don't change ordering - this will invalidate logs enum leventType {SAVE_PRESET, // 0 @@ -128,7 +129,15 @@ return os; } //--------------------------------------------------------------------------- - + + class ThreadedObject: ofThread{ + int i; + int threadedFunc(int i){ + return i + 10; + }; + }; + + class EventLogger{ public: int nextUploadNumber; @@ -136,7 +145,9 @@ bool logUploadInProgress; bool serverConnectionOK; bool consentGiven; - unsigned int deviceID; // unique get something from hardware?? + bool questionnaireCompleted; + bool questionnaireUploaded; + unsigned int deviceID; unsigned int totalInteractionTime, savedInteractionTime, sessionTime, sessionStartTime; string userName; // not unique @@ -149,18 +160,13 @@ void questionnaireAnswersObtained(vector<int> answers, const char* userComments); void urlResponse(ofHttpResponse & response); private: - // what we need... - /* - time, type, value - */ int currentHTTPRequestID; + + vector<lEvent> theEvents; - + void thinnedLogEvent(lEvent nextEvent); - - // values applicable to all events - unsigned int nextUploadQty; string questionnaireComments; @@ -169,12 +175,11 @@ bool testConnection(); vector<int> questionnaireAnswers; - bool questionnaireCompleted; - bool questionnaireUploaded; int interfaceOrder; void checkLogFile(); + void deleteLogs(); // new user bool uploadEventLog(bool async); void firstEverAppOpen(); void readJsonToLog(const string &jsonFile); @@ -190,6 +195,10 @@ } }; + + // + ServerComms *serverComms; + };