Commit eb096bad143ece6a0831b45a65162227b59ff8fe

Authored by Imanol-Mikel Barba Sabariego
1 parent 2a24825e

--no commit message

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
... ... @@ -57,22 +57,6 @@
57 57 shouldBeEnabled = "No"
58 58 ignoreCount = "0"
59 59 continueAfterRunningActions = "No"
60   - filePath = "MenuTableViewController.m"
61   - timestampString = "431435390.453053"
62   - startingColumnNumber = "9223372036854775807"
63   - endingColumnNumber = "9223372036854775807"
64   - startingLineNumber = "204"
65   - endingLineNumber = "204"
66   - landmarkName = "-viewDidLoad"
67   - landmarkType = "5">
68   - </BreakpointContent>
69   - </BreakpointProxy>
70   - <BreakpointProxy
71   - BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
72   - <BreakpointContent
73   - shouldBeEnabled = "No"
74   - ignoreCount = "0"
75   - continueAfterRunningActions = "No"
76 60 filePath = "DatePickerViewController.m"
77 61 timestampString = "431435820.039883"
78 62 startingColumnNumber = "9223372036854775807"
... ...
DUREX Vendor Control/FirstAppExample/EMDevicePickerViewController.m
... ... @@ -100,24 +100,25 @@
100 100  
101 101 -(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
102 102 {
103   - if([[[[tableView cellForRowAtIndexPath:indexPath] textLabel] text] isEqualToString:NSLocalizedString(@"Searching for devices...",nil)])
  103 + //[self performSegueWithIdentifier:@"ConnectionSegue" sender:self];
  104 + if(![[[[tableView cellForRowAtIndexPath:indexPath] textLabel] text] isEqualToString:NSLocalizedString(@"Searching for devices...",nil)])
104 105 {
105   - return;
  106 + [self _showConnectingView];
  107 + EMDeviceBasicDescription *description = [[[EMConnectionListManager sharedManager] devices] objectAtIndex:[indexPath row]];
  108 + [[EMConnectionManager sharedManager] connectDevice:description onSuccess:^
  109 + {
  110 + [self _hideConnectingView];
  111 + [self performSegueWithIdentifier:@"ConnectionSegue" sender:self];
  112 + }
  113 + onFail:^(NSError *error)
  114 + {
  115 + [self _hideConnectingView];
  116 + 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];
  117 + [alert show];
  118 + }
  119 + ];
106 120 }
107   - [self _showConnectingView];
108   - EMDeviceBasicDescription *description = [[[EMConnectionListManager sharedManager] devices] objectAtIndex:[indexPath row]];
109   - [[EMConnectionManager sharedManager] connectDevice:description onSuccess:^
110   - {
111   - [self _hideConnectingView];
112   - [self performSegueWithIdentifier:@"ConnectionSegue" sender:self];
113   - }
114   - onFail:^(NSError *error)
115   - {
116   - [self _hideConnectingView];
117   - 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];
118   - [alert show];
119   - }
120   - ];
  121 + [tableView deselectRowAtIndexPath:indexPath animated:YES];
121 122 }
122 123  
123 124 @end
... ...
DUREX Vendor Control/MenuTableViewController.m
... ... @@ -65,6 +65,22 @@
65 65 [self setMenuHeaders:nil];
66 66 }
67 67  
  68 + [self setConfigElements:[[NSArray alloc] initWithObjects:CONFIGURATION_ELEMENTS, nil]];
  69 + [self setConfigStructure:[[NSArray alloc] initWithObjects:CONFIGURATION_CELLS_PER_SECTION, nil]];
  70 + if([[self configStructure] count] > 1)
  71 + {
  72 + [self setConfigHeaders:[[NSArray alloc] initWithObjects:CONFIGURATION_HEADERS, nil]];
  73 + }
  74 + else
  75 + {
  76 + [self setConfigHeaders:nil];
  77 + }
  78 +
  79 + [self setCellIdentifiers:[[NSArray alloc] initWithObjects:CELL_IDENTIFIERS, nil]];
  80 +}
  81 +
  82 +- (void) generateMaintenanceLevel
  83 +{
68 84 [self setMaintenanceElements:[[NSArray alloc] initWithObjects:MAINTENANCE_ELEMENTS, nil]];
69 85 [self setMaintenanceStructure:[[NSArray alloc] initWithObjects:MAINTENANCE_CELLS_PER_SECTION, nil]];
70 86 if([[self maintenanceStructure] count] > 1)
... ... @@ -75,7 +91,10 @@
75 91 {
76 92 [self setMaintenanceHeaders:nil];
77 93 }
78   -
  94 +}
  95 +
  96 +- (void) generateSalesNavLevel
  97 +{
79 98 [self setSalesElements:[[NSArray alloc] initWithObjects:SALES_ELEMENTS, nil]];
80 99 [self setSalesStructure:[[NSArray alloc] initWithObjects:SALES_CELLS_PER_SECTION, nil]];
81 100 if([[self salesStructure] count] > 1)
... ... @@ -86,21 +105,10 @@
86 105 {
87 106 [self setSalesHeaders:nil];
88 107 }
89   -
90   - [self setConfigElements:[[NSArray alloc] initWithObjects:CONFIGURATION_ELEMENTS, nil]];
91   - [self setConfigStructure:[[NSArray alloc] initWithObjects:CONFIGURATION_CELLS_PER_SECTION, nil]];
92   - if([[self configStructure] count] > 1)
93   - {
94   - [self setConfigHeaders:[[NSArray alloc] initWithObjects:CONFIGURATION_HEADERS, nil]];
95   - }
96   - else
97   - {
98   - [self setConfigHeaders:nil];
99   - }
100   -
101   - [self setCellIdentifiers:[[NSArray alloc] initWithObjects:CELL_IDENTIFIERS, nil]];
102 108 }
103 109  
  110 +
  111 +
