Commit ac650a20e88ff330441fa8902d7ab57cb18403b4

Authored by Imanol-Mikel Barba Sabariego
1 parent 76dea9de

--no commit message

Showing 20 changed files with 408 additions and 155 deletions
DUREX Vendor Control/DUREX Vendor Control.xcodeproj/project.pbxproj
... ... @@ -15,10 +15,10 @@
15 15 3471867C18070D9300FA0FB2 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3471866418070D9300FA0FB2 /* UIKit.framework */; };
16 16 347186A618070E7200FA0FB2 /* libEMFramework.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 347186A518070E7200FA0FB2 /* libEMFramework.a */; };
17 17 347186AC18070FAB00FA0FB2 /* CoreBluetooth.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 347186AB18070FAB00FA0FB2 /* CoreBluetooth.framework */; };
18   - 34AAB883189804FF0019860D /* EMAppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 34AAB877189804FF0019860D /* EMAppDelegate.m */; };
  18 + 34AAB883189804FF0019860D /* DUREXAppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 34AAB877189804FF0019860D /* DUREXAppDelegate.m */; };
19 19 34AAB884189804FF0019860D /* EMConnectingView.xib in Resources */ = {isa = PBXBuildFile; fileRef = 34AAB878189804FF0019860D /* EMConnectingView.xib */; };
20 20 34AAB885189804FF0019860D /* EMDevicePickerViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 34AAB87A189804FF0019860D /* EMDevicePickerViewController.m */; };
21   - 34AAB886189804FF0019860D /* EMFirstAppViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 34AAB87C189804FF0019860D /* EMFirstAppViewController.m */; };
  21 + 34AAB886189804FF0019860D /* DUREXAppViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 34AAB87C189804FF0019860D /* DUREXAppViewController.m */; };
22 22 34AAB889189804FF0019860D /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 34AAB880189804FF0019860D /* main.m */; };
23 23 34AAB88A189804FF0019860D /* MainStoryboard.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 34AAB881189804FF0019860D /* MainStoryboard.storyboard */; };
24 24 34AAB88D189805300019860D /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 34AAB88C189805300019860D /* Images.xcassets */; };
... ... @@ -59,13 +59,13 @@
59 59 347186A318070E6500FA0FB2 /* EMTypes.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EMTypes.h; sourceTree = "<group>"; };
60 60 347186A518070E7200FA0FB2 /* libEMFramework.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libEMFramework.a; path = EmmocoMobileFramework/Framework/libEMFramework.a; sourceTree = SOURCE_ROOT; };
61 61 347186AB18070FAB00FA0FB2 /* CoreBluetooth.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreBluetooth.framework; path = System/Library/Frameworks/CoreBluetooth.framework; sourceTree = SDKROOT; };
62   - 34AAB876189804FF0019860D /* EMAppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = EMAppDelegate.h; path = FirstAppExample/EMAppDelegate.h; sourceTree = SOURCE_ROOT; };
63   - 34AAB877189804FF0019860D /* EMAppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = EMAppDelegate.m; path = FirstAppExample/EMAppDelegate.m; sourceTree = SOURCE_ROOT; };
  62 + 34AAB876189804FF0019860D /* DUREXAppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DUREXAppDelegate.h; path = FirstAppExample/DUREXAppDelegate.h; sourceTree = SOURCE_ROOT; };
  63 + 34AAB877189804FF0019860D /* DUREXAppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = DUREXAppDelegate.m; path = FirstAppExample/DUREXAppDelegate.m; sourceTree = SOURCE_ROOT; };
64 64 34AAB878189804FF0019860D /* EMConnectingView.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; name = EMConnectingView.xib; path = FirstAppExample/EMConnectingView.xib; sourceTree = SOURCE_ROOT; };
65 65 34AAB879189804FF0019860D /* EMDevicePickerViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = EMDevicePickerViewController.h; path = FirstAppExample/EMDevicePickerViewController.h; sourceTree = SOURCE_ROOT; };
66 66 34AAB87A189804FF0019860D /* EMDevicePickerViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = EMDevicePickerViewController.m; path = FirstAppExample/EMDevicePickerViewController.m; sourceTree = SOURCE_ROOT; };
67   - 34AAB87B189804FF0019860D /* EMFirstAppViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = EMFirstAppViewController.h; path = FirstAppExample/EMFirstAppViewController.h; sourceTree = SOURCE_ROOT; };
68   - 34AAB87C189804FF0019860D /* EMFirstAppViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = EMFirstAppViewController.m; path = FirstAppExample/EMFirstAppViewController.m; sourceTree = SOURCE_ROOT; };
  67 + 34AAB87B189804FF0019860D /* DUREXAppViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DUREXAppViewController.h; path = FirstAppExample/DUREXAppViewController.h; sourceTree = SOURCE_ROOT; };
  68 + 34AAB87C189804FF0019860D /* DUREXAppViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = DUREXAppViewController.m; path = FirstAppExample/DUREXAppViewController.m; sourceTree = SOURCE_ROOT; };
69 69 34AAB87E189804FF0019860D /* DUREX Vendor Control-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = "DUREX Vendor Control-Info.plist"; path = "FirstAppExample/DUREX Vendor Control-Info.plist"; sourceTree = SOURCE_ROOT; };
70 70 34AAB87F189804FF0019860D /* DUREX Vendor Control-Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "DUREX Vendor Control-Prefix.pch"; path = "FirstAppExample/DUREX Vendor Control-Prefix.pch"; sourceTree = SOURCE_ROOT; };
71 71 34AAB880189804FF0019860D /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = main.m; path = FirstAppExample/main.m; sourceTree = SOURCE_ROOT; };
... ... @@ -135,10 +135,10 @@
135 135 isa = PBXGroup;
136 136 children = (
137 137 34AAB881189804FF0019860D /* MainStoryboard.storyboard */,
138   - 34AAB876189804FF0019860D /* EMAppDelegate.h */,
139   - 34AAB877189804FF0019860D /* EMAppDelegate.m */,
140   - 34AAB87B189804FF0019860D /* EMFirstAppViewController.h */,
141   - 34AAB87C189804FF0019860D /* EMFirstAppViewController.m */,
  138 + 34AAB876189804FF0019860D /* DUREXAppDelegate.h */,
  139 + 34AAB877189804FF0019860D /* DUREXAppDelegate.m */,
  140 + 34AAB87B189804FF0019860D /* DUREXAppViewController.h */,
  141 + 34AAB87C189804FF0019860D /* DUREXAppViewController.m */,
