Commit 985b8e1cdd1714794c2c116dcb621fa89e67d7f1

Authored by Imanol-Mikel Barba Sabariego
1 parent c0a50a77

--no commit message

DUREX Vendor Control/Base.lproj/Localizable.strings
... ... @@ -45,4 +45,16 @@
45 45 "Searching for devices..." = "Searching for devices...";
46 46 "Connection Failed" = "Connection Failed";
47 47 "An error occurred while trying to connect to the selected device" = "An error occurred while trying to connect to the selected device";
48   -"Close" = "Close";
49 48 \ No newline at end of file
  49 +"Close" = "Close";
  50 +"20€ Notes" = "20€ Notes";
  51 +"10€ Notes" = "10€ Notes";
  52 +"5€ Notes" = "5€ Notes";
  53 +"2€ Coins" = "2€ Coins";
  54 +"1€ Coins" = "1€ Coins";
  55 +"50c Coins" = "50c Coins";
  56 +"Channel" = "Channel";
  57 +"Product Code" = "Product Code";
  58 +"Nominal Price" = "Nominal Price";
  59 +"Discounted Price" = "Discounted Price";
  60 +"1€ Change" = "1€ Change";
  61 +"50c Change" = "50c Change";
50 62 \ No newline at end of file
... ...
DUREX Vendor Control/CommunicationProtocol.h
... ... @@ -9,8 +9,9 @@
9 9 #import <Foundation/Foundation.h>
10 10 #import "EMFramework.h"
11 11  
12   -#define MAX_STRING_LENGTH ((int)200)
13   -#define MAX_RETRIES ((int)3)
  12 +#define MAX_STRING_LENGTH ((int)200)
  13 +#define MAX_RETRIES ((int)3)
  14 +#define MAX_PRODUCT_NAME_LENGTH ((int)64)
14 15  
15 16 @interface CommunicationProtocol : NSObject
16 17  
... ... @@ -18,6 +19,9 @@
18 19 -(Boolean) writeMessage: (NSString*) message;
19 20 -(NSString*) readMessage;
20 21 -(Boolean) establishConnection;
  22 +-(Boolean) updateTime: (NSDateComponents*) date;
  23 +-(Boolean) updatePrice: (uint8_t) channel : (uint8_t) product : (uint8_t) eur : (uint8_t) cents;
  24 +-(Boolean) updateProductName: (uint8_t) channel : (uint8_t) product : (NSString*) name;
21 25 +(id) sharedProtocol;
22 26 @property Boolean messageAvailable;
23 27  
... ...
DUREX Vendor Control/CommunicationProtocol.m
... ... @@ -185,4 +185,54 @@
185 185 return FALSE;
186 186 }
187 187  
  188 +-(Boolean) updateTime: (NSDateComponents*) date
  189 +{
  190 + if(date == nil)
  191 + {
  192 + NSCalendar *calendar = [[NSCalendar alloc] initWithCalendarIdentifier:NSGregorianCalendar];
  193 + NSCalendarUnit units = NSYearCalendarUnit | NSMonthCalendarUnit | NSDayCalendarUnit | NSHourCalendarUnit | NSMinuteCalendarUnit | NSSecondCalendarUnit;
  194 + date = [calendar components:units fromDate:[NSDate date]];
  195 + }
  196 + NSMutableString *command = [NSMutableString stringWithFormat: @"A5"];
  197 + NSInteger year = [date year];
  198 + year = year - (year/100)*100;
  199 + [command appendString:[NSString stringWithFormat:@"%02d",year]];
  200 + [command appendString:[NSString stringWithFormat:@"%02d%02d%02d%02d%02d",[date month],[date day],[date hour],[date minute],[date second]]];
  201 + [self writeMessage:command];
  202 + NSString *answer = [self readMessage];
  203 + if([answer isEqualToString:@"P51"])
  204 + {
  205 + return TRUE;
  206 + }
  207 + return FALSE;
  208 +}
  209 +
  210 +-(Boolean) updatePrice: (uint8_t) channel : (uint8_t) product : (uint8_t) eur : (uint8_t) cents
  211 +{
  212 + NSMutableString *command = [NSMutableString stringWithFormat: @"A6%01d%01d%02d%02d",channel,product,eur,cents];
  213 + [self writeMessage:command];
  214 + NSString *answer = [self readMessage];
  215 + if([answer isEqualToString:@"P61"])
  216 + {
  217 + return TRUE;
  218 + }
  219 + return FALSE;
  220 +}
  221 +
  222 +-(Boolean) updateProductName: (uint8_t) channel : (uint8_t) product : (NSString*) name
  223 +{
  224 + if([name length] > MAX_PRODUCT_NAME_LENGTH)
  225 + {
  226 + name = [name substringToIndex:MAX_PRODUCT_NAME_LENGTH-1];
  227 + }
  228 + NSMutableString *command = [NSMutableString stringWithFormat: @"A7%01d%01d%@",channel,product,name];
  229 + [self writeMessage:command];
  230 + NSString *answer = [self readMessage];
  231 + if([answer isEqualToString:@"P71"])
  232 + {
  233 + return TRUE;
  234 + }
  235 + return FALSE;
  236 +}
  237 +
