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 364 - (void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data
365 365 {
366 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 370 - (void)connection:(NSURLConnection *)connection didFailWithError:(NSError *)error
371 371 {
372 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 375 //PROTOCOL ERROR CALLBACK
376 376 - (void) reportProtocolError: (CommunicationProtocol*)protocol didFinishEnteringItem:(NSString*) error
... ... @@ -381,7 +381,7 @@
381 381 }
382 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 430 NSLog(@"[MenuTableViewController.m]: Received A5 answer");
431 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 435 else if([response isEqualToString:@"P52"])
436 436 {
437 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 441 else if(self.sentCommand == A6 && [[response substringToIndex:2]isEqualToString:@"P6"])
... ... @@ -443,12 +443,12 @@
443 443 NSLog(@"[MenuTableViewController.m]: Received A6 answer");
444 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 448 else if([response isEqualToString:@"P62"])
449 449 {
450 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 454 else if(self.sentCommand == A7 && [[response substringToIndex:2]isEqualToString:@"P7"])
... ... @@ -456,12 +456,12 @@
456 456 NSLog(@"[MenuTableViewController.m]: Received A7 answer");
457 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 461 else if([response isEqualToString:@"P72"])
462 462 {
463 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 467 else if(self.sentCommand == BATCH_COMMANDS)
... ... @@ -502,7 +502,7 @@
502 502 else
503 503 {
504 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 507 self.controlsDisabled = FALSE;
508 508 }
... ... @@ -536,7 +536,7 @@
536 536 if(data == nil)
537 537 {
538 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 540 return;
541 541 }
542 542 NSLog(@"[MenuTableViewController.m]: Read file contents from handled URL: %@",contents);
... ... @@ -545,7 +545,7 @@
545 545 if(!JSONData)
546 546 {
547 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 549 return;
550 550 }
551 551 NSString *version = [JSONData objectForKey:@"version"];
... ...