104 112 - (void) changeNavLevel: (uint8_t) level : (BOOL) push
105 113 {
106 114 NSLog(@"[MenuTableViewController.m]: navLevel is %d",level);
... ... @@ -182,6 +190,7 @@
182 190 [super viewDidLoad];
183 191 [_activityIndicator setHidden:YES];
184 192  
  193 + //Set navigation bar
185 194 UIImage *backImage = [UIImage imageNamed:@"back_arrow.png"];
186 195 UIButton *backButton = [UIButton buttonWithType:UIButtonTypeCustom];
187 196 backButton.frame = CGRectMake(0, 0, backImage.size.width/2, backImage.size.height/2);
... ... @@ -198,17 +207,6 @@
198 207 [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(didReceiveNotification:) name:kEMConnectionDidReceiveIndicatorNotificationName object:nil];
199 208 [[EMConnectionManager sharedManager] addObserver:self forKeyPath:@"connectionState" options:0 context:NULL];
200 209  
201   - //DUREX protocol initialization
202   - [_protocol setMessageAvailableMobile:false];
203   - [_protocol setMessageAvailableDevice:false];
204   - if(![_protocol establishConnection])
205   - {
206   - UIAlertView* alert = [[UIAlertView alloc] initWithTitle:@"Communication error" message:@"Error while trying to connect to the device" delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil];
207   - [alert show];
208   - UIViewController *previous = [[[self navigationController] viewControllers] objectAtIndex:[[[self navigationController] viewControllers] count]-2];
209   - [[self navigationController] popToViewController:previous animated:YES];
210   - }
211   -
212 210 //Initialize parentLayout stack
213 211 [self setParentLayout:[[Stack alloc]init]];
214 212  
... ... @@ -224,6 +222,22 @@
224 222 // self.navigationItem.rightBarButtonItem = self.editButtonItem;
225 223 }
226 224  
  225 +-(void)viewDidAppear:(BOOL)animated
  226 +{
  227 + [super viewDidAppear:animated];
  228 +
  229 + //DUREX protocol
  230 + [_protocol setMessageAvailableMobile:false];
  231 + [_protocol setMessageAvailableDevice:false];
  232 + if(![_protocol establishConnection])
  233 + {
  234 + UIAlertView* alert = [[UIAlertView alloc] initWithTitle:@"Communication error" message:@"Error while trying to connect to the device" delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil];
  235 + [alert show];
  236 + UIViewController *previous = [[[self navigationController] viewControllers] objectAtIndex:[[[self navigationController] viewControllers] count]-2];
  237 + [[self navigationController] popToViewController:previous animated:YES];
  238 + }
  239 +}
  240 +
227 241 -(void)didReceiveNotification:(NSNotification*) notification
228 242 {
229 243  
... ... @@ -265,12 +279,13 @@
265 279 if([cellName isEqualToString:NSLocalizedString(@"Maintenance", nil)] && [self currentNavLevel] == MENU)
266 280 {
267 281 NSLog(@"[MenuTableViewController.m]: Changing to navLevel: MAINTENANCE");
268   - [_protocol updateProductName:7 :2 :@"Producte #987654321"];
  282 + [self generateMaintenanceLevel];
269 283 [self changeNavLevel:MAINTENANCE:TRUE];
270 284 }
271 285 else if([cellName isEqualToString:NSLocalizedString(@"Sales log", nil)] && [self currentNavLevel] == MAINTENANCE)
272 286 {
273 287 NSLog(@"[MenuTableViewController.m]: Changing to navLevel: SALES");
  288 + [self generateSalesNavLevel];
274 289 [self changeNavLevel:SALES:TRUE];
275 290 }
276 291 else if([cellName isEqualToString:NSLocalizedString(@"Basic Configuration", nil)] && [self currentNavLevel] == MENU)
... ... @@ -283,7 +298,6 @@
283 298 {
284 299 if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)
285 300 {
286   - //self.popupViewController = [[DatePickerViewController alloc] initWithNibName:@"DatePickerViewController_iPad" bundle:nil];
287 301 self.datePickerViewController = [[DatePickerViewController alloc] initWithNibName:@"DatePickerViewController_iPad" bundle:nil];
288 302 self.datePickerViewController.delegate = self;
289 303 [self.datePickerViewController showInView:self.navigationController.view animated:YES];
... ... @@ -295,11 +309,11 @@
295 309 [self.datePickerViewController showInView:self.navigationController.view animated:YES];
296 310 }
297 311 }
  312 + //Update Product Price command
