CaptuvoOptionsController.m 3.89 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56
//
//  CaptuvoOptionsController.m
//  CaptuvoSDKDemo
//
//  Created by PLUC SeniorDesign on 2/24/15.
//  Copyright (c) 2015 Anthony J. Carno. All rights reserved.
//

#import "CaptuvoOptionsController.h"

@interface CaptuvoOptionsController ()

@end

@implementation CaptuvoOptionsController

int sled_volume;

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    [[Captuvo sharedCaptuvoDevice] requestDecoderGoodReadBeeperVolumeStatus];
    
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/**
 @brief This method identifies the current sled volume and then sets the label and the stepper to the correct values.
 */
- (void)decoderGoodReadBeeperVolumeStatus:(BeeperVolume)volume
{
    switch (volume) {
        case BeeperVolumeHigh:
            sled_volume = 3;
            self.sledSoundLabel.text = @"High";
            break;
        case BeeperVolumeMedium:
            sled_volume = 2;
            self.sledSoundLabel.text = @"Medium";
            break;
        case BeeperVolumeLow:
            sled_volume = 1;
            self.sledSoundLabel.text = @"Low";
            break;
        case BeeperVolumeOff:
            sled_volume = 0;
            self.sledSoundLabel.text = @"Silent";
            break;
        default:
            break;
    }
    self.sledSoundStepper.value = (double)sled_volume;
57
    self.volumeSlider.value = sled_volume;
58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89
}

/**
 @brief This method changes the sled volume between high, medium, low, and silent.
 
 @param (id)sender - tied to button
 @return IBAction - tied to button
 */
- (IBAction)changeSledVolume:(id)sender {
    sled_volume = (int)self.sledSoundStepper.value;
    switch (sled_volume) {
        case 0:
            [[Captuvo sharedCaptuvoDevice] setDecoderGoodReadBeeperVolume:BeeperVolumeOff persistSetting:YES];
            self.sledSoundLabel.text = @"Silent";
            break;
        case 1:
            [[Captuvo sharedCaptuvoDevice] setDecoderGoodReadBeeperVolume:BeeperVolumeLow persistSetting:YES];
            self.sledSoundLabel.text = @"Low";
            break;
        case 2:
            [[Captuvo sharedCaptuvoDevice] setDecoderGoodReadBeeperVolume:BeeperVolumeMedium persistSetting:YES];
            self.sledSoundLabel.text = @"Medium";
            break;
        case 3:
            [[Captuvo sharedCaptuvoDevice] setDecoderGoodReadBeeperVolume:BeeperVolumeHigh persistSetting:YES];
            self.sledSoundLabel.text = @"High";
            break;
        default:
            break;
    }
}

90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115
- (IBAction)changeSledVolumeSlider:(id)sender {
    sled_volume = (int)lroundf(self.volumeSlider.value);
    [self.volumeSlider setValue:sled_volume animated:YES];
    switch (sled_volume) {
        case 0:
            [[Captuvo sharedCaptuvoDevice] setDecoderGoodReadBeeperVolume:BeeperVolumeOff persistSetting:YES];
            self.sledSoundLabel.text = @"Silent";
            break;
        case 1:
            [[Captuvo sharedCaptuvoDevice] setDecoderGoodReadBeeperVolume:BeeperVolumeLow persistSetting:YES];
            self.sledSoundLabel.text = @"Low";
            break;
        case 2:
            [[Captuvo sharedCaptuvoDevice] setDecoderGoodReadBeeperVolume:BeeperVolumeMedium persistSetting:YES];
            self.sledSoundLabel.text = @"Medium";
            break;
        case 3:
            [[Captuvo sharedCaptuvoDevice] setDecoderGoodReadBeeperVolume:BeeperVolumeHigh persistSetting:YES];
            self.sledSoundLabel.text = @"High";
            break;
        default:
            break;
    }
}


116 117 118 119 120 121 122 123 124 125 126
/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end