Commit cf609976b4acf01daf351c68ff35b2639b2c7637
1 parent
8a75e251
--no commit message
Showing
11 changed files
with
245 additions
and
248 deletions
DUREX Vendor Control/Base.lproj/Localizable.strings
... | ... | @@ -92,4 +92,12 @@ |
92 | 92 | "Entered product code has an invalid format" = "Entered product code has an invalid format"; |
93 | 93 | "Entered channel has an invalid format" = "Entered channel has an invalid format"; |
94 | 94 | "Missing channel" = "Missing channel"; |
95 | -"Missing product code" = "Missing product code"; | |
96 | 95 | \ No newline at end of file |
96 | +"Missing product code" = "Missing product code"; | |
97 | +"Time and Date changed successfully" = "Time and Date changed successfully"; | |
98 | +"Time and Date change returned error" = "Time and Date change returned error"; | |
99 | +"Product price changed successfully" = "Product price changed successfully"; | |
100 | +"Product price change returned error" = "Product price change returned error"; | |
101 | +"Product name changed successfully" = "Product name changed successfully"; | |
102 | +"Product name change returned error" = "Product name change returned error"; | |
103 | +"Error occurred while reading answer from device" = "Error occurred while reading answer from device"; | |
104 | +"Error occurred while sending command to device" = "Error occurred while sending command to device"; | |
97 | 105 | \ No newline at end of file | ... | ... |
DUREX Vendor Control/CommunicationProtocol.h
... | ... | @@ -25,7 +25,7 @@ |
25 | 25 | |
26 | 26 | @protocol CommunicationProtocolDelegate <NSObject> |
27 | 27 | - (void)processMessage:(CommunicationProtocol*)protocol didFinishEnteringItem:(NSString*) response; |
28 | - | |
28 | +- (void) reportProtocolError: (CommunicationProtocol*)protocol didFinishEnteringItem:(NSString*) error; | |
29 | 29 | @end |
30 | 30 | |
31 | 31 | @interface CommunicationProtocol : NSObject |
... | ... | @@ -35,6 +35,7 @@ |
35 | 35 | -(void) writeMessage: (NSString*) message; |
36 | 36 | -(void) readMessage; |
37 | 37 | -(void) establishConnection; |
38 | +-(void) disconnect; | |
38 | 39 | -(void) updateTime: (NSDateComponents*) date; |
39 | 40 | -(void) updatePrice: (uint8_t) channel : (uint8_t) product : (uint8_t) eur : (uint8_t) cents; |
40 | 41 | -(void) updateProductName: (uint8_t) channel : (uint8_t) product : (NSString*) name; | ... | ... |
DUREX Vendor Control/CommunicationProtocol.m
... | ... | @@ -33,11 +33,6 @@ |
33 | 33 | return shared; |
34 | 34 | } |
35 | 35 | |
36 | -- (void) reportError : (NSString*) error | |
37 | -{ | |
38 | - | |
39 | -} | |
40 | - | |
41 | 36 | -(void) readMessage |
42 | 37 | { |
43 | 38 | self.numPackets = -1; |
... | ... | @@ -47,46 +42,47 @@ |
47 | 42 | - (void) readNextFragment |
48 | 43 | { |
49 | 44 | __block NSUInteger numBytes; |
50 | - if(self.numPackets) | |
45 | + [[EMConnectionManager sharedManager] readResource:@"numBytes" onSuccess:^(id readValue) | |
51 | 46 | { |
52 | - [[EMConnectionManager sharedManager] readResource:@"numBytes" onSuccess:^(id readValue) | |
47 | + numBytes = [readValue unsignedCharValue]; | |
48 | + NSLog(@"[CommunicationProtocol.m]: numBytes read: %d",numBytes); | |
49 | + [[EMConnectionManager sharedManager] readResource:@"data" onSuccess:^(id readValue) | |
53 | 50 | { |
54 | - numBytes = [readValue unsignedCharValue]; | |
55 | - NSLog(@"[CommunicationProtocol.m]: numBytes read: %d",numBytes); | |
56 | - [[EMConnectionManager sharedManager] readResource:@"data" onSuccess:^(id readValue) | |
51 | + NSString *readData = [readValue substringToIndex:numBytes]; | |
52 | + if([readValue length] < numBytes) | |
57 | 53 | { |
58 | - NSString *readData = [readValue substringToIndex:numBytes]; | |
59 | - if([readValue length] < numBytes) | |
60 | - { | |
61 | - NSLog(@"[CommunicationProtocol.m]: WARNING: Device issued wrong numBytes, possible truncated message."); | |
62 | - } | |
63 | - [self.message appendString:readData]; | |
64 | - NSLog(@"[CommunicationProtocol.m]: data read: %@",readData); | |
65 | - [[EMConnectionManager sharedManager] writeValue:@"0" toResource:@"messageAvailableDevice" onSuccess:^ | |
54 | + NSLog(@"[CommunicationProtocol.m]: WARNING: Device issued wrong numBytes, possible truncated message."); | |
55 | + } | |
56 | + [self.message appendString:readData]; | |
57 | + NSLog(@"[CommunicationProtocol.m]: data read: %@",readData); | |
58 | + [[EMConnectionManager sharedManager] writeValue:@"0" toResource:@"messageAvailableDevice" onSuccess:^ | |
59 | + { | |
60 | + NSLog(@"[CommunicationProtocol.m]: messageAvailableDevice set to FALSE"); | |
61 | + NSLog(@"[CommunicationProtocol.m]: packet read"); | |
62 | + self.numPackets--; | |
63 | + if(self.numPackets) | |
66 | 64 | { |
67 | - NSLog(@"[CommunicationProtocol.m]: messageAvailableDevice set to FALSE"); | |
68 | - NSLog(@"[CommunicationProtocol.m]: packet read"); | |
69 | 65 | [self waitForMessage: 0]; |
70 | - }onFail:^(NSError *error) | |
66 | + } | |
67 | + else | |
71 | 68 | { |
72 | - NSLog(@"[CommunicationProtocol.m]: On setMessageAvailableDevice to FALSE: %@",error); | |
73 | - [self reportError:[NSString stringWithFormat:@"Error occurred while reading answer from device: %@",[error localizedDescription]]]; | |
74 | - }]; | |
69 | + [[self delegate] processMessage:self didFinishEnteringItem:self.message]; | |
70 | + } | |
75 | 71 | }onFail:^(NSError *error) |
76 | 72 | { |
77 | - NSLog(@"[CommunicationProtocol.m]: On readData: %@",error); | |
78 | - [self reportError:[NSString stringWithFormat:@"Error occurred while reading answer from device: %@",[error localizedDescription]]]; | |
73 | + NSLog(@"[CommunicationProtocol.m]: On setMessageAvailableDevice to FALSE: %@",error); | |
74 | + [[self delegate] reportProtocolError:self didFinishEnteringItem:[NSString stringWithFormat:@"%@: %@",NSLocalizedString(@"Error occurred while reading answer from device",nil),[error localizedDescription]]]; | |
79 | 75 | }]; |
80 | 76 | }onFail:^(NSError *error) |
81 | 77 | { |
82 | - NSLog(@"[CommunicationProtocol.m]: On readNumBytes: %@",error); | |
83 | - [self reportError:[NSString stringWithFormat:@"Error occurred while reading answer from device: %@",[error localizedDescription]]]; | |
78 | + NSLog(@"[CommunicationProtocol.m]: On readData: %@",error); | |
79 | + [[self delegate] reportProtocolError:self didFinishEnteringItem:[NSString stringWithFormat:@"%@: %@",NSLocalizedString(@"Error occurred while reading answer from device",nil),[error localizedDescription]]]; | |
84 | 80 | }]; |
85 | - } | |
86 | - else | |
81 | + }onFail:^(NSError *error) | |
87 | 82 | { |
88 | - [[self delegate] processMessage:self didFinishEnteringItem:self.message]; | |
89 | - } | |
83 | + NSLog(@"[CommunicationProtocol.m]: On readNumBytes: %@",error); | |
84 | + [[self delegate] reportProtocolError:self didFinishEnteringItem:[NSString stringWithFormat:@"%@: %@",NSLocalizedString(@"Error occurred while reading answer from device",nil),[error localizedDescription]]]; | |
85 | + }]; | |
90 | 86 | } |
91 | 87 | |
92 | 88 | - (void) readNumPackets |
... | ... | @@ -99,7 +95,7 @@ |
99 | 95 | }onFail:^(NSError *error) |
100 | 96 | { |
101 | 97 | NSLog(@"[CommunicationProtocol.m]: On readNumPackets: %@",error); |
102 | - [self reportError:[NSString stringWithFormat:@"Error occurred while reading answer from device: %@",[error localizedDescription]]]; | |
98 | + [[self delegate] reportProtocolError:self didFinishEnteringItem:[NSString stringWithFormat:@"%@: %@",NSLocalizedString(@"Error occurred while reading answer from device",nil),[error localizedDescription]]]; | |
103 | 99 | }]; |
104 | 100 | } |
105 | 101 | |
... | ... | @@ -136,7 +132,7 @@ |
136 | 132 | }onFail:^(NSError *error) |
137 | 133 | { |
138 | 134 | NSLog(@"[CommunicationProtocol.m]: On waitForMessage: %@",error); |
139 | - [self reportError:[NSString stringWithFormat:@"Error occurred while reading answer from device: %@",[error localizedDescription]]]; | |
135 | + [[self delegate] reportProtocolError:self didFinishEnteringItem:[NSString stringWithFormat:@"%@: %@",NSLocalizedString(@"Error occurred while reading answer from device",nil),[error localizedDescription]]]; | |
140 | 136 | }]; |
141 | 137 | } |
142 | 138 | } |
... | ... | @@ -154,69 +150,60 @@ |
154 | 150 | }onFail:^(NSError *error) |
155 | 151 | { |
156 | 152 | NSLog(@"[CommunicationProtocol.m]: On setNumPackets: %@",error); |
157 | - [self reportError:[NSString stringWithFormat:@"Error occurred while sending command to device: %@",[error localizedDescription]]]; | |
153 | + [[self delegate] reportProtocolError:self didFinishEnteringItem:[NSString stringWithFormat:@"%@: %@",NSLocalizedString(@"Error occurred while sending command to device",nil),[error localizedDescription]]]; | |
158 | 154 | }]; |
159 | 155 | } |
160 | 156 | |
161 | 157 | - (void) sendNextFragment |
162 | 158 | { |
163 | - NSLog(@"[CommunicationProtocol.m]: Sending next fragment"); | |
164 | - [[EMConnectionManager sharedManager] writeValue:@"0" toResource:@"messageAvailableMobile" onSuccess:^ | |
159 | + if(self.remainingBytes) | |
165 | 160 | { |
166 | - NSLog(@"[CommunicationProtocol.m]: messageAvailableMobile set to FALSE"); | |
161 | + NSLog(@"[CommunicationProtocol.m]: Sending next fragment"); | |
167 | 162 | NSUInteger numBytes; |
168 | - if(self.remainingBytes) | |
163 | + if(self.remainingBytes > MAX_STRING_LENGTH) | |
169 | 164 | { |
170 | - if(self.remainingBytes > MAX_STRING_LENGTH) | |
171 | - { | |
172 | - numBytes = MAX_STRING_LENGTH; | |
173 | - self.remainingBytes -= MAX_STRING_LENGTH; | |
174 | - } | |
175 | - else | |
176 | - { | |
177 | - numBytes = self.remainingBytes; | |
178 | - self.remainingBytes = 0; | |
179 | - } | |
180 | - [[EMConnectionManager sharedManager] writeValue:[NSNumber numberWithUnsignedChar:(unsigned char)numBytes] toResource:@"numBytes" onSuccess:^ | |
181 | - { | |
182 | - NSLog(@"[CommunicationProtocol.m]: numBytes set to %d", numBytes); | |
183 | - NSString *data = [self.message substringWithRange:NSMakeRange(self.currentIndex, numBytes)]; | |
184 | - self.currentIndex += numBytes; | |
185 | - [[EMConnectionManager sharedManager] writeValue:data toResource:@"data" onSuccess:^ | |
186 | - { | |
187 | - NSLog(@"[CommunicationProtocol.m]: data set to: %@",data); | |
188 | - [[EMConnectionManager sharedManager] writeValue:@"1" toResource:@"messageAvailableMobile" onSuccess:^ | |
189 | - { | |
190 | - NSLog(@"[CommunicationProtocol.m]: messageAvailableMobile set to TRUE"); | |
191 | - NSLog(@"[CommunicationProtocol.m]: Packet written"); | |
192 | - [self readACK: 0]; | |
193 | - }onFail:^(NSError *error) | |
194 | - { | |
195 | - NSLog(@"[CommunicationProtocol.m]: On setMessageAvailable to TRUE: %@",error); | |
196 | - [self reportError:[NSString stringWithFormat:@"Error occurred while sending command to device: %@",[error localizedDescription]]]; | |
197 | - }]; | |
198 | - }onFail:^(NSError *error) | |
199 | - { | |
200 | - NSLog(@"[CommunicationProtocol.m]: On setData: %@",error); | |
201 | - [self reportError:[NSString stringWithFormat:@"Error occurred while sending command to device: %@",[error localizedDescription]]]; | |
202 | - }]; | |
203 | - }onFail:^(NSError *error) | |
204 | - { | |
205 | - NSLog(@"[CommunicationProtocol.m]: On setNumBytes: %@",error); | |
206 | - [self reportError:[NSString stringWithFormat:@"Error occurred while sending command to device: %@",[error localizedDescription]]]; | |
207 | - }]; | |
165 | + numBytes = MAX_STRING_LENGTH; | |
166 | + self.remainingBytes -= MAX_STRING_LENGTH; | |
208 | 167 | } |
209 | 168 | else |
210 | 169 | { |
211 | - NSLog(@"[CommunicationProtocol.m]: Finished sending message"); | |
212 | - [self readMessage]; | |
170 | + numBytes = self.remainingBytes; | |
171 | + self.remainingBytes = 0; | |
213 | 172 | } |
214 | - | |
215 | - }onFail:^(NSError *error) | |
173 | + [[EMConnectionManager sharedManager] writeValue:[NSNumber numberWithUnsignedChar:(unsigned char)numBytes] toResource:@"numBytes" onSuccess:^ | |
174 | + { | |
175 | + NSLog(@"[CommunicationProtocol.m]: numBytes set to %d", numBytes); | |
176 | + NSString *data = [self.message substringWithRange:NSMakeRange(self.currentIndex, numBytes)]; | |
177 | + self.currentIndex += numBytes; | |
178 | + [[EMConnectionManager sharedManager] writeValue:data toResource:@"data" onSuccess:^ | |
179 | + { | |
180 | + NSLog(@"[CommunicationProtocol.m]: data set to: %@",data); | |
181 | + [[EMConnectionManager sharedManager] writeValue:@"1" toResource:@"messageAvailableMobile" onSuccess:^ | |
182 | + { | |
183 | + NSLog(@"[CommunicationProtocol.m]: messageAvailableMobile set to TRUE"); | |
184 | + NSLog(@"[CommunicationProtocol.m]: Packet written"); | |
185 | + [self readACK: 0]; | |
186 | + }onFail:^(NSError *error) | |
187 | + { | |
188 | + NSLog(@"[CommunicationProtocol.m]: On setMessageAvailable to TRUE: %@",error); | |
189 | + [[self delegate] reportProtocolError:self didFinishEnteringItem:[NSString stringWithFormat:@"%@: %@",NSLocalizedString(@"Error occurred while sending command to device",nil),[error localizedDescription]]]; | |
190 | + }]; | |
191 | + }onFail:^(NSError *error) | |
192 | + { | |
193 | + NSLog(@"[CommunicationProtocol.m]: On setData: %@",error); | |
194 | + [[self delegate] reportProtocolError:self didFinishEnteringItem:[NSString stringWithFormat:@"%@: %@",NSLocalizedString(@"Error occurred while sending command to device",nil),[error localizedDescription]]]; | |
195 | + }]; | |
196 | + }onFail:^(NSError *error) | |
197 | + { | |
198 | + NSLog(@"[CommunicationProtocol.m]: On setNumBytes: %@",error); | |
199 | + [[self delegate] reportProtocolError:self didFinishEnteringItem:[NSString stringWithFormat:@"%@: %@",NSLocalizedString(@"Error occurred while sending command to device",nil),[error localizedDescription]]]; | |
200 | + }]; | |
201 | + } | |
202 | + else | |
216 | 203 | { |
217 | - NSLog(@"[CommunicationProtocol.m]: On setMessageAvailableMobile to FALSE: %@",error); | |
218 | - [self reportError:[NSString stringWithFormat:@"Error occurred while sending command to device: %@",[error localizedDescription]]]; | |
219 | - }]; | |
204 | + NSLog(@"[CommunicationProtocol.m]: Finished sending message"); | |
205 | + [self readMessage]; | |
206 | + } | |
220 | 207 | } |
221 | 208 | |
222 | 209 | - (void) readACK: (uint8_t) retries |
... | ... | @@ -245,7 +232,7 @@ |
245 | 232 | }onFail:^(NSError *error) |
246 | 233 | { |
247 | 234 | NSLog(@"[CommunicationProtocol.m]: On readACK: %@",error); |
248 | - [self reportError:[NSString stringWithFormat:@"Error occurred while sending command to device: %@",[error localizedDescription]]]; | |
235 | + [[self delegate] reportProtocolError:self didFinishEnteringItem:[NSString stringWithFormat:@"%@: %@",NSLocalizedString(@"Error occurred while sending command to device",nil),[error localizedDescription]]]; | |
249 | 236 | }]; |
250 | 237 | } |
251 | 238 | } |
... | ... | @@ -257,6 +244,13 @@ |
257 | 244 | NSLog(@"[CommunicationProtocol.m]: Hello sent"); |
258 | 245 | } |
259 | 246 | |
247 | +-(void) disconnect | |
248 | +{ | |
249 | + NSLog(@"[CommunicationProtocol.m]: Terminating connection..."); | |
250 | + [self writeMessage:@"Bye"]; | |
251 | + NSLog(@"[CommunicationProtocol.m]: Bye sent"); | |
252 | +} | |
253 | + | |
260 | 254 | -(void) updateTime: (NSDateComponents*) date |
261 | 255 | { |
262 | 256 | NSMutableString *command = [NSMutableString stringWithFormat: @"A5"]; |
... | ... | @@ -288,20 +282,7 @@ |
288 | 282 | NSString *command = @"A4"; |
289 | 283 | [self writeMessage:command]; |
290 | 284 | |
291 | - /*NSMutableString *answer = [[NSMutableString alloc]initWithString:@"P400015000150001500000001001003005002000001002"]; | |
292 | - for(int i = 0; i < 4; i++) | |
293 | - { | |
294 | - [answer appendString:@"0"]; | |
295 | - [answer appendString:@"1"]; | |
296 | - } | |
297 | - for(int i = 0; i < 12; i++) | |
298 | - { | |
299 | - [answer appendString:@"0"]; | |
300 | - [answer appendString:@"0"]; | |
301 | - } | |
302 | - | |
303 | - [answer appendString:@"0"]; | |
304 | - [answer appendString:@"0"];*/ | |
285 | + /*NSMutableString *answer = [[NSMutableString alloc]initWithString:@"P4000150001500015000000010010030050020000010020101010100000000000000000000000000"];*/ | |
305 | 286 | } |
306 | 287 | |
307 | 288 | -(void) readSalesLog : (NSDateComponents*) start : (NSDateComponents*) end | ... | ... |
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
... | ... | @@ -26,11 +26,11 @@ |
26 | 26 | ignoreCount = "0" |
27 | 27 | continueAfterRunningActions = "No" |
28 | 28 | filePath = "MenuTableViewController.m" |
29 | - timestampString = "434037601.622012" | |
29 | + timestampString = "434133664.559575" | |
30 | 30 | startingColumnNumber = "9223372036854775807" |
31 | 31 | endingColumnNumber = "9223372036854775807" |
32 | - startingLineNumber = "770" | |
33 | - endingLineNumber = "770" | |
32 | + startingLineNumber = "774" | |
33 | + endingLineNumber = "774" | |
34 | 34 | landmarkName = "-tableView:cellForRowAtIndexPath:" |
35 | 35 | landmarkType = "5"> |
36 | 36 | </BreakpointContent> |
... | ... | @@ -42,12 +42,12 @@ |
42 | 42 | ignoreCount = "0" |
43 | 43 | continueAfterRunningActions = "No" |
44 | 44 | filePath = "MenuTableViewController.m" |
45 | - timestampString = "434037601.622012" | |
45 | + timestampString = "434133664.559575" | |
46 | 46 | startingColumnNumber = "9223372036854775807" |
47 | 47 | endingColumnNumber = "9223372036854775807" |
48 | - startingLineNumber = "712" | |
49 | - endingLineNumber = "712" | |
50 | - landmarkName = "-tableView:cellForRowAtIndexPath:" | |
48 | + startingLineNumber = "716" | |
49 | + endingLineNumber = "716" | |
50 | + landmarkName = "-tableView:indentationLevelForRowAtIndexPath:" | |
51 | 51 | landmarkType = "5"> |
52 | 52 | </BreakpointContent> |
53 | 53 | </BreakpointProxy> |
... | ... | @@ -58,11 +58,11 @@ |
58 | 58 | ignoreCount = "0" |
59 | 59 | continueAfterRunningActions = "No" |
60 | 60 | filePath = "MenuTableViewController.m" |
61 | - timestampString = "434037601.622012" | |
61 | + timestampString = "434133664.559575" | |
62 | 62 | startingColumnNumber = "9223372036854775807" |
63 | 63 | endingColumnNumber = "9223372036854775807" |
64 | - startingLineNumber = "571" | |
65 | - endingLineNumber = "571" | |
64 | + startingLineNumber = "575" | |
65 | + endingLineNumber = "575" | |
66 | 66 | landmarkName = "-tableView:didSelectRowAtIndexPath:" |
67 | 67 | landmarkType = "5"> |
68 | 68 | </BreakpointContent> |
... | ... | @@ -74,13 +74,13 @@ |
74 | 74 | ignoreCount = "0" |
75 | 75 | continueAfterRunningActions = "No" |
76 | 76 | filePath = "CommunicationProtocol.m" |
77 | - timestampString = "434038085.179085" | |
77 | + timestampString = "434133664.559575" | |
78 | 78 | startingColumnNumber = "9223372036854775807" |
79 | 79 | endingColumnNumber = "9223372036854775807" |
80 | - startingLineNumber = "341" | |
81 | - endingLineNumber = "341" | |
82 | - landmarkName = "-updateProductName:::" | |
83 | - landmarkType = "5"> | |
80 | + startingLineNumber = "336" | |
81 | + endingLineNumber = "336" | |
82 | + landmarkName = "@implementation CommunicationProtocol" | |
83 | + landmarkType = "3"> | |
84 | 84 | </BreakpointContent> |
85 | 85 | </BreakpointProxy> |
86 | 86 | <BreakpointProxy |
... | ... | @@ -90,12 +90,12 @@ |
90 | 90 | ignoreCount = "0" |
91 | 91 | continueAfterRunningActions = "No" |
92 | 92 | filePath = "CommunicationProtocol.m" |
93 | - timestampString = "434038085.179085" | |
93 | + timestampString = "434133664.559575" | |
94 | 94 | startingColumnNumber = "9223372036854775807" |
95 | 95 | endingColumnNumber = "9223372036854775807" |
96 | - startingLineNumber = "340" | |
97 | - endingLineNumber = "340" | |
98 | - landmarkName = "-updateProductName:::" | |
96 | + startingLineNumber = "335" | |
97 | + endingLineNumber = "335" | |
98 | + landmarkName = "-readSalesLog::" | |
99 | 99 | landmarkType = "5"> |
100 | 100 | </BreakpointContent> |
101 | 101 | </BreakpointProxy> |
... | ... | @@ -106,13 +106,11 @@ |
106 | 106 | ignoreCount = "0" |
107 | 107 | continueAfterRunningActions = "No" |
108 | 108 | filePath = "CommunicationProtocol.m" |
109 | - timestampString = "434038085.179085" | |
109 | + timestampString = "434133664.559575" | |
110 | 110 | startingColumnNumber = "9223372036854775807" |
111 | 111 | endingColumnNumber = "9223372036854775807" |
112 | - startingLineNumber = "353" | |
113 | - endingLineNumber = "353" | |
114 | - landmarkName = "-readSensorData" | |
115 | - landmarkType = "5"> | |
112 | + startingLineNumber = "348" | |
113 | + endingLineNumber = "348"> | |
116 | 114 | </BreakpointContent> |
117 | 115 | </BreakpointProxy> |
118 | 116 | <BreakpointProxy |
... | ... | @@ -186,11 +184,11 @@ |
186 | 184 | ignoreCount = "0" |
187 | 185 | continueAfterRunningActions = "No" |
188 | 186 | filePath = "MenuTableViewController.m" |
189 | - timestampString = "434037601.622012" | |
187 | + timestampString = "434133664.559575" | |
190 | 188 | startingColumnNumber = "9223372036854775807" |
191 | 189 | endingColumnNumber = "9223372036854775807" |
192 | - startingLineNumber = "821" | |
193 | - endingLineNumber = "821" | |
190 | + startingLineNumber = "825" | |
191 | + endingLineNumber = "825" | |
194 | 192 | landmarkName = "-tableView:cellForRowAtIndexPath:" |
195 | 193 | landmarkType = "5"> |
196 | 194 | </BreakpointContent> |
... | ... | @@ -202,12 +200,12 @@ |
202 | 200 | ignoreCount = "0" |
203 | 201 | continueAfterRunningActions = "No" |
204 | 202 | filePath = "MenuTableViewController.m" |
205 | - timestampString = "434037601.622012" | |
203 | + timestampString = "434127499.570083" | |
206 | 204 | startingColumnNumber = "9223372036854775807" |
207 | 205 | endingColumnNumber = "9223372036854775807" |
208 | - startingLineNumber = "105" | |
209 | - endingLineNumber = "105" | |
210 | - landmarkName = "-generateSaleListNavLevel" | |
206 | + startingLineNumber = "101" | |
207 | + endingLineNumber = "101" | |
208 | + landmarkName = "-generateMaintenanceLevel" | |
211 | 209 | landmarkType = "5"> |
212 | 210 | </BreakpointContent> |
213 | 211 | </BreakpointProxy> |
... | ... | @@ -218,12 +216,12 @@ |
218 | 216 | ignoreCount = "0" |
219 | 217 | continueAfterRunningActions = "No" |
220 | 218 | filePath = "MenuTableViewController.m" |
221 | - timestampString = "434037601.622012" | |
219 | + timestampString = "434127499.570083" | |
222 | 220 | startingColumnNumber = "9223372036854775807" |
223 | 221 | endingColumnNumber = "9223372036854775807" |
224 | - startingLineNumber = "108" | |
225 | - endingLineNumber = "108" | |
226 | - landmarkName = "-generateSaleListNavLevel" | |
222 | + startingLineNumber = "104" | |
223 | + endingLineNumber = "104" | |
224 | + landmarkName = "-generateMaintenanceLevel" | |
227 | 225 | landmarkType = "5"> |
228 | 226 | </BreakpointContent> |
229 | 227 | </BreakpointProxy> |
... | ... | @@ -234,11 +232,11 @@ |
234 | 232 | ignoreCount = "0" |
235 | 233 | continueAfterRunningActions = "No" |
236 | 234 | filePath = "MenuTableViewController.m" |
237 | - timestampString = "434037601.622012" | |
235 | + timestampString = "434127499.570083" | |
238 | 236 | startingColumnNumber = "9223372036854775807" |
239 | 237 | endingColumnNumber = "9223372036854775807" |
240 | - startingLineNumber = "116" | |
241 | - endingLineNumber = "116" | |
238 | + startingLineNumber = "112" | |
239 | + endingLineNumber = "112" | |
242 | 240 | landmarkName = "-generateSaleListNavLevel" |
243 | 241 | landmarkType = "5"> |
244 | 242 | </BreakpointContent> |
... | ... | @@ -250,11 +248,11 @@ |
250 | 248 | ignoreCount = "0" |
251 | 249 | continueAfterRunningActions = "No" |
252 | 250 | filePath = "MenuTableViewController.m" |
253 | - timestampString = "434037601.622012" | |
251 | + timestampString = "434127499.570083" | |
254 | 252 | startingColumnNumber = "9223372036854775807" |
255 | 253 | endingColumnNumber = "9223372036854775807" |
256 | - startingLineNumber = "188" | |
257 | - endingLineNumber = "188" | |
254 | + startingLineNumber = "184" | |
255 | + endingLineNumber = "184" | |
258 | 256 | landmarkName = "-changeNavLevel::" |
259 | 257 | landmarkType = "5"> |
260 | 258 | </BreakpointContent> |
... | ... | @@ -266,28 +264,12 @@ |
266 | 264 | ignoreCount = "0" |
267 | 265 | continueAfterRunningActions = "No" |
268 | 266 | filePath = "MenuTableViewController.m" |
269 | - timestampString = "434037601.622012" | |
270 | - startingColumnNumber = "9223372036854775807" | |
271 | - endingColumnNumber = "9223372036854775807" | |
272 | - startingLineNumber = "556" | |
273 | - endingLineNumber = "556" | |
274 | - landmarkName = "-tableView:numberOfRowsInSection:" | |
275 | - landmarkType = "5"> | |
276 | - </BreakpointContent> | |
277 | - </BreakpointProxy> | |
278 | - <BreakpointProxy | |
279 | - BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint"> | |
280 | - <BreakpointContent | |
281 | - shouldBeEnabled = "No" | |
282 | - ignoreCount = "0" | |
283 | - continueAfterRunningActions = "No" | |
284 | - filePath = "MenuTableViewController.m" | |
285 | - timestampString = "434037601.622012" | |
267 | + timestampString = "434133664.559575" | |
286 | 268 | startingColumnNumber = "9223372036854775807" |
287 | 269 | endingColumnNumber = "9223372036854775807" |
288 | - startingLineNumber = "697" | |
289 | - endingLineNumber = "697" | |
290 | - landmarkName = "-tableView:indentationLevelForRowAtIndexPath:" | |
270 | + startingLineNumber = "701" | |
271 | + endingLineNumber = "701" | |
272 | + landmarkName = "-tableView:didSelectRowAtIndexPath:" | |
291 | 273 | landmarkType = "5"> |
292 | 274 | </BreakpointContent> |
293 | 275 | </BreakpointProxy> |
... | ... | @@ -298,12 +280,12 @@ |
298 | 280 | ignoreCount = "0" |
299 | 281 | continueAfterRunningActions = "No" |
300 | 282 | filePath = "MenuTableViewController.m" |
301 | - timestampString = "434037601.622012" | |
283 | + timestampString = "434133664.559575" | |
302 | 284 | startingColumnNumber = "9223372036854775807" |
303 | 285 | endingColumnNumber = "9223372036854775807" |
304 | - startingLineNumber = "717" | |
305 | - endingLineNumber = "717" | |
306 | - landmarkName = "-tableView:cellForRowAtIndexPath:" | |
286 | + startingLineNumber = "721" | |
287 | + endingLineNumber = "721" | |
288 | + landmarkName = "-numberOfSectionsInTableView:" | |
307 | 289 | landmarkType = "5"> |
308 | 290 | </BreakpointContent> |
309 | 291 | </BreakpointProxy> |
... | ... | @@ -314,11 +296,11 @@ |
314 | 296 | ignoreCount = "0" |
315 | 297 | continueAfterRunningActions = "No" |
316 | 298 | filePath = "MenuTableViewController.m" |
317 | - timestampString = "434037601.622012" | |
299 | + timestampString = "434133664.559575" | |
318 | 300 | startingColumnNumber = "9223372036854775807" |
319 | 301 | endingColumnNumber = "9223372036854775807" |
320 | - startingLineNumber = "910" | |
321 | - endingLineNumber = "910" | |
302 | + startingLineNumber = "914" | |
303 | + endingLineNumber = "914" | |
322 | 304 | landmarkName = "-tableView:cellForRowAtIndexPath:" |
323 | 305 | landmarkType = "5"> |
324 | 306 | </BreakpointContent> |
... | ... | @@ -330,11 +312,11 @@ |
330 | 312 | ignoreCount = "0" |
331 | 313 | continueAfterRunningActions = "No" |
332 | 314 | filePath = "MenuTableViewController.m" |
333 | - timestampString = "434037601.622012" | |
315 | + timestampString = "434133664.559575" | |
334 | 316 | startingColumnNumber = "9223372036854775807" |
335 | 317 | endingColumnNumber = "9223372036854775807" |
336 | - startingLineNumber = "911" | |
337 | - endingLineNumber = "911" | |
318 | + startingLineNumber = "915" | |
319 | + endingLineNumber = "915" | |
338 | 320 | landmarkName = "-tableView:cellForRowAtIndexPath:" |
339 | 321 | landmarkType = "5"> |
340 | 322 | </BreakpointContent> |
... | ... | @@ -362,11 +344,11 @@ |
362 | 344 | ignoreCount = "0" |
363 | 345 | continueAfterRunningActions = "No" |
364 | 346 | filePath = "MenuTableViewController.m" |
365 | - timestampString = "434037601.622012" | |
347 | + timestampString = "434133664.559575" | |
366 | 348 | startingColumnNumber = "9223372036854775807" |
367 | 349 | endingColumnNumber = "9223372036854775807" |
368 | - startingLineNumber = "1030" | |
369 | - endingLineNumber = "1030" | |
350 | + startingLineNumber = "1034" | |
351 | + endingLineNumber = "1034" | |
370 | 352 | landmarkName = "-tableView:cellForRowAtIndexPath:" |
371 | 353 | landmarkType = "5"> |
372 | 354 | </BreakpointContent> |
... | ... | @@ -378,11 +360,11 @@ |
378 | 360 | ignoreCount = "0" |
379 | 361 | continueAfterRunningActions = "No" |
380 | 362 | filePath = "MenuTableViewController.m" |
381 | - timestampString = "434037601.622012" | |
363 | + timestampString = "434133664.559575" | |
382 | 364 | startingColumnNumber = "9223372036854775807" |
383 | 365 | endingColumnNumber = "9223372036854775807" |
384 | - startingLineNumber = "512" | |
385 | - endingLineNumber = "512" | |
366 | + startingLineNumber = "505" | |
367 | + endingLineNumber = "505" | |
386 | 368 | landmarkName = "-toggleDropList:" |
387 | 369 | landmarkType = "5"> |
388 | 370 | </BreakpointContent> |
... | ... | @@ -394,11 +376,11 @@ |
394 | 376 | ignoreCount = "0" |
395 | 377 | continueAfterRunningActions = "No" |
396 | 378 | filePath = "MenuTableViewController.m" |
397 | - timestampString = "434037601.622012" | |
379 | + timestampString = "434133664.559575" | |
398 | 380 | startingColumnNumber = "9223372036854775807" |
399 | 381 | endingColumnNumber = "9223372036854775807" |
400 | - startingLineNumber = "1115" | |
401 | - endingLineNumber = "1115" | |
382 | + startingLineNumber = "1119" | |
383 | + endingLineNumber = "1119" | |
402 | 384 | landmarkName = "-tableView:cellForRowAtIndexPath:" |
403 | 385 | landmarkType = "5"> |
404 | 386 | </BreakpointContent> |
... | ... | @@ -410,11 +392,11 @@ |
410 | 392 | ignoreCount = "0" |
411 | 393 | continueAfterRunningActions = "No" |
412 | 394 | filePath = "MenuTableViewController.m" |
413 | - timestampString = "434037601.622012" | |
395 | + timestampString = "434133664.559575" | |
414 | 396 | startingColumnNumber = "9223372036854775807" |
415 | 397 | endingColumnNumber = "9223372036854775807" |
416 | - startingLineNumber = "1107" | |
417 | - endingLineNumber = "1107" | |
398 | + startingLineNumber = "1111" | |
399 | + endingLineNumber = "1111" | |
418 | 400 | landmarkName = "-tableView:cellForRowAtIndexPath:" |
419 | 401 | landmarkType = "5"> |
420 | 402 | </BreakpointContent> |
... | ... | @@ -426,11 +408,11 @@ |
426 | 408 | ignoreCount = "0" |
427 | 409 | continueAfterRunningActions = "No" |
428 | 410 | filePath = "MenuTableViewController.m" |
429 | - timestampString = "434037601.622012" | |
411 | + timestampString = "434133664.559575" | |
430 | 412 | startingColumnNumber = "9223372036854775807" |
431 | 413 | endingColumnNumber = "9223372036854775807" |
432 | - startingLineNumber = "902" | |
433 | - endingLineNumber = "902" | |
414 | + startingLineNumber = "906" | |
415 | + endingLineNumber = "906" | |
434 | 416 | landmarkName = "-tableView:cellForRowAtIndexPath:" |
435 | 417 | landmarkType = "5"> |
436 | 418 | </BreakpointContent> |
... | ... | @@ -442,11 +424,11 @@ |
442 | 424 | ignoreCount = "0" |
443 | 425 | continueAfterRunningActions = "No" |
444 | 426 | filePath = "MenuTableViewController.m" |
445 | - timestampString = "434037601.622012" | |
427 | + timestampString = "434133664.559575" | |
446 | 428 | startingColumnNumber = "9223372036854775807" |
447 | 429 | endingColumnNumber = "9223372036854775807" |
448 | - startingLineNumber = "900" | |
449 | - endingLineNumber = "900" | |
430 | + startingLineNumber = "904" | |
431 | + endingLineNumber = "904" | |
450 | 432 | landmarkName = "-tableView:cellForRowAtIndexPath:" |
451 | 433 | landmarkType = "5"> |
452 | 434 | </BreakpointContent> |
... | ... | @@ -458,11 +440,11 @@ |
458 | 440 | ignoreCount = "0" |
459 | 441 | continueAfterRunningActions = "No" |
460 | 442 | filePath = "MenuTableViewController.m" |
461 | - timestampString = "434037601.622012" | |
443 | + timestampString = "434133664.559575" | |
462 | 444 | startingColumnNumber = "9223372036854775807" |
463 | 445 | endingColumnNumber = "9223372036854775807" |
464 | - startingLineNumber = "761" | |
465 | - endingLineNumber = "761" | |
446 | + startingLineNumber = "765" | |
447 | + endingLineNumber = "765" | |
466 | 448 | landmarkName = "-tableView:cellForRowAtIndexPath:" |
467 | 449 | landmarkType = "5"> |
468 | 450 | </BreakpointContent> |
... | ... | @@ -538,11 +520,11 @@ |
538 | 520 | ignoreCount = "0" |
539 | 521 | continueAfterRunningActions = "No" |
540 | 522 | filePath = "MenuTableViewController.m" |
541 | - timestampString = "434037601.622012" | |
523 | + timestampString = "434133664.559575" | |
542 | 524 | startingColumnNumber = "9223372036854775807" |
543 | 525 | endingColumnNumber = "9223372036854775807" |
544 | - startingLineNumber = "1230" | |
545 | - endingLineNumber = "1230" | |
526 | + startingLineNumber = "1235" | |
527 | + endingLineNumber = "1235" | |
546 | 528 | landmarkName = "-passDateRangeViewController:didFinishEnteringItem::" |
547 | 529 | landmarkType = "5"> |
548 | 530 | </BreakpointContent> |
... | ... | @@ -554,12 +536,12 @@ |
554 | 536 | ignoreCount = "0" |
555 | 537 | continueAfterRunningActions = "No" |
556 | 538 | filePath = "MenuTableViewController.m" |
557 | - timestampString = "434037601.622012" | |
539 | + timestampString = "434133664.559575" | |
558 | 540 | startingColumnNumber = "9223372036854775807" |
559 | 541 | endingColumnNumber = "9223372036854775807" |
560 | - startingLineNumber = "1215" | |
561 | - endingLineNumber = "1215" | |
562 | - landmarkName = "-passDateRangeViewController:didFinishEnteringItem::" | |
542 | + startingLineNumber = "1220" | |
543 | + endingLineNumber = "1220" | |
544 | + landmarkName = "-passNameViewController:didFinishEnteringItem:" | |
563 | 545 | landmarkType = "5"> |
564 | 546 | </BreakpointContent> |
565 | 547 | </BreakpointProxy> | ... | ... |
DUREX Vendor Control/FirstAppExample/EMDevicePickerViewController.m
... | ... | @@ -106,7 +106,7 @@ |
106 | 106 | |
107 | 107 | -(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath |
108 | 108 | { |
109 | - //[self performSegueWithIdentifier:@"ConnectionSegue" sender:self]; | |
109 | + [self performSegueWithIdentifier:@"ConnectionSegue" sender:self]; | |
110 | 110 | if(![[[[tableView cellForRowAtIndexPath:indexPath] textLabel] text] isEqualToString:NSLocalizedString(@"Searching for devices...",nil)]) |
111 | 111 | { |
112 | 112 | [self _showConnectingView]; | ... | ... |
DUREX Vendor Control/MenuTableViewController.h
... | ... | @@ -73,16 +73,6 @@ enum { |
73 | 73 | |
74 | 74 | @interface MenuTableViewController : UITableViewController <DatePickerViewControllerDelegate,PriceChangerViewControllerDelegate,NameChangerViewControllerDelegate, DateRangePickerViewControllerDelegate, CommunicationProtocolDelegate, NSURLConnectionDataDelegate> |
75 | 75 | |
76 | -@property (strong,nonatomic) Stack *parentLayout; | |
77 | -@property (strong,nonatomic) DatePickerViewController *datePickerViewController; | |
78 | -@property (strong,nonatomic) PriceChangerViewController *priceChangerViewController; | |
79 | -@property (strong,nonatomic) NameChangerViewController *nameChangerViewController; | |
80 | -@property (strong,nonatomic) DateRangePickerViewController *dateRangePickerViewController; | |
81 | -@property (strong,nonatomic) Sensors *sensorStatus; | |
82 | -@property (strong,nonatomic) SalesLog *salesLog; | |
83 | -@property (strong,nonatomic) Sale *currentSale; | |
84 | -@property (strong,nonatomic) NSString *machineMACAddr; | |
85 | - | |
86 | 76 | - (void) navBack; |
87 | 77 | |
88 | 78 | @end | ... | ... |
DUREX Vendor Control/MenuTableViewController.m
... | ... | @@ -13,6 +13,8 @@ |
13 | 13 | IBOutlet UIActivityIndicatorView *_activityIndicator; |
14 | 14 | NSTimer *_writeTimer; |
15 | 15 | } |
16 | + | |
17 | +//NAVIGATION LEVELS LAYOUT AND CELL IDENTIFIERS | |
16 | 18 | @property (nonatomic,strong) const NSMutableArray *menuElements; |
17 | 19 | @property (nonatomic,strong) const NSMutableArray *menuStructure; |
18 | 20 | @property (nonatomic,strong) const NSMutableArray *menuHeaders; |
... | ... | @@ -35,29 +37,32 @@ |
35 | 37 | |
36 | 38 | @property (nonatomic,strong) const NSArray *cellIdentifiers; |
37 | 39 | |
40 | +//GENERAL ATTRIBUTES | |
38 | 41 | @property (nonatomic,strong) CommunicationProtocol* protocol; |
39 | -@property uint8_t currentNavLevel; | |
40 | -@property NSString *currentCellIdentifier; | |
41 | -@property const NSMutableArray *currentElements; | |
42 | -@property const NSMutableArray *currentStructure; | |
43 | -@property const NSMutableArray *currentHeaders; | |
42 | +@property (strong,nonatomic) NSString *machineMACAddr; | |
43 | +@property (strong,nonatomic) Stack *parentLayout; | |
44 | 44 | |
45 | +@property (strong,nonatomic) Sensors *sensorStatus; | |
46 | +@property (strong,nonatomic) SalesLog *salesLog; | |
47 | +@property (strong,nonatomic) Sale *currentSale; | |
45 | 48 | @property uint8_t requestedLog; |
46 | 49 | @property uint8_t sentCommand; |
50 | + | |
51 | +@property uint8_t currentNavLevel; | |
52 | +@property (strong,nonatomic) NSString *currentCellIdentifier; | |
53 | +@property (strong,nonatomic) const NSMutableArray *currentElements; | |
54 | +@property (strong,nonatomic) const NSMutableArray *currentStructure; | |
55 | +@property (strong,nonatomic) const NSMutableArray *currentHeaders; | |
56 | + | |
57 | +@property (strong,nonatomic) DatePickerViewController *datePickerViewController; | |
58 | +@property (strong,nonatomic) PriceChangerViewController *priceChangerViewController; | |
59 | +@property (strong,nonatomic) NameChangerViewController *nameChangerViewController; | |
60 | +@property (strong,nonatomic) DateRangePickerViewController *dateRangePickerViewController; | |
47 | 61 | @end |
48 | 62 | |
49 | 63 | @implementation MenuTableViewController |
50 | 64 | |
51 | -- (id)initWithStyle:(UITableViewStyle)style | |
52 | -{ | |
53 | - self = [super initWithStyle:style]; | |
54 | - if (self) | |
55 | - { | |
56 | - // Custom initialization | |
57 | - } | |
58 | - return self; | |
59 | -} | |
60 | - | |
65 | +//NAVIGATION LEVELS GENERATION AND NAVIGATION | |
61 | 66 | - (void) initializeMenuEntries |
62 | 67 | { |
63 | 68 | [self setMenuElements:[[NSMutableArray alloc] initWithObjects:MENU_ELEMENTS, nil]]; |
... | ... | @@ -203,16 +208,6 @@ |
203 | 208 | [self changeNavLevel: prevLevel.intValue : FALSE]; |
204 | 209 | } |
205 | 210 | |
206 | -- (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section | |
207 | -{ | |
208 | - NSString *title = @""; | |
209 | - if([self currentHeaders] != nil) | |
210 | - { | |
211 | - title = [[self currentHeaders] objectAtIndex:section]; | |
212 | - } | |
213 | - return title; | |
214 | -} | |
215 | - | |
216 | 211 | - (void) backButtonPressed: (id) sender |
217 | 212 | { |
218 | 213 | NSLog(@"[MenuTableViewController.m]: Navigation Stack has %ld remaining levels",(long)[[self parentLayout] count]); |
... | ... | @@ -224,10 +219,12 @@ |
224 | 219 | else |
225 | 220 | { |
226 | 221 | NSLog(@"[MenuTableViewController.m]: No more navigation levels in stack, falling to previous view"); |
222 | + [_protocol disconnect]; | |
227 | 223 | [self.navigationController popViewControllerAnimated:YES]; |
228 | 224 | } |
229 | 225 | } |
230 | 226 | |
227 | +//MAINTENANCE REPORT SENDING | |
231 | 228 | - (void) sendMaintenanceReport : (NSString*) status : (NSString*) date : (NSString*) machineid |
232 | 229 | { |
233 | 230 | NSString *content = [NSString stringWithFormat:@"status=%@&date=%@&machineid=%@",status,date,machineid]; |
... | ... | @@ -235,15 +232,11 @@ |
235 | 232 | NSMutableURLRequest *request = [[NSMutableURLRequest alloc] initWithURL:[NSURL URLWithString:REPORT_SERVER_URL]]; |
236 | 233 | [request setHTTPMethod:@"POST"]; |
237 | 234 | [request setHTTPBody:[content dataUsingEncoding:NSUTF8StringEncoding]]; |
238 | - | |
239 | - // generates an autoreleased NSURLConnection | |
240 | 235 | [NSURLConnection connectionWithRequest:request delegate:self]; |
241 | 236 | } |
242 | 237 | |
243 | 238 | - (void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data |
244 | 239 | { |
245 | - // Append the new data to receivedData. | |
246 | - // receivedData is an instance variable declared elsewhere. | |
247 | 240 | NSLog(@"[MenuTableViewController.m]: Received response from report server: %@",[NSString stringWithUTF8String:[data bytes]]); |
248 | 241 | [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"]]; |
249 | 242 | } |
... | ... | @@ -253,7 +246,20 @@ |
253 | 246 | NSLog(@"[MenuTableViewController.m]: Error connecting to server: %@ %@",[error localizedDescription],[[error userInfo] objectForKey:NSURLErrorFailingURLStringErrorKey]); |
254 | 247 | [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"]]; |
255 | 248 | } |
249 | +//PROTOCOL ERROR CALLBACK | |
250 | +- (void) reportProtocolError: (CommunicationProtocol*)protocol didFinishEnteringItem:(NSString*) error | |
251 | +{ | |
252 | + if(self.currentNavLevel == 255) | |
253 | + { | |
254 | + [self processMessage:protocol didFinishEnteringItem:@"ERROR"]; | |
255 | + } | |
256 | + else | |
257 | + { | |
258 | + [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"]]; | |
259 | + } | |
260 | +} | |
256 | 261 | |
262 | +//MESSAGE RECEIVED CALLBACK | |
257 | 263 | - (void)processMessage:(CommunicationProtocol*)protocol didFinishEnteringItem:(NSString*) response |
258 | 264 | { |
259 | 265 | NSLog(@"[MenuTableViewController.m]: Answer received"); |
... | ... | @@ -298,11 +304,12 @@ |
298 | 304 | NSLog(@"[MenuTableViewController.m]: Received A5 answer"); |
299 | 305 | if([response isEqualToString:@"P51"]) |
300 | 306 | { |
301 | - | |
307 | + [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"]]; | |
302 | 308 | } |
303 | 309 | else if([response isEqualToString:@"P52"]) |
304 | 310 | { |
305 | 311 | NSLog(@"[MenuTableViewController.m]: Device returned error for command A5"); |
312 | + [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"]]; | |
306 | 313 | } |
307 | 314 | } |
308 | 315 | else if(self.sentCommand == A6 && [[response substringToIndex:2]isEqualToString:@"P6"]) |
... | ... | @@ -310,11 +317,12 @@ |
310 | 317 | NSLog(@"[MenuTableViewController.m]: Received A6 answer"); |
311 | 318 | if([response isEqualToString:@"P61"]) |
312 | 319 | { |
313 | - | |
320 | + [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"]]; | |
314 | 321 | } |
315 | 322 | else if([response isEqualToString:@"P62"]) |
316 | 323 | { |
317 | 324 | NSLog(@"[MenuTableViewController.m]: Device returned error for command A6"); |
325 | + [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"]]; | |
318 | 326 | } |
319 | 327 | } |
320 | 328 | else if(self.sentCommand == A7 && [[response substringToIndex:2]isEqualToString:@"P7"]) |
... | ... | @@ -322,11 +330,12 @@ |
322 | 330 | NSLog(@"[MenuTableViewController.m]: Received A7 answer"); |
323 | 331 | if([response isEqualToString:@"P71"]) |
324 | 332 | { |
325 | - | |
333 | + [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"]]; | |
326 | 334 | } |
327 | 335 | else if([response isEqualToString:@"P72"]) |
328 | 336 | { |
329 | 337 | NSLog(@"[MenuTableViewController.m]: Device returned error for command A7"); |
338 | + [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"]]; | |
330 | 339 | } |
331 | 340 | } |
332 | 341 | else |
... | ... | @@ -402,6 +411,7 @@ |
402 | 411 | |
403 | 412 | #pragma mark - Table view delegate |
404 | 413 | |
414 | +//CELL PROCESSING AND CUSTOMIZATION | |
405 | 415 | - (void) addTags : (NSMutableArray*) rows : (NSInteger) tag |
406 | 416 | { |
407 | 417 | for(int i = 0; i < [rows count]; i++) |
... | ... | @@ -552,6 +562,17 @@ |
552 | 562 | [[self currentStructure] replaceObjectAtIndex:[indexPath section] withObject:[NSNumber numberWithInt:([[[self currentStructure] objectAtIndex:[indexPath section]] intValue] - numRows)]]; |
553 | 563 | } |
554 | 564 | |
565 | +//UITABLEVIEWCONTROLLER FUNCTIONS | |
566 | +- (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section | |
567 | +{ | |
568 | + NSString *title = @""; | |
569 | + if([self currentHeaders] != nil) | |
570 | + { | |
571 | + title = [[self currentHeaders] objectAtIndex:section]; | |
572 | + } | |
573 | + return title; | |
574 | +} | |
575 | + | |
555 | 576 | - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section |
556 | 577 | { |
557 | 578 | return [[[self currentStructure] objectAtIndex:section] intValue]; |
... | ... | @@ -1120,6 +1141,7 @@ |
1120 | 1141 | return cell; |
1121 | 1142 | } |
1122 | 1143 | |
1144 | +//DELEGATE FUNCTIONS | |
1123 | 1145 | - (void)passDateViewController:(DatePickerViewController *)controller didFinishEnteringItem:(NSDate *)date |
1124 | 1146 | { |
1125 | 1147 | NSCalendar *calendar = [[NSCalendar alloc] initWithCalendarIdentifier:NSGregorianCalendar]; | ... | ... |
DUREX Vendor Control/en.lproj/Localizable.strings
... | ... | @@ -92,4 +92,12 @@ |
92 | 92 | "Entered product code has an invalid format" = "Entered product code has an invalid format"; |
93 | 93 | "Entered channel has an invalid format" = "Entered channel has an invalid format"; |
94 | 94 | "Missing channel" = "Missing channel"; |
95 | -"Missing product code" = "Missing product code"; | |
96 | 95 | \ No newline at end of file |
96 | +"Missing product code" = "Missing product code"; | |
97 | +"Time and Date changed successfully" = "Time and Date changed successfully"; | |
98 | +"Time and Date change returned error" = "Time and Date change returned error"; | |
99 | +"Product price changed successfully" = "Product price changed successfully"; | |
100 | +"Product price change returned error" = "Product price change returned error"; | |
101 | +"Product name changed successfully" = "Product name changed successfully"; | |
102 | +"Product name change returned error" = "Product name change returned error"; | |
103 | +"Error occurred while reading answer from device" = "Error occurred while reading answer from device"; | |
104 | +"Error occurred while sending command to device" = "Error occurred while sending command to device"; | |
97 | 105 | \ No newline at end of file | ... | ... |
DUREX Vendor Control/es.lproj/Localizable.strings
... | ... | @@ -92,4 +92,12 @@ |
92 | 92 | "Entered code has an invalid format" = "El código de producto introducido está en un formato incorrecto"; |
93 | 93 | "Entered channel has an invalid format" = "El canal introducido está en un formato incorrecto"; |
94 | 94 | "Missing channel" = "Falta el canal"; |
95 | -"Missing product code" = "Falta el código del producto"; | |
96 | 95 | \ No newline at end of file |
96 | +"Missing product code" = "Falta el código del producto"; | |
97 | +"Time and Date changed successfully" = "Fecha y hora cambiadas con éxito"; | |
98 | +"Time and Date change returned error" = "Error al cambiar la fecha y hora"; | |
99 | +"Product price changed successfully" = "El precio del producto se cambió con éxito"; | |
100 | +"Product price change returned error" = "Error al cambiar el precio del producto"; | |
101 | +"Product name changed successfully" = "El nombre del producto se cambió con éxito"; | |
102 | +"Product name change returned error" = "Error al cambiar el nombre del producto"; | |
103 | +"Error occurred while reading answer from device" = "Error al leer la respuesta del dispositivo"; | |
104 | +"Error occurred while sending command to device" = "Error al mandar el comando al dispositivo"; | |
97 | 105 | \ No newline at end of file | ... | ... |
TODO
... | ... | @@ -5,12 +5,9 @@ BUGS: |
5 | 5 | - On date change, response is overwritten by previous query, trimming needed according to numBytes |
6 | 6 | |
7 | 7 | TODO: |
8 | -- Error reporting function | |
9 | -- Toast if success or error on processMessage (except nav changes) | |
10 | 8 | - Incident class |
11 | 9 | - Incident parser |
12 | 10 | - A3 command |
13 | -- BYE command | |
14 | 11 | - Channels and codes to 2 ciphers |
15 | 12 | - Add landscape layout and inverted layout |
16 | 13 | - Month/Year headers on sale list | ... | ... |