298 313 else if([cellName isEqualToString:NSLocalizedString(@"Update product price", nil)] && [self currentNavLevel] == BASIC_CONFIGURATION)
299 314 {
300 315 if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)
301 316 {
302   - //self.popupViewController = [[DatePickerViewController alloc] initWithNibName:@"DatePickerViewController_iPad" bundle:nil];
303 317 self.priceChangerViewController = [[PriceChangerViewController alloc] initWithNibName:@"PriceChangerViewController_iPad" bundle:nil];
304 318 self.priceChangerViewController.delegate = self;
305 319 [self.priceChangerViewController showInView:self.navigationController.view animated:YES];
... ... @@ -311,11 +325,11 @@
311 325 [self.priceChangerViewController showInView:self.navigationController.view animated:YES];
312 326 }
313 327 }
  328 + //Update Product Name command
314 329 else if([cellName isEqualToString:NSLocalizedString(@"Update product name", nil)] && [self currentNavLevel] == BASIC_CONFIGURATION)
315 330 {
316 331 if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)
317 332 {
318   - //self.popupViewController = [[DatePickerViewController alloc] initWithNibName:@"DatePickerViewController_iPad" bundle:nil];
319 333 self.nameChangerViewController = [[NameChangerViewController alloc] initWithNibName:@"NameChangerViewController_iPad" bundle:nil];
320 334 self.nameChangerViewController.delegate = self;
321 335 [self.nameChangerViewController showInView:self.navigationController.view animated:YES];
... ... @@ -386,10 +400,6 @@
386 400  
387 401 }
388 402 }
389   - else if([self currentNavLevel] == SALES)
390   - {
391   - //Customize SALES cells if needed
392   - }
393 403 return cell;
394 404 }
395 405  
... ...
DUREX tests/CommunicationProtocol.m
... ... @@ -42,7 +42,7 @@
42 42  
43 43 -(Boolean) establishConnection
44 44 {
45   - return TRUE;
  45 + return FALSE;
46 46 }
47 47  
48 48 @end
... ...
DUREX tests/DUREX test.xcodeproj/project.xcworkspace/xcuserdata/imanol.xcuserdatad/UserInterfaceState.xcuserstate
No preview for this file type
DUREX tests/MenuTableViewController.m
... ... @@ -198,16 +198,6 @@
198 198 //Emmoco protocol initialization
199 199 _protocol = [CommunicationProtocol sharedProtocol];
200 200  
201   - //DUREX protocol initialization
202   - [_protocol setMessageAvailable:false];
203   - if(![_protocol establishConnection])
204   - {
205   - UIAlertView* alert = [[UIAlertView alloc] initWithTitle:@"Communication error" message:@"Error while trying to connect to the device." delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil];
206   - [alert show];
207   - UIViewController *previous = [[[self navigationController] viewControllers] objectAtIndex:[[[self navigationController] viewControllers] count]-2];
208   - [[self navigationController] popToViewController:previous animated:YES];
209   - }
210   -
211 201 //Initialize parentLayout stack
212 202 [self setParentLayout:[[Stack alloc]init]];
213 203  
... ... @@ -223,6 +213,19 @@
223 213 // self.navigationItem.rightBarButtonItem = self.editButtonItem;
224 214 }
225 215  
  216 +-(void)viewDidAppear:(BOOL)animated
  217 +{
  218 + //DUREX protocol initialization
  219 + [_protocol setMessageAvailable:false];
  220 + if(![_protocol establishConnection])
  221 + {
  222 + UIAlertView* alert = [[UIAlertView alloc] initWithTitle:@"Communication error" message:@"Error while trying to connect to the device." delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil];
  223 + [alert show];
  224 + UIViewController *previous = [[[self navigationController] viewControllers] objectAtIndex:[[[self navigationController] viewControllers] count]-2];
  225 + [[self navigationController] popToViewController:previous animated:YES];
  226 + }
  227 +}
  228 +
226 229 -(void)didReceiveNotification:(NSNotification*) notification
227 230 {
228 231  
... ...