142 142 34AAB88C189805300019860D /* Images.xcassets */,
143 143 347186B91807290E00FA0FB2 /* Schemas */,
144 144 347186A718070F7F00FA0FB2 /* Device Picker */,
... ... @@ -308,8 +308,8 @@
308 308 buildActionMask = 2147483647;
309 309 files = (
310 310 34AAB885189804FF0019860D /* EMDevicePickerViewController.m in Sources */,
311   - 34AAB883189804FF0019860D /* EMAppDelegate.m in Sources */,
312   - 34AAB886189804FF0019860D /* EMFirstAppViewController.m in Sources */,
  311 + 34AAB883189804FF0019860D /* DUREXAppDelegate.m in Sources */,
  312 + 34AAB886189804FF0019860D /* DUREXAppViewController.m in Sources */,
313 313 34AAB889189804FF0019860D /* main.m in Sources */,
314 314 );
315 315 runOnlyForDeploymentPostprocessing = 0;
... ...
DUREX Vendor Control/DUREX Vendor Control.xcodeproj/project.xcworkspace/xcuserdata/imanol.xcuserdatad/UserInterfaceState.xcuserstate
No preview for this file type
DUREX Vendor Control/DUREX Vendor Control.xcodeproj/xcuserdata/imanol.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist 0 → 100644
  1 +<?xml version="1.0" encoding="UTF-8"?>
  2 +<Bucket
  3 + type = "1"
  4 + version = "2.0">
  5 +</Bucket>
... ...
DUREX Vendor Control/DUREX Vendor Control.xcodeproj/xcuserdata/imanol.xcuserdatad/xcschemes/FirstApp.xcscheme renamed to DUREX Vendor Control/DUREX Vendor Control.xcodeproj/xcuserdata/imanol.xcuserdatad/xcschemes/DUREX Vendor Control.xcscheme
DUREX Vendor Control/DUREX Vendor Control.xcodeproj/xcuserdata/imanol.xcuserdatad/xcschemes/xcschememanagement.plist
... ... @@ -4,7 +4,7 @@
4 4 <dict>
5 5 <key>SchemeUserState</key>
6 6 <dict>
7   - <key>FirstApp.xcscheme</key>
  7 + <key>DUREX Vendor Control.xcscheme</key>
8 8 <dict>
9 9 <key>orderHint</key>
10 10 <integer>0</integer>
... ...
DUREX Vendor Control/FirstAppExample/EMAppDelegate.h renamed to DUREX Vendor Control/FirstAppExample/DUREXAppDelegate.h
1 1 //
2   -// EMAppDelegate.h
  2 +// DUREXAppDelegate.h
3 3 // TestAppExample
4 4 //
5 5 // Created by Dexter Weiss on 10/10/13.
... ... @@ -8,7 +8,7 @@
8 8  
9 9 #import <UIKit/UIKit.h>
10 10  
11   -@interface EMAppDelegate : UIResponder <UIApplicationDelegate>
  11 +@interface DUREXAppDelegate : UIResponder <UIApplicationDelegate>
12 12  
13 13 @property (strong, nonatomic) UIWindow *window;
14 14 @property (nonatomic, strong) IBOutlet UINavigationController *navController;
... ...
DUREX Vendor Control/FirstAppExample/EMAppDelegate.m renamed to DUREX Vendor Control/FirstAppExample/DUREXAppDelegate.m
1 1 //
2   -// EMAppDelegate.m
  2 +// DUREXAppDelegate.m