188 238 @end
... ...
DUREX Vendor Control/DUREX Vendor Control.xcodeproj/project.pbxproj
... ... @@ -429,8 +429,8 @@
429 429 CLANG_WARN_INT_CONVERSION = YES;
430 430 CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
431 431 CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
432   - CODE_SIGN_IDENTITY = "iPhone Developer";
433   - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
  432 + CODE_SIGN_IDENTITY = "";
  433 + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "";
434 434 COPY_PHASE_STRIP = NO;
435 435 GCC_C_LANGUAGE_STANDARD = gnu99;
436 436 GCC_DYNAMIC_NO_PIC = NO;
... ... @@ -469,8 +469,8 @@
469 469 CLANG_WARN_INT_CONVERSION = YES;
470 470 CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
471 471 CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
472   - CODE_SIGN_IDENTITY = "iPhone Developer";
473   - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
  472 + CODE_SIGN_IDENTITY = "";
  473 + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "";
474 474 COPY_PHASE_STRIP = YES;
475 475 ENABLE_NS_ASSERTIONS = NO;
476 476 GCC_C_LANGUAGE_STANDARD = gnu99;
... ...
DUREX Vendor Control/DUREX Vendor Control.xcodeproj/project.xcworkspace/xcuserdata/imanol.xcuserdatad/UserInterfaceState.xcuserstate
No preview for this file type
DUREX Vendor Control/FirstAppExample/Base.lproj/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="5056" systemVersion="13B42" 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="13E28" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" initialViewController="kWw-Rk-wD6">
3 3 <dependencies>
4 4 <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="3733"/>
5 5 </dependencies>
... ... @@ -78,9 +78,26 @@
78 78 </subviews>
79 79 </tableViewCellContentView>
80 80 </tableViewCell>
81   - <tableViewCell contentMode="scaleToFill" selectionStyle="blue" hidesAccessoryWhenEditing="NO" indentationLevel="1" indentationWidth="0.0" reuseIdentifier="MaintenanceCell" textLabel="C5J-Ml-IpR" detailTextLabel="2Zv-NQ-q8W" style="IBUITableViewCellStyleValue1" id="tNx-4C-IjZ">
  81 + <tableViewCell contentMode="scaleToFill" selectionStyle="blue" accessoryType="disclosureIndicator" hidesAccessoryWhenEditing="NO" indentationLevel="1" indentationWidth="0.0" reuseIdentifier="ConfigCell" textLabel="PIv-Eg-iw5" style="IBUITableViewCellStyleDefault" id="fRm-AU-oWl">
82 82 <rect key="frame" x="0.0" y="130" width="320" height="44"/>
83 83 <autoresizingMask key="autoresizingMask"/>
  84 + <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="fRm-AU-oWl" id="fZ0-yn-P6t">
  85 + <rect key="frame" x="0.0" y="0.0" width="287" height="43"/>
  86 + <autoresizingMask key="autoresizingMask"/>
  87 + <subviews>
  88 + <label opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="left" text="Title" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="PIv-Eg-iw5">
  89 + <rect key="frame" x="15" y="0.0" width="270" height="43"/>
  90 + <autoresizingMask key="autoresizingMask"/>
  91 + <fontDescription key="fontDescription" type="system" pointSize="18"/>
  92 + <color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
  93 + <nil key="highlightedColor"/>
  94 + </label>
  95 + </subviews>
  96 + </tableViewCellContentView>
  97 + </tableViewCell>
  98 + <tableViewCell contentMode="scaleToFill" selectionStyle="blue" hidesAccessoryWhenEditing="NO" indentationLevel="1" indentationWidth="0.0" reuseIdentifier="MaintenanceCell" textLabel="C5J-Ml-IpR" detailTextLabel="2Zv-NQ-q8W" style="IBUITableViewCellStyleValue1" id="tNx-4C-IjZ">
  99 + <rect key="frame" x="0.0" y="174" width="320" height="44"/>
  100 + <autoresizingMask key="autoresizingMask"/>
