diff testApp.mm @ 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/testApp.mm	Mon Feb 18 11:45:05 2013 +0000
+++ b/testApp.mm	Fri Feb 22 17:41:38 2013 +0000
@@ -17,14 +17,15 @@
 //--------------------------------------------------------------
 void testApp::setup(){
     paused = true;
-	
+
    
     ofBackground( 0, 0, 0 );
     ofEnableAlphaBlending();
     //ofEnableSmoothing();
 
-	// open an outgoing connection to HOST:PORT
-	sender.setup( HOST, PORT );
+	// open an outgoing connection to HOST:PORT for OSC
+    
+	sender.setup( OSC_HOST, OSC_PORT );
     ofSetFrameRate(50);
     // reciever
     lastMoveTime = ofGetSystemTimeMicros();
@@ -83,7 +84,7 @@
 	
     [bottomTabViewController setAppRef:(id)this];
     bottomTabViewController.view.frame = CGRectMake(0,getHeight()-44,getWidth(),44);
-    
+    bottomTabViewController.view.hidden = YES;
 
     /////
     
@@ -112,14 +113,21 @@
 
     // initialise user logging stuff
     presetManager.startupLoadAll();
+    tsc = [[TimedSessionController alloc] init];
+    [tsc setAppRef:(id)this];
     eventLogger.init();
     
     // timer.init();
+	whichInterfaceShowing = BOTH; // but timer will change this
+
     
-    whichInterfaceShowing = SLIDERS;
+    if(eventLogger.questionnaireCompleted){
+        [bottomTabViewController show:(id)this withSelection:1];
+    }
     setAllGUISliders(theGridView.getParams());
     // GO
     paused = false;
+
     
 }
 
@@ -193,8 +201,7 @@
     // stop updating / drawing
 
     // if(eventLogger.questionnaireCompleted) return;
-    
-    paused = true; // need to set button
+
     [topButtonViewController pausePressed:(id)this];
     
     //stopSequencer
@@ -216,18 +223,19 @@
     eventLogger.questionnaireAnswersObtained(answers, userComments);
     
     // set "we've done questionnaire" to true in event logger
-    paused = false;
 
     whichInterfaceShowing = BOTH;
     // tell bottomtabviewcontroller
-    [bottomTabViewController show:(id)this];
+    [bottomTabViewController show:(id)this withSelection:1];
+
 }
 //--------------------------------------------------------------
 void testApp::showIntro(){
-    paused = true;
 
     cout << "SHOW INTRO\n";
 
+    [tsc cancelTimers];
+    bottomTabViewController.view.hidden = YES;
     introViewController	= [[IntroViewController alloc] initWithNibName:@"IntroViewController" bundle:nil];
     [ofxiPhoneGetGLParentView() addSubview:introViewController.view];
 	
@@ -242,7 +250,9 @@
 void testApp::introHidden(bool OK){
     if(OK){
         eventLogger.consentGiven = true;
-        whichInterfaceShowing = BOTH;
+        //
+        // clear presets?
+        presetManager.clearAll();
         // show username prompt
         [usernameAlertViewController showUserNamePrompt];
     }
@@ -293,9 +303,10 @@
     // LEFT GUI
     sliderGUI = new ofxUICanvas(0,100,SLIDER_GUI_WIDTH,getHeight());
 
+    
     // Uh.. loop this
     for(int i = 1; i<=10;i++){
-        
+    
         ofxUISlider *slider;
         slider = (ofxUISlider *)sliderGUI->addWidgetDown(new ofxUISlider(length,dim,0.0,127,64,sliderParamNames[i-1]));
         slider->setDrawPadding(true);
@@ -373,14 +384,14 @@
 }
 //-
 void testApp::showHelp(){
-    paused = true;
+    whichInterfaceShowing = HELP;
     seqStartStop(false);
     [topButtonViewController pausePressed:(id)this];
     helpViewController.view.hidden = NO;
     eventLogger.logEvent(HELP_PRESSED);
 }
 void testApp::helpHidden(){
-    paused = false;
+    whichInterfaceShowing = BOTH;
     // start seq?
     
 }
@@ -477,7 +488,6 @@
 }
 //--------------------------------------------------------------
 void testApp::draw(){
-    if(paused) return;
 
     switch (whichInterfaceShowing){
         case SLIDERS: