Commit 1dbccbb998b6a15643990ddaf8bda4a0860540b1

Authored by Imanol-Mikel Barba Sabariego
1 parent 0ec31859

FINAL CODE REVISION

BT Vendor/BT Vendor.xcodeproj/project.xcworkspace/xcuserdata/imanol.xcuserdatad/UserInterfaceState.xcuserstate
No preview for this file type
BT Vendor/MenuTableViewController.m
@@ -364,13 +364,13 @@ @@ -364,13 +364,13 @@
364 - (void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data 364 - (void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data
365 { 365 {
366 NSLog(@"[MenuTableViewController.m]: Received response from report server: %@",[NSString stringWithUTF8String:[data bytes]]); 366 NSLog(@"[MenuTableViewController.m]: Received response from report server: %@",[NSString stringWithUTF8String:[data bytes]]);
367 - [self.view makeToast:NSLocalizedString(@"Report sent successfully", nil) duration:3 position:[NSValue valueWithCGPoint:CGPointMake(self.view.frame.size.width/2,self.view.frame.size.height/2)] title:NSLocalizedString(@"Success!", nil) image:[UIImage imageNamed:@"icon_checkmark"]]; 367 + [self.navigationController.view makeToast:NSLocalizedString(@"Report sent successfully", nil) duration:3 position:[NSValue valueWithCGPoint:self.view.center] title:NSLocalizedString(@"Success!", nil) image:[UIImage imageNamed:@"icon_checkmark"]];
368 } 368 }
369 369
370 - (void)connection:(NSURLConnection *)connection didFailWithError:(NSError *)error 370 - (void)connection:(NSURLConnection *)connection didFailWithError:(NSError *)error
371 { 371 {
372 NSLog(@"[MenuTableViewController.m]: Error connecting to server: %@ %@",[error localizedDescription],[[error userInfo] objectForKey:NSURLErrorFailingURLStringErrorKey]); 372 NSLog(@"[MenuTableViewController.m]: Error connecting to server: %@ %@",[error localizedDescription],[[error userInfo] objectForKey:NSURLErrorFailingURLStringErrorKey]);
373 - [self.view makeToast:NSLocalizedString(@"Connection to server failed", nil) duration:3 position:[NSValue valueWithCGPoint:CGPointMake(self.view.frame.size.width/2,self.view.frame.size.height/2)] title:NSLocalizedString(@"Error", nil) image:[UIImage imageNamed:@"icon_delete"]]; 373 + [self.navigationController.view makeToast:NSLocalizedString(@"Connection to server failed", nil) duration:3 position:[NSValue valueWithCGPoint:self.view.center] title:NSLocalizedString(@"Error", nil) image:[UIImage imageNamed:@"icon_delete"]];
374 } 374 }
375 //PROTOCOL ERROR CALLBACK 375 //PROTOCOL ERROR CALLBACK
376 - (void) reportProtocolError: (CommunicationProtocol*)protocol didFinishEnteringItem:(NSString*) error 376 - (void) reportProtocolError: (CommunicationProtocol*)protocol didFinishEnteringItem:(NSString*) error
@@ -381,7 +381,7 @@ @@ -381,7 +381,7 @@
381 } 381 }
382 else 382 else
383 { 383 {
384 - [self.view makeToast:error duration:3 position:[NSValue valueWithCGPoint:CGPointMake(self.view.frame.size.width/2,self.view.frame.size.height/2)] title:NSLocalizedString(@"Error", nil) image:[UIImage imageNamed:@"icon_delete"]]; 384 + [self.navigationController.view makeToast:error duration:3 position:[NSValue valueWithCGPoint:self.view.center] title:NSLocalizedString(@"Error", nil) image:[UIImage imageNamed:@"icon_delete"]];
385 } 385 }
386 } 386 }
387 387
@@ -430,12 +430,12 @@ @@ -430,12 +430,12 @@
430 NSLog(@"[MenuTableViewController.m]: Received A5 answer"); 430 NSLog(@"[MenuTableViewController.m]: Received A5 answer");
431 if([response isEqualToString:@"P51"]) 431 if([response isEqualToString:@"P51"])
432 { 432 {
433 - [self.view makeToast:NSLocalizedString(@"Time and Date changed successfully", nil) duration:3 position:[NSValue valueWithCGPoint:CGPointMake(self.view.frame.size.width/2,self.view.frame.size.height/2)] title:nil image:[UIImage imageNamed:@"icon_checkmark"]]; 433 + [self.navigationController.view makeToast:NSLocalizedString(@"Time and Date changed successfully", nil) duration:3 position:[NSValue valueWithCGPoint:self.view.center] title:nil image:[UIImage imageNamed:@"icon_checkmark"]];
434 } 434 }
435 else if([response isEqualToString:@"P52"]) 435 else if([response isEqualToString:@"P52"])
436 { 436 {
437 NSLog(@"[MenuTableViewController.m]: Device returned error for command A5"); 437 NSLog(@"[MenuTableViewController.m]: Device returned error for command A5");
438 - [self.view makeToast:NSLocalizedString(@"Time and Date change returned error", nil) duration:3 position:[NSValue valueWithCGPoint:CGPointMake(self.view.frame.size.width/2,self.view.frame.size.height/2)] title:NSLocalizedString(@"Error", nil) image:[UIImage imageNamed:@"icon_delete"]]; 438 + [self.navigationController.view makeToast:NSLocalizedString(@"Time and Date change returned error", nil) duration:3 position:[NSValue valueWithCGPoint:self.view.center] title:NSLocalizedString(@"Error", nil) image:[UIImage imageNamed:@"icon_delete"]];
439 } 439 }
440 } 440 }
441 else if(self.sentCommand == A6 && [[response substringToIndex:2]isEqualToString:@"P6"]) 441 else if(self.sentCommand == A6 && [[response substringToIndex:2]isEqualToString:@"P6"])
@@ -443,12 +443,12 @@ @@ -443,12 +443,12 @@
443 NSLog(@"[MenuTableViewController.m]: Received A6 answer"); 443 NSLog(@"[MenuTableViewController.m]: Received A6 answer");
444 if([response isEqualToString:@"P61"]) 444 if([response isEqualToString:@"P61"])
445 { 445 {
446 - [self.view makeToast:NSLocalizedString(@"Product price changed successfully", nil) duration:3 position:[NSValue valueWithCGPoint:CGPointMake(self.view.frame.size.width/2,self.view.frame.size.height/2)] title:nil image:[UIImage imageNamed:@"icon_checkmark"]]; 446 + [self.navigationController.view makeToast:NSLocalizedString(@"Product price changed successfully", nil) duration:3 position:[NSValue valueWithCGPoint:self.view.center] title:nil image:[UIImage imageNamed:@"icon_checkmark"]];
447 } 447 }
448 else if([response isEqualToString:@"P62"]) 448 else if([response isEqualToString:@"P62"])
449 { 449 {
450 NSLog(@"[MenuTableViewController.m]: Device returned error for command A6"); 450 NSLog(@"[MenuTableViewController.m]: Device returned error for command A6");
451 - [self.view makeToast:NSLocalizedString(@"Product price change returned error", nil) duration:3 position:[NSValue valueWithCGPoint:CGPointMake(self.view.frame.size.width/2,self.view.frame.size.height/2)] title:NSLocalizedString(@"Error", nil) image:[UIImage imageNamed:@"icon_delete"]]; 451 + [self.navigationController.view makeToast:NSLocalizedString(@"Product price change returned error", nil) duration:3 position:[NSValue valueWithCGPoint:self.view.center] title:NSLocalizedString(@"Error", nil) image:[UIImage imageNamed:@"icon_delete"]];
452 } 452 }
453 } 453 }
454 else if(self.sentCommand == A7 && [[response substringToIndex:2]isEqualToString:@"P7"]) 454 else if(self.sentCommand == A7 && [[response substringToIndex:2]isEqualToString:@"P7"])
@@ -456,12 +456,12 @@ @@ -456,12 +456,12 @@
456 NSLog(@"[MenuTableViewController.m]: Received A7 answer"); 456 NSLog(@"[MenuTableViewController.m]: Received A7 answer");
457 if([response isEqualToString:@"P71"]) 457 if([response isEqualToString:@"P71"])
458 { 458 {
459 - [self.view makeToast:NSLocalizedString(@"Product name changed successfully", nil) duration:3 position:[NSValue valueWithCGPoint:CGPointMake(self.view.frame.size.width/2,self.view.frame.size.height/2)] title:nil image:[UIImage imageNamed:@"icon_checkmark"]]; 459 + [self.navigationController.view makeToast:NSLocalizedString(@"Product name changed successfully", nil) duration:3 position:[NSValue valueWithCGPoint:self.view.center] title:nil image:[UIImage imageNamed:@"icon_checkmark"]];
460 } 460 }
461 else if([response isEqualToString:@"P72"]) 461 else if([response isEqualToString:@"P72"])
462 { 462 {
463 NSLog(@"[MenuTableViewController.m]: Device returned error for command A7"); 463 NSLog(@"[MenuTableViewController.m]: Device returned error for command A7");
464 - [self.view makeToast:NSLocalizedString(@"Product name change returned error", nil) duration:3 position:[NSValue valueWithCGPoint:CGPointMake(self.view.frame.size.width/2,self.view.frame.size.height/2)] title:NSLocalizedString(@"Error", nil) image:[UIImage imageNamed:@"icon_delete"]]; 464 + [self.navigationController.view makeToast:NSLocalizedString(@"Product name change returned error", nil) duration:3 position:[NSValue valueWithCGPoint:self.view.center] title:NSLocalizedString(@"Error", nil) image:[UIImage imageNamed:@"icon_delete"]];
465 } 465 }
466 } 466 }
467 else if(self.sentCommand == BATCH_COMMANDS) 467 else if(self.sentCommand == BATCH_COMMANDS)
@@ -502,7 +502,7 @@ @@ -502,7 +502,7 @@
502 else 502 else
503 { 503 {
504 [self setSentCommand:NONE]; 504 [self setSentCommand:NONE];
505 - [self.view makeToast:NSLocalizedString(@"Device answer timeout occurred", nil) duration:3 position:[NSValue valueWithCGPoint:CGPointMake(self.view.frame.size.width/2,self.view.frame.size.height/2)] title:NSLocalizedString(@"Error", nil) image:[UIImage imageNamed:@"icon_delete"]]; 505 + [self.navigationController.view makeToast:NSLocalizedString(@"Device answer timeout occurred", nil) duration:3 position:[NSValue valueWithCGPoint:self.view.center] title:NSLocalizedString(@"Error", nil) image:[UIImage imageNamed:@"icon_delete"]];
506 } 506 }
507 self.controlsDisabled = FALSE; 507 self.controlsDisabled = FALSE;
508 } 508 }
@@ -536,7 +536,7 @@ @@ -536,7 +536,7 @@
536 if(data == nil) 536 if(data == nil)
537 { 537 {
538 NSLog(@"[MenuTableViewController.m]: Error obtaining data from URL"); 538 NSLog(@"[MenuTableViewController.m]: Error obtaining data from URL");
539 - [self.view makeToast:NSLocalizedString(@"Error obtaining data from URL", nil) duration:3 position:[NSValue valueWithCGPoint:CGPointMake(self.view.frame.size.width/2,self.view.frame.size.height/2)] title:NSLocalizedString(@"Error", nil) image:[UIImage imageNamed:@"icon_delete"]]; 539 + [self.navigationController.view makeToast:NSLocalizedString(@"Error obtaining data from URL", nil) duration:3 position:[NSValue valueWithCGPoint:self.view.center] title:NSLocalizedString(@"Error", nil) image:[UIImage imageNamed:@"icon_delete"]];
540 return; 540 return;
541 } 541 }
542 NSLog(@"[MenuTableViewController.m]: Read file contents from handled URL: %@",contents); 542 NSLog(@"[MenuTableViewController.m]: Read file contents from handled URL: %@",contents);
@@ -545,7 +545,7 @@ @@ -545,7 +545,7 @@
545 if(!JSONData) 545 if(!JSONData)
546 { 546 {
547 NSLog(@"[MenuTableViewController.m]: %@",error); 547 NSLog(@"[MenuTableViewController.m]: %@",error);
548 - [self.view makeToast:[error localizedDescription] duration:3 position:[NSValue valueWithCGPoint:CGPointMake(self.view.frame.size.width/2,self.view.frame.size.height/2)] title:NSLocalizedString(@"Error", nil) image:[UIImage imageNamed:@"icon_delete"]]; 548 + [self.navigationController.view makeToast:[error localizedDescription] duration:3 position:[NSValue valueWithCGPoint:self.view.center] title:NSLocalizedString(@"Error", nil) image:[UIImage imageNamed:@"icon_delete"]];
549 return; 549 return;
550 } 550 }
551 NSString *version = [JSONData objectForKey:@"version"]; 551 NSString *version = [JSONData objectForKey:@"version"];