- Timestamp:
- 08/19/13 12:44:51 (9 years ago)
- Branches:
- master, Servo, Tab_Interface, pyramid
- Children:
- 1472980, 548a60f
- Parents:
- 6d0d67b
- Location:
- iOS/Orbit
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
iOS/Orbit/Orbit/SignalConverter.m
r7945ecb r8a0f920f 185 185 */ 186 186 187 NSLog(@"Output: %@ is %@", output, kAudioSessionOutputRoute_Headphones);188 187 return CFStringCompare(output, kAudioSessionOutputRoute_Headphones, 0) == kCFCompareEqualTo; 189 188 } -
iOS/Orbit/Orbit/controllers/FlightViewController.h
rde10cbc r8a0f920f 15 15 } 16 16 17 @property (nonatomic, retain) IBOutlet UILabel *status;18 17 @property (nonatomic, retain) IBOutlet UIProgressView *attention; 19 18 @property (nonatomic, retain) IBOutlet UILabel *attentionPercent; -
iOS/Orbit/Orbit/controllers/FlightViewController.m
r359a504 r8a0f920f 23 23 @implementation FlightViewController { 24 24 SignalConverter *signalConverter; 25 int deviceStatus; 25 int deviceStatus; 26 BOOL warned; 26 27 } 27 28 28 @synthesize status,attention, meditation, signal, power, attentionThreshold, meditationThreshold, connectButton, testButton, statusImage, signalPercent, attentionPercent, meditationPercent, powerPercent;29 @synthesize attention, meditation, signal, power, attentionThreshold, meditationThreshold, connectButton, testButton, statusImage, signalPercent, attentionPercent, meditationPercent, powerPercent; 29 30 30 31 - (void)viewDidLoad … … 35 36 36 37 signalConverter.delegate = self; 37 [self.attentionThreshold addTarget:self action:@selector(sliderChanged) forControlEvents:UIControlEventValueChanged]; 38 [self.meditationThreshold addTarget:self action:@selector(sliderChanged) forControlEvents:UIControlEventValueChanged]; 38 [self setThresholds]; 39 [self.attentionThreshold addTarget:self action:@selector(setThresholds) forControlEvents:UIControlEventValueChanged]; 40 [self.meditationThreshold addTarget:self action:@selector(setThresholds) forControlEvents:UIControlEventValueChanged]; 39 41 } 40 42 … … 52 54 power.progress = 0; 53 55 powerPercent.text = @"0%"; 54 [self logMessage:@"Disconnected"];55 56 [self updateStatusImage:STATUS_DEFAULT]; 56 57 connectButton.title = @"Connect"; … … 62 63 [statusImage setImage: [UIImage imageNamed:[NSString stringWithFormat:@"status_%u", statusNo]]]; 63 64 deviceStatus = statusNo; 64 if (statusNo == STATUS_CONNECTED) {65 [self logMessage:@"Check headset fitted properly"];66 } else if (statusNo == STATUS_PROCESSING) {67 [self logMessage:@"Increase your concentration"];68 } else if (statusNo == STATUS_ACTIVE) {69 [self logMessage:@"Flying!"];70 }71 65 } 72 66 } 73 67 74 - (void) s liderChanged68 - (void) setThresholds 75 69 { 76 70 [signalConverter setValuesForAttention:attentionThreshold.value meditation:meditationThreshold.value]; 77 }78 79 - (void) logMessage:(NSString *) str80 {81 status.text = str;82 71 } 83 72 … … 113 102 - (void) notifyHeadsetConnect 114 103 { 115 [self logMessage:@"Headset connected"];116 104 [self updateStatusImage:STATUS_CONNECTING]; 117 105 } … … 125 113 - (void) notifyDeviceConnected:(NSString *)name 126 114 { 127 [self logMessage:[NSString stringWithFormat:@"EEG device %@ connected", name]];128 115 [self updateStatusImage:STATUS_CONNECTING]; 129 116 connectButton.title = @"Disconnect"; … … 146 133 BOOL headphones = [signalConverter isAudioJackPlugged]; 147 134 148 if (! volumeMax && !headphones) {135 if (!warned && !volumeMax && !headphones) { 149 136 UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Check Volume & Transmitter" message:@"Ensure the volume is at max and the transmitter is plugged into the headphones" delegate:nil cancelButtonTitle:@"OK" otherButtonTitles: nil]; 150 137 [alert show]; 151 } else if (! volumeMax) {138 } else if (!warned && !volumeMax) { 152 139 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]; 153 140 [alert show]; 154 } else if (! headphones) {141 } else if (!warned && !headphones) { 155 142 UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Plug In The Transmitter" message:@"Ensure the infrared transmitter is plugged into the headphone jack" delegate:nil cancelButtonTitle:@"OK" otherButtonTitles: nil]; 156 143 [alert show]; … … 159 146 [alert show]; 160 147 } else if ([signalConverter startProcessing]) { 161 [self logMessage:@"Searching for device"];162 148 connectButton.title = @"Disconnect"; 163 149 } else { … … 165 151 [alert show]; 166 152 } 153 warned = YES; 167 154 } 168 155 } -
iOS/Orbit/Orbit/en.lproj/MainStoryboard.storyboard
r28bce14 r8a0f920f 1 1 <?xml version="1.0" encoding="UTF-8" standalone="no"?> 2 <document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="2.0" toolsVersion="3084" systemVersion="11G63 b" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" initialViewController="T1J-Fd-fkz">2 <document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="2.0" toolsVersion="3084" systemVersion="11G63" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" initialViewController="T1J-Fd-fkz"> 3 3 <dependencies> 4 4 <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="2083"/> … … 243 243 </navigationBar> 244 244 <view contentMode="scaleToFill" id="vgz-EV-JZc" userLabel="Attention Background"> 245 <rect key="frame" x="6" y="47" width="309" height=" 55"/>245 <rect key="frame" x="6" y="47" width="309" height="62"/> 246 246 <autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES" heightSizable="YES" flexibleMaxY="YES"/> 247 247 <subviews> … … 254 254 </label> 255 255 <slider opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" value="0.69999999999999996" minValue="0.0" maxValue="1" id="ym8-zN-dSb" userLabel="Attention Threshold"> 256 <rect key="frame" x="4" y="3 3" width="254" height="23"/>256 <rect key="frame" x="4" y="34" width="254" height="23"/> 257 257 <autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMaxX="YES" flexibleMinY="YES" flexibleMaxY="YES"/> 258 258 </slider> … … 278 278 </view> 279 279 <view contentMode="scaleToFill" id="6bR-ua-0jV" userLabel="Meditation Background"> 280 <rect key="frame" x="6" y="1 08" width="309" height="57"/>280 <rect key="frame" x="6" y="117" width="309" height="63"/> 281 281 <autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES" heightSizable="YES" flexibleMaxY="YES"/> 282 282 <subviews> … … 299 299 </label> 300 300 <slider opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" value="0.69999999999999996" minValue="0.0" maxValue="1" id="LJj-vt-JUw" userLabel="Meditation Threshold"> 301 <rect key="frame" x="6" y="3 5" width="254" height="23"/>301 <rect key="frame" x="6" y="36" width="254" height="23"/> 302 302 </slider> 303 303 </subviews> … … 310 310 </view> 311 311 <view contentMode="scaleToFill" id="DEF-SC-IYQ" userLabel="Meditation Background"> 312 <rect key="frame" x="6" y="1 71" width="309" height="64"/>312 <rect key="frame" x="6" y="189" width="309" height="72"/> 313 313 <autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES" heightSizable="YES" flexibleMaxY="YES"/> 314 314 <subviews> 315 315 <progressView opaque="NO" contentMode="scaleToFill" id="AuD-cU-2pt" userLabel="Signal"> 316 <rect key="frame" x="4" y="2 0" width="254" height="9"/>316 <rect key="frame" x="4" y="23" width="254" height="9"/> 317 317 <autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMaxX="YES" flexibleMinY="YES" flexibleMaxY="YES"/> 318 318 <color key="progressTintColor" red="0.0" green="1" blue="0.017424847109999999" alpha="1" colorSpace="calibratedRGB"/> 319 319 </progressView> 320 320 <label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" text="Signal" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="JXh-II-yAS"> 321 <rect key="frame" x="6" y=" 1" width="48" height="17"/>321 <rect key="frame" x="6" y="3" width="48" height="17"/> 322 322 <autoresizingMask key="autoresizingMask" flexibleMinX="YES" widthSizable="YES" flexibleMaxX="YES" flexibleMinY="YES" heightSizable="YES" flexibleMaxY="YES"/> 323 323 <fontDescription key="fontDescription" type="system" pointSize="14"/> … … 326 326 </label> 327 327 <label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" text="Hover" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="oUh-1C-0bs"> 328 <rect key="frame" x="6" y=" 26" width="46" height="21"/>328 <rect key="frame" x="6" y="31" width="46" height="21"/> 329 329 <autoresizingMask key="autoresizingMask" flexibleMinX="YES" widthSizable="YES" flexibleMaxX="YES" flexibleMinY="YES" flexibleMaxY="YES"/> 330 330 <fontDescription key="fontDescription" type="system" pointSize="14"/> … … 333 333 </label> 334 334 <progressView opaque="NO" contentMode="scaleToFill" id="KeR-cO-90u" userLabel="Power"> 335 <rect key="frame" x="4" y=" 49" width="254" height="9"/>335 <rect key="frame" x="4" y="54" width="254" height="9"/> 336 336 <autoresizingMask key="autoresizingMask" flexibleMinX="YES" widthSizable="YES" flexibleMaxX="YES" flexibleMinY="YES" flexibleMaxY="YES"/> 337 337 <color key="progressTintColor" red="1" green="0.84573597209999996" blue="0.0" alpha="1" colorSpace="calibratedRGB"/> 338 338 </progressView> 339 339 <label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" text="0%" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="yYn-76-IoI"> 340 <rect key="frame" x="263" y="1 6" width="46" height="17"/>340 <rect key="frame" x="263" y="19" width="46" height="17"/> 341 341 <autoresizingMask key="autoresizingMask" flexibleMinX="YES" widthSizable="YES" flexibleMaxX="YES" flexibleMinY="YES" heightSizable="YES" flexibleMaxY="YES"/> 342 342 <fontDescription key="fontDescription" type="system" pointSize="14"/> … … 345 345 </label> 346 346 <label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" text="0%" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="ah9-c0-kCb"> 347 <rect key="frame" x="263" y="4 1" width="46" height="23"/>347 <rect key="frame" x="263" y="46" width="46" height="23"/> 348 348 <autoresizingMask key="autoresizingMask" flexibleMinX="YES" widthSizable="YES" flexibleMaxX="YES" flexibleMinY="YES" flexibleMaxY="YES"/> 349 349 <fontDescription key="fontDescription" type="system" pointSize="14"/> … … 363 363 </view> 364 364 <view contentMode="scaleToFill" id="lfi-AW-BAx"> 365 <rect key="frame" x="7" y="243" width="308" height="163"/> 366 <autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES" heightSizable="YES" flexibleMaxY="YES"/> 367 <subviews> 368 <label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" text="Disconnected" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="BOS-Js-1rx" userLabel="Status"> 369 <rect key="frame" x="20" y="126" width="268" height="32"/> 370 <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/> 371 <color key="backgroundColor" white="0.66666666666666663" alpha="1" colorSpace="calibratedWhite"/> 372 <fontDescription key="fontDescription" type="system" pointSize="16"/> 373 <color key="textColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="calibratedRGB"/> 374 <nil key="highlightedColor"/> 375 <userDefinedRuntimeAttributes> 376 <userDefinedRuntimeAttribute type="number" keyPath="layer.cornerRadius"> 377 <real key="value" value="5"/> 378 </userDefinedRuntimeAttribute> 379 </userDefinedRuntimeAttributes> 380 </label> 365 <rect key="frame" x="7" y="269" width="308" height="137"/> 366 <autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES" heightSizable="YES" flexibleMaxY="YES"/> 367 <subviews> 381 368 <imageView opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleAspectFit" image="status_0.png" id="aa9-oz-0Qj"> 382 <rect key="frame" x="66" y=" 0.0" width="177" height="126"/>369 <rect key="frame" x="66" y="6" width="177" height="126"/> 383 370 <autoresizingMask key="autoresizingMask" flexibleMinX="YES" widthSizable="YES" flexibleMaxX="YES" flexibleMinY="YES" heightSizable="YES" flexibleMaxY="YES"/> 384 371 </imageView> … … 408 395 <outlet property="signal" destination="AuD-cU-2pt" id="uuu-hc-E2e"/> 409 396 <outlet property="signalPercent" destination="yYn-76-IoI" id="4Ei-JM-jZ1"/> 410 <outlet property="status" destination="BOS-Js-1rx" id="fDM-Of-lza"/>411 397 <outlet property="statusImage" destination="aa9-oz-0Qj" id="ilQ-PQ-gI8"/> 412 398 <outlet property="testButton" destination="Geo-cL-sK5" id="P8n-GW-Eih"/>
Note: See TracChangeset
for help on using the changeset viewer.