Ignore:
Timestamp:
08/27/13 02:28:13 (7 years ago)
Author:
Steve Castellotti <sc@…>
Branches:
master, Servo, Tab_Interface, pyramid
Children:
ad80ed2
Parents:
6bdfe8d
Message:

Orbit:

  • Signal bar now updating correctly

Tutorial:

  • additional text added to step 6
File:
1 edited

Legend:

Unmodified
Added
Removed
  • iOS/Orbit/Orbit/SignalConverter.m

    rba2b6ff rd249b65  
    8282} 
    8383 
    84 // Updated signal received from the EEG headset.  
     84// Updated signal received from the EEG headset. 
    8585- (void) updatedSignalReceived:(id) data 
    8686{ 
     
    9090    { 
    9191        [_delegate updatedValuesForSignal: signalStrength 
    92                                     attention: (float)attentionLevel / 100 
    93                                    meditation: (float)meditationLevel / 100 
    94                                         power: [self currentPowerLevel]]; 
     92                                attention: (float)attentionLevel / 100 
     93                               meditation: (float)meditationLevel / 100 
     94                                    power: [self currentPowerLevel]]; 
    9595    } 
    9696    [self playAudio]; 
     
    101101    [self setSignalStrength:(NSNumber *)[data valueForKey:POOR_SIGNAL_KEY]]; 
    102102    [self setAttentionLevel:(NSNumber *)[data valueForKey:ATTENTION_KEY]]; 
    103     [self setMeditationLevel:(NSNumber *)[data valueForKey:MEDITATION_KEY]];     
     103    [self setMeditationLevel:(NSNumber *)[data valueForKey:MEDITATION_KEY]]; 
    104104} 
    105105 
     
    107107{ 
    108108    if (value != nil) { 
    109         signalStrength = (200.0 - [value intValue]) / 200.0; 
     109         
     110//        NSLog(@"value: %i", [value intValue]); 
     111         
     112        if ([value intValue] == 0) { 
     113            signalStrength = 100; 
     114        } 
     115         
     116        else if ([value intValue] == 200) { 
     117            signalStrength = 0; 
     118        } 
     119         
     120        else { 
     121            signalStrength = [value intValue]; 
     122        } 
     123         
     124//        NSLog(@"signalStrength: %i", signalStrength); 
     125         
    110126    } 
    111127} 
     
    162178    // make the call to get the audio description and populate the desc dictionary 
    163179    AudioSessionGetProperty(kAudioSessionProperty_AudioRouteDescription, &routeSize, &desc); 
    164  
     180     
    165181    // the dictionary contains 2 keys, for input and output. Get output array 
    166182    CFArrayRef outputs = CFDictionaryGetValue(desc, kAudioSession_AudioRouteKey_Outputs); 
     
    184200     kAudioSessionOutputRoute_AirPlay 
    185201     */ 
    186  
     202     
    187203    return CFStringCompare(output, kAudioSessionOutputRoute_Headphones, 0) == kCFCompareEqualTo; 
    188204} 
     
    231247- (float) currentPowerLevel 
    232248{ 
    233     
     249     
    234250    float attentionScore = attentionPower[attentionLevel]; 
    235251    float meditationScore = meditationPower[meditationLevel]; 
     
    242258        meditationScore = 0; 
    243259    } 
    244  
     260     
    245261    float powerLevel = attentionScore + meditationScore; 
    246262    if (powerLevel > 1) { 
Note: See TracChangeset for help on using the changeset viewer.