diff --git a/DUREX Vendor Control/DUREX Vendor Control.xcodeproj/project.xcworkspace/xcuserdata/imanol.xcuserdatad/UserInterfaceState.xcuserstate b/DUREX Vendor Control/DUREX Vendor Control.xcodeproj/project.xcworkspace/xcuserdata/imanol.xcuserdatad/UserInterfaceState.xcuserstate index b1efc66..6e8ad07 100644 --- a/DUREX Vendor Control/DUREX Vendor Control.xcodeproj/project.xcworkspace/xcuserdata/imanol.xcuserdatad/UserInterfaceState.xcuserstate +++ b/DUREX Vendor Control/DUREX Vendor Control.xcodeproj/project.xcworkspace/xcuserdata/imanol.xcuserdatad/UserInterfaceState.xcuserstate diff --git a/DUREX Vendor Control/DUREX Vendor Control.xcodeproj/xcuserdata/imanol.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist b/DUREX Vendor Control/DUREX Vendor Control.xcodeproj/xcuserdata/imanol.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist index 966b7bc..163caa2 100644 --- a/DUREX Vendor Control/DUREX Vendor Control.xcodeproj/xcuserdata/imanol.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist +++ b/DUREX Vendor Control/DUREX Vendor Control.xcodeproj/xcuserdata/imanol.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist @@ -57,22 +57,6 @@ shouldBeEnabled = "No" ignoreCount = "0" continueAfterRunningActions = "No" - filePath = "MenuTableViewController.m" - timestampString = "431435390.453053" - startingColumnNumber = "9223372036854775807" - endingColumnNumber = "9223372036854775807" - startingLineNumber = "204" - endingLineNumber = "204" - landmarkName = "-viewDidLoad" - landmarkType = "5"> - - - - 1) + { + [self setConfigHeaders:[[NSArray alloc] initWithObjects:CONFIGURATION_HEADERS, nil]]; + } + else + { + [self setConfigHeaders:nil]; + } + + [self setCellIdentifiers:[[NSArray alloc] initWithObjects:CELL_IDENTIFIERS, nil]]; +} + +- (void) generateMaintenanceLevel +{ [self setMaintenanceElements:[[NSArray alloc] initWithObjects:MAINTENANCE_ELEMENTS, nil]]; [self setMaintenanceStructure:[[NSArray alloc] initWithObjects:MAINTENANCE_CELLS_PER_SECTION, nil]]; if([[self maintenanceStructure] count] > 1) @@ -75,7 +91,10 @@ { [self setMaintenanceHeaders:nil]; } - +} + +- (void) generateSalesNavLevel +{ [self setSalesElements:[[NSArray alloc] initWithObjects:SALES_ELEMENTS, nil]]; [self setSalesStructure:[[NSArray alloc] initWithObjects:SALES_CELLS_PER_SECTION, nil]]; if([[self salesStructure] count] > 1) @@ -86,21 +105,10 @@ { [self setSalesHeaders:nil]; } - - [self setConfigElements:[[NSArray alloc] initWithObjects:CONFIGURATION_ELEMENTS, nil]]; - [self setConfigStructure:[[NSArray alloc] initWithObjects:CONFIGURATION_CELLS_PER_SECTION, nil]]; - if([[self configStructure] count] > 1) - { - [self setConfigHeaders:[[NSArray alloc] initWithObjects:CONFIGURATION_HEADERS, nil]]; - } - else - { - [self setConfigHeaders:nil]; - } - - [self setCellIdentifiers:[[NSArray alloc] initWithObjects:CELL_IDENTIFIERS, nil]]; } + + - (void) changeNavLevel: (uint8_t) level : (BOOL) push { NSLog(@"[MenuTableViewController.m]: navLevel is %d",level); @@ -182,6 +190,7 @@ [super viewDidLoad]; [_activityIndicator setHidden:YES]; + //Set navigation bar UIImage *backImage = [UIImage imageNamed:@"back_arrow.png"]; UIButton *backButton = [UIButton buttonWithType:UIButtonTypeCustom]; backButton.frame = CGRectMake(0, 0, backImage.size.width/2, backImage.size.height/2); @@ -198,17 +207,6 @@ [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(didReceiveNotification:) name:kEMConnectionDidReceiveIndicatorNotificationName object:nil]; [[EMConnectionManager sharedManager] addObserver:self forKeyPath:@"connectionState" options:0 context:NULL]; - //DUREX protocol initialization - [_protocol setMessageAvailableMobile:false]; - [_protocol setMessageAvailableDevice:false]; - if(![_protocol establishConnection]) - { - UIAlertView* alert = [[UIAlertView alloc] initWithTitle:@"Communication error" message:@"Error while trying to connect to the device" delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil]; - [alert show]; - UIViewController *previous = [[[self navigationController] viewControllers] objectAtIndex:[[[self navigationController] viewControllers] count]-2]; - [[self navigationController] popToViewController:previous animated:YES]; - } - //Initialize parentLayout stack [self setParentLayout:[[Stack alloc]init]]; @@ -224,6 +222,22 @@ // self.navigationItem.rightBarButtonItem = self.editButtonItem; } +-(void)viewDidAppear:(BOOL)animated +{ + [super viewDidAppear:animated]; + + //DUREX protocol + [_protocol setMessageAvailableMobile:false]; + [_protocol setMessageAvailableDevice:false]; + if(![_protocol establishConnection]) + { + UIAlertView* alert = [[UIAlertView alloc] initWithTitle:@"Communication error" message:@"Error while trying to connect to the device" delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil]; + [alert show]; + UIViewController *previous = [[[self navigationController] viewControllers] objectAtIndex:[[[self navigationController] viewControllers] count]-2]; + [[self navigationController] popToViewController:previous animated:YES]; + } +} + -(void)didReceiveNotification:(NSNotification*) notification { @@ -265,12 +279,13 @@ if([cellName isEqualToString:NSLocalizedString(@"Maintenance", nil)] && [self currentNavLevel] == MENU) { NSLog(@"[MenuTableViewController.m]: Changing to navLevel: MAINTENANCE"); - [_protocol updateProductName:7 :2 :@"Producte #987654321"]; + [self generateMaintenanceLevel]; [self changeNavLevel:MAINTENANCE:TRUE]; } else if([cellName isEqualToString:NSLocalizedString(@"Sales log", nil)] && [self currentNavLevel] == MAINTENANCE) { NSLog(@"[MenuTableViewController.m]: Changing to navLevel: SALES"); + [self generateSalesNavLevel]; [self changeNavLevel:SALES:TRUE]; } else if([cellName isEqualToString:NSLocalizedString(@"Basic Configuration", nil)] && [self currentNavLevel] == MENU) @@ -283,7 +298,6 @@ { if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) { - //self.popupViewController = [[DatePickerViewController alloc] initWithNibName:@"DatePickerViewController_iPad" bundle:nil]; self.datePickerViewController = [[DatePickerViewController alloc] initWithNibName:@"DatePickerViewController_iPad" bundle:nil]; self.datePickerViewController.delegate = self; [self.datePickerViewController showInView:self.navigationController.view animated:YES]; @@ -295,11 +309,11 @@ [self.datePickerViewController showInView:self.navigationController.view animated:YES]; } } + //Update Product Price command else if([cellName isEqualToString:NSLocalizedString(@"Update product price", nil)] && [self currentNavLevel] == BASIC_CONFIGURATION) { if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) { - //self.popupViewController = [[DatePickerViewController alloc] initWithNibName:@"DatePickerViewController_iPad" bundle:nil]; self.priceChangerViewController = [[PriceChangerViewController alloc] initWithNibName:@"PriceChangerViewController_iPad" bundle:nil]; self.priceChangerViewController.delegate = self; [self.priceChangerViewController showInView:self.navigationController.view animated:YES]; @@ -311,11 +325,11 @@ [self.priceChangerViewController showInView:self.navigationController.view animated:YES]; } } + //Update Product Name command else if([cellName isEqualToString:NSLocalizedString(@"Update product name", nil)] && [self currentNavLevel] == BASIC_CONFIGURATION) { if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) { - //self.popupViewController = [[DatePickerViewController alloc] initWithNibName:@"DatePickerViewController_iPad" bundle:nil]; self.nameChangerViewController = [[NameChangerViewController alloc] initWithNibName:@"NameChangerViewController_iPad" bundle:nil]; self.nameChangerViewController.delegate = self; [self.nameChangerViewController showInView:self.navigationController.view animated:YES]; @@ -386,10 +400,6 @@ } } - else if([self currentNavLevel] == SALES) - { - //Customize SALES cells if needed - } return cell; } diff --git a/DUREX tests/CommunicationProtocol.m b/DUREX tests/CommunicationProtocol.m index 68e1333..b432c3f 100644 --- a/DUREX tests/CommunicationProtocol.m +++ b/DUREX tests/CommunicationProtocol.m @@ -42,7 +42,7 @@ -(Boolean) establishConnection { - return TRUE; + return FALSE; } @end diff --git a/DUREX tests/DUREX test.xcodeproj/project.xcworkspace/xcuserdata/imanol.xcuserdatad/UserInterfaceState.xcuserstate b/DUREX tests/DUREX test.xcodeproj/project.xcworkspace/xcuserdata/imanol.xcuserdatad/UserInterfaceState.xcuserstate index 6759501..549c2ed 100644 --- a/DUREX tests/DUREX test.xcodeproj/project.xcworkspace/xcuserdata/imanol.xcuserdatad/UserInterfaceState.xcuserstate +++ b/DUREX tests/DUREX test.xcodeproj/project.xcworkspace/xcuserdata/imanol.xcuserdatad/UserInterfaceState.xcuserstate diff --git a/DUREX tests/MenuTableViewController.m b/DUREX tests/MenuTableViewController.m index 1a7252c..89dcfba 100644 --- a/DUREX tests/MenuTableViewController.m +++ b/DUREX tests/MenuTableViewController.m @@ -198,16 +198,6 @@ //Emmoco protocol initialization _protocol = [CommunicationProtocol sharedProtocol]; - //DUREX protocol initialization - [_protocol setMessageAvailable:false]; - if(![_protocol establishConnection]) - { - UIAlertView* alert = [[UIAlertView alloc] initWithTitle:@"Communication error" message:@"Error while trying to connect to the device." delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil]; - [alert show]; - UIViewController *previous = [[[self navigationController] viewControllers] objectAtIndex:[[[self navigationController] viewControllers] count]-2]; - [[self navigationController] popToViewController:previous animated:YES]; - } - //Initialize parentLayout stack [self setParentLayout:[[Stack alloc]init]]; @@ -223,6 +213,19 @@ // self.navigationItem.rightBarButtonItem = self.editButtonItem; } +-(void)viewDidAppear:(BOOL)animated +{ + //DUREX protocol initialization + [_protocol setMessageAvailable:false]; + if(![_protocol establishConnection]) + { + UIAlertView* alert = [[UIAlertView alloc] initWithTitle:@"Communication error" message:@"Error while trying to connect to the device." delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil]; + [alert show]; + UIViewController *previous = [[[self navigationController] viewControllers] objectAtIndex:[[[self navigationController] viewControllers] count]-2]; + [[self navigationController] popToViewController:previous animated:YES]; + } +} + -(void)didReceiveNotification:(NSNotification*) notification {