Mercurial > hg > soniczoomios
diff eventLogger.h @ 22:8c0783739337
Logs uploading.
Questionnaire also.
author | Robert Tubb <rt300@eecs.qmul.ac.uk> |
---|---|
date | Thu, 24 Jan 2013 18:14:40 +0000 |
parents | fb2ef16dd013 |
children | a4908ad8c78e |
line wrap: on
line diff
--- a/eventLogger.h Fri Jan 18 15:48:33 2013 +0000 +++ b/eventLogger.h Thu Jan 24 18:14:40 2013 +0000 @@ -12,6 +12,7 @@ #define __oscSenderExample__eventLogger__ #define EVENT_LOG_FILENAME "log.json" +#define SERVER_URL "http://127.0.0.1:8080/testservice/" #include "ofMain.h" #include "ofxiPhone.h" @@ -20,6 +21,7 @@ #include <sys/time.h> #include <iostream> #include <string> +#include <cstring> #include <map> #include "2dvector.h" #include "json.h" @@ -28,11 +30,14 @@ // can add but don't change ordering - this will invalidate logs +#define PROGRAM_VERSION 1.0 enum leventType {SAVE_PRESET, SAVE_DESET, SCROLL, + ZOOM, SCROLL_STOPPED, - ZOOM, + ZOOM_STOPPED, + SNAPPED_TO_PRESET, CHANGE_SLIDER, SWAP_VIEW, SET_MIN_ZOOM, @@ -109,7 +114,7 @@ class EventLogger{ public: bool loggingEnabled; - bool internetConnectionOK; + bool serverConnectionOK; unsigned int deviceID; // unique get something from hardware?? unsigned int totalInteractionTime, sessionTime, sessionStartTime; string userName; // not unique @@ -119,7 +124,7 @@ void exitAndSave(); void setUsername(const char *u); void logEvent(const leventType& evtType,const TwoVector& centre = TwoVector(), const double& scale = 1.0, const int& sliderID = -1, const double& sliderVal = 0.0); - + void questionnaireAnswersObtained(vector<int> answers); private: // what we need... @@ -136,17 +141,21 @@ unsigned int nextUploadQty; + ofxiPhoneDeviceType iOSdeviceType; bool testConnection(); - + vector<int> questionnaireAnswers; + bool questionnaireCompleted; + bool questionnaireUploaded; - void sendHttp(); void checkLogFile(); - bool attemptUpload(); + bool uploadEventLog(); void firstEverAppOpen(); void readJsonToLog(const string &jsonFile); - + bool uploadQuestionnaire(); + bool sendToServer(string functionName, Json::Value jsonData); Json::Value logsToJson(); + Json::Value questionnaireToJson(); void printAll(){ cout << "ALL LOGGED EVENTS!: \n"; vector<lEvent>::iterator evIter;