84 101 <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="tNx-4C-IjZ" id="YyS-Ug-Lg0">
85 102 <rect key="frame" x="0.0" y="0.0" width="320" height="43"/>
86 103 <autoresizingMask key="autoresizingMask"/>
... ... @@ -102,6 +119,30 @@
102 119 </subviews>
103 120 </tableViewCellContentView>
104 121 </tableViewCell>
  122 + <tableViewCell contentMode="scaleToFill" selectionStyle="blue" hidesAccessoryWhenEditing="NO" indentationLevel="1" indentationWidth="0.0" reuseIdentifier="SalesCell" textLabel="HRc-DC-qxG" detailTextLabel="dhY-17-9fo" style="IBUITableViewCellStyleValue1" id="gpr-Mk-KfN">
  123 + <rect key="frame" x="0.0" y="218" width="320" height="44"/>
  124 + <autoresizingMask key="autoresizingMask"/>
  125 + <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="gpr-Mk-KfN" id="bFe-TX-iWA">
  126 + <rect key="frame" x="0.0" y="0.0" width="320" height="43"/>
  127 + <autoresizingMask key="autoresizingMask"/>
  128 + <subviews>
  129 + <label opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="left" text="Title" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="HRc-DC-qxG">
  130 + <rect key="frame" x="15" y="11" width="33" height="21"/>
  131 + <autoresizingMask key="autoresizingMask"/>
  132 + <fontDescription key="fontDescription" type="system" pointSize="17"/>
  133 + <color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
  134 + <nil key="highlightedColor"/>
  135 + </label>
  136 + <label opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="left" text="Detail" textAlignment="right" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="dhY-17-9fo">
  137 + <rect key="frame" x="261" y="11" width="44" height="21"/>
  138 + <autoresizingMask key="autoresizingMask"/>
  139 + <fontDescription key="fontDescription" type="system" pointSize="17"/>
  140 + <color key="textColor" red="0.5568627451" green="0.5568627451" blue="0.57647058819999997" alpha="1" colorSpace="calibratedRGB"/>
  141 + <nil key="highlightedColor"/>
  142 + </label>
  143 + </subviews>
  144 + </tableViewCellContentView>
  145 + </tableViewCell>
105 146 </prototypes>
106 147 <sections/>
107 148 <connections>
... ...
DUREX Vendor Control/MenuTableViewController.h
... ... @@ -21,13 +21,20 @@
21 21 #define MAINTENANCE_CELLS_PER_SECTION num(23),num(3)
22 22 #define MAINTENANCE_HEADERS NSLocalizedString(@"Sensors", nil),NSLocalizedString(@"Commands", nil)
23 23  
24   -#define CELL_IDENTIFIERS @"MenuCell",@"MaintenanceCell",@"ConfigCell",@"ReportCell"
  24 +#define SALES_ELEMENTS @"20€ Notes",@"10€ Notes",@"5€ Notes",@"2€ Coins",@"1€ Coins",@"50c Coins",@"Channel",@"Product Code",@"Nominal Price",@"Discounted Price",@"1€ Change",@"50c Change",@"20€ Notes",@"10€ Notes",@"5€ Notes",@"2€ Coins",@"1€ Coins",@"50c Coins",@"Channel",@"Product Code",@"Nominal Price",@"Discounted Price",@"1€ Change",@"50c Change",@"20€ Notes",@"10€ Notes",@"5€ Notes",@"2€ Coins",@"1€ Coins",@"50c Coins",@"Channel",@"Product Code",@"Nominal Price",@"Discounted Price",@"1€ Change",@"50c Change"
  25 +#define SALES_CELLS_PER_SECTION num(12),num(12),num(12)
  26 +#define SALES_HEADERS @"14/06/2014",@"25/06/2014",@"05/07/2014"
25 27  
26   -#define NUM_CHANNELS 8
  28 +#define CONFIGURATION_ELEMENTS @"Update Date & Time",@"Update product price",@"Update product name"
  29 +#define CONFIGURATION_CELLS_PER_SECTION num(3)
  30 +#define CONFIGURATION_HEADERS nil
  31 +
  32 +#define CELL_IDENTIFIERS @"MenuCell",@"MaintenanceCell",@"SalesCell",@"ConfigCell",@"ReportCell"
27 33  
28 34 enum {
29 35 MENU = 0,
30 36 MAINTENANCE,
  37 + SALES,
31 38 BASIC_CONFIGURATION,
32 39 REPORT,
33 40 } navigationLevel;
... ...
DUREX Vendor Control/MenuTableViewController.m
... ... @@ -21,6 +21,14 @@
21 21 @property (nonatomic,strong) const NSArray *maintenanceStructure;
22 22 @property (nonatomic,strong) const NSArray *maintenanceHeaders;
23 23  
  24 +@property (nonatomic,strong) const NSArray *salesElements;
  25 +@property (nonatomic,strong) const NSArray *salesStructure;
  26 +@property (nonatomic,strong) const NSArray *salesHeaders;
  27 +
  28 +@property (nonatomic,strong) const NSArray *configElements;
  29 +@property (nonatomic,strong) const NSArray *configStructure;
  30 +@property (nonatomic,strong) const NSArray *configHeaders;
  31 +
24 32 @property (nonatomic,strong) const NSArray *cellIdentifiers;
25 33  
26 34 @property (nonatomic,strong) CommunicationProtocol* protocol;
... ... @@ -68,6 +76,28 @@
68 76 [self setMaintenanceHeaders:nil];
69 77 }
70 78  
  79 + [self setSalesElements:[[NSArray alloc] initWithObjects:SALES_ELEMENTS, nil]];
  80 + [self setSalesStructure:[[NSArray alloc] initWithObjects:SALES_CELLS_PER_SECTION, nil]];
  81 + if([[self salesStructure] count] > 1)
  82 + {
  83 + [self setSalesHeaders:[[NSArray alloc] initWithObjects:SALES_HEADERS, nil]];
  84 + }
  85 + else
  86 + {
  87 + [self setSalesHeaders:nil];
  88 + }
  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 +
