summaryrefslogtreecommitdiff
path: root/SDL_iOS/SmartDeviceLinkTester/SmartDeviceLinkTester/SetMediaClockTimerViewController.m
blob: e296c6098d5ab06ce607aa5d42bb80bb7e5fb502 (plain)
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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
//
// Copyright (c) 2013 Ford Motor Company
//

#import "SetMediaClockTimerViewController.h"

@interface SetMediaClockTimerViewController ()

@end

@implementation SetMediaClockTimerViewController

-(IBAction)setMediaClockTimerPressed:(id)sender {
   
    SDLUpdateMode *ua;
    if (updateControl.selectedSegmentIndex == 0) {
        ua = [SDLUpdateMode COUNTUP];
    }
    else if (updateControl.selectedSegmentIndex == 1) {
        ua = [SDLUpdateMode COUNTDOWN];
    }
    else if (updateControl.selectedSegmentIndex == 2) {
        ua = [SDLUpdateMode PAUSE];
    }
    else {
        ua = [SDLUpdateMode RESUME];
    }
    
    [[SDLBrain getInstance] setMediaClockTimerPressedwithHours:[NSNumber numberWithInt:[[hoursText text] intValue]] minutes:[NSNumber numberWithInt:[[minutesText text] intValue]] seconds:[NSNumber numberWithInt:[[secondsText text] intValue]] updateMode:ua];
    
    hoursText.text = @"";
    minutesText.text = @"";
    secondsText.text = @"";
}

- (BOOL)textFieldShouldReturn:(UITextField *)textField {
    [textField resignFirstResponder];
    return NO;
}


- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self.title = @"SetMediaClockTimer";
    
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization
    }
    return self;
}

- (void)viewDidLoad
{
    [super viewDidLoad];
    hoursText.delegate = self;
    minutesText.delegate = self;
    secondsText.delegate = self;
}

- (void)viewDidUnload
{
    [super viewDidUnload];
    
}

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
    return (interfaceOrientation == UIInterfaceOrientationPortrait);
}

@end