- Timestamp:
- 08/02/13 19:00:35 (9 years ago)
- Branches:
- master, Servo, Tab_Interface, pyramid
- Children:
- 1472980
- Parents:
- ce0a7ee
- Location:
- iOS/Orbit
- Files:
-
- 3 added
- 2 deleted
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
iOS/Orbit/Orbit/AppDelegate.m
rce0a7ee rde10cbc 24 24 return YES; 25 25 } 26 26 27 27 - (void)applicationWillResignActive:(UIApplication *)application 28 28 { -
iOS/Orbit/Orbit/SignalConverter.h
rce0a7ee rde10cbc 8 8 9 9 #import <Foundation/Foundation.h> 10 //#import <MediaPlayer/MediaPlayer.h> 10 11 #import <AVFoundation/AVFoundation.h> 11 12 #import "TGAccessoryManager.h" … … 22 23 @property (nonatomic) float meditationThreshold; 23 24 @property (nonatomic) BOOL running; 25 @property (nonatomic) BOOL testing; 24 26 25 27 … … 31 33 - (BOOL) isVolumeMax; 32 34 - (void) setYaw:(int)y throttle:(int)t pitch:(int)p; 35 - (void) playTestSound; 36 - (void) stopTestSound; 33 37 34 38 @end -
iOS/Orbit/Orbit/SignalConverter.m
rce0a7ee rde10cbc 30 30 } 31 31 32 @synthesize attentionThreshold, meditationThreshold, running ;32 @synthesize attentionThreshold, meditationThreshold, running, testing; 33 33 34 34 … … 139 139 - (BOOL) isVolumeMax 140 140 { 141 float volume = [[AVAudioSession sharedInstance] outputVolume];142 return volume == 1.0;141 AudioSessionSetActive(YES); 142 return 1.0 == [[AVAudioSession sharedInstance] outputVolume]; 143 143 } 144 144 … … 147 147 - (BOOL) startProcessing 148 148 { 149 if (testing) return NO; 149 150 EAAccessory *accessory = [[TGAccessoryManager sharedTGAccessoryManager] accessory]; 150 151 if (accessory != nil) { … … 160 161 - (void) stopProcessing 161 162 { 162 [self appStopped]; 163 if (running) [self appStopped]; 164 } 165 166 - (void) playTestSound 167 { 168 if (!running && !testing) { 169 testing = YES; 170 [audioPlayer playWithThrottle:throttle yaw:yaw pitch:pitch]; 171 } 172 } 173 174 - (void) stopTestSound 175 { 176 if (testing) { 177 testing = NO; 178 [audioPlayer stop]; 179 } 163 180 } 164 181 -
iOS/Orbit/Orbit/controllers/AdvancedViewController.h
rab9d63b rde10cbc 17 17 @property (nonatomic, retain) IBOutlet UILabel *pitchPercent; 18 18 @property (nonatomic, retain) IBOutlet UISlider *pitch; 19 @property (nonatomic, retain) IBOutlet UIBarButtonItem *resetButton; 19 20 20 21 - (IBAction) pitchChanged:(id)sender; … … 22 23 - (IBAction) throttleChanged:(id)sender; 23 24 25 - (IBAction) resetButtonPressed:(id)button; 26 24 27 @end -
iOS/Orbit/Orbit/controllers/AdvancedViewController.m
rce0a7ee rde10cbc 53 53 - (void) adjustValues 54 54 { 55 55 [signalConverter setYaw:[self yawValue]throttle:[self throttleValue] pitch:[self pitchValue]]; 56 } 57 58 - (int) yawValue 59 { 60 return round(yaw.value * 100); 61 } 62 63 - (int) pitchValue 64 { 65 return round(pitch.value * 100); 66 } 67 68 - (int) throttleValue 69 { 70 return round(throttle.value * 100); 71 } 72 73 - (IBAction) resetButtonPressed:(id)button 74 { 75 pitch.value = 0.5; 76 yaw.value = 0.5; 77 throttle.value = 0.5; 78 NSString *zero = @"0%"; 79 throttlePercent.text = zero; 80 yawPercent.text = zero; 81 pitchPercent.text = zero; 82 [self adjustValues]; 56 83 } 57 84 -
iOS/Orbit/Orbit/controllers/FlightViewController.h
rab9d63b rde10cbc 27 27 @property (nonatomic, retain) IBOutlet UISlider *meditationThreshold; 28 28 @property (nonatomic, retain) IBOutlet UIBarButtonItem *connectButton; 29 @property (nonatomic, retain) IBOutlet UIBarButtonItem *testButton; 29 30 @property (nonatomic, retain) IBOutlet UIImageView *statusImage; 30 31 31 32 - (IBAction) connectButtonPressed:(id) sender; 33 - (IBAction) testButtonPressed:(id) sender; 32 34 33 35 @end -
iOS/Orbit/Orbit/controllers/FlightViewController.m
rce0a7ee rde10cbc 26 26 } 27 27 28 @synthesize status, attention, meditation, signal, power, attentionThreshold, meditationThreshold, connectButton, statusImage, signalPercent, attentionPercent, meditationPercent, powerPercent;28 @synthesize status, attention, meditation, signal, power, attentionThreshold, meditationThreshold, connectButton, testButton, statusImage, signalPercent, attentionPercent, meditationPercent, powerPercent; 29 29 30 30 - (void)viewDidLoad … … 142 142 [signalConverter stopProcessing]; 143 143 [self resetViews]; 144 } else if (!signalConverter.isVolumeMax) { 145 UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Turn Up The Volume" message:@"Your device volume must be at the maximum for proper operation" delegate:nil cancelButtonTitle:@"OK" otherButtonTitles: nil]; 146 [alert show]; 144 147 } else if (!signalConverter.isBluetoothReady) { 145 148 UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Device not found" message:@"No Bluetooth device detected. Ensure Bluetooth is on and the Mindwave headset is paired" delegate:nil cancelButtonTitle:@"OK" otherButtonTitles: nil]; 146 [alert show];147 } else if (!signalConverter.isVolumeMax) {148 UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Turn Up The Volume" message:@"Your device volume must be at the maximum for proper operation" delegate:nil cancelButtonTitle:@"OK" otherButtonTitles: nil];149 149 [alert show]; 150 150 } else if ([signalConverter startProcessing]) { … … 157 157 } 158 158 159 - (IBAction) testButtonPressed:(id) sender { 160 if (signalConverter.running) { 161 UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Stop test sound" message:@"Press Stop first to end the test" delegate:nil cancelButtonTitle:@"OK" otherButtonTitles: nil]; 162 [alert show]; 163 } else { 164 if (signalConverter.testing) { 165 testButton.title = @"Test"; 166 [signalConverter stopTestSound]; 167 } else { 168 testButton.title = @"Stop"; 169 [signalConverter playTestSound]; 170 } 171 } 172 } 173 159 174 @end -
iOS/Orbit/Orbit/controllers/TutorialViewController.m
rce0a7ee rde10cbc 15 15 - (void)viewDidLoad 16 16 { 17 NSString *file = [[NSBundle mainBundle] pathForResource:@"index" ofType:@"html"]; 18 NSString *html = [NSString stringWithContentsOfFile:file encoding:NSUTF8StringEncoding error:nil]; 19 [webView loadHTMLString:html baseURL:nil]; 17 [webView loadRequest: 18 [NSURLRequest requestWithURL: 19 [NSURL fileURLWithPath: 20 [[NSBundle mainBundle] pathForResource:@"index" ofType:@"html"]]]]; 20 21 [super viewDidLoad]; 21 22 } -
iOS/Orbit/Orbit/en.lproj/MainStoryboard.storyboard
rce0a7ee rde10cbc 189 189 <autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMaxY="YES"/> 190 190 <items> 191 <navigationItem title="Advanced" id="5si-2Z-XrP"/> 191 <navigationItem title="Advanced" id="5si-2Z-XrP"> 192 <barButtonItem key="rightBarButtonItem" title="Reset" id="gTs-AS-CLK"> 193 <connections> 194 <action selector="resetButtonPressed:" destination="GcO-3J-amz" id="BNP-eK-aEX"/> 195 </connections> 196 </barButtonItem> 197 </navigationItem> 192 198 </items> 193 199 </navigationBar> … … 199 205 <outlet property="pitch" destination="pE4-wd-89x" id="Sbm-iD-GAE"/> 200 206 <outlet property="pitchPercent" destination="cMg-2k-3dB" id="CuC-M3-EWV"/> 207 <outlet property="resetButton" destination="gTs-AS-CLK" id="xuL-gD-ehx"/> 201 208 <outlet property="throttle" destination="mKS-gr-qpn" id="O0G-49-cDf"/> 202 209 <outlet property="throttlePercent" destination="uE4-bJ-AfU" id="2eT-1d-7nT"/> … … 222 229 <items> 223 230 <navigationItem title="Flight" id="adH-fG-xVu"> 224 <barButtonItem key=" rightBarButtonItem" title="Connect" id="Lwp-ZU-iKO">231 <barButtonItem key="leftBarButtonItem" title="Connect" id="Lwp-ZU-iKO"> 225 232 <connections> 226 233 <action selector="connectButtonPressed:" destination="2FE-fA-6q3" id="01p-85-w79"/> 234 </connections> 235 </barButtonItem> 236 <barButtonItem key="rightBarButtonItem" title="Test" id="Geo-cL-sK5"> 237 <connections> 238 <action selector="testButtonPressed:" destination="FNb-Lg-ILk" id="eh7-gJ-44x"/> 227 239 </connections> 228 240 </barButtonItem> … … 398 410 <outlet property="status" destination="BOS-Js-1rx" id="fDM-Of-lza"/> 399 411 <outlet property="statusImage" destination="aa9-oz-0Qj" id="ilQ-PQ-gI8"/> 412 <outlet property="testButton" destination="Geo-cL-sK5" id="P8n-GW-Eih"/> 400 413 </connections> 401 414 </viewController> … … 474 487 <relationships> 475 488 <relationship kind="action" name="pitchChanged:"/> 489 <relationship kind="action" name="resetButtonPressed:"/> 476 490 <relationship kind="action" name="throttleChanged:"/> 477 491 <relationship kind="action" name="yawChanged:"/> 478 492 <relationship kind="outlet" name="pitch" candidateClass="UISlider"/> 479 493 <relationship kind="outlet" name="pitchPercent" candidateClass="UILabel"/> 494 <relationship kind="outlet" name="resetButton" candidateClass="UIBarButtonItem"/> 480 495 <relationship kind="outlet" name="throttle" candidateClass="UISlider"/> 481 496 <relationship kind="outlet" name="throttlePercent" candidateClass="UILabel"/> … … 488 503 <relationships> 489 504 <relationship kind="action" name="connectButtonPressed:"/> 505 <relationship kind="action" name="testButtonPressed:"/> 490 506 <relationship kind="outlet" name="attention" candidateClass="UIProgressView"/> 491 507 <relationship kind="outlet" name="attentionPercent" candidateClass="UILabel"/> … … 501 517 <relationship kind="outlet" name="status" candidateClass="UILabel"/> 502 518 <relationship kind="outlet" name="statusImage" candidateClass="UIImageView"/> 519 <relationship kind="outlet" name="testButton" candidateClass="UIBarButtonItem"/> 503 520 </relationships> 504 521 </class> -
iOS/Orbit/index.html
rce0a7ee rde10cbc 3 3 <head> 4 4 <meta name="viewport" content="width=device-width"> 5 <link rel="stylesheet" type="text/css" href="style.css"> 5 6 <title>Orbit Tutorial</title> 6 7 </head> 7 8 <body> 8 <h1>Content goes here</h1> 9 <h1>Step 1</h1> 10 <a class='next button' href="step2.html">Step 2 »</a> 9 11 </body> 10 12 </html> -
iOS/Orbit/orbit.xcodeproj/project.pbxproj
rce0a7ee rde10cbc 28 28 28174C71167F2EA900104752 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 28174C70167F2EA900104752 /* AppDelegate.m */; }; 29 29 28174C7A167F2EAA00104752 /* MainStoryboard.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 28174C78167F2EAA00104752 /* MainStoryboard.storyboard */; }; 30 28174C7D167F2EAA00104752 /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 28174C7C167F2EAA00104752 /* ViewController.m */; }; 31 28174C84167F30C400104752 /* AVFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 28174C83167F30C400104752 /* AVFoundation.framework */; }; 30 282B687017ABD601003DA675 /* step2.html in Resources */ = {isa = PBXBuildFile; fileRef = 282B686F17ABD601003DA675 /* step2.html */; }; 31 282B687217ABD9EC003DA675 /* style.css in Resources */ = {isa = PBXBuildFile; fileRef = 282B687117ABD9EC003DA675 /* style.css */; }; 32 282B687417ABDAB2003DA675 /* step3.html in Resources */ = {isa = PBXBuildFile; fileRef = 282B687317ABDAB2003DA675 /* step3.html */; }; 33 282B687517ABEE33003DA675 /* AVFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 28174C83167F30C400104752 /* AVFoundation.framework */; }; 32 34 2843FE891790205900C79D56 /* status_1.png in Resources */ = {isa = PBXBuildFile; fileRef = 2843FE811790205900C79D56 /* status_1.png */; }; 33 35 2843FE8A1790205900C79D56 /* status_1@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 2843FE821790205900C79D56 /* status_1@2x.png */; }; … … 83 85 28174C70167F2EA900104752 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = "<group>"; }; 84 86 28174C79167F2EAA00104752 /* en */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = en; path = en.lproj/MainStoryboard.storyboard; sourceTree = "<group>"; }; 85 28174C7B167F2EAA00104752 /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = "<group>"; };86 28174C7C167F2EAA00104752 /* ViewController.m */ = {isa = PBXFileReference; indentWidth = 3; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = "<group>"; tabWidth = 3; };87 87 28174C83167F30C400104752 /* AVFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AVFoundation.framework; path = System/Library/Frameworks/AVFoundation.framework; sourceTree = SDKROOT; }; 88 282B686D17ABC368003DA675 /* MediaPlayer.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = MediaPlayer.framework; path = System/Library/Frameworks/MediaPlayer.framework; sourceTree = SDKROOT; }; 89 282B686F17ABD601003DA675 /* step2.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = step2.html; sourceTree = "<group>"; }; 90 282B687117ABD9EC003DA675 /* style.css */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.css; path = style.css; sourceTree = "<group>"; }; 91 282B687317ABDAB2003DA675 /* step3.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = step3.html; sourceTree = "<group>"; }; 88 92 2843FE811790205900C79D56 /* status_1.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = status_1.png; sourceTree = "<group>"; }; 89 93 2843FE821790205900C79D56 /* status_1@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "status_1@2x.png"; sourceTree = "<group>"; }; … … 199 203 buildActionMask = 2147483647; 200 204 files = ( 205 282B687517ABEE33003DA675 /* AVFoundation.framework in Frameworks */, 201 206 286608E417A7D40F003FA806 /* AudioToolbox.framework in Frameworks */, 202 207 28F901301799436F003FB5ED /* CoreBluetooth.framework in Frameworks */, … … 206 211 2815BC0E167F42F500F7E6DA /* Accelerate.framework in Frameworks */, 207 212 2815BC0F167F42F500F7E6DA /* ExternalAccessory.framework in Frameworks */, 208 28174C84167F30C400104752 /* AVFoundation.framework in Frameworks */,209 213 28174C61167F2EA900104752 /* UIKit.framework in Frameworks */, 210 214 28174C63167F2EA900104752 /* Foundation.framework in Frameworks */, … … 220 224 children = ( 221 225 280D2AB417A802DB002D6863 /* index.html */, 226 282B686F17ABD601003DA675 /* step2.html */, 227 282B687117ABD9EC003DA675 /* style.css */, 228 282B687317ABDAB2003DA675 /* step3.html */, 222 229 ); 223 230 name = Tutorial; … … 240 247 isa = PBXGroup; 241 248 children = ( 249 282B686D17ABC368003DA675 /* MediaPlayer.framework */, 242 250 280D2AB317A802C7002D6863 /* Tutorial */, 243 251 286608E317A7D40F003FA806 /* AudioToolbox.framework */, … … 282 290 28174C70167F2EA900104752 /* AppDelegate.m */, 283 291 28174C78167F2EAA00104752 /* MainStoryboard.storyboard */, 284 28174C7B167F2EAA00104752 /* ViewController.h */,285 28174C7C167F2EAA00104752 /* ViewController.m */,286 292 2815BC08167F428B00F7E6DA /* Libraries */, 287 293 28174C67167F2EA900104752 /* Supporting Files */, … … 498 504 280D2AC417A81714002D6863 /* tutorial.png in Resources */, 499 505 280D2AC517A81714002D6863 /* tutorial@2x.png in Resources */, 506 282B687017ABD601003DA675 /* step2.html in Resources */, 507 282B687217ABD9EC003DA675 /* style.css in Resources */, 508 282B687417ABDAB2003DA675 /* step3.html in Resources */, 500 509 ); 501 510 runOnlyForDeploymentPostprocessing = 0; … … 510 519 28174C6D167F2EA900104752 /* main.m in Sources */, 511 520 28174C71167F2EA900104752 /* AppDelegate.m in Sources */, 512 28174C7D167F2EAA00104752 /* ViewController.m in Sources */,513 521 289C7CCF178C36A9005C08EC /* TutorialViewController.m in Sources */, 514 522 289C7D0E178D757F005C08EC /* FlightViewController.m in Sources */,
Note: See TracChangeset
for help on using the changeset viewer.