-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathCSGenericSensorSetup.m
More file actions
80 lines (63 loc) · 2 KB
/
Copy pathCSGenericSensorSetup.m
File metadata and controls
80 lines (63 loc) · 2 KB
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
73
74
75
76
77
78
79
80
//
// CSGenericSensorSetup.m
// CrowdSensing-iOS
//
// Created by Minos Katevas on 14/10/2014.
// Copyright (c) 2014 Kleomenis Katevas. All rights reserved.
//
#import "CSGenericSensorSetup.h"
#import <SensingKit/NSString+SensorType.h>
@interface CSGenericSensorSetup ()
@end
@implementation CSGenericSensorSetup
- (void)viewDidLoad {
[super viewDidLoad];
}
- (NSString *)tableView:(UITableView *)tableView titleForFooterInSection:(NSInteger)section
{
if (section == 0)
{
return self.sensorDescription;
}
else
{
return nil;
}
}
- (void)setSensorType:(SKSensorType)sensorType
{
// Update the title first
[self updateTitleForSensor:sensorType];
_sensorType = sensorType;
}
- (void)updateTitleForSensor:(SKSensorType)sensorType
{
self.title = [NSString stringWithSensorType:sensorType];
}
- (void)alertSensorNotAvailable
{
[self alertWithTitle:[NSString stringWithFormat:@"%@ Sensor", self.title]
withMessage:@"Sensor is not available on this device."
withHandler:nil];
}
- (void)updateConfiguration
{
if (self.delegate)
{
[self.delegate updateConfiguration:self.configuration forSensor:self.sensorType];
}
}
- (void)alertWithTitle:(NSString *)title withMessage:(NSString *)message
withHandler:(void (^ __nullable)(UIAlertAction *action))handler
{
UIAlertController *alertController = [UIAlertController alertControllerWithTitle:title
message:message
preferredStyle:UIAlertControllerStyleAlert];
UIAlertAction *okAction = [UIAlertAction
actionWithTitle:@"OK"
style:UIAlertActionStyleDefault
handler:handler];
[alertController addAction:okAction];
[self presentViewController:alertController animated:YES completion:nil];
}
@end