summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrettyWhite <geekman3454@protonmail.com>2017-07-20 13:39:50 -0400
committerBrettyWhite <geekman3454@protonmail.com>2017-07-20 13:39:50 -0400
commit54117e1a2734a9b5d797327f381f83fe8e334b31 (patch)
tree3c4f979f41b1db4eaeec7703cb5e273d3f5cc735
parent471652ee9fe22e0ae4a66e5164c4e70125c0b7e1 (diff)
downloadsdl_ios-54117e1a2734a9b5d797327f381f83fe8e334b31.tar.gz
added patch version parameter
-rw-r--r--SmartDeviceLink/SDLNames.h1
-rw-r--r--SmartDeviceLink/SDLSyncMsgVersion.h8
-rw-r--r--SmartDeviceLink/SDLSyncMsgVersion.m15
-rw-r--r--SmartDeviceLinkTests/RPCSpecs/StructSpecs/SDLSyncMsgVersionSpec.m9
4 files changed, 30 insertions, 3 deletions
diff --git a/SmartDeviceLink/SDLNames.h b/SmartDeviceLink/SDLNames.h
index 61bc53a06..93da8a03a 100644
--- a/SmartDeviceLink/SDLNames.h
+++ b/SmartDeviceLink/SDLNames.h
@@ -275,6 +275,7 @@
#define NAMES_passengerDoorAjar @"passengerDoorAjar"
#define NAMES_passengerKneeAirbagDeployed @"passengerKneeAirbagDeployed"
#define NAMES_passengerSideAirbagDeployed @"passengerSideAirbagDeployed"
+#define NAMES_patchVersion @"patchVersion"
#define NAMES_pdop @"pdop"
#define NAMES_PerformAudioPassThru @"PerformAudioPassThru"
#define NAMES_PerformInteraction @"PerformInteraction"
diff --git a/SmartDeviceLink/SDLSyncMsgVersion.h b/SmartDeviceLink/SDLSyncMsgVersion.h
index 8ad8d89ed..8d9d058be 100644
--- a/SmartDeviceLink/SDLSyncMsgVersion.h
+++ b/SmartDeviceLink/SDLSyncMsgVersion.h
@@ -26,6 +26,8 @@
// TODO: (Alex M.)[2016-12-1] Change from NSInteger to UInt8
- (instancetype)initWithMajorVersion:(NSInteger)majorVersion minorVersion:(NSInteger)minorVersion;
+- (instancetype)initWithMajorVersion:(NSInteger)majorVersion minorVersion:(NSInteger)minorVersion patchVersion:(NSInteger)patchVersion;
+
/**
* @abstract The major version indicates versions that is not-compatible to previous versions
*
@@ -39,4 +41,10 @@
*/
@property (strong) NSNumber *minorVersion;
+/**
+ * @abstract Optional, allows backward-compatible fixes to the API without increasing the minor version of the interface
+ *
+ */
+@property (strong) NSNumber *patchVersion;
+
@end
diff --git a/SmartDeviceLink/SDLSyncMsgVersion.m b/SmartDeviceLink/SDLSyncMsgVersion.m
index 704ec7e7e..94d33487a 100644
--- a/SmartDeviceLink/SDLSyncMsgVersion.m
+++ b/SmartDeviceLink/SDLSyncMsgVersion.m
@@ -20,7 +20,7 @@
return self;
}
-- (instancetype)initWithMajorVersion:(NSInteger)majorVersion minorVersion:(NSInteger)minorVersion {
+- (instancetype)initWithMajorVersion:(NSInteger)majorVersion minorVersion:(NSInteger)minorVersion patchVersion:(NSInteger)patchVersion {
self = [self init];
if (!self) {
return nil;
@@ -28,6 +28,7 @@
self.majorVersion = @(majorVersion);
self.minorVersion = @(minorVersion);
+ self.patchVersion = @(patchVersion);
return self;
}
@@ -56,6 +57,18 @@
return [store objectForKey:NAMES_minorVersion];
}
+- (void)setPatchVersion:(NSNumber *)patchVersion {
+ if (patchVersion != nil) {
+ [store setObject:patchVersion forKey:NAMES_patchVersion];
+ } else {
+ [store removeObjectForKey:NAMES_patchVersion];
+ }
+}
+
+- (NSNumber *)patchVersion {
+ return [store objectForKey:NAMES_patchVersion];
+}
+
- (NSString *)description {
return [NSString stringWithFormat:@"%@.%@", self.majorVersion, self.minorVersion];
}
diff --git a/SmartDeviceLinkTests/RPCSpecs/StructSpecs/SDLSyncMsgVersionSpec.m b/SmartDeviceLinkTests/RPCSpecs/StructSpecs/SDLSyncMsgVersionSpec.m
index 56c74cd18..180a52842 100644
--- a/SmartDeviceLinkTests/RPCSpecs/StructSpecs/SDLSyncMsgVersionSpec.m
+++ b/SmartDeviceLinkTests/RPCSpecs/StructSpecs/SDLSyncMsgVersionSpec.m
@@ -19,18 +19,22 @@ describe(@"Getter/Setter Tests", ^ {
testStruct.majorVersion = @4;
testStruct.minorVersion = @532;
+ testStruct.patchVersion = @12;
expect(testStruct.majorVersion).to(equal(@4));
expect(testStruct.minorVersion).to(equal(@532));
+ expect(testStruct.patchVersion).to(equal(@12));
});
it(@"Should get correctly when initialized", ^ {
NSMutableDictionary* dict = [@{NAMES_majorVersion:@4,
- NAMES_minorVersion:@532} mutableCopy];
+ NAMES_minorVersion:@532,
+ NAMES_patchVersion:@12} mutableCopy];
SDLSyncMsgVersion* testStruct = [[SDLSyncMsgVersion alloc] initWithDictionary:dict];
expect(testStruct.majorVersion).to(equal(@4));
expect(testStruct.minorVersion).to(equal(@532));
+ expect(testStruct.patchVersion).to(equal(@12));
});
it(@"Should return nil if not set", ^ {
@@ -38,7 +42,8 @@ describe(@"Getter/Setter Tests", ^ {
expect(testStruct.majorVersion).to(beNil());
expect(testStruct.minorVersion).to(beNil());
+ expect(testStruct.patchVersion).to(beNil());
});
});
-QuickSpecEnd \ No newline at end of file
+QuickSpecEnd