71 101 [self setCellIdentifiers:[[NSArray alloc] initWithObjects:CELL_IDENTIFIERS, nil]];
72 102 }
73 103  
... ... @@ -94,6 +124,20 @@
94 124 [self setCurrentStructure:[self maintenanceStructure]];
95 125 [self setCurrentHeaders:[self maintenanceHeaders]];
96 126 }
  127 + else if([self currentNavLevel] == SALES)
  128 + {
  129 + [[self navigationItem] setTitle:NSLocalizedString(@"Sales log", nil)];
  130 + [self setCurrentElements:[self salesElements]];
  131 + [self setCurrentStructure:[self salesStructure]];
  132 + [self setCurrentHeaders:[self salesHeaders]];
  133 + }
  134 + else if([self currentNavLevel] == BASIC_CONFIGURATION)
  135 + {
  136 + [[self navigationItem] setTitle:NSLocalizedString(@"Basic Configuration", nil)];
  137 + [self setCurrentElements:[self configElements]];
  138 + [self setCurrentStructure:[self configStructure]];
  139 + [self setCurrentHeaders:[self configHeaders]];
  140 + }
97 141 //AND SO ON...
98 142 [[self tableView] reloadData];
99 143 NSRange range = NSMakeRange(0, [self numberOfSectionsInTableView:[self tableView]]);
... ... @@ -235,12 +279,27 @@
235 279 NSLog(@"Section: %ld Row: %ld",(long)[indexPath section],(long)[indexPath row]);
236 280 [tableView deselectRowAtIndexPath:indexPath animated:YES];
237 281 NSString *cellName = [[[[self tableView] cellForRowAtIndexPath:indexPath]textLabel]text];
238   - if([cellName isEqualToString:NSLocalizedString(@"Maintenance", nil)])
  282 + if([cellName isEqualToString:NSLocalizedString(@"Maintenance", nil)] && [self currentNavLevel] == MENU)
239 283 {
240 284 NSLog(@"[MenuTableViewController.m]: Changing to navLevel: MAINTENANCE");
241 285  
242 286 [self changeNavLevel:MAINTENANCE:TRUE];
243 287 }
  288 + else if([cellName isEqualToString:NSLocalizedString(@"Sales log", nil)] && [self currentNavLevel] == MAINTENANCE)
  289 + {
  290 + NSLog(@"[MenuTableViewController.m]: Changing to navLevel: SALES");
  291 + [self changeNavLevel:SALES:TRUE];
  292 + }
  293 + else if([cellName isEqualToString:NSLocalizedString(@"Sales log", nil)] && [self currentNavLevel] == MAINTENANCE)
  294 + {
  295 + NSLog(@"[MenuTableViewController.m]: Changing to navLevel: SALES");
  296 + [self changeNavLevel:SALES:TRUE];
  297 + }
  298 + else if([cellName isEqualToString:NSLocalizedString(@"Basic Configuration", nil)] && [self currentNavLevel] == MENU)
  299 + {
  300 + NSLog(@"[MenuTableViewController.m]: Changing to navLevel: BASIC_CONFIGURATION");
  301 + [self changeNavLevel:BASIC_CONFIGURATION:TRUE];
  302 + }
244 303 }
245 304  
246 305 #pragma mark - Table view data source
... ... @@ -300,6 +359,10 @@
300 359  
301 360 }
302 361 }
  362 + else if([self currentNavLevel] == SALES)
  363 + {
  364 +
  365 + }
