comparison eventLogger.h @ 27:ae4d2c3ce5e0

Details. Zoom trailing finger move sorted. Qs rephrased.
author Robert Tubb <rt300@eecs.qmul.ac.uk>
date Wed, 13 Feb 2013 17:03:56 +0000
parents f42a00e3f22d
children e2c62db1e265
comparison
equal deleted inserted replaced
26:2e1fdac115af 27:ae4d2c3ce5e0
54 APP_EXITED, // 13 54 APP_EXITED, // 13
55 CONSENT_DENIED, // 14 55 CONSENT_DENIED, // 14
56 SEQ_LOCKED, // 15 56 SEQ_LOCKED, // 15
57 SYNTH_LOCKED, // 16 57 SYNTH_LOCKED, // 16
58 PLAY_PRESSED, // 17 58 PLAY_PRESSED, // 17
59 PAUSE_PRESSED}; // 18 59 PAUSE_PRESSED, // 18
60 HELP_PRESSED}; // 19
60 61
61 //--------------------------------------------------------------------------- 62 //---------------------------------------------------------------------------
62 63
63 class lEvent{ 64 class lEvent{
64 public: 65 public:
130 131
131 class EventLogger{ 132 class EventLogger{
132 public: 133 public:
133 int nextUploadNumber; 134 int nextUploadNumber;
134 bool loggingEnabled; 135 bool loggingEnabled;
136 bool logUploadInProgress;
135 bool serverConnectionOK; 137 bool serverConnectionOK;
136 bool consentGiven; 138 bool consentGiven;
137 unsigned int deviceID; // unique get something from hardware?? 139 unsigned int deviceID; // unique get something from hardware??
138 unsigned int totalInteractionTime, savedInteractionTime, sessionTime, sessionStartTime; 140 unsigned int totalInteractionTime, savedInteractionTime, sessionTime, sessionStartTime;
139 string userName; // not unique 141 string userName; // not unique
140 142
141 EventLogger(); 143 EventLogger();
142 void init(); 144 void init();
143 void exitAndSave(); 145 void exitAndSave();
144 void setUsername(const char *u); 146 void setUsername(const char *u);
147 void newUser();
145 void logEvent(const leventType& evtType,const TwoVector& centre = TwoVector(), const double& scale = 1.0, const int& sliderID = -1, const double& sliderVal = 0.0); 148 void logEvent(const leventType& evtType,const TwoVector& centre = TwoVector(), const double& scale = 1.0, const int& sliderID = -1, const double& sliderVal = 0.0);
146 void questionnaireAnswersObtained(vector<int> answers); 149 void questionnaireAnswersObtained(vector<int> answers);
147 150 void urlResponse(ofHttpResponse & response);
148 private: 151 private:
149 // what we need... 152 // what we need...
150 /* 153 /*
151 time, type, value 154 time, type, value
152 */ 155 */
153 156
154 157 int currentHTTPRequestID;
155 vector<lEvent> theEvents; 158 vector<lEvent> theEvents;
156 159
157 160
158 // values applicable to all events 161 // values applicable to all events
159 162
165 bool testConnection(); 168 bool testConnection();
166 vector<int> questionnaireAnswers; 169 vector<int> questionnaireAnswers;
167 bool questionnaireCompleted; 170 bool questionnaireCompleted;
168 bool questionnaireUploaded; 171 bool questionnaireUploaded;
169 172
173
170 void checkLogFile(); 174 void checkLogFile();
171 bool uploadEventLog(); 175 bool uploadEventLog(bool async);
172 void firstEverAppOpen(); 176 void firstEverAppOpen();
173 void readJsonToLog(const string &jsonFile); 177 void readJsonToLog(const string &jsonFile);
174 bool uploadQuestionnaire(); 178 void uploadQuestionnaire();
175 bool sendToServer(string functionName, Json::Value jsonData); 179 bool sendToServer(string functionName, Json::Value jsonData, bool async);
176 Json::Value logsToJson(); 180 Json::Value logsToJson();
177 Json::Value questionnaireToJson(); 181 Json::Value questionnaireToJson();
178 void printAll(){ 182 void printAll(){
179 cout << "ALL LOGGED EVENTS!: \n"; 183 cout << "ALL LOGGED EVENTS!: \n";
180 vector<lEvent>::iterator evIter; 184 vector<lEvent>::iterator evIter;