3 3 // TestAppExample
4 4 //
5 5 // Created by Dexter Weiss on 10/10/13.
6 6 // Copyright (c) 2013 Emmoco. All rights reserved.
7 7 //
8 8  
9   -#import "EMAppDelegate.h"
  9 +#import "DUREXAppDelegate.h"
10 10 #import "EMFramework.h"
11 11 #import "EMDevicePickerViewController.h"
12 12  
13   -@interface EMAppDelegate () <UINavigationControllerDelegate> {
  13 +@interface DUREXAppDelegate () <UINavigationControllerDelegate>
  14 +{
  15 +
14 16 }
15 17  
16 18 @end
17 19  
18   -@implementation EMAppDelegate
  20 +@implementation DUREXAppDelegate
19 21  
20 22 - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
21 23 {
... ... @@ -56,13 +58,19 @@
56 58  
57 59 #pragma mark - Navigation Controller
58 60  
59   -- (void)navigationController:(UINavigationController *)navigationController didShowViewController:(UIViewController *)viewController animated:(BOOL)animated {
60   - if ([viewController isKindOfClass:[EMDevicePickerViewController class]]) {
61   - [[EMConnectionManager sharedManager] disconnectWithSuccess:^{
62   -
63   - } onFail:^(NSError *error) {
64   -
65   - }];
  61 +- (void)navigationController:(UINavigationController *)navigationController didShowViewController:(UIViewController *)viewController animated:(BOOL)animated
  62 +{
  63 + if ([viewController isKindOfClass:[EMDevicePickerViewController class]])
  64 + {
  65 + [[EMConnectionManager sharedManager] disconnectWithSuccess:^
  66 + {
  67 +
  68 + }
  69 + onFail:^(NSError *error)
  70 + {
  71 +
  72 + }
  73 + ];
66 74 }
67 75 }
68 76  
... ...
DUREX Vendor Control/FirstAppExample/EMFirstAppViewController.h renamed to DUREX Vendor Control/FirstAppExample/DUREXAppViewController.h
1 1 #import <UIKit/UIKit.h>
2 2  
3   -@interface EMFirstAppViewController : UIViewController
  3 +@interface DUREXAppViewController : UIViewController
4 4  
5 5 @property (nonatomic, strong) IBOutlet UILabel *valueLabel;
6 6 @property (nonatomic, strong) IBOutlet UISlider *valueSlider;
7 7  
8   --(IBAction)sliderChanged:(UISlider *)sender;
9   --(IBAction)sliderDidFinishChanging:(UISlider *)sender;
  8 +
10 9  
11 10 @end
... ...
DUREX Vendor Control/FirstAppExample/DUREXAppViewController.m 0 → 100644
  1 +#import "DUREXAppViewController.h"
  2 +#import "EMFramework.h"
  3 +
  4 +@interface DUREXAppViewController ()
  5 +{
  6 + IBOutlet UIActivityIndicatorView *_activityIndicator;
  7 + NSTimer *_writeTimer;
  8 +}
  9 +
  10 +@end
  11 +
  12 +@implementation DUREXAppViewController
  13 +
  14 +- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
  15 +{
  16 + self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
  17 + if (self)
  18 + {
  19 + // Custom initialization
  20 + }
  21 + return self;
  22 +}
  23 +
  24 +- (void)viewDidLoad
  25 +{
  26 + [super viewDidLoad];
  27 + [_activityIndicator setHidden:YES];
  28 + [self setTitle:[[[EMConnectionManager sharedManager] connectedDevice] name]];
  29 + [[EMConnectionManager sharedManager] readResource:@"data" onSuccess:^(id readValue)
  30 + {
  31 + [[self valueLabel] setText:[NSString stringWithFormat:@"%d", [readValue intValue]]];
  32 + [[self valueSlider] setValue:[readValue floatValue]];
  33 + }
  34 + onFail:^(NSError *error)
  35 + {
  36 +
  37 + }
  38 + ];
  39 +
  40 + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(didReceiveNotification:) name:kEMConnectionDidReceiveIndicatorNotificationName object:nil];
  41 +
  42 + [[EMConnectionManager sharedManager] addObserver:self forKeyPath:@"connectionState" options:0 context:NULL];
  43 +}
  44 +
  45 +-(void)didReceiveNotification:(NSNotification*) notification
  46 +{
  47 + id notificationValue = [[notification userInfo] objectForKey:kEMIndicatorResourceValueKey];
  48 + NSString *resourceName = [[notification userInfo] objectForKey:kEMIndicatorNameKey];
  49 + NSString *resourceValue = [notificationValue stringValue];
  50 +}
  51 +
  52 +-(void)dealloc
  53 +{
  54 + [[EMConnectionManager sharedManager] removeObserver:self forKeyPath:@"connectionState"];
  55 +}
  56 +
  57 +-(void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context
  58 +{
  59 + if (object == [EMConnectionManager sharedManager])
  60 + {
  61 + if ([keyPath isEqualToString:@"connectionState"])
  62 + {
  63 + if ([[EMConnectionManager sharedManager] connectionState] == EMConnectionStateDisrupted)
  64 + {
  65 + [[self navigationController] popToRootViewControllerAnimated:YES];
  66 + }
  67 + }
  68 + }
  69 +}
  70 +
  71 +-(NSString*) readMessage
  72 +{
  73 +
  74 +}
  75 +
  76 +-(Boolean) writeMessage: (NSString*) message
  77 +{
  78 + __block Boolean status = FALSE;
  79 + [[EMConnectionManager sharedManager] writeValue:[NSNumber numberWithFloat:[[self valueSlider] value]] toResource:@"data" onSuccess:^
  80 + {
  81 + status = TRUE;
  82 + }
  83 + onFail:^(NSError *error)
  84 + {
  85 + NSLog(@"%@",error);
  86 + status = FALSE;
  87 + }
  88 + ];
  89 + if(status != FALSE)
  90 + {
  91 + [[EMConnectionManager sharedManager] writeValue:[NSNumber numberWithFloat:[[self valueSlider] value]] toResource:@"data" onSuccess:^
  92 + {
  93 + status = TRUE;
  94 + }
  95 + onFail:^(NSError *error)
  96 + {
  97 + NSLog(@"%@",error);
  98 + status = FALSE;
  99 + }
  100 + ];
  101 + if(status != FALSE)
  102 + {
  103 + [[EMConnectionManager sharedManager] writeValue:[NSNumber numberWithFloat:[[self valueSlider] value]] toResource:@"data" onSuccess:^
  104 + {
  105 + status = TRUE;
  106 + }
  107 + onFail:^(NSError *error)
  108 + {
  109 + NSLog(@"%@",error);
  110 + status = FALSE;
  111 + }
  112 + ];
  113 + if(status != FALSE)
  114 + {
  115 + [[EMConnectionManager sharedManager] writeValue:[NSNumber numberWithFloat:[[self valueSlider] value]] toResource:@"data" onSuccess:^
  116 + {
  117 + status = TRUE;
  118 + }
  119 + onFail:^(NSError *error)
  120 + {
  121 + NSLog(@"%@",error);
  122 + status = FALSE;
  123 + }
  124 + ];
  125 + }
  126 + }
  127 + }
  128 + return status;
  129 +}
  130 +
  131 +#pragma mark - Interface actions
  132 +
  133 +
  134 +
  135 +
  136 +@end
0 137 \ No newline at end of file
... ...
DUREX Vendor Control/FirstAppExample/EMDevicePickerViewController.m
... ... @@ -23,7 +23,8 @@
23 23 - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
24 24 {
25 25 self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
26   - if (self) {
  26 + if (self)
  27 + {
27 28 // Custom initialization
28 29 }
29 30 return self;
... ... @@ -40,46 +41,56 @@
40 41 [[EMConnectionListManager sharedManager] addObserver:self forKeyPath:@"devices" options:0 context:NULL];
41 42 }
42 43  
43   --(void)_showConnectingView {
  44 +-(void)_showConnectingView
  45 +{
44 46 [[self activityIndicator] startAnimating];
45 47 [[self connectingView] setHidden:NO];
46 48 }
47 49  
48   --(void)_hideConnectingView {
  50 +-(void)_hideConnectingView
  51 +{
49 52 [[self activityIndicator] stopAnimating];
50 53 [[self connectingView] setHidden:YES];
51 54 }
52 55  
53   --(void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context {
54   - if (object == [EMConnectionListManager sharedManager]) {
  56 +-(void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context
  57 +{
  58 + if (object == [EMConnectionListManager sharedManager])
  59 + {
55 60 [[self tableView] reloadData];
56 61 }
57 62 }
58 63  
59 64 #pragma mark - Table View Methods
60 65  
61   --(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
  66 +-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
  67 +{
62 68 return 1;
63 69 }
64 70  
65   --(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
  71 +-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
  72 +{
66 73 return MAX([[[EMConnectionListManager sharedManager] devices] count], 1);
67 74 }
68 75  
69   --(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
  76 +-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
  77 +{
70 78 UITableViewCell *deviceCell = [tableView dequeueReusableCellWithIdentifier:@"DeviceCell"];
71 79 [[deviceCell detailTextLabel] setTextColor:[UIColor darkGrayColor]];
72 80  
73 81 EMDeviceBasicDescription *description = nil;
74   - if ([indexPath row] < [[[EMConnectionListManager sharedManager] devices] count]) {
  82 + if ([indexPath row] < [[[EMConnectionListManager sharedManager] devices] count])
  83 + {
75 84 description = [[[EMConnectionListManager sharedManager] devices] objectAtIndex:[indexPath row]];
76 85 }
77 86  
78   - if (description) {
  87 + if (description)
  88 + {
79 89 [[deviceCell textLabel] setText:[description name]];
80 90 [[deviceCell detailTextLabel] setText:[NSString stringWithFormat:@"Signal Strength: %0.0f", [description signalStrength]]];
81 91 }
82   - else {
  92 + else
  93 + {
83 94 [[deviceCell textLabel] setText:NSLocalizedString(@"Searching for devices...", @"No devices found string")];
84 95 [[deviceCell detailTextLabel] setText:nil];
85 96 }
... ... @@ -87,17 +98,22 @@
87 98 return deviceCell;
88 99 }
89 100  
90   --(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
  101 +-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
  102 +{
91 103 [self _showConnectingView];
92 104 EMDeviceBasicDescription *description = [[[EMConnectionListManager sharedManager] devices] objectAtIndex:[indexPath row]];
93   - [[EMConnectionManager sharedManager] connectDevice:description onSuccess:^{
94   - [self _hideConnectingView];
95   - [self performSegueWithIdentifier:@"ConnectionSegue" sender:self];
96   - } onFail:^(NSError *error) {
97   - [self _hideConnectingView];
98   - UIAlertView *alert = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Connection Failed", @"Alert title") message:NSLocalizedString(@"An error occurred while trying to connect to the selected device", @"Alert message") delegate:nil cancelButtonTitle:NSLocalizedString(@"Close", @"Close button") otherButtonTitles:nil];
99   - [alert show];
100   - }];
  105 + [[EMConnectionManager sharedManager] connectDevice:description onSuccess:^
  106 + {
  107 + [self _hideConnectingView];
  108 + [self performSegueWithIdentifier:@"ConnectionSegue" sender:self];
  109 + }
  110 + onFail:^(NSError *error)
  111 + {
  112 + [self _hideConnectingView];
  113 + UIAlertView *alert = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Connection Failed", @"Alert title") message:NSLocalizedString(@"An error occurred while trying to connect to the selected device", @"Alert message") delegate:nil cancelButtonTitle:NSLocalizedString(@"Close", @"Close button") otherButtonTitles:nil];
  114 + [alert show];
  115 + }
  116 + ];
101 117 }
102 118  
103 119 @end
... ...
DUREX Vendor Control/FirstAppExample/EMFirstAppViewController.m deleted
1   -#import "EMFirstAppViewController.h"
2   -#import "EMFramework.h"
3   -
4   -@interface EMFirstAppViewController () {
5   - IBOutlet UIActivityIndicatorView *_activityIndicator;
6   - NSTimer *_writeTimer;
7   -}
8   -
9   -@end
10   -
11   -@implementation EMFirstAppViewController
12   -
13   -- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
14   -{
15   - self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
16   - if (self) {
17   - // Custom initialization
18   - }
19   - return self;
20   -}
21   -
22   -- (void)viewDidLoad
23   -{
24   - [super viewDidLoad];
25   - [_activityIndicator setHidden:YES];
26   - [self setTitle:[[[EMConnectionManager sharedManager] connectedDevice] name]];
27   - [[EMConnectionManager sharedManager] readResource:@"data" onSuccess:^(id readValue) {
28   - [[self valueLabel] setText:[NSString stringWithFormat:@"%d", [readValue intValue]]];
29   - [[self valueSlider] setValue:[readValue floatValue]];
30   - } onFail:^(NSError *error) {
31   -
32   - }];
33   -
34   - [[EMConnectionManager sharedManager] addObserver:self forKeyPath:@"connectionState" options:0 context:NULL];
35   -}
36   -
37   --(void)dealloc {
38   - [[EMConnectionManager sharedManager] removeObserver:self forKeyPath:@"connectionState"];
39   -}
40   -
41   --(void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context {
42   - if (object == [EMConnectionManager sharedManager]) {
43   - if ([keyPath isEqualToString:@"connectionState"]) {
44   - if ([[EMConnectionManager sharedManager] connectionState] == EMConnectionStateDisrupted) {
45   - [[self navigationController] popToRootViewControllerAnimated:YES];
46   - }
47   - }
48   - }
49   -}
50   -
51   -#pragma mark - Interface actions
52   -
53   --(IBAction)sliderChanged:(UISlider *)sender {
54   - [[self valueLabel] setText:[NSString stringWithFormat:@"%0.0f", [sender value]]];
55   - if (_writeTimer) {
56   - [_writeTimer invalidate];
57   - _writeTimer = nil;
58   - }
59   - _writeTimer = [NSTimer scheduledTimerWithTimeInterval:0.1 target:self selector:@selector(sliderDidFinishChanging:) userInfo:nil repeats:NO];
60   -}
61   -
62   --(IBAction)sliderDidFinishChanging:(UISlider *)sender {
63   - [_writeTimer invalidate];
64   - _writeTimer = nil;
65   - [_activityIndicator startAnimating];
66   - [_activityIndicator setHidden:NO];
67   -
68   - [[EMConnectionManager sharedManager] writeValue:[NSNumber numberWithFloat:[[self valueSlider] value]] toResource:@"data" onSuccess:^{
69   - [_activityIndicator setHidden:YES];
70   - [_activityIndicator stopAnimating];
71   - } onFail:^(NSError *error) {
72   -
73   - }];
74   -}
75   -@end
DUREX Vendor Control/FirstAppExample/MainStoryboard.storyboard
1 1 <?xml version="1.0" encoding="UTF-8" standalone="no"?>
2   -<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="4510" systemVersion="13B3116" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" initialViewController="kWw-Rk-wD6">
  2 +<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="5056" systemVersion="12F45" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" initialViewController="kWw-Rk-wD6">
3 3 <dependencies>
4   - <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="3742"/>
  4 + <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="3733"/>
5 5 </dependencies>
6 6 <scenes>
7 7 <!--Device Picker View Controller - First App-->
... ... @@ -64,39 +64,17 @@
64 64 <rect key="frame" x="0.0" y="0.0" width="320" height="568"/>
65 65 <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
66 66 <subviews>
67   - <slider opaque="NO" contentMode="scaleToFill" fixedFrame="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" value="0.5" minValue="0.0" maxValue="65535" translatesAutoresizingMaskIntoConstraints="NO" id="0OZ-CY-Zj4">
68   - <rect key="frame" x="18" y="267" width="284" height="34"/>
69   - <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
70   - <connections>
71   - <action selector="sliderChanged:" destination="brh-a3-PgF" eventType="valueChanged" id="Lym-cA-4qW"/>
72   - </connections>
73   - </slider>
74   - <textView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" fixedFrame="YES" editable="NO" text="My App contains a single unsigned integer resource. Drag the slider to change the value." selectable="NO" translatesAutoresizingMaskIntoConstraints="NO" id="0W0-sW-zLj">
  67 + <textView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" fixedFrame="YES" editable="NO" text="THE GAME" selectable="NO" translatesAutoresizingMaskIntoConstraints="NO" id="0W0-sW-zLj">
75 68 <rect key="frame" x="20" y="86" width="280" height="173"/>
76 69 <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
77 70 <color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="calibratedRGB"/>
78 71 <fontDescription key="fontDescription" type="system" pointSize="14"/>
79 72 <textInputTraits key="textInputTraits" autocapitalizationType="sentences"/>
80 73 </textView>
81   - <label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" text="Label" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="JaT-6i-nWK">
82   - <rect key="frame" x="20" y="308" width="280" height="21"/>
83   - <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
84   - <fontDescription key="fontDescription" type="system" pointSize="17"/>
85   - <nil key="highlightedColor"/>
86   - </label>
87   - <activityIndicatorView opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="750" verticalHuggingPriority="750" fixedFrame="YES" style="gray" translatesAutoresizingMaskIntoConstraints="NO" id="kkT-Fw-PZB">
88   - <rect key="frame" x="103" y="308" width="20" height="20"/>
89   - <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
90   - </activityIndicatorView>
91 74 </subviews>
92 75 <color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
93 76 </view>
94 77 <navigationItem key="navigationItem" id="2ME-k3-mFZ"/>
95   - <connections>
96   - <outlet property="_activityIndicator" destination="kkT-Fw-PZB" id="ZTL-TP-ybx"/>
97   - <outlet property="valueLabel" destination="JaT-6i-nWK" id="SF8-4d-C6u"/>
98   - <outlet property="valueSlider" destination="0OZ-CY-Zj4" id="hIS-Tw-wnP"/>
99   - </connections>
100 78 </viewController>
101 79 <placeholder placeholderIdentifier="IBFirstResponder" id="pLK-Yw-jB4" userLabel="First Responder" sceneMemberID="firstResponder"/>
102 80 </objects>
... ... @@ -123,4 +101,4 @@
123 101 <simulatedOrientationMetrics key="orientation"/>
124 102 <simulatedScreenMetrics key="destination" type="retina4"/>
125 103 </simulatedMetricsContainer>
126   -</document>
127 104 \ No newline at end of file
  105 +</document>
... ...
DUREX Vendor Control/FirstAppExample/main.m
... ... @@ -8,11 +8,11 @@
8 8  
9 9 #import <UIKit/UIKit.h>
10 10  
11   -#import "EMAppDelegate.h"
  11 +#import "DUREXAppDelegate.h"
12 12  
13 13 int main(int argc, char * argv[])
14 14 {
15 15 @autoreleasepool {
16   - return UIApplicationMain(argc, argv, nil, NSStringFromClass([EMAppDelegate class]));
  16 + return UIApplicationMain(argc, argv, nil, NSStringFromClass([DUREXAppDelegate class]));
17 17 }
18 18 }
... ...
ios-examples-13.4.9/FirstApp/FirstApp.xcodeproj/project.xcworkspace/contents.xcworkspacedata 0 → 100644
  1 +<?xml version="1.0" encoding="UTF-8"?>
  2 +<Workspace
  3 + version = "1.0">
  4 + <FileRef
  5 + location = "self:FirstApp.xcodeproj">
  6 + </FileRef>
  7 +</Workspace>
... ...
ios-examples-13.4.9/FirstApp/FirstApp.xcodeproj/project.xcworkspace/xcshareddata/FirstApp.xccheckout 0 → 100644
  1 +<?xml version="1.0" encoding="UTF-8"?>
  2 +<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
  3 +<plist version="1.0">
  4 +<dict>
  5 + <key>IDESourceControlProjectFavoriteDictionaryKey</key>
  6 + <false/>
  7 + <key>IDESourceControlProjectIdentifier</key>
  8 + <string>F3823CA7-4E1F-42C9-83E6-7F9A3B0B4380</string>
  9 + <key>IDESourceControlProjectName</key>
  10 + <string>FirstApp</string>
  11 + <key>IDESourceControlProjectOriginsDictionary</key>
  12 + <dict>
  13 + <key>C52D274C-DEEC-4CDB-BD77-3B4747652588</key>
  14 + <string>svn://imanolbarba.net/durex</string>
  15 + </dict>
  16 + <key>IDESourceControlProjectPath</key>
  17 + <string>ios-examples-13.4.9/FirstApp/FirstApp.xcodeproj/project.xcworkspace</string>
  18 + <key>IDESourceControlProjectRelativeInstallPathDictionary</key>
  19 + <dict>
  20 + <key>C52D274C-DEEC-4CDB-BD77-3B4747652588</key>
  21 + <string>../../../..</string>
  22 + </dict>
  23 + <key>IDESourceControlProjectRepositoryRootDictionary</key>
  24 + <dict>
  25 + <key>C52D274C-DEEC-4CDB-BD77-3B4747652588</key>
  26 + <string>svn://imanolbarba.net/durex</string>
  27 + </dict>
  28 + <key>IDESourceControlProjectURL</key>
  29 + <string>svn://imanolbarba.net/durex/ios-examples-13.4.9/FirstApp/FirstApp.xcodeproj</string>
  30 + <key>IDESourceControlProjectVersion</key>
  31 + <integer>110</integer>
  32 + <key>IDESourceControlProjectWCCIdentifier</key>
  33 + <string>C52D274C-DEEC-4CDB-BD77-3B4747652588</string>
  34 + <key>IDESourceControlProjectWCConfigurations</key>
  35 + <array>
  36 + <dict>
  37 + <key>IDESourceControlRepositoryExtensionIdentifierKey</key>
  38 + <string>public.vcs.subversion</string>
  39 + <key>IDESourceControlWCCIdentifierKey</key>
  40 + <string>C52D274C-DEEC-4CDB-BD77-3B4747652588</string>
  41 + <key>IDESourceControlWCCName</key>
  42 + <string>durex</string>
  43 + </dict>
  44 + </array>
  45 +</dict>
  46 +</plist>
... ...
ios-examples-13.4.9/FirstApp/FirstApp.xcodeproj/project.xcworkspace/xcuserdata/imanol.xcuserdatad/UserInterfaceState.xcuserstate 0 → 100644
No preview for this file type
ios-examples-13.4.9/FirstApp/FirstApp.xcodeproj/project.xcworkspace/xcuserdata/imanol.xcuserdatad/WorkspaceSettings.xcsettings 0 → 100644
  1 +<?xml version="1.0" encoding="UTF-8"?>
  2 +<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
  3 +<plist version="1.0">
  4 +<dict>
  5 + <key>HasAskedToTakeAutomaticSnapshotBeforeSignificantChanges</key>
  6 + <true/>
  7 + <key>SnapshotAutomaticallyBeforeSignificantChanges</key>
  8 + <true/>
  9 +</dict>
  10 +</plist>
... ...
ios-examples-13.4.9/FirstApp/FirstApp.xcodeproj/xcuserdata/imanol.xcuserdatad/xcschemes/FirstApp.xcscheme 0 → 100644
  1 +<?xml version="1.0" encoding="UTF-8"?>
  2 +<Scheme
  3 + LastUpgradeVersion = "0510"
  4 + version = "1.3">
  5 + <BuildAction
  6 + parallelizeBuildables = "YES"
  7 + buildImplicitDependencies = "YES">
  8 + <BuildActionEntries>
  9 + <BuildActionEntry
  10 + buildForTesting = "YES"
  11 + buildForRunning = "YES"
  12 + buildForProfiling = "YES"
  13 + buildForArchiving = "YES"
  14 + buildForAnalyzing = "YES">
  15 + <BuildableReference
  16 + BuildableIdentifier = "primary"
  17 + BlueprintIdentifier = "3471865C18070D9300FA0FB2"
  18 + BuildableName = "FirstApp.app"
  19 + BlueprintName = "FirstApp"
  20 + ReferencedContainer = "container:FirstApp.xcodeproj">
  21 + </BuildableReference>
  22 + </BuildActionEntry>
  23 + </BuildActionEntries>
  24 + </BuildAction>
  25 + <TestAction
  26 + selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
  27 + selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
  28 + shouldUseLaunchSchemeArgsEnv = "YES"
  29 + buildConfiguration = "Debug">
  30 + <Testables>
  31 + <TestableReference
  32 + skipped = "NO">
  33 + <BuildableReference
  34 + BuildableIdentifier = "primary"
  35 + BlueprintIdentifier = "3471867718070D9300FA0FB2"
  36 + BuildableName = "FirstAppTests.xctest"
  37 + BlueprintName = "FirstAppTests"
  38 + ReferencedContainer = "container:FirstApp.xcodeproj">
  39 + </BuildableReference>
  40 + </TestableReference>
  41 + </Testables>
  42 + <MacroExpansion>
  43 + <BuildableReference
  44 + BuildableIdentifier = "primary"
  45 + BlueprintIdentifier = "3471865C18070D9300FA0FB2"
  46 + BuildableName = "FirstApp.app"
  47 + BlueprintName = "FirstApp"
  48 + ReferencedContainer = "container:FirstApp.xcodeproj">
  49 + </BuildableReference>
  50 + </MacroExpansion>
  51 + </TestAction>
  52 + <LaunchAction
  53 + selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
  54 + selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
  55 + launchStyle = "0"
  56 + useCustomWorkingDirectory = "NO"
  57 + buildConfiguration = "Debug"
  58 + ignoresPersistentStateOnLaunch = "NO"
  59 + debugDocumentVersioning = "YES"
  60 + allowLocationSimulation = "YES">
  61 + <BuildableProductRunnable>
  62 + <BuildableReference
  63 + BuildableIdentifier = "primary"
  64 + BlueprintIdentifier = "3471865C18070D9300FA0FB2"
  65 + BuildableName = "FirstApp.app"
  66 + BlueprintName = "FirstApp"
  67 + ReferencedContainer = "container:FirstApp.xcodeproj">
  68 + </BuildableReference>
  69 + </BuildableProductRunnable>
  70 + <AdditionalOptions>
  71 + </AdditionalOptions>
  72 + </LaunchAction>
  73 + <ProfileAction
  74 + shouldUseLaunchSchemeArgsEnv = "YES"
  75 + savedToolIdentifier = ""
  76 + useCustomWorkingDirectory = "NO"
  77 + buildConfiguration = "Release"
  78 + debugDocumentVersioning = "YES">
  79 + <BuildableProductRunnable>
  80 + <BuildableReference
  81 + BuildableIdentifier = "primary"
  82 + BlueprintIdentifier = "3471865C18070D9300FA0FB2"
  83 + BuildableName = "FirstApp.app"
  84 + BlueprintName = "FirstApp"
  85 + ReferencedContainer = "container:FirstApp.xcodeproj">
  86 + </BuildableReference>
  87 + </BuildableProductRunnable>
  88 + </ProfileAction>
  89 + <AnalyzeAction
  90 + buildConfiguration = "Debug">
  91 + </AnalyzeAction>
  92 + <ArchiveAction
  93 + buildConfiguration = "Release"
  94 + revealArchiveInOrganizer = "YES">
  95 + </ArchiveAction>
  96 +</Scheme>
... ...
ios-examples-13.4.9/FirstApp/FirstApp.xcodeproj/xcuserdata/imanol.xcuserdatad/xcschemes/xcschememanagement.plist 0 → 100644
  1 +<?xml version="1.0" encoding="UTF-8"?>
  2 +<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
  3 +<plist version="1.0">
  4 +<dict>
  5 + <key>SchemeUserState</key>
  6 + <dict>
  7 + <key>FirstApp.xcscheme</key>
  8 + <dict>
  9 + <key>orderHint</key>
  10 + <integer>0</integer>
  11 + </dict>
  12 + </dict>
  13 + <key>SuppressBuildableAutocreation</key>
  14 + <dict>
  15 + <key>3471865C18070D9300FA0FB2</key>
  16 + <dict>
  17 + <key>primary</key>
  18 + <true/>
  19 + </dict>
  20 + <key>3471867718070D9300FA0FB2</key>
  21 + <dict>
  22 + <key>primary</key>
  23 + <true/>
  24 + </dict>
  25 + </dict>
  26 +</dict>
  27 +</plist>
... ...
ios-examples-13.4.9/FirstApp/FirstAppExample/MainStoryboard.storyboard
1 1 <?xml version="1.0" encoding="UTF-8" standalone="no"?>
2   -<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="4510" systemVersion="13B3116" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" initialViewController="kWw-Rk-wD6">
  2 +<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="5056" systemVersion="12F45" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" initialViewController="kWw-Rk-wD6">
3 3 <dependencies>
4   - <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="3742"/>
  4 + <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="3733"/>
5 5 </dependencies>
6 6 <scenes>
7 7 <!--Device Picker View Controller - First App-->
... ... @@ -123,4 +123,4 @@
123 123 <simulatedOrientationMetrics key="orientation"/>
124 124 <simulatedScreenMetrics key="destination" type="retina4"/>
125 125 </simulatedMetricsContainer>
126   -</document>
127 126 \ No newline at end of file
  127 +</document>
... ...