Show
Ignore:
Timestamp:
05/11/08 21:50:29 (6 months ago)
Author:
morris
Message:

Only disconnect from Bluetooth remotes on delay when there are no player windows open

Refactor delegate methods a bit

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • Spiral/trunk/SPBluetoothRemote.m

    r5517 r5523  
    124124        NSLog(@"*** -[%@ _disconnect]", [self class]); 
    125125 
    126         if(_controlConnected) 
    127                 [_controlChannel closeChannel]; 
    128  
    129         if(_interruptConnected) 
    130                 [_interruptChannel closeChannel]; 
    131          
    132         [_device closeConnection]; 
     126        if([self remoteShouldDisconnect]) { 
     127                if(_controlConnected) 
     128                        [_controlChannel closeChannel]; 
     129 
     130                if(_interruptConnected) 
     131                        [_interruptChannel closeChannel]; 
     132                 
     133                [_device closeConnection]; 
     134        } else { 
     135                [self disconnectAfterDelay]; 
     136        } 
    133137} 
    134138 
     
    197201 
    198202- (void)disconnectAfterDelay { 
    199         [self performSelectorOnce:@selector(_disconnect) afterDelay:1800.0]; 
     203        [self performSelectorOnce:@selector(_disconnect) afterDelay:600.0]; 
     204
     205 
     206 
     207 
     208- (BOOL)remoteShouldDisconnect { 
     209        return NO; 
    200210} 
    201211