303 366 return cell;
304 367 }
305 368  
... ...
DUREX Vendor Control/Stack.m
... ... @@ -27,10 +27,12 @@
27 27 - (void) push: (id) element
28 28 {
29 29 [[self dataArray] addObject:element];
  30 + [self setLastPosition: [self lastPosition] + 1];
30 31 }
31 32 - (id) pop
32 33 {
33 34 id element;
  35 + [self setLastPosition: [self lastPosition] - 1];
34 36 element = [[self dataArray] objectAtIndex:[self lastPosition]];
35 37 [[self dataArray] removeLastObject];
36 38 return element;
... ...
DUREX Vendor Control/en.lproj/Localizable.strings
... ... @@ -45,4 +45,16 @@
45 45 "Searching for devices..." = "Searching for devices...";
46 46 "Connection Failed" = "Connection Failed";
47 47 "An error occurred while trying to connect to the selected device" = "An error occurred while trying to connect to the selected device";
48   -"Close" = "Close";
49 48 \ No newline at end of file
  49 +"Close" = "Close";
  50 +"20€ Notes" = "20€ Notes";
  51 +"10€ Notes" = "10€ Notes";
  52 +"5€ Notes" = "5€ Notes";
  53 +"2€ Coins" = "2€ Coins";
  54 +"1€ Coins" = "1€ Coins";
  55 +"50c Coins" = "50c Coins";
  56 +"Channel" = "Channel";
  57 +"Product Code" = "Product Code";
  58 +"Nominal Price" = "Nominal Price";
  59 +"Discounted Price" = "Discounted Price";
  60 +"1€ Change" = "1€ Change";
  61 +"50c Change" = "50c Change";
50 62 \ No newline at end of file
... ...
DUREX Vendor Control/es.lproj/Localizable.strings
... ... @@ -45,4 +45,16 @@
45 45 "Searching for devices..." = "Buscando dispositivos...";
46 46 "Connection Failed" = "Falló la conexión";
47 47 "An error occurred while trying to connect to the selected device" = "Error al intentar conectarse al dispositivo seleccionado";
48   -"Close" = "Cerrar";
49 48 \ No newline at end of file
  49 +"Close" = "Cerrar";
  50 +"20€ Notes" = "Billetes de 20€";
  51 +"10€ Notes" = "Billetes de 10€";
  52 +"5€ Notes" = "Billetes de 5€";
  53 +"2€ Coins" = "Monedas de 2€";
  54 +"1€ Coins" = "Monedas de 1€";
  55 +"50c Coins" = "Monedas de 50c";
  56 +"Channel" = "Canal";
  57 +"Product Code" = "Código del producto";
  58 +"Nominal Price" = "Precio Nominal";
  59 +"Discounted Price" = "Precio con descuento";
  60 +"1€ Change" = "Cambio de 1€";
  61 +"50c Change" = "Cambio de 50c";
50 62 \ No newline at end of file
... ...
DUREX tests/Base.lproj/Localizable.strings
... ... @@ -38,4 +38,19 @@
38 38 "50c Coin spin" = "50c Coin spin";
39 39 "Sales log" = "Sales log";
40 40 "Incident report" = "Incident report";
41   -"Send report" = "Send report";
42 41 \ No newline at end of file
  42 +"Send report" = "Send report";
  43 +"20€ Notes" = "20€ Notes";
  44 +"10€ Notes" = "10€ Notes";
  45 +"5€ Notes" = "5€ Notes";
  46 +"2€ Coins" = "2€ Coins";
  47 +"1€ Coins" = "1€ Coins";
  48 +"50c Coins" = "50c Coins";
  49 +"Channel" = "Channel";
  50 +"Product Code" = "Product Code";
  51 +"Nominal Price" = "Nominal Price";
  52 +"Discounted Price" = "Discounted Price";
  53 +"1€ Change" = "1€ Change";
  54 +"50c Change" = "50c Change";
  55 +"Update Date & Time" = "Update Date & Time";
  56 +"Update product price" = "Update product price";
  57 +"Update product name" = "Update product name";
43 58 \ No newline at end of file
... ...
DUREX tests/Base.lproj/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="5056" systemVersion="13B42" 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="13E28" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" initialViewController="kWw-Rk-wD6">
3 3 <dependencies>
4 4 <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="3733"/>
5 5 </dependencies>
... ... @@ -78,9 +78,26 @@
78 78 </subviews>
79 79 </tableViewCellContentView>
80 80 </tableViewCell>
81   - <tableViewCell contentMode="scaleToFill" selectionStyle="blue" hidesAccessoryWhenEditing="NO" indentationLevel="1" indentationWidth="0.0" reuseIdentifier="MaintenanceCell" textLabel="oML-ji-1Ho" detailTextLabel="Ghk-fD-iNE" style="IBUITableViewCellStyleValue1" id="apQ-aM-g3l">
  81 + <tableViewCell contentMode="scaleToFill" selectionStyle="blue" accessoryType="disclosureIndicator" hidesAccessoryWhenEditing="NO" indentationLevel="1" indentationWidth="0.0" reuseIdentifier="ConfigCell" textLabel="lht-4G-6aX" style="IBUITableViewCellStyleDefault" id="udl-ZZ-ijZ">
82 82 <rect key="frame" x="0.0" y="130" width="320" height="44"/>
83 83 <autoresizingMask key="autoresizingMask"/>
  84 + <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="udl-ZZ-ijZ" id="SlK-j4-bxE">
  85 + <rect key="frame" x="0.0" y="0.0" width="287" height="43"/>
  86 + <autoresizingMask key="autoresizingMask"/>
  87 + <subviews>
  88 + <label opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="left" text="Title" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="lht-4G-6aX">
  89 + <rect key="frame" x="15" y="0.0" width="270" height="43"/>
  90 + <autoresizingMask key="autoresizingMask"/>
  91 + <fontDescription key="fontDescription" type="system" pointSize="18"/>
  92 + <color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
  93 + <nil key="highlightedColor"/>
  94 + </label>
  95 + </subviews>
  96 + </tableViewCellContentView>
  97 + </tableViewCell>
  98 + <tableViewCell contentMode="scaleToFill" selectionStyle="blue" hidesAccessoryWhenEditing="NO" indentationLevel="1" indentationWidth="0.0" reuseIdentifier="MaintenanceCell" textLabel="oML-ji-1Ho" detailTextLabel="Ghk-fD-iNE" style="IBUITableViewCellStyleValue1" id="apQ-aM-g3l">
  99 + <rect key="frame" x="0.0" y="174" width="320" height="44"/>
  100 + <autoresizingMask key="autoresizingMask"/>
84 101 <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="apQ-aM-g3l" id="dQQ-Yv-wa7">
85 102 <rect key="frame" x="0.0" y="0.0" width="320" height="43"/>
86 103 <autoresizingMask key="autoresizingMask"/>
... ... @@ -102,6 +119,30 @@
102 119 </subviews>
103 120 </tableViewCellContentView>
104 121 </tableViewCell>
  122 + <tableViewCell contentMode="scaleToFill" selectionStyle="blue" hidesAccessoryWhenEditing="NO" indentationLevel="1" indentationWidth="0.0" reuseIdentifier="SalesCell" textLabel="CUV-qn-vKu" detailTextLabel="S5I-Bk-8Z7" style="IBUITableViewCellStyleValue1" id="9Sz-ic-H44">
  123 + <rect key="frame" x="0.0" y="218" width="320" height="44"/>
  124 + <autoresizingMask key="autoresizingMask"/>
  125 + <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="9Sz-ic-H44" id="Kux-KL-HPg">
  126 + <rect key="frame" x="0.0" y="0.0" width="320" height="43"/>
  127 + <autoresizingMask key="autoresizingMask"/>
  128 + <subviews>
  129 + <label opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="left" text="Title" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="CUV-qn-vKu">
  130 + <rect key="frame" x="15" y="11" width="33" height="21"/>
  131 + <autoresizingMask key="autoresizingMask"/>
  132 + <fontDescription key="fontDescription" type="system" pointSize="17"/>
  133 + <color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
  134 + <nil key="highlightedColor"/>
  135 + </label>
  136 + <label opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="left" text="Detail" textAlignment="right" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="S5I-Bk-8Z7">
  137 + <rect key="frame" x="261" y="11" width="44" height="21"/>
  138 + <autoresizingMask key="autoresizingMask"/>
  139 + <fontDescription key="fontDescription" type="system" pointSize="17"/>
  140 + <color key="textColor" red="0.5568627451" green="0.5568627451" blue="0.57647058819999997" alpha="1" colorSpace="calibratedRGB"/>
  141 + <nil key="highlightedColor"/>
  142 + </label>
  143 + </subviews>
  144 + </tableViewCellContentView>
  145 + </tableViewCell>
105 146 </prototypes>
106 147 <sections/>
107 148 <connections>
... ... @@ -166,10 +207,10 @@
166 207 </subviews>
167 208 <color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
168 209 <constraints>
169   - <constraint firstItem="oyW-sA-Lfb" firstAttribute="top" secondItem="bXZ-vt-REt" secondAttribute="bottom" constant="8" id="4cZ-A3-dtl"/>
  210 + <constraint firstItem="oyW-sA-Lfb" firstAttribute="centerX" secondItem="bXZ-vt-REt" secondAttribute="centerX" constant="0.5" id="FeM-2t-cfF"/>
  211 + <constraint firstItem="oyW-sA-Lfb" firstAttribute="top" secondItem="bXZ-vt-REt" secondAttribute="bottom" constant="8" id="OG4-ph-EWc"/>
170 212 <constraint firstAttribute="centerY" secondItem="bXZ-vt-REt" secondAttribute="centerY" id="iX3-rf-HXs"/>
171 213 <constraint firstAttribute="centerX" secondItem="bXZ-vt-REt" secondAttribute="centerX" id="o5J-8O-TzK"/>
172   - <constraint firstItem="oyW-sA-Lfb" firstAttribute="centerX" secondItem="bXZ-vt-REt" secondAttribute="centerX" constant="0.5" id="ruI-SS-9Bo"/>
173 214 </constraints>
174 215 </view>
175 216 <navigationItem key="navigationItem" id="VgB-ne-yWx"/>
... ...
DUREX tests/DUREX test.xcodeproj/project.xcworkspace/xcuserdata/imanol.xcuserdatad/UserInterfaceState.xcuserstate
No preview for this file type
DUREX tests/MenuTableViewController.h
... ... @@ -20,13 +20,21 @@
20 20 #define MAINTENANCE_CELLS_PER_SECTION num(23),num(3)
21 21 #define MAINTENANCE_HEADERS NSLocalizedString(@"Sensors", nil),NSLocalizedString(@"Commands", nil)
22 22  
23   -#define CELL_IDENTIFIERS @"MenuCell",@"MaintenanceCell",@"ConfigCell",@"ReportCell"
  23 +#define SALES_ELEMENTS @"20€ Notes",@"10€ Notes",@"5€ Notes",@"2€ Coins",@"1€ Coins",@"50c Coins",@"Channel",@"Product Code",@"Nominal Price",@"Discounted Price",@"1€ Change",@"50c Change",@"20€ Notes",@"10€ Notes",@"5€ Notes",@"2€ Coins",@"1€ Coins",@"50c Coins",@"Channel",@"Product Code",@"Nominal Price",@"Discounted Price",@"1€ Change",@"50c Change",@"20€ Notes",@"10€ Notes",@"5€ Notes",@"2€ Coins",@"1€ Coins",@"50c Coins",@"Channel",@"Product Code",@"Nominal Price",@"Discounted Price",@"1€ Change",@"50c Change"
  24 +#define SALES_CELLS_PER_SECTION num(12),num(12),num(12)
  25 +#define SALES_HEADERS @"14/06/2014",@"25/06/2014",@"05/07/2014"
24 26  
25   -#define NUM_CHANNELS 8
  27 +#define CONFIGURATION_ELEMENTS @"Update Date & Time",@"Update product price",@"Update product name"
  28 +#define CONFIGURATION_CELLS_PER_SECTION num(3)
  29 +#define CONFIGURATION_HEADERS nil
  30 +
  31 +
  32 +#define CELL_IDENTIFIERS @"MenuCell",@"MaintenanceCell",@"SalesCell",@"ConfigCell",@"ReportCell"
26 33  
27 34 enum {
28 35 MENU = 0,
29 36 MAINTENANCE,
  37 + SALES,
30 38 BASIC_CONFIGURATION,
31 39 REPORT,
32 40 } navigationLevel;
... ...
DUREX tests/MenuTableViewController.m
... ... @@ -22,6 +22,14 @@
22 22 @property (nonatomic,strong) const NSArray *maintenanceStructure;
23 23 @property (nonatomic,strong) const NSArray *maintenanceHeaders;
24 24  
  25 +@property (nonatomic,strong) const NSArray *salesElements;
  26 +@property (nonatomic,strong) const NSArray *salesStructure;
  27 +@property (nonatomic,strong) const NSArray *salesHeaders;
  28 +
  29 +@property (nonatomic,strong) const NSArray *configElements;
  30 +@property (nonatomic,strong) const NSArray *configStructure;
  31 +@property (nonatomic,strong) const NSArray *configHeaders;
  32 +
25 33 @property (nonatomic,strong) const NSArray *cellIdentifiers;
26 34  
27 35 @property (nonatomic,strong) CommunicationProtocol* protocol;
... ... @@ -68,6 +76,28 @@
68 76 {
69 77 [self setMaintenanceHeaders:nil];
70 78 }
  79 +
  80 + [self setSalesElements:[[NSArray alloc] initWithObjects:SALES_ELEMENTS, nil]];
  81 + [self setSalesStructure:[[NSArray alloc] initWithObjects:SALES_CELLS_PER_SECTION, nil]];
  82 + if([[self salesStructure] count] > 1)
  83 + {
  84 + [self setSalesHeaders:[[NSArray alloc] initWithObjects:SALES_HEADERS, nil]];
  85 + }
  86 + else
  87 + {
  88 + [self setSalesHeaders:nil];
  89 + }
  90 +
  91 + [self setConfigElements:[[NSArray alloc] initWithObjects:CONFIGURATION_ELEMENTS, nil]];
  92 + [self setConfigStructure:[[NSArray alloc] initWithObjects:CONFIGURATION_CELLS_PER_SECTION, nil]];
  93 + if([[self configStructure] count] > 1)
  94 + {
  95 + [self setConfigHeaders:[[NSArray alloc] initWithObjects:CONFIGURATION_HEADERS, nil]];
  96 + }
  97 + else
  98 + {
  99 + [self setConfigHeaders:nil];
  100 + }
71 101  
72 102 [self setCellIdentifiers:[[NSArray alloc] initWithObjects:CELL_IDENTIFIERS, nil]];
73 103 }
... ... @@ -96,6 +126,20 @@
96 126 [self setCurrentHeaders:[self maintenanceHeaders]];
97 127  
98 128 }
  129 + else if([self currentNavLevel] == SALES)
  130 + {
  131 + [[self navigationItem] setTitle:NSLocalizedString(@"Sales log", nil)];
  132 + [self setCurrentElements:[self salesElements]];
  133 + [self setCurrentStructure:[self salesStructure]];
  134 + [self setCurrentHeaders:[self salesHeaders]];
  135 + }
  136 + else if([self currentNavLevel] == BASIC_CONFIGURATION)
  137 + {
  138 + [[self navigationItem] setTitle:NSLocalizedString(@"Basic Configuration", nil)];
  139 + [self setCurrentElements:[self configElements]];
  140 + [self setCurrentStructure:[self configStructure]];
  141 + [self setCurrentHeaders:[self configHeaders]];
  142 + }
