Take Picture

The ‘Take Picture’ scene is responsible for executing image capture actions. The main UI scene contains a show segue to the ‘Take Picture’ scene in the ‘Take Picture’ button of the main UI scene. 

Take Picture

Clicking the ‘Take Picture’ button in the ‘Take Picture’ scene performs an image capture action.

 

ios_take_picture.png

 

From the TakePictureViewController class, the clickTakePictureButton: method calls the executeTakePicture method to send camera.takePicture command. If the command state is equal to “inProgress”, checkCommandsStatusWithId: is recursively called until the state changes to other than “inProgress”. The response (fileUrl) will be presented in a dialog if the command is successfully executed. 

Interval Shot

The ‘Interval Shot’ button in the ‘Take Picture’ scene contains a show segue to the ‘Interval Shot’ sub-scene. If the current captureMode option is not set to “interval”, the application prompts a dialog whether to change captureMode to “interval”.

 

ios_interval_shot.png

 

Set ‘Capture Interval’ and ‘Capture Number’ and click ‘Set Options (captureInterval, captureNumber)’ button to execute camera.setOptions command by calling the setOptionForIntervalShot method of IntervalShotViewController class.

 

The executeStartCapture method is called from the clickStartCaptureButton: method by the ‘Start Capture’ button click. The executeStartCapture method sends camera.startCapture command to the camera.  

-(void) executeStartCapture {
    
    NSLog(@"---------Send Request for camera.startCapture");
    
    [OSCCommandsExecute OSCRequestCommandsExecute:OSC_STR_CAMERA_START_CAPTURE
                                     oscParameter:nil
                               block_notConnected:^{}
                                  block_errorHttp:^(id err){}
                                   block_errorOSC:^(id err){}
                                    block_finally:^{}
                                    block_success:^(NSData* result){
                                        [self successFuncStartCapture:result];
                                        
                                    }];
}

 

The response is handled in the successFuncStartCapture: method. The application uses NSTimer to wait for captureNumber * captureInterval seconds after submitting camera.startCapture command to get the full list of fileUrls. If the command state is equal to “inProgress”, checkCommandsStatusWithId: is recursively called until the state changes to other than “inProgress”. 

-(void) successFuncStartCapture: (NSData *) result {
    ...
    
    if(_delayTimerForCheckCommandsStatus == nil){
        NSLog(@" Set timer to wait captureInterval finished");
        NSTimeInterval delay = (_captureNumber + 1) * _captureInterval;
        NSDictionary *userInfo = @{ @"commandId" : commandId};
        _delayTimerForCheckCommandsStatus =
        [NSTimer scheduledTimerWithTimeInterval:delay
                                         target:self
                                       selector:@selector(delayTimerOut:)
                                       userInfo:userInfo
                                        repeats:NO];
    }
}

 

The interval capture can be stopped by clicking the ‘Stop Capture’ button. The executeStopCapture method calls camera.stopCapture command to terminate previously started interval capture action. 

Burst Shot

The ‘Burst Shot’ button in the ‘Take Picture’ scene contains a show segue to the ‘Burst Shot’ sub-scene. If the current captureMode option is not set to “_burstshot”, the application prompts a dialog whether to change captureMode to “_burstshot”.

 

ios_burst_shot.png

 

Set ‘_burstshotNumber’ and click ‘Set Options (_burstshotNumber)’ button to execute camera.setOptions command by calling the setOptionForBurstShot method of BurstShotViewController class.

 

The executeStartCapture method is called from the clickStartCaptureButton: method by the ‘Start Capture’ button click. The executeStartCapture method sends camera.startCapture command to the camera.

-(void) executeStartCapture {
    
    NSLog(@"---------Send Request for camera.startCapture");
    
    [OSCCommandsExecute OSCRequestCommandsExecute:OSC_STR_CAMERA_START_CAPTURE
                                     oscParameter:nil
                               block_notConnected:^{}
                                  block_errorHttp:^(id err){}
                                   block_errorOSC:^(id err){}
                                    block_finally:^{}
                                    block_success:^(NSData* result){
                                        [self successFuncStartCapture:result];
                                        
                                    }];
}

 

Note that the command returns ‘done’ state and no fileUrls are specified in the output.

Navigation