comparison eventLogger.h @ 42:3d627dce8bf0

Tidied up startup logic.
author Robert Tubb <rt300@eecs.qmul.ac.uk>
date Wed, 17 Apr 2013 13:44:05 +0100
parents af06bb942d58
children b91a1859829a
comparison
equal deleted inserted replaced
41:79c129e500e1 42:3d627dce8bf0
28 #import "ServerComms.h" 28 #import "ServerComms.h"
29 #include "grid.h" 29 #include "grid.h"
30 30
31 #define EVENT_THIN_FACTOR 12 31 #define EVENT_THIN_FACTOR 12
32 #define EVENT_LOG_FILENAME "log.json" 32 #define EVENT_LOG_FILENAME "log.json"
33 #define UPLOAD_CHUNK_SIZE 10 33 #define UPLOAD_CHUNK_SIZE 1000
34 #define APP_CREATION_TIME 381429000000 // milliseconds to the time i wrote this wee blighter. saves digits 34 #define APP_CREATION_TIME 381429000000 // milliseconds to the time i wrote this wee blighter. saves digits
35 #define SCROLL_TRAIL_LENGTH 200 35 #define SCROLL_TRAIL_LENGTH 200
36 #define PROGRAM_VERSION 0.5 // NOW USES NEW HILBERT CURVE. ALL OLD PRESETS WILL BE INVALID :( 36 #define PROGRAM_VERSION 0.5 // NOW USES NEW HILBERT CURVE. ALL OLD PRESETS WILL BE INVALID :(
37 37
38 #define SUPERVISED // this def will save files 38 #define SUPERVISED // this def will save files
154 154
155 // constr 155 // constr
156 EventLogger(); 156 EventLogger();
157 157
158 // public methods: 158 // public methods:
159 void init(); 159 void startLoadAll();
160 void exitAndSave(); 160 void exitAndSave();
161 void setUsername(const char *u); 161 void setUsername(const char *u);
162 void newUser(); 162 void newUser();
163 void logEvent(const leventType& evtType,const TwoVector& centre = TwoVector(), const double& scale = 1.0, const int& sliderID = -1, const double& sliderVal = 0.0); 163 void logEvent(const leventType& evtType,const TwoVector& centre = TwoVector(), const double& scale = 1.0, const int& sliderID = -1, const double& sliderVal = 0.0);
164 void questionnaireAnswersObtained(vector<int> answers, const char* userComments); 164 void questionnaireAnswersObtained(vector<int> answers, const char* userComments);
191 191
192 string questionnaireComments; 192 string questionnaireComments;
193 193
194 ofxiPhoneDeviceType iOSdeviceType; 194 ofxiPhoneDeviceType iOSdeviceType;
195 195
196 void testConnection(); 196
197 vector<int> questionnaireAnswers; 197 vector<int> questionnaireAnswers;
198 int interfaceOrder; 198 int interfaceOrder;
199 199
200 // private methods 200 // private methods
201 void testConnection();
201 void checkLogFile(); 202 void checkLogFile();
202 void deleteLogs(); // new user 203 void deleteLogs(); // new user
203 bool uploadEventLog(bool async); 204 bool uploadEventLog(bool async);
204 void firstEverAppOpen(); 205 void firstEverAppOpen();
205 void checkExistingLogFile(const string &jsonFile); 206 void loadExistingLogFile(const string &jsonFile);
206 void uploadQuestionnaire(); 207 void uploadQuestionnaire();
207 bool sendToServer(string functionName, Json::Value jsonData, bool async); 208 bool sendToServer(string functionName, Json::Value jsonData, bool async);
208 209
209 210
210 211