99 143 //AND SO ON...
100 144 [[self tableView] reloadData];
101 145 NSRange range = NSMakeRange(0, [self numberOfSectionsInTableView:[self tableView]]);
... ... @@ -207,13 +251,22 @@
207 251 NSLog(@"[MenuTableViewController.m]: Section: %d Row: %d",[indexPath section],[indexPath row]);
208 252 [tableView deselectRowAtIndexPath:indexPath animated:YES];
209 253 NSString *cellName = [[[[self tableView] cellForRowAtIndexPath:indexPath]textLabel]text];
210   - if([cellName isEqualToString:NSLocalizedString(@"Maintenance", nil)])
  254 + if([cellName isEqualToString:NSLocalizedString(@"Maintenance", nil)] && [self currentNavLevel] == MENU)
211 255 {
212 256 NSLog(@"[MenuTableViewController.m]: Changing to navLevel: MAINTENANCE");
213 257 [self changeNavLevel:MAINTENANCE:TRUE];
214 258 }
  259 + else if([cellName isEqualToString:NSLocalizedString(@"Sales log", nil)] && [self currentNavLevel] == MAINTENANCE)
  260 + {
  261 + NSLog(@"[MenuTableViewController.m]: Changing to navLevel: SALES");
  262 + [self changeNavLevel:SALES:TRUE];
  263 + }
  264 + else if([cellName isEqualToString:NSLocalizedString(@"Basic Configuration", nil)] && [self currentNavLevel] == MENU)
  265 + {
  266 + NSLog(@"[MenuTableViewController.m]: Changing to navLevel: BASIC_CONFIGURATION");
  267 + [self changeNavLevel:BASIC_CONFIGURATION:TRUE];
  268 + }
