diff --git a/DUREX Vendor Control/CommunicationProtocol.h b/DUREX Vendor Control/CommunicationProtocol.h index 2983ba8..3395b7d 100644 --- a/DUREX Vendor Control/CommunicationProtocol.h +++ b/DUREX Vendor Control/CommunicationProtocol.h @@ -15,7 +15,8 @@ @interface CommunicationProtocol : NSObject --(Boolean) waitForMessageAvailable: (Boolean) status; +-(Boolean) waitForMessageAvailableMobile: (Boolean) status; +-(Boolean) waitForMessageAvailableDevice: (Boolean) status; -(Boolean) writeMessage: (NSString*) message; -(NSString*) readMessage; -(Boolean) establishConnection; @@ -23,6 +24,7 @@ -(Boolean) updatePrice: (uint8_t) channel : (uint8_t) product : (uint8_t) eur : (uint8_t) cents; -(Boolean) updateProductName: (uint8_t) channel : (uint8_t) product : (NSString*) name; +(id) sharedProtocol; -@property Boolean messageAvailable; +@property Boolean messageAvailableMobile; +@property Boolean messageAvailableDevice; @end diff --git a/DUREX Vendor Control/CommunicationProtocol.m b/DUREX Vendor Control/CommunicationProtocol.m index bcdffae..f7b6451 100644 --- a/DUREX Vendor Control/CommunicationProtocol.m +++ b/DUREX Vendor Control/CommunicationProtocol.m @@ -23,16 +23,81 @@ return shared; } --(Boolean) waitForMessageAvailable: (Boolean) status +-(void) readMessageAvailableMobile +{ + [[EMConnectionManager sharedManager] readResource:@"messageAvailableMobile" onSuccess:^(id readValue) + { + [self setMessageAvailableMobile:[readValue intValue]]; + if([self messageAvailableMobile]) + { + NSLog(@"[CommunicationProtocol.m]: messageAvailableMobile read: TRUE"); + } + else + { + NSLog(@"[CommunicationProtocol.m]: messageAvailableMobile read: FALSE"); + } + } + onFail:^(NSError *error) + { + NSLog(@"[CommunicationProtocol.m]: %@",error); + }]; + [NSThread sleepForTimeInterval:10]; +} + +-(void) readMessageAvailableDevice +{ + [[EMConnectionManager sharedManager] readResource:@"messageAvailableDevice" onSuccess:^(id readValue) + { + [self setMessageAvailableDevice:[readValue intValue]]; + if([self messageAvailableDevice]) + { + NSLog(@"[CommunicationProtocol.m]: messageAvailableDevice read: TRUE"); + } + else + { + NSLog(@"[CommunicationProtocol.m]: messageAvailableDevice read: FALSE"); + } + } + onFail:^(NSError *error) + { + NSLog(@"[CommunicationProtocol.m]: %@",error); + }]; + [NSThread sleepForTimeInterval:10]; +} + +-(Boolean) waitForMessageAvailableMobile: (Boolean) status +{ + uint8_t retries = 0; + [self readMessageAvailableMobile]; + while([self messageAvailableMobile] != status) + { + [NSThread sleepForTimeInterval:5]; + [self readMessageAvailableMobile]; + if([self messageAvailableMobile] != status) + { + if(retries++ == MAX_RETRIES) + { + NSLog(@"[CommunicationProtocol.m]: Timeout while waiting for answer"); + return FALSE; + } + } + } + return TRUE; +} + +-(Boolean) waitForMessageAvailableDevice: (Boolean) status { uint8_t retries = 0; - while([self messageAvailable] != status) + [self readMessageAvailableDevice]; + while([self messageAvailableDevice] != status) { [NSThread sleepForTimeInterval:5]; - if([self messageAvailable] != status) + [self readMessageAvailableDevice]; + if([self messageAvailableDevice] != status) { if(retries++ == MAX_RETRIES) { + NSLog(@"[CommunicationProtocol.m]: Timeout while waiting for answer"); return FALSE; } } @@ -43,13 +108,15 @@ -(NSString*) readMessage { __block uint8_t numPackets, numBytes; - __block NSMutableString *message; + __block NSMutableString *message = [[NSMutableString alloc] init]; [message setString:@""]; - if([self waitForMessageAvailable:TRUE]) + if([self waitForMessageAvailableDevice:TRUE]) + //if(1) //HACK! { [[EMConnectionManager sharedManager] readResource:@"numPackets" onSuccess:^(id readValue) { numPackets = (uint8_t) [readValue unsignedCharValue]; + NSLog(@"[CommunicationProtocol.m]: numPackets read: %d",numPackets); } onFail:^(NSError *error) { @@ -60,38 +127,61 @@ { for(int i = 0; i < numPackets; i++) { - [[EMConnectionManager sharedManager] readResource:@"numBytes" onSuccess:^(id readValue) - { - numBytes = (uint8_t) [readValue unsignedCharValue]; - } - onFail:^(NSError *error) - { - NSLog(@"[CommunicationProtocol.m]: %@",error); - numBytes = 0; - }]; - if(numBytes) + if([self waitForMessageAvailableDevice:TRUE]) + //if(1)//HACK! { - [[EMConnectionManager sharedManager] readResource:@"data" onSuccess:^(id readValue) + [[EMConnectionManager sharedManager] readResource:@"numBytes" onSuccess:^(id readValue) { - [message appendString:[readValue stringValue]]; + numBytes = (uint8_t) [readValue unsignedCharValue]; + NSLog(@"[CommunicationProtocol.m]: numBytes read: %d",numBytes); } onFail:^(NSError *error) { NSLog(@"[CommunicationProtocol.m]: %@",error); + numBytes = 0; }]; + if(numBytes) + { + [[EMConnectionManager sharedManager] readResource:@"data" onSuccess:^(id readValue) + { + [message appendString: readValue]; + NSLog(@"[CommunicationProtocol.m]: data read: %@",message); + } + onFail:^(NSError *error) + { + NSLog(@"[CommunicationProtocol.m]: %@",error); + }]; + } + [[EMConnectionManager sharedManager] writeValue:@"0" toResource:@"messageAvailableDevice" onSuccess:^ + { + NSLog(@"[CommunicationProtocol.m]: messageAvailableDevice set to FALSE"); + NSLog(@"[CommunicationProtocol.m]: packet read"); + } + onFail:^(NSError *error) + { + NSLog(@"[CommunicationProtocol.m]: %@",error); + } + ]; + } + else + { + NSLog(@"[CommunicationProtocol.m]: Error, resetting message"); + [message setString:@""]; } } } } - [[EMConnectionManager sharedManager] writeValue:@"FALSE" toResource:@"messageAvailable" onSuccess:^ + [[EMConnectionManager sharedManager] writeValue:@"0" toResource:@"messageAvailableDevice" onSuccess:^ { - + NSLog(@"[CommunicationProtocol.m]: messageAvailableDevice set to FALSE"); + NSLog(@"[CommunicationProtocol.m]: Message received: %@",message); } onFail:^(NSError *error) { NSLog(@"[CommunicationProtocol.m]: %@",error); } ]; + NSLog(@"[CommunicationProtocol.m]: Message received: %@",message); return message; } @@ -99,10 +189,23 @@ { unsigned long remainingBytes = [message length]; uint8_t numBytes, current_index = 0; - __block Boolean status = FALSE; + __block Boolean status = TRUE; + [[EMConnectionManager sharedManager] writeValue:@"0" toResource:@"messageAvailableMobile" onSuccess:^ + { + status = TRUE; + NSLog(@"[CommunicationProtocol.m]: messageAvailableMobile set to FALSE"); + } + onFail:^(NSError *error) + { + NSLog(@"[CommunicationProtocol.m]: %@",error); + status = FALSE; + } + ]; [[EMConnectionManager sharedManager] writeValue:[NSNumber numberWithUnsignedChar:(unsigned char)([message length]/MAX_STRING_LENGTH)+1] toResource:@"numPackets" onSuccess:^ { status = TRUE; + NSLog(@"[CommunicationProtocol.m]: numPackets set to %d",([message length]/MAX_STRING_LENGTH) + 1); + NSLog(@"[CommunicationProtocol.m]: new status is: %d",status); } onFail:^(NSError *error) { @@ -110,15 +213,18 @@ status = FALSE; } ]; + NSLog(@"[CommunicationProtocol.m]: status is: %d",status); if(status != FALSE) { + NSLog(@"[CommunicationProtocol.m]: Carrying on after numPackets..."); while(remainingBytes) { - if(![self waitForMessageAvailable:FALSE]) + if(![self waitForMessageAvailableMobile:FALSE]) { status = FALSE; break; } + NSLog(@"[CommunicationProtocol.m]: Device is ready for next packet"); if(remainingBytes > MAX_STRING_LENGTH) { numBytes = MAX_STRING_LENGTH; @@ -131,6 +237,7 @@ } [[EMConnectionManager sharedManager] writeValue:[NSNumber numberWithUnsignedChar:(unsigned char)numBytes] toResource:@"numBytes" onSuccess:^ { + NSLog(@"[CommunicationProtocol.m]: numBytes set to %d", numBytes); status = TRUE; } onFail:^(NSError *error) @@ -141,10 +248,12 @@ ]; if(status != FALSE) { + NSLog(@"[CommunicationProtocol.m]: Carrying on after numBytes..."); NSString *data = [message substringWithRange:NSMakeRange(current_index, numBytes)]; current_index += numBytes; [[EMConnectionManager sharedManager] writeValue:data toResource:@"data" onSuccess:^ { + NSLog(@"[CommunicationProtocol.m]: data set to: %@",data); status = TRUE; } onFail:^(NSError *error) @@ -155,9 +264,12 @@ ]; if(status != FALSE) { - [[EMConnectionManager sharedManager] writeValue:@"TRUE" toResource:@"messageAvailable" onSuccess:^ + NSLog(@"[CommunicationProtocol.m]: Carrying on after data..."); + [[EMConnectionManager sharedManager] writeValue:@"1" toResource:@"messageAvailableMobile" onSuccess:^ { status = TRUE; + NSLog(@"[CommunicationProtocol.m]: messageAvailableMobile set to TRUE"); + NSLog(@"[CommunicationProtocol.m]: Message written"); } onFail:^(NSError *error) { @@ -165,24 +277,31 @@ status = FALSE; } ]; + NSLog(@"[CommunicationProtocol.m]: Carrying on after messageAvailableMobile..."); } } } } + NSLog(@"[CommunicationProtocol.m]: Device has processed the message"); return status; } -(Boolean) establishConnection { + NSLog(@"[CommunicationProtocol.m]: Establishing connection..."); if([self writeMessage:@"Hello"]) { + NSLog(@"[CommunicationProtocol.m]: Hello sent"); NSString *answer = [self readMessage]; + NSLog(@"[CommunicationProtocol.m]: Answer received"); if([answer isEqualToString:@"Hello"]) { + NSLog(@"[CommunicationProtocol.m]: Connection established"); return TRUE; } } - return FALSE; + NSLog(@"[CommunicationProtocol.m]: Error while establishing connection"); + return TRUE; } -(Boolean) updateTime: (NSDateComponents*) date diff --git a/DUREX Vendor Control/DUREX Vendor Control.xcodeproj/project.pbxproj b/DUREX Vendor Control/DUREX Vendor Control.xcodeproj/project.pbxproj index 35ccf49..4733ccd 100644 --- a/DUREX Vendor Control/DUREX Vendor Control.xcodeproj/project.pbxproj +++ b/DUREX Vendor Control/DUREX Vendor Control.xcodeproj/project.pbxproj @@ -28,7 +28,7 @@ F98356DB192EAFD400EA6821 /* CommunicationProtocol.m in Sources */ = {isa = PBXBuildFile; fileRef = F98356DA192EAFD400EA6821 /* CommunicationProtocol.m */; }; F98356E1192EC84700EA6821 /* MenuTableViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = F98356E0192EC84700EA6821 /* MenuTableViewController.m */; }; F9A8EF7C192FE201009E7532 /* Stack.m in Sources */ = {isa = PBXBuildFile; fileRef = F9A8EF7B192FE201009E7532 /* Stack.m */; }; - F9C77F50192CDE30002DBE8A /* durex.json in Resources */ = {isa = PBXBuildFile; fileRef = F9C77F4F192CDE30002DBE8A /* durex.json */; }; + F9C77F50192CDE30002DBE8A /* system.json in Resources */ = {isa = PBXBuildFile; fileRef = F9C77F4F192CDE30002DBE8A /* system.json */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ @@ -93,7 +93,7 @@ F98356E0192EC84700EA6821 /* MenuTableViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MenuTableViewController.m; sourceTree = SOURCE_ROOT; }; F9A8EF7A192FE201009E7532 /* Stack.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Stack.h; sourceTree = SOURCE_ROOT; }; F9A8EF7B192FE201009E7532 /* Stack.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Stack.m; sourceTree = SOURCE_ROOT; }; - F9C77F4F192CDE30002DBE8A /* durex.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = durex.json; sourceTree = SOURCE_ROOT; }; + F9C77F4F192CDE30002DBE8A /* system.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = system.json; sourceTree = SOURCE_ROOT; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -233,7 +233,7 @@ 347186B91807290E00FA0FB2 /* Schemas */ = { isa = PBXGroup; children = ( - F9C77F4F192CDE30002DBE8A /* durex.json */, + F9C77F4F192CDE30002DBE8A /* system.json */, ); name = Schemas; sourceTree = ""; @@ -318,7 +318,7 @@ files = ( F98356D8192E906600EA6821 /* bluetooth.png in Resources */, F961D819199A711300E9282C /* EMConnectingView.xib in Resources */, - F9C77F50192CDE30002DBE8A /* durex.json in Resources */, + F9C77F50192CDE30002DBE8A /* system.json in Resources */, F961D80C199A5F2D00E9282C /* back_arrow.png in Resources */, F961D816199A5FA000E9282C /* Localizable.strings in Resources */, 34AAB88D189805300019860D /* Images.xcassets in Resources */, @@ -429,8 +429,8 @@ CLANG_WARN_INT_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - CODE_SIGN_IDENTITY = ""; - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; + CODE_SIGN_IDENTITY = "iPhone Developer"; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; COPY_PHASE_STRIP = NO; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_DYNAMIC_NO_PIC = NO; @@ -448,6 +448,7 @@ GCC_WARN_UNUSED_VARIABLE = YES; IPHONEOS_DEPLOYMENT_TARGET = 7.1; ONLY_ACTIVE_ARCH = YES; + OTHER_CODE_SIGN_FLAGS = "-gta"; SDKROOT = iphoneos; TARGETED_DEVICE_FAMILY = "1,2"; }; @@ -469,8 +470,8 @@ CLANG_WARN_INT_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - CODE_SIGN_IDENTITY = ""; - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; + CODE_SIGN_IDENTITY = "iPhone Developer"; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; COPY_PHASE_STRIP = YES; ENABLE_NS_ASSERTIONS = NO; GCC_C_LANGUAGE_STANDARD = gnu99; @@ -481,6 +482,7 @@ GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; IPHONEOS_DEPLOYMENT_TARGET = 7.1; + OTHER_CODE_SIGN_FLAGS = "-gta"; SDKROOT = iphoneos; TARGETED_DEVICE_FAMILY = "1,2"; VALIDATE_PRODUCT = YES; 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 35d3138..44e5a06 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 fe2b454..7d891d3 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 @@ -2,4 +2,86 @@ + + + + + + + + + + + + + + + + + + + + + + diff --git a/DUREX Vendor Control/FirstAppExample/Base.lproj/MainStoryboard.storyboard b/DUREX Vendor Control/FirstAppExample/Base.lproj/MainStoryboard.storyboard index 76d7e6e..0fd2d54 100644 --- a/DUREX Vendor Control/FirstAppExample/Base.lproj/MainStoryboard.storyboard +++ b/DUREX Vendor Control/FirstAppExample/Base.lproj/MainStoryboard.storyboard @@ -1,5 +1,5 @@ - + @@ -156,6 +156,24 @@ + + + + + + + + + + + + + + + + + + @@ -183,13 +201,9 @@ - + + + + + + + + +VFppZgAAAAAAAAAAAAAAAAAAAAAAAAAEAAAABAAAAAAAAAC5AAAABAAAABCepkign7sVkKCGKqChmveQ +y4kaoNIj9HDSYSYQ1v50INiArZDa/tGg28CQENzes6DdqayQ3r6VoN+JjpDgnneg4WlwkOJ+WaDjSVKQ +5F47oOUpNJDmR1gg5xJREOgnOiDo8jMQ6gccIOrSFRDr5v4g7LH3EO3G4CDukdkQ76/8oPBxuxDxj96g +8n/BkPNvwKD0X6OQ9U+ioPY/hZD3L4Sg+CiiEPkPZqD6CIQQ+viDIPvoZhD82GUg/chIEP64RyD/qCoQ +AJgpIAGIDBACeAsgA3EokARhJ6AFUQqQBkEJoAcw7JAHjUOgCRDOkAmtvyAK8LCQC+CvoAzZzRANwJGg +DrmvEA+priAQmZEQEYmQIBJ5cxATaXIgFFlVEBVJVCAWOTcQFyk2IBgiU5AZCRggGgI1kBryNKAb4heQ +HNIWoB3B+ZAesfigH6HbkCB2KyAhgb2QIlYNICNq2hAkNe8gJUq8ECYV0SAnKp4QJ/7toCkKgBAp3s+g +KupiECu+saAs036QLZ6ToC6zYJAvfnWgMJNCkDFnkiAycySQM0d0IDRTBpA1J1YgNjLokDcHOCA4HAUQ +OOcaIDn75xA6xvwgO9vJEDywGKA9u6sQPo/6oD+bjRBAb9ygQYSpkEJPvqBDZIuQRC+goEVEbZBF89Mg +Ry2KEEfTtSBJDWwQSbOXIErtThBLnLOgTNZqkE18laBOtkyQT1x3oFCWLpBRPFmgUnYQkFMcO6BUVfKQ +VPwdoFY11JBW5TogWB7xEFjFHCBZ/tMQWqT+IFvetRBchOAgXb6XEF5kwiBfnnkQYE3eoGGHlZBiLcCg +Y2d3kGQNoqBlR1mQZe2EoGcnO5BnzWagaQcdkGmtSKBq5v+Qa5ZlIGzQHBBtdkcgbq/+EG9WKSBwj+AQ +cTYLIHJvwhBzFe0gdE+kEHT/CaB2OMCQdt7roHgYopB4vs2gefiEkHqer6B72GaQfH6RoH24SJB+XnOg +f5gqkAABAAECAwEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEA +AQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEA +AQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEA +AQABAAEAAQAB//+dkAEA//+PgAAE//+dkAEI//+dkAEMUERUAFBTVABQV1QAUFBUAAAAAAEAAAABA + + + + + + + + + + + + + + + diff --git a/DUREX tests/Base.lproj/DatePickerViewController_iPad.xib b/DUREX tests/Base.lproj/DatePickerViewController_iPad.xib new file mode 100644 index 0000000..acbd686 --- /dev/null +++ b/DUREX tests/Base.lproj/DatePickerViewController_iPad.xib @@ -0,0 +1,67 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + +VFppZgAAAAAAAAAAAAAAAAAAAAAAAAAEAAAABAAAAAAAAAC5AAAABAAAABCepkign7sVkKCGKqChmveQ +y4kaoNIj9HDSYSYQ1v50INiArZDa/tGg28CQENzes6DdqayQ3r6VoN+JjpDgnneg4WlwkOJ+WaDjSVKQ +5F47oOUpNJDmR1gg5xJREOgnOiDo8jMQ6gccIOrSFRDr5v4g7LH3EO3G4CDukdkQ76/8oPBxuxDxj96g +8n/BkPNvwKD0X6OQ9U+ioPY/hZD3L4Sg+CiiEPkPZqD6CIQQ+viDIPvoZhD82GUg/chIEP64RyD/qCoQ +AJgpIAGIDBACeAsgA3EokARhJ6AFUQqQBkEJoAcw7JAHjUOgCRDOkAmtvyAK8LCQC+CvoAzZzRANwJGg +DrmvEA+priAQmZEQEYmQIBJ5cxATaXIgFFlVEBVJVCAWOTcQFyk2IBgiU5AZCRggGgI1kBryNKAb4heQ +HNIWoB3B+ZAesfigH6HbkCB2KyAhgb2QIlYNICNq2hAkNe8gJUq8ECYV0SAnKp4QJ/7toCkKgBAp3s+g +KupiECu+saAs036QLZ6ToC6zYJAvfnWgMJNCkDFnkiAycySQM0d0IDRTBpA1J1YgNjLokDcHOCA4HAUQ +OOcaIDn75xA6xvwgO9vJEDywGKA9u6sQPo/6oD+bjRBAb9ygQYSpkEJPvqBDZIuQRC+goEVEbZBF89Mg +Ry2KEEfTtSBJDWwQSbOXIErtThBLnLOgTNZqkE18laBOtkyQT1x3oFCWLpBRPFmgUnYQkFMcO6BUVfKQ +VPwdoFY11JBW5TogWB7xEFjFHCBZ/tMQWqT+IFvetRBchOAgXb6XEF5kwiBfnnkQYE3eoGGHlZBiLcCg +Y2d3kGQNoqBlR1mQZe2EoGcnO5BnzWagaQcdkGmtSKBq5v+Qa5ZlIGzQHBBtdkcgbq/+EG9WKSBwj+AQ +cTYLIHJvwhBzFe0gdE+kEHT/CaB2OMCQdt7roHgYopB4vs2gefiEkHqer6B72GaQfH6RoH24SJB+XnOg +f5gqkAABAAECAwEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEA +AQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEA +AQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEA +AQABAAEAAQAB//+dkAEA//+PgAAE//+dkAEI//+dkAEMUERUAFBTVABQV1QAUFBUAAAAAAEAAAABA + + + + + + + + + + + + + + + diff --git a/DUREX tests/Base.lproj/MainStoryboard.storyboard b/DUREX tests/Base.lproj/MainStoryboard.storyboard index 9f0a6e4..bb41308 100644 --- a/DUREX tests/Base.lproj/MainStoryboard.storyboard +++ b/DUREX tests/Base.lproj/MainStoryboard.storyboard @@ -1,5 +1,5 @@ - + diff --git a/DUREX tests/DUREX test.xcodeproj/project.pbxproj b/DUREX tests/DUREX test.xcodeproj/project.pbxproj index 9fb4aed..82b096e 100644 --- a/DUREX tests/DUREX test.xcodeproj/project.pbxproj +++ b/DUREX tests/DUREX test.xcodeproj/project.pbxproj @@ -28,6 +28,9 @@ F98356D8192E906600EA6821 /* bluetooth.png in Resources */ = {isa = PBXBuildFile; fileRef = F98356D7192E906600EA6821 /* bluetooth.png */; }; F98356DB192EAFD400EA6821 /* CommunicationProtocol.m in Sources */ = {isa = PBXBuildFile; fileRef = F98356DA192EAFD400EA6821 /* CommunicationProtocol.m */; }; F98356E1192EC84700EA6821 /* MenuTableViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = F98356E0192EC84700EA6821 /* MenuTableViewController.m */; }; + F98ACEDC19B6294E00D90AEE /* DatePickerViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = F98ACEDA19B6294E00D90AEE /* DatePickerViewController.m */; }; + F9AB5A6F19B63931006785E4 /* DatePickerViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = F9AB5A7119B63931006785E4 /* DatePickerViewController.xib */; }; + F9AB5A7219B63938006785E4 /* DatePickerViewController_iPad.xib in Resources */ = {isa = PBXBuildFile; fileRef = F9AB5A7419B63938006785E4 /* DatePickerViewController_iPad.xib */; }; F9C77F50192CDE30002DBE8A /* durex.json in Resources */ = {isa = PBXBuildFile; fileRef = F9C77F4F192CDE30002DBE8A /* durex.json */; }; /* End PBXBuildFile section */ @@ -77,6 +80,14 @@ F98356DA192EAFD400EA6821 /* CommunicationProtocol.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CommunicationProtocol.m; sourceTree = SOURCE_ROOT; }; F98356DF192EC84700EA6821 /* MenuTableViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MenuTableViewController.h; sourceTree = SOURCE_ROOT; }; F98356E0192EC84700EA6821 /* MenuTableViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MenuTableViewController.m; sourceTree = SOURCE_ROOT; }; + F98ACED919B6294E00D90AEE /* DatePickerViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DatePickerViewController.h; sourceTree = SOURCE_ROOT; }; + F98ACEDA19B6294E00D90AEE /* DatePickerViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DatePickerViewController.m; sourceTree = SOURCE_ROOT; }; + F9AB5A7019B63931006785E4 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/DatePickerViewController.xib; sourceTree = ""; }; + F9AB5A7319B63938006785E4 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/DatePickerViewController_iPad.xib; sourceTree = ""; }; + F9AB5A7619B6393C006785E4 /* es */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = es; path = es.lproj/DatePickerViewController.strings; sourceTree = ""; }; + F9AB5A7819B6393D006785E4 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/DatePickerViewController.strings; sourceTree = ""; }; + F9AB5A7A19B6393F006785E4 /* es */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = es; path = es.lproj/DatePickerViewController_iPad.strings; sourceTree = ""; }; + F9AB5A7C19B63940006785E4 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/DatePickerViewController_iPad.strings; sourceTree = ""; }; F9C77F4F192CDE30002DBE8A /* durex.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = durex.json; sourceTree = SOURCE_ROOT; }; /* End PBXFileReference section */ @@ -149,6 +160,10 @@ F98356DA192EAFD400EA6821 /* CommunicationProtocol.m */, F962A231192FCA8A00E4324A /* Stack.h */, F962A232192FCA8A00E4324A /* Stack.m */, + F98ACED919B6294E00D90AEE /* DatePickerViewController.h */, + F98ACEDA19B6294E00D90AEE /* DatePickerViewController.m */, + F9AB5A7119B63931006785E4 /* DatePickerViewController.xib */, + F9AB5A7419B63938006785E4 /* DatePickerViewController_iPad.xib */, 34AAB88C189805300019860D /* Images.xcassets */, 347186B91807290E00FA0FB2 /* Schemas */, 347186A718070F7F00FA0FB2 /* Device Picker */, @@ -278,9 +293,11 @@ files = ( F98356D8192E906600EA6821 /* bluetooth.png in Resources */, F9C77F50192CDE30002DBE8A /* durex.json in Resources */, + F9AB5A6F19B63931006785E4 /* DatePickerViewController.xib in Resources */, 34AAB88D189805300019860D /* Images.xcassets in Resources */, F92B0B6C19993D3F00CAEF3E /* Localizable.strings in Resources */, F961D7FE199A5B4700E9282C /* back_arrow.png in Resources */, + F9AB5A7219B63938006785E4 /* DatePickerViewController_iPad.xib in Resources */, F9469169193015EE006DACD3 /* icon_checkmark.png in Resources */, F961D7F5199A4A4800E9282C /* MainStoryboard.storyboard in Resources */, F946916A193015EE006DACD3 /* icon_delete.png in Resources */, @@ -304,6 +321,7 @@ F98356D6192E835F00EA6821 /* InitialViewController.m in Sources */, F962A233192FCA8A00E4324A /* Stack.m in Sources */, 34AAB885189804FF0019860D /* EMDevicePickerViewController.m in Sources */, + F98ACEDC19B6294E00D90AEE /* DatePickerViewController.m in Sources */, 34AAB883189804FF0019860D /* DUREXAppDelegate.m in Sources */, F98356DB192EAFD400EA6821 /* CommunicationProtocol.m in Sources */, F98356E1192EC84700EA6821 /* MenuTableViewController.m in Sources */, @@ -359,6 +377,26 @@ name = back_arrow.png; sourceTree = SOURCE_ROOT; }; + F9AB5A7119B63931006785E4 /* DatePickerViewController.xib */ = { + isa = PBXVariantGroup; + children = ( + F9AB5A7019B63931006785E4 /* Base */, + F9AB5A7619B6393C006785E4 /* es */, + F9AB5A7819B6393D006785E4 /* en */, + ); + name = DatePickerViewController.xib; + sourceTree = SOURCE_ROOT; + }; + F9AB5A7419B63938006785E4 /* DatePickerViewController_iPad.xib */ = { + isa = PBXVariantGroup; + children = ( + F9AB5A7319B63938006785E4 /* Base */, + F9AB5A7A19B6393F006785E4 /* es */, + F9AB5A7C19B63940006785E4 /* en */, + ); + name = DatePickerViewController_iPad.xib; + sourceTree = SOURCE_ROOT; + }; /* End PBXVariantGroup section */ /* Begin XCBuildConfiguration section */ @@ -398,6 +436,7 @@ "INFOPLIST_FILE[sdk=*]" = "DUREX test-Info.plist"; IPHONEOS_DEPLOYMENT_TARGET = 7.1; ONLY_ACTIVE_ARCH = YES; + OTHER_CODE_SIGN_FLAGS = "-gta"; SDKROOT = iphoneos; TARGETED_DEVICE_FAMILY = "1,2"; }; @@ -432,6 +471,7 @@ GCC_WARN_UNUSED_VARIABLE = YES; "INFOPLIST_FILE[sdk=*]" = "DUREX test-Info.plist"; IPHONEOS_DEPLOYMENT_TARGET = 7.1; + OTHER_CODE_SIGN_FLAGS = "-gta"; SDKROOT = iphoneos; TARGETED_DEVICE_FAMILY = "1,2"; VALIDATE_PRODUCT = YES; 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 172956a..c31975e 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/DatePickerViewController.h b/DUREX tests/DatePickerViewController.h new file mode 100644 index 0000000..e1dc31a --- /dev/null +++ b/DUREX tests/DatePickerViewController.h @@ -0,0 +1,29 @@ +// +// PopupViewController.h +// DUREX test +// +// Created by Imanol Barba on 9/2/14. +// Copyright (c) 2014 Emmoco. All rights reserved. +// + +@class DatePickerViewController; + +#import +#import +#import "DUREXAppDelegate.h" + +@protocol DatePickerViewControllerDelegate +- (void)addItemViewController:(DatePickerViewController*)controller didFinishEnteringItem:(NSDate *)date; + +@end + +@interface DatePickerViewController : UIViewController + +@property (strong, nonatomic) IBOutlet UIView *datePickerView; +@property (strong, nonatomic) IBOutlet UIDatePicker *datePicker; +@property (nonatomic, strong) id delegate; + +- (void)showInView:(UIView *)aView animated:(BOOL)animated; +- (IBAction)closePopup:(id)sender; + +@end diff --git a/DUREX tests/DatePickerViewController.m b/DUREX tests/DatePickerViewController.m new file mode 100644 index 0000000..bcffd2c --- /dev/null +++ b/DUREX tests/DatePickerViewController.m @@ -0,0 +1,78 @@ +// +// PopupViewController.m +// DUREX test +// +// Created by Imanol Barba on 9/2/14. +// Copyright (c) 2014 Emmoco. All rights reserved. +// + +#import "DatePickerViewController.h" + +@interface DatePickerViewController () + +@end + +@implementation DatePickerViewController + +- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil +{ + self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]; + if (self) { + // Custom initialization + } + return self; +} + +- (void)viewDidLoad +{ + self.view.backgroundColor=[[UIColor blackColor] colorWithAlphaComponent:.6]; + self.datePickerView.layer.cornerRadius = 5; + self.datePickerView.layer.shadowOpacity = 0.8; + self.datePickerView.layer.shadowOffset = CGSizeMake(0.0f, 0.0f); + [super viewDidLoad]; + // Do any additional setup after loading the view from its nib. +} + +- (void)didReceiveMemoryWarning +{ + [super didReceiveMemoryWarning]; + // Dispose of any resources that can be recreated. +} + +- (void)showAnimate +{ + self.view.transform = CGAffineTransformMakeScale(1.3, 1.3); + self.view.alpha = 0; + [UIView animateWithDuration:.25 animations:^{ + self.view.alpha = 1; + self.view.transform = CGAffineTransformMakeScale(1, 1); + }]; +} + +- (void)removeAnimate +{ + [UIView animateWithDuration:.25 animations:^{ + self.view.transform = CGAffineTransformMakeScale(1.3, 1.3); + self.view.alpha = 0.0; + } completion:^(BOOL finished) { + if (finished) { + [self.view removeFromSuperview]; + } + }]; +} + +- (IBAction)closePopup:(id)sender +{ + [self.delegate addItemViewController:self didFinishEnteringItem:[[self datePicker] date]]; + [self removeAnimate]; +} + +- (void)showInView:(UIView *)aView animated:(BOOL)animated +{ + [aView addSubview:self.view]; + if (animated) { + [self showAnimate]; + } +} + +@end diff --git a/DUREX tests/MenuTableViewController.h b/DUREX tests/MenuTableViewController.h index 9143567..d699dc9 100644 --- a/DUREX tests/MenuTableViewController.h +++ b/DUREX tests/MenuTableViewController.h @@ -9,6 +9,7 @@ #import #import "CommunicationProtocol.h" #import "Stack.h" +#import "DatePickerViewController.h" #define num(x) [NSNumber numberWithUnsignedInt:x] @@ -39,9 +40,10 @@ enum { REPORT, } navigationLevel; -@interface MenuTableViewController : UITableViewController +@interface MenuTableViewController : UITableViewController @property (strong,nonatomic) Stack *parentLayout; +@property (strong,nonatomic) DatePickerViewController *popupViewController; - (void) navBack; diff --git a/DUREX tests/MenuTableViewController.m b/DUREX tests/MenuTableViewController.m index 7a75198..1587b1a 100644 --- a/DUREX tests/MenuTableViewController.m +++ b/DUREX tests/MenuTableViewController.m @@ -266,6 +266,19 @@ NSLog(@"[MenuTableViewController.m]: Changing to navLevel: BASIC_CONFIGURATION"); [self changeNavLevel:BASIC_CONFIGURATION:TRUE]; } + else if([cellName isEqualToString:NSLocalizedString(@"Update Date & Time", nil)] && [self currentNavLevel] == BASIC_CONFIGURATION) + { + if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) + { + self.popupViewController = [[DatePickerViewController alloc] initWithNibName:@"DatePickerViewController_iPad" bundle:nil]; + [self.popupViewController showInView:self.navigationController.view animated:YES]; + } + else + { + self.popupViewController = [[DatePickerViewController alloc] initWithNibName:@"DatePickerViewController" bundle:nil]; + [self.popupViewController showInView:self.navigationController.view animated:YES]; + } + } } @@ -333,6 +346,14 @@ return cell; } +- (void)addItemViewController:(DatePickerViewController *)controller didFinishEnteringItem:(NSDate *)date +{ + NSCalendar *calendar = [[NSCalendar alloc] initWithCalendarIdentifier:NSGregorianCalendar]; + NSCalendarUnit units = NSYearCalendarUnit | NSMonthCalendarUnit | NSDayCalendarUnit | NSHourCalendarUnit | NSMinuteCalendarUnit | NSSecondCalendarUnit; + NSDateComponents *components = [calendar components:units fromDate:date]; + [_protocol updateTime: components]; +} + /* // Override to support conditional editing of the table view. diff --git a/DUREX tests/durex.json b/DUREX tests/durex.json deleted file mode 100644 index ff2a0ed..0000000 --- a/DUREX tests/durex.json +++ /dev/null @@ -1,247 +0,0 @@ -{ - "resources": { - "$eapProtocolLevel": { - "id": -3, - "align": 2, - "attributes": {"readonly": true}, - "type": "u2", - "access": "r", - "size": 2 - }, - "numBytes": { - "id": 1, - "align": 1, - "attributes": {}, - "type": "u1", - "access": "rw", - "size": 1 - }, - "data": { - "id": 2, - "align": 1, - "attributes": {}, - "type": "C:201", - "access": "rw", - "size": 201 - }, - "$activeGroup": { - "id": -10, - "align": 1, - "pack": 1, - "attributes": {"readwrite": true}, - "type": "E:system@emmoco.com.System/ParameterGroup", - "access": "rw", - "size": 1 - }, - "$mcmDisconnect": { - "id": -9, - "align": 1, - "attributes": {"writeonly": true}, - "type": "u1", - "access": "w", - "size": 1 - }, - "$eapBuildDate": { - "dim": 8, - "id": -4, - "align": 1, - "attributes": {"readonly": true}, - "type": "A8:u1", - "access": "r", - "size": 8 - }, - "numPackets": { - "id": 3, - "align": 1, - "attributes": {}, - "type": "u1", - "access": "rw", - "size": 1 - }, - "$resourceCount": { - "id": -7, - "align": 1, - "attributes": {"readonly": true}, - "type": "S:system@emmoco.com.System/ResourceCount", - "access": "r", - "size": 2 - }, - "$schemaHash": { - "dim": 20, - "id": -6, - "align": 1, - "attributes": {"readonly": true}, - "type": "A20:u1", - "access": "r", - "size": 20 - }, - "messageAvailable": { - "id": 4, - "align": 1, - "pack": 1, - "attributes": {"indicator": true}, - "type": "E:@emmoco.com.DUREX/BOOLEAN", - "access": "ir", - "size": 1 - }, - "$mcmProtocolLevel": { - "id": -2, - "align": 2, - "attributes": {"readonly": true}, - "type": "u2", - "access": "r", - "size": 2 - }, - "$mobileRssi": { - "id": -8, - "align": 1, - "attributes": {"readonly": true}, - "type": "i1", - "access": "r", - "size": 1 - }, - "$fileIndexReset": { - "id": -5, - "align": 2, - "attributes": {"writeonly": true}, - "type": "i2", - "access": "w", - "size": 2 - } - }, - "resourceNamesSys": [ - "$activeGroup", - "$eapBuildDate", - "$eapProtocolLevel", - "$fileIndexReset", - "$mcmDisconnect", - "$mcmProtocolLevel", - "$mobileRssi", - "$resourceCount", - "$schemaHash" - ], - "manifest": { - "protocolLevel": 13, - "hash": [ - 0, - 164, - 192, - 32, - 22, - 163, - 114, - 239, - 91, - 240, - 123, - 128, - 206, - 12, - 50, - 148 - ], - "toolVersion": "13.4.1.201311121909", - "name": "DUREX", - "$$md5": "00a4c02016a372ef5bf07b80ce0c3294", - "build": [ - 171, - 30, - 204, - 135, - 71, - 1, - 0, - 0 - ], - "date": "2014-07-30T17:03:27T", - "maxAlign": 2, - "maxSize": 201, - "version": "1.0.0" - }, - "resourceNames": [ - "numBytes", - "data", - "numPackets", - "messageAvailable", - "$mcmProtocolLevel", - "$eapProtocolLevel", - "$eapBuildDate", - "$fileIndexReset", - "$schemaHash", - "$resourceCount", - "$mobileRssi", - "$mcmDisconnect", - "$activeGroup" - ], - "attributes": { - "description": "", - "version": "1.0.0" - }, - "resourceNamesApp": [ - "numBytes", - "data", - "numPackets", - "messageAvailable" - ], - "types": { - "system@emmoco.com.System/ResourceCount": { - "packed": false, - "align": 1, - "type": "S:system@emmoco.com.System/ResourceCount", - "size": 2, - "fields": [ - { - "pad": 0, - "align": 1, - "name": "app", - "type": "u1", - "size": 1 - }, - { - "pad": 0, - "align": 1, - "name": "sys", - "type": "u1", - "size": 1 - } - ] - }, - "std:i2": { - "align": 2, - "size": 2 - }, - "std:i1": { - "align": 1, - "size": 1 - }, - "std:u1": { - "align": 1, - "size": 1 - }, - "@emmoco.com.DUREX/BOOLEAN": { - "values": [ - "TRUE", - "FALSE" - ], - "align": 1, - "pack": 1, - "type": "E:@emmoco.com.DUREX/BOOLEAN", - "size": 1 - }, - "system@emmoco.com.System/ParameterGroup": { - "values": [ - "GROUP_A", - "GROUP_B" - ], - "align": 1, - "pack": 1, - "type": "E:system@emmoco.com.System/ParameterGroup", - "size": 1 - }, - "std:u2": { - "align": 2, - "size": 2 - } - }, - "imports": {"@emmoco.com.DUREX": true} -} \ No newline at end of file diff --git a/DUREX tests/en.lproj/DatePickerViewController.strings b/DUREX tests/en.lproj/DatePickerViewController.strings new file mode 100644 index 0000000..1c8077b --- /dev/null +++ b/DUREX tests/en.lproj/DatePickerViewController.strings @@ -0,0 +1,3 @@ + +/* Class = "IBUIButton"; normalTitle = "Button"; ObjectID = "7QC-Xa-liQ"; */ +"7QC-Xa-liQ.normalTitle" = "Done"; diff --git a/DUREX tests/en.lproj/DatePickerViewController_iPad.strings b/DUREX tests/en.lproj/DatePickerViewController_iPad.strings new file mode 100644 index 0000000..47b34d1 --- /dev/null +++ b/DUREX tests/en.lproj/DatePickerViewController_iPad.strings @@ -0,0 +1,3 @@ + +/* Class = "IBUIButton"; normalTitle = "Button"; ObjectID = "b32-QI-eSJ"; */ +"b32-QI-eSJ.normalTitle" = "Done"; diff --git a/DUREX tests/es.lproj/DatePickerViewController.strings b/DUREX tests/es.lproj/DatePickerViewController.strings new file mode 100644 index 0000000..5be4d76 --- /dev/null +++ b/DUREX tests/es.lproj/DatePickerViewController.strings @@ -0,0 +1,3 @@ + +/* Class = "IBUIButton"; normalTitle = "Button"; ObjectID = "7QC-Xa-liQ"; */ +"7QC-Xa-liQ.normalTitle" = "Aceptar"; diff --git a/DUREX tests/es.lproj/DatePickerViewController_iPad.strings b/DUREX tests/es.lproj/DatePickerViewController_iPad.strings new file mode 100644 index 0000000..09824df --- /dev/null +++ b/DUREX tests/es.lproj/DatePickerViewController_iPad.strings @@ -0,0 +1,3 @@ + +/* Class = "IBUIButton"; normalTitle = "Button"; ObjectID = "b32-QI-eSJ"; */ +"b32-QI-eSJ.normalTitle" = "Aceptar"; diff --git a/TODO b/TODO index 9abdceb..d0f8982 100644 --- a/TODO +++ b/TODO @@ -1,3 +1,8 @@ +- messageAvailable checks and status checks NOT working +- pop to previous view on connect error NOT working + + + - Incident class - Sale class - Sale parser