215 269  
216   -
217 270 }
218 271  
219 272 #pragma mark - Table view data source
... ... @@ -273,6 +326,10 @@
273 326  
274 327 }
275 328 }
  329 + else if([self currentNavLevel] == SALES)
  330 + {
  331 +
  332 + }
276 333 return cell;
277 334 }
278 335  
... ...
DUREX tests/Stack.m
... ... @@ -27,14 +27,17 @@
27 27 - (void) push: (id) element
28 28 {
29 29 [[self dataArray] addObject:element];
  30 + [self setLastPosition: [self lastPosition] + 1];
30 31 }
31 32 - (id) pop
32 33 {
33 34 id element;
  35 + [self setLastPosition: [self lastPosition] - 1];
34 36 element = [[self dataArray] objectAtIndex:[self lastPosition]];
35 37 [[self dataArray] removeLastObject];
36 38 return element;
37 39 }
  40 +
38 41 - (NSInteger) count
39 42 {
40 43 return [[self dataArray] count];
... ...
DUREX tests/en.lproj/Localizable.strings
... ... @@ -38,4 +38,19 @@
38 38 "50c Coin spin" = "50c Coin spin";
39 39 "Sales log" = "Sales log";
40 40 "Incident report" = "Incident report";
41   -"Send report" = "Send report";
42 41 \ No newline at end of file
  42 +"Send report" = "Send report";
  43 +"20€ Notes" = "20€ Notes";
  44 +"10€ Notes" = "10€ Notes";
  45 +"5€ Notes" = "5€ Notes";
  46 +"2€ Coins" = "2€ Coins";
  47 +"1€ Coins" = "1€ Coins";
  48 +"50c Coins" = "50c Coins";
  49 +"Channel" = "Channel";
  50 +"Product Code" = "Product Code";
  51 +"Nominal Price" = "Nominal Price";
  52 +"Discounted Price" = "Discounted Price";
  53 +"1€ Change" = "1€ Change";
  54 +"50c Change" = "50c Change";
  55 +"Update Date & Time" = "Update Date & Time";
  56 +"Update product price" = "Update product price";
  57 +"Update product name" = "Update product name";
43 58 \ No newline at end of file
... ...
DUREX tests/es.lproj/Localizable.strings
... ... @@ -39,3 +39,18 @@
39 39 "Sales log" = "Registro de ventas";
40 40 "Incident report" = "Registro de incidencias";
41 41 "Send report" = "Mandar informe";
  42 +"20€ Notes" = "Billetes de 20€";
  43 +"10€ Notes" = "Billetes de 10€";
  44 +"5€ Notes" = "Billetes de 5€";
  45 +"2€ Coins" = "Monedas de 2€";
  46 +"1€ Coins" = "Monedas de 1€";
  47 +"50c Coins" = "Monedas de 50c";
  48 +"Channel" = "Canal";
  49 +"Product Code" = "Código del producto";
  50 +"Nominal Price" = "Precio Nominal";
  51 +"Discounted Price" = "Precio con descuento";
  52 +"1€ Change" = "Cambio de 1€";
  53 +"50c Change" = "Cambio de 50c";
  54 +"Update Date & Time" = "Actualizar fecha y hora";
  55 +"Update product price" = "Actualizar precio del producto";
  56 +"Update product name" = "Actualizar nombre del producto";
42 57 \ No newline at end of file
... ...
1   --Implement sensors options
2   --Make changes to DUREX Vendor Control Project
3   --Implement Navigation Controller
4   --Implement table inside UITableViewCell
  1 +- Incident class
  2 +- Sale class
  3 +- Sale parser
  4 +- Incident parser
  5 +- Popup view
  6 +- A2 command
  7 +- A3 command
  8 +- Redefine A4 command
  9 +- A4 command
... ...