diff options
author | Muller, Alexander (A.) <amulle19@ford.com> | 2016-11-01 15:44:49 -0700 |
---|---|---|
committer | Muller, Alexander (A.) <amulle19@ford.com> | 2016-11-01 15:44:49 -0700 |
commit | 293cb3020da125e1efe4c6804ef933ca004ce2fc (patch) | |
tree | e3ddd2a10541004c34d2090b37b4f7d015c74a4c | |
parent | e7845f4bf9ddeb0fe8a4a2b42d25a88d6ae7429a (diff) | |
download | sdl_ios-293cb3020da125e1efe4c6804ef933ca004ce2fc.tar.gz |
Added support for Send Location updates with delivery mode, time stamp, and address updates.
-rw-r--r-- | SmartDeviceLink-iOS.xcodeproj/project.pbxproj | 36 | ||||
-rw-r--r-- | SmartDeviceLink/SDLDateTime.h | 73 | ||||
-rw-r--r-- | SmartDeviceLink/SDLDateTime.m | 136 | ||||
-rw-r--r-- | SmartDeviceLink/SDLDeliveryMode.h | 48 | ||||
-rw-r--r-- | SmartDeviceLink/SDLDeliveryMode.m | 55 | ||||
-rw-r--r-- | SmartDeviceLink/SDLNames.h | 21 | ||||
-rw-r--r-- | SmartDeviceLink/SDLOasisAddress.h | 75 | ||||
-rw-r--r-- | SmartDeviceLink/SDLOasisAddress.m | 141 | ||||
-rw-r--r-- | SmartDeviceLink/SDLProtocolHeader.m | 2 | ||||
-rw-r--r-- | SmartDeviceLink/SDLSendLocation.h | 28 | ||||
-rw-r--r-- | SmartDeviceLink/SDLSendLocation.m | 51 | ||||
-rw-r--r-- | SmartDeviceLink/SmartDeviceLink.h | 2 | ||||
-rw-r--r-- | SmartDeviceLinkTests/RPCSpecs/EnumSpecs/SDLDeliveryModeSpec.m | 55 | ||||
-rw-r--r-- | SmartDeviceLinkTests/RPCSpecs/RequestSpecs/SDLSendLocationSpec.m | 71 | ||||
-rw-r--r-- | SmartDeviceLinkTests/RPCSpecs/StructSpecs/SDLDateTimeSpec.m | 82 | ||||
-rw-r--r-- | SmartDeviceLinkTests/RPCSpecs/StructSpecs/SDLOasisAddressSpec.m | 78 |
16 files changed, 949 insertions, 5 deletions
diff --git a/SmartDeviceLink-iOS.xcodeproj/project.pbxproj b/SmartDeviceLink-iOS.xcodeproj/project.pbxproj index a8c69557a..83354d03a 100644 --- a/SmartDeviceLink-iOS.xcodeproj/project.pbxproj +++ b/SmartDeviceLink-iOS.xcodeproj/project.pbxproj @@ -794,6 +794,15 @@ DA4353E91D2721680099B8C4 /* DispatchTimerSpec.m in Sources */ = {isa = PBXBuildFile; fileRef = DA4353E61D2721680099B8C4 /* DispatchTimerSpec.m */; }; DA4353EA1D2721680099B8C4 /* SDLTouchManagerSpec.m in Sources */ = {isa = PBXBuildFile; fileRef = DA4353E71D2721680099B8C4 /* SDLTouchManagerSpec.m */; }; DA4353EB1D2721680099B8C4 /* SDLTouchSpec.m in Sources */ = {isa = PBXBuildFile; fileRef = DA4353E81D2721680099B8C4 /* SDLTouchSpec.m */; }; + DA48712F1DC9430800F92042 /* SDLOasisAddressSpec.m in Sources */ = {isa = PBXBuildFile; fileRef = DA48712E1DC9430800F92042 /* SDLOasisAddressSpec.m */; }; + DA4871321DC9431B00F92042 /* SDLOasisAddress.h in Headers */ = {isa = PBXBuildFile; fileRef = DA4871301DC9431B00F92042 /* SDLOasisAddress.h */; settings = {ATTRIBUTES = (Public, ); }; }; + DA4871331DC9431B00F92042 /* SDLOasisAddress.m in Sources */ = {isa = PBXBuildFile; fileRef = DA4871311DC9431B00F92042 /* SDLOasisAddress.m */; }; + DA733F341DC8F96300738CC2 /* SDLDeliveryMode.h in Headers */ = {isa = PBXBuildFile; fileRef = DA733F321DC8F96300738CC2 /* SDLDeliveryMode.h */; settings = {ATTRIBUTES = (Public, ); }; }; + DA733F351DC8F96300738CC2 /* SDLDeliveryMode.m in Sources */ = {isa = PBXBuildFile; fileRef = DA733F331DC8F96300738CC2 /* SDLDeliveryMode.m */; }; + DA733F381DC8FB0A00738CC2 /* SDLDeliveryModeSpec.m in Sources */ = {isa = PBXBuildFile; fileRef = DA733F371DC8FB0A00738CC2 /* SDLDeliveryModeSpec.m */; }; + DA733F3B1DC9030800738CC2 /* SDLDateTime.h in Headers */ = {isa = PBXBuildFile; fileRef = DA733F391DC9030800738CC2 /* SDLDateTime.h */; settings = {ATTRIBUTES = (Public, ); }; }; + DA733F3C1DC9030800738CC2 /* SDLDateTime.m in Sources */ = {isa = PBXBuildFile; fileRef = DA733F3A1DC9030800738CC2 /* SDLDateTime.m */; }; + DA733F3E1DC907C500738CC2 /* SDLDateTimeSpec.m in Sources */ = {isa = PBXBuildFile; fileRef = DA733F3D1DC907C500738CC2 /* SDLDateTimeSpec.m */; }; DA96C0661D4D4F730022F520 /* SDLAppInfoSpec.m in Sources */ = {isa = PBXBuildFile; fileRef = DA96C0651D4D4F730022F520 /* SDLAppInfoSpec.m */; }; DAC572571D1067270004288B /* SDLTouchManager.h in Headers */ = {isa = PBXBuildFile; fileRef = DAC572551D1067270004288B /* SDLTouchManager.h */; settings = {ATTRIBUTES = (Public, ); }; }; DAC572581D1067270004288B /* SDLTouchManager.m in Sources */ = {isa = PBXBuildFile; fileRef = DAC572561D1067270004288B /* SDLTouchManager.m */; }; @@ -1692,6 +1701,15 @@ DA4353E61D2721680099B8C4 /* DispatchTimerSpec.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = DispatchTimerSpec.m; path = UtilitiesSpecs/Touches/DispatchTimerSpec.m; sourceTree = "<group>"; }; DA4353E71D2721680099B8C4 /* SDLTouchManagerSpec.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SDLTouchManagerSpec.m; path = UtilitiesSpecs/Touches/SDLTouchManagerSpec.m; sourceTree = "<group>"; }; DA4353E81D2721680099B8C4 /* SDLTouchSpec.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SDLTouchSpec.m; path = UtilitiesSpecs/Touches/SDLTouchSpec.m; sourceTree = "<group>"; }; + DA48712E1DC9430800F92042 /* SDLOasisAddressSpec.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SDLOasisAddressSpec.m; sourceTree = "<group>"; }; + DA4871301DC9431B00F92042 /* SDLOasisAddress.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDLOasisAddress.h; sourceTree = "<group>"; }; + DA4871311DC9431B00F92042 /* SDLOasisAddress.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SDLOasisAddress.m; sourceTree = "<group>"; }; + DA733F321DC8F96300738CC2 /* SDLDeliveryMode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDLDeliveryMode.h; sourceTree = "<group>"; }; + DA733F331DC8F96300738CC2 /* SDLDeliveryMode.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SDLDeliveryMode.m; sourceTree = "<group>"; }; + DA733F371DC8FB0A00738CC2 /* SDLDeliveryModeSpec.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SDLDeliveryModeSpec.m; sourceTree = "<group>"; }; + DA733F391DC9030800738CC2 /* SDLDateTime.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDLDateTime.h; sourceTree = "<group>"; }; + DA733F3A1DC9030800738CC2 /* SDLDateTime.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SDLDateTime.m; sourceTree = "<group>"; }; + DA733F3D1DC907C500738CC2 /* SDLDateTimeSpec.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SDLDateTimeSpec.m; sourceTree = "<group>"; }; DA96C0651D4D4F730022F520 /* SDLAppInfoSpec.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SDLAppInfoSpec.m; sourceTree = "<group>"; }; DAC572551D1067270004288B /* SDLTouchManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDLTouchManager.h; sourceTree = "<group>"; }; DAC572561D1067270004288B /* SDLTouchManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SDLTouchManager.m; sourceTree = "<group>"; }; @@ -1781,6 +1799,7 @@ 162E81EC1A9BDE8A00906325 /* SDLCharacterSetSpec.m */, 162E81ED1A9BDE8A00906325 /* SDLCompassDirectionSpec.m */, 162E81EE1A9BDE8A00906325 /* SDLComponentVolumeStatusSpec.m */, + DA733F371DC8FB0A00738CC2 /* SDLDeliveryModeSpec.m */, 162E81EF1A9BDE8A00906325 /* SDLDeviceLevelStatusSpec.m */, 162E81F01A9BDE8A00906325 /* SDLDimensionSpec.m */, 162E81F11A9BDE8A00906325 /* SDLDisplayTypeSpec.m */, @@ -1988,6 +2007,7 @@ 162E82931A9BDE8A00906325 /* SDLButtonCapabilitiesSpec.m */, 162E82941A9BDE8A00906325 /* SDLChoiceSpec.m */, 162E82951A9BDE8A00906325 /* SDLClusterModeStatusSpec.m */, + DA733F3D1DC907C500738CC2 /* SDLDateTimeSpec.m */, 162E82961A9BDE8A00906325 /* SDLDeviceInfoSpec.m */, 162E82971A9BDE8A00906325 /* SDLDeviceStatusSpec.m */, 162E82981A9BDE8A00906325 /* SDLDIDResult.m */, @@ -2003,6 +2023,7 @@ 162E82A11A9BDE8A00906325 /* SDLKeyboardPropertiesSpec.m */, 162E82A21A9BDE8A00906325 /* SDLMenuParamsSpec.m */, 162E82A31A9BDE8A00906325 /* SDLMyKeySpec.m */, + DA48712E1DC9430800F92042 /* SDLOasisAddressSpec.m */, 162E82A41A9BDE8A00906325 /* SDLParameterPermissionsSpec.m */, 162E82A51A9BDE8A00906325 /* SDLPermissionItemSpec.m */, 162E82A61A9BDE8A00906325 /* SDLPresetBankCapabilitiesSpec.m */, @@ -2481,6 +2502,8 @@ 5D61FA751A84238A00846EE7 /* SDLChoice.m */, 5D61FA761A84238A00846EE7 /* SDLClusterModeStatus.h */, 5D61FA771A84238A00846EE7 /* SDLClusterModeStatus.m */, + DA733F391DC9030800738CC2 /* SDLDateTime.h */, + DA733F3A1DC9030800738CC2 /* SDLDateTime.m */, 5D61FA951A84238A00846EE7 /* SDLDeviceInfo.h */, 5D61FA961A84238A00846EE7 /* SDLDeviceInfo.m */, 5D61FA991A84238A00846EE7 /* SDLDeviceStatus.h */, @@ -2513,6 +2536,8 @@ 5D61FB0C1A84238A00846EE7 /* SDLMenuParams.m */, 5D61FB0D1A84238A00846EE7 /* SDLMyKey.h */, 5D61FB0E1A84238A00846EE7 /* SDLMyKey.m */, + DA4871301DC9431B00F92042 /* SDLOasisAddress.h */, + DA4871311DC9431B00F92042 /* SDLOasisAddress.m */, 5D61FB361A84238B00846EE7 /* SDLParameterPermissions.h */, 5D61FB371A84238B00846EE7 /* SDLParameterPermissions.m */, 5D61FB401A84238B00846EE7 /* SDLPermissionItem.h */, @@ -2584,6 +2609,8 @@ 5D61FA791A84238A00846EE7 /* SDLCompassDirection.m */, 5D61FA7A1A84238A00846EE7 /* SDLComponentVolumeStatus.h */, 5D61FA7B1A84238A00846EE7 /* SDLComponentVolumeStatus.m */, + DA733F321DC8F96300738CC2 /* SDLDeliveryMode.h */, + DA733F331DC8F96300738CC2 /* SDLDeliveryMode.m */, 5D61FA971A84238A00846EE7 /* SDLDeviceLevelStatus.h */, 5D61FA981A84238A00846EE7 /* SDLDeviceLevelStatus.m */, 5D61FAA11A84238A00846EE7 /* SDLDimension.h */, @@ -3169,6 +3196,7 @@ 5D61FDF11A84238C00846EE7 /* SDLUpdateTurnList.h in Headers */, 5D61FD671A84238C00846EE7 /* SDLResult.h in Headers */, 5D61FD351A84238C00846EE7 /* SDLPowerModeStatus.h in Headers */, + DA4871321DC9431B00F92042 /* SDLOasisAddress.h in Headers */, 5D61FD971A84238C00846EE7 /* SDLSingleTireStatus.h in Headers */, 5D61FCE21A84238C00846EE7 /* SDLKeyboardLayout.h in Headers */, 5D61FD891A84238C00846EE7 /* SDLSetGlobalPropertiesResponse.h in Headers */, @@ -3265,6 +3293,7 @@ 5DCC19A41B822804004FFAD9 /* SDLURLRequestTask.h in Headers */, 5D61FCCF1A84238C00846EE7 /* SDLImageField.h in Headers */, 5D535DC51B72473800CF7760 /* SDLGlobals.h in Headers */, + DA733F341DC8F96300738CC2 /* SDLDeliveryMode.h in Headers */, 5D61FD231A84238C00846EE7 /* SDLParameterPermissions.h in Headers */, 5D61FCB91A84238C00846EE7 /* SDLGlobalProperty.h in Headers */, 5D61FE051A84238C00846EE7 /* SDLVehicleDataResultCode.h in Headers */, @@ -3320,6 +3349,7 @@ 5D61FDF51A84238C00846EE7 /* SDLV1ProtocolHeader.h in Headers */, DAC572671D10C5640004288B /* CGPoint_Util.h in Headers */, 5D61FDF91A84238C00846EE7 /* SDLV2ProtocolHeader.h in Headers */, + DA733F3B1DC9030800738CC2 /* SDLDateTime.h in Headers */, 5D61FD4A1A84238C00846EE7 /* SDLProtocolMessageAssembler.h in Headers */, 5D61FD4C1A84238C00846EE7 /* SDLProtocolMessageDisassembler.h in Headers */, 5D61FD4E1A84238C00846EE7 /* SDLProtocolReceivedMessageRouter.h in Headers */, @@ -3628,6 +3658,7 @@ 5D61FD661A84238C00846EE7 /* SDLResetGlobalPropertiesResponse.m in Sources */, 5D61FCFE1A84238C00846EE7 /* SDLObjectWithPriority.m in Sources */, 5D61FC401A84238C00846EE7 /* SDLAmbientLightStatus.m in Sources */, + DA733F351DC8F96300738CC2 /* SDLDeliveryMode.m in Sources */, 5D61FC951A84238C00846EE7 /* SDLDriverDistractionState.m in Sources */, 5D61FD961A84238C00846EE7 /* SDLShowResponse.m in Sources */, 5D61FD981A84238C00846EE7 /* SDLSingleTireStatus.m in Sources */, @@ -3677,6 +3708,7 @@ 5D61FE121A84238C00846EE7 /* SDLWarningLightStatus.m in Sources */, 5D61FCDD1A84238C00846EE7 /* SDLJsonDecoder.m in Sources */, 5D61FCB81A84238C00846EE7 /* SDLGetVehicleDataResponse.m in Sources */, + DA733F3C1DC9030800738CC2 /* SDLDateTime.m in Sources */, 5D61FC661A84238C00846EE7 /* SDLCompassDirection.m in Sources */, 5D61FD841A84238C00846EE7 /* SDLSetDisplayLayout.m in Sources */, 5D61FE001A84238C00846EE7 /* SDLVehicleDataEventStatus.m in Sources */, @@ -3718,6 +3750,7 @@ 5D61FD761A84238C00846EE7 /* SDLRPCResponse.m in Sources */, 5D61FE081A84238C00846EE7 /* SDLVehicleDataStatus.m in Sources */, E9C32B9F1AB20C5900F283AF /* EAAccessoryManager+SDLProtocols.m in Sources */, + DA4871331DC9431B00F92042 /* SDLOasisAddress.m in Sources */, 5D61FDA81A84238C00846EE7 /* SDLSpeakResponse.m in Sources */, 5DB92D331AC9C8BA00C15BB0 /* SDLRPCStruct.m in Sources */, 5D61FCD61A84238C00846EE7 /* SDLImageType.m in Sources */, @@ -3845,6 +3878,7 @@ 162E83811A9BDE8B00906325 /* SDLImageFieldSpec.m in Sources */, 162E834F1A9BDE8B00906325 /* SDLDeleteCommandResponseSpec.m in Sources */, 162E83231A9BDE8B00906325 /* SDLAddSubMenuSpec.m in Sources */, + DA733F381DC8FB0A00738CC2 /* SDLDeliveryModeSpec.m in Sources */, DA4353E91D2721680099B8C4 /* DispatchTimerSpec.m in Sources */, 162E82F21A9BDE8B00906325 /* SDLPredefinedLayoutSpec.m in Sources */, 162E83521A9BDE8B00906325 /* SDLDeleteSubMenuResponseSpec.m in Sources */, @@ -3940,12 +3974,14 @@ 162E835E1A9BDE8B00906325 /* SDLRegisterAppInterfaceResponseSpec.m in Sources */, 162E835A1A9BDE8B00906325 /* SDLPerformAudioPassThruResponseSpec.m in Sources */, 162E83501A9BDE8B00906325 /* SDLDeleteFileResponseSpec.m in Sources */, + DA733F3E1DC907C500738CC2 /* SDLDateTimeSpec.m in Sources */, 162E83601A9BDE8B00906325 /* SDLScrollableMessageResponseSpec.m in Sources */, 162E83791A9BDE8B00906325 /* SDLDeviceStatusSpec.m in Sources */, 162E83821A9BDE8B00906325 /* SDLImageSpec.m in Sources */, 162E834A1A9BDE8B00906325 /* SDLAddSubMenuResponseSpec.m in Sources */, 162E830C1A9BDE8B00906325 /* SDLWarningLightStatusSpec.m in Sources */, 162E82E71A9BDE8B00906325 /* SDLKeyboardEventSpec.m in Sources */, + DA48712F1DC9430800F92042 /* SDLOasisAddressSpec.m in Sources */, 162E834E1A9BDE8B00906325 /* SDLCreateInteractionChoiceSetResponseSpec.m in Sources */, 162E83301A9BDE8B00906325 /* SDLGetVehicleDataSpec.m in Sources */, 162E833F1A9BDE8B00906325 /* SDLSliderSpec.m in Sources */, diff --git a/SmartDeviceLink/SDLDateTime.h b/SmartDeviceLink/SDLDateTime.h new file mode 100644 index 000000000..4d15c83c2 --- /dev/null +++ b/SmartDeviceLink/SDLDateTime.h @@ -0,0 +1,73 @@ +// SDLDateTime.h +// + +#import "SDLRPCStruct.h" + +@interface SDLDateTime : SDLRPCStruct + +- (instancetype)initWithHour:(UInt8)hour minute:(UInt8)minute second:(UInt8)second millisecond:(UInt16)millisecond day:(UInt8)day month:(UInt8)month year:(UInt16)year timezoneMinuteOffset:(UInt8)timezoneMinuteOffset timezoneHourOffset:(int)timezoneHourOffset; + +/** + * @abstract Milliseconds part of time + * + * Required, Integer 0 - 999 + */ +@property (copy, nonatomic) NSNumber *millisecond; + +/** + * @abstract Seconds part of time + * + * Required, Integer 0 - 59 + */ +@property (copy, nonatomic) NSNumber *second; + +/** + * @abstract Minutes part of time + * + * Required, Integer 0 - 59 + */ +@property (copy, nonatomic) NSNumber *minute; + +/** + * @abstract Hour part of time + * + * Required, Integer 0 - 23 + */ +@property (copy, nonatomic) NSNumber *hour; + +/** + * @abstract Day of the month + * + * Required, Integer 1 - 31 + */ +@property (copy, nonatomic) NSNumber *day; + +/** + * @abstract Month of the year + * + * Required, Integer 1 - 12 + */ +@property (copy, nonatomic) NSNumber *month; + +/** + * @abstract The year in YYYY format + * + * Required, Max Value 4095 + */ +@property (copy, nonatomic) NSNumber *year; + +/** + * @abstract Time zone offset in Min with regard to UTC + * + * Required, Integer 0 - 59 + */ +@property (copy, nonatomic) NSNumber *timezoneMinuteOffset; + +/** + * @abstract Time zone offset in Hours with regard to UTC + * + * Required, Integer -12 - 14 + */ +@property (copy, nonatomic) NSNumber *timezoneHourOffset; + +@end diff --git a/SmartDeviceLink/SDLDateTime.m b/SmartDeviceLink/SDLDateTime.m new file mode 100644 index 000000000..5e5f18915 --- /dev/null +++ b/SmartDeviceLink/SDLDateTime.m @@ -0,0 +1,136 @@ +// SDLDateTime.m +// + +#import "SDLDateTime.h" +#import "SDLNames.h" + +@implementation SDLDateTime + +- (instancetype)initWithHour:(UInt8)hour minute:(UInt8)minute second:(UInt8)second millisecond:(UInt16)millisecond day:(UInt8)day month:(UInt8)month year:(UInt16)year timezoneMinuteOffset:(UInt8)timezoneMinuteOffset timezoneHourOffset:(int)timezoneHourOffset { + self = [self init]; + if (!self) { + return nil; + } + + self.hour = @(hour); + self.minute = @(minute); + self.second = @(second); + self.millisecond = @(millisecond); + self.day = @(day); + self.month = @(month); + self.year = @(year); + self.timezoneMinuteOffset = @(timezoneMinuteOffset); + self.timezoneHourOffset = @(timezoneHourOffset); + + return self; +} + +- (void)setMillisecond:(NSNumber *)millisecond { + if (millisecond != nil) { + store[NAMES_millisecond] = millisecond; + } else { + [store removeObjectForKey:NAMES_millisecond]; + } +} + +- (NSNumber *)millisecond { + return store[NAMES_millisecond]; +} + +- (void)setSecond:(NSNumber *)second { + if (second != nil) { + store[NAMES_second] = second; + } else { + [store removeObjectForKey:NAMES_second]; + } +} + +- (NSNumber *)second { + return store[NAMES_second]; +} + +- (void)setMinute:(NSNumber *)minute { + if (minute != nil) { + store[NAMES_minute] = minute; + } else { + [store removeObjectForKey:NAMES_minute]; + } +} + +- (NSNumber *)minute { + return store[NAMES_minute]; +} + +- (void)setHour:(NSNumber *)hour { + if (hour != nil) { + store[NAMES_hour] = hour; + } else { + [store removeObjectForKey:NAMES_hour]; + } +} + +- (NSNumber *)hour { + return store[NAMES_hour]; +} + +- (void)setDay:(NSNumber *)day { + if (day != nil) { + store[NAMES_day] = day; + } else { + [store removeObjectForKey:NAMES_day]; + } +} + +- (NSNumber *)day { + return store[NAMES_day]; +} + +- (void)setMonth:(NSNumber *)month { + if (month != nil) { + store[NAMES_month] = month; + } else { + [store removeObjectForKey:NAMES_month]; + } +} + +- (NSNumber *)month { + return store[NAMES_month]; +} + +- (void)setYear:(NSNumber *)year { + if (year != nil) { + store[NAMES_year] = year; + } else { + [store removeObjectForKey:NAMES_year]; + } +} + +- (NSNumber *)year { + return store[NAMES_year]; +} + +- (void)setTimezoneMinuteOffset:(NSNumber *)timezoneMinuteOffset { + if (timezoneMinuteOffset != nil) { + store[NAMES_timezoneMinuteOffset] = timezoneMinuteOffset; + } else { + [store removeObjectForKey:NAMES_timezoneMinuteOffset]; + } +} + +- (NSNumber *)timezoneMinuteOffset { + return store[NAMES_timezoneMinuteOffset]; +} + +- (void)setTimezoneHourOffset:(NSNumber *)timezoneHourOffset { + if (timezoneHourOffset != nil) { + store[NAMES_timezoneHourOffset] = timezoneHourOffset; + } else { + [store removeObjectForKey:NAMES_timezoneHourOffset]; + } +} + +- (NSNumber *)timezoneHourOffset { + return store[NAMES_timezoneHourOffset]; +} + +@end diff --git a/SmartDeviceLink/SDLDeliveryMode.h b/SmartDeviceLink/SDLDeliveryMode.h new file mode 100644 index 000000000..16a6cfe84 --- /dev/null +++ b/SmartDeviceLink/SDLDeliveryMode.h @@ -0,0 +1,48 @@ +// SDLDeliveryMode.h +// + +#import "SDLEnum.h" + +/** + *Specifies the mode in which the sendLocation request is sent. + */ +@interface SDLDeliveryMode : SDLEnum + +/** + * @abstract Convert String to SDLDeliveryMode + * + * @param value The value of the string to get an object for + * + * @return SDLDeliveryMode + */ ++ (SDLDeliveryMode *)valueOf:(NSString *)value; + +/** + * @abstract Store the enumeration of all possible SDLDeliveryMode + * + * @return an array that store all possible SDLDeliveryMode + */ ++ (NSArray *)values; + +/** + * @abstract User is prompted on HMI + * + * @return a SDLDeliveryMode with value of *PROMPT* + */ ++ (SDLDeliveryMode *)PROMPT; + +/** + * @abstract Set the location as destination without prompting the user + * + * @return a SDLDeliveryMode with value of *DESTINATION* + */ ++ (SDLDeliveryMode *)DESTINATION; + +/** + * @abstract Adds the current location to navigation queue + * + * @return a SDLDeliveryMode with value of *QUEUE* + */ ++ (SDLDeliveryMode *)QUEUE; + +@end diff --git a/SmartDeviceLink/SDLDeliveryMode.m b/SmartDeviceLink/SDLDeliveryMode.m new file mode 100644 index 000000000..f008987a5 --- /dev/null +++ b/SmartDeviceLink/SDLDeliveryMode.m @@ -0,0 +1,55 @@ +// SDLDeliveryMode.h +// + +#import "SDLDeliveryMode.h" + +SDLDeliveryMode *SDLDeliveryMode_PROMPT = nil; +SDLDeliveryMode *SDLDeliveryMode_DESTINATION = nil; +SDLDeliveryMode *SDLDeliveryMode_QUEUE = nil; + +NSArray *SDLDeliveryMode_values = nil; + +@implementation SDLDeliveryMode + ++ (SDLDeliveryMode *)valueOf:(NSString *)value { + for (SDLDeliveryMode *item in SDLDeliveryMode.values) { + if ([item.value isEqualToString:value]) { + return item; + } + } + return nil; +} + ++ (NSArray *)values { + if (SDLDeliveryMode_values == nil) { + SDLDeliveryMode_values = @[ + SDLDeliveryMode.PROMPT, + SDLDeliveryMode.DESTINATION, + SDLDeliveryMode.QUEUE, + ]; + } + return SDLDeliveryMode_values; +} + ++ (SDLDeliveryMode *)PROMPT { + if (SDLDeliveryMode_PROMPT == nil) { + SDLDeliveryMode_PROMPT = [[SDLDeliveryMode alloc] initWithValue:@"PROMPT"]; + } + return SDLDeliveryMode_PROMPT; +} + ++ (SDLDeliveryMode *)DESTINATION { + if (SDLDeliveryMode_DESTINATION == nil) { + SDLDeliveryMode_DESTINATION = [[SDLDeliveryMode alloc] initWithValue:@"DESTINATION"]; + } + return SDLDeliveryMode_DESTINATION; +} + ++ (SDLDeliveryMode *)QUEUE { + if (SDLDeliveryMode_QUEUE == nil) { + SDLDeliveryMode_QUEUE = [[SDLDeliveryMode alloc] initWithValue:@"QUEUE"]; + } + return SDLDeliveryMode_QUEUE; +} + +@end diff --git a/SmartDeviceLink/SDLNames.h b/SmartDeviceLink/SDLNames.h index d4adb7dc6..370615b48 100644 --- a/SmartDeviceLink/SDLNames.h +++ b/SmartDeviceLink/SDLNames.h @@ -5,8 +5,10 @@ #define NAMES_accPedalPosition @"accPedalPosition" #define NAMES_actual @"actual" #define NAMES_AddCommand @"AddCommand" +#define NAMES_address @"address" #define NAMES_addressLines @"addressLines" #define NAMES_AddSubMenu @"AddSubMenu" +#define NAMES_administrativeArea @"administrativeArea" #define NAMES_airbagStatus @"airbagStatus" #define NAMES_Alert @"Alert" #define NAMES_AlertManeuver @"AlertManeuver" @@ -57,15 +59,19 @@ #define NAMES_compassDirection @"compassDirection" #define NAMES_correlationID @"correlationID" #define NAMES_CreateInteractionChoiceSet @"CreateInteractionChoiceSet" +#define NAMES_countryCode @"countryCode" +#define NAMES_countryName @"countryName" #define NAMES_customButtonID @"customButtonID" #define NAMES_customPresets @"customPresets" #define NAMES_data @"data" #define NAMES_dataResult @"dataResult" #define NAMES_dataType @"dataType" +#define NAMES_day @"day" #define NAMES_DeleteCommand @"DeleteCommand" #define NAMES_DeleteFile @"DeleteFile" #define NAMES_DeleteInteractionChoiceSet @"DeleteInteractionChoiceSet" #define NAMES_DeleteSubMenu @"DeleteSubMenu" +#define NAMES_deliveryMode @"deliveryMode" #define NAMES_deviceInfo @"deviceInfo" #define NAMES_deviceStatus @"deviceStatus" #define NAMES_DiagnosticMessage @"DiagnosticMessage" @@ -133,6 +139,7 @@ #define NAMES_hmiPermissions @"hmiPermissions" #define NAMES_hmiCapabilities @"hmiCapabilities" #define NAMES_hmiZoneCapabilities @"hmiZoneCapabilities" +#define NAMES_hour @"hour" #define NAMES_hours @"hours" #define NAMES_id @"id" #define NAMES_ignitionStableStatus @"ignitionStableStatus" @@ -169,6 +176,7 @@ #define NAMES_length @"length" #define NAMES_limitedCharacterList @"limitedCharacterList" #define NAMES_ListFiles @"ListFiles" +#define NAMES_locality @"locality" #define NAMES_locationDescription @"locationDescription" #define NAMES_locationImage @"locationImage" #define NAMES_locationName @"locationName" @@ -202,11 +210,14 @@ #define NAMES_middleRow1BuckleBelted @"middleRow1BuckleBelted" #define NAMES_middleRow2BuckleBelted @"middleRow2BuckleBelted" #define NAMES_middleRow3BuckleBelted @"middleRow3BuckleBelted" +#define NAMES_millisecond @"millisecond" #define NAMES_minorVersion @"minorVersion" +#define NAMES_minute @"minute" #define NAMES_minutes @"minutes" #define NAMES_model @"model" #define NAMES_modelYear @"modelYear" #define NAMES_monoAudioOutputMuted @"monoAudioOutputMuted" +#define NAMES_month @"month" #define NAMES_multipleEvents @"multipleEvents" #define NAMES_multiTouchAvailable @"multiTouchAvailable" #define NAMES_muteAudio @"muteAudio" @@ -267,6 +278,7 @@ #define NAMES_phoneRoaming @"phoneRoaming" #define NAMES_playTone @"playTone" #define NAMES_position @"position" +#define NAMES_postalCode @"postalCode" #define NAMES_powerModeActive @"powerModeActive" #define NAMES_powerModeQualificationStatus @"powerModeQualificationStatus" #define NAMES_powerModeStatus @"powerModeStatus" @@ -313,6 +325,7 @@ #define NAMES_secondaryGraphic @"secondaryGraphic" #define NAMES_secondaryImage @"secondaryImage" #define NAMES_secondaryText @"secondaryText" +#define NAMES_second @"second" #define NAMES_seconds @"seconds" #define NAMES_SendLocation @"SendLocation" #define NAMES_SetAppIcon @"SetAppIcon" @@ -342,9 +355,12 @@ #define NAMES_statusBar @"statusBar" #define NAMES_steeringWheelAngle @"steeringWheelAngle" #define NAMES_stereoAudioOutputMuted @"stereoAudioOutputMuted" +#define NAMES_subAdministrativeArea @"subAdministrativeArea" +#define NAMES_subLocality @"subLocality" #define NAMES_Subscribe @"Subscribe" #define NAMES_SubscribeButton @"SubscribeButton" #define NAMES_SubscribeVehicleData @"SubscribeVehicleData" +#define NAMES_subThoroughfare @"subThoroughfare" #define NAMES_success @"success" #define NAMES_supportedDiagModes @"supportedDiagModes" #define NAMES_syncFileName @"syncFileName" @@ -362,10 +378,14 @@ #define NAMES_text @"text" #define NAMES_textFields @"textFields" #define NAMES_textMsgAvailable @"textMsgAvailable" +#define NAMES_thoroughfare @"thoroughfare" #define NAMES_timeout @"timeout" #define NAMES_Timeout @"Timeout" #define NAMES_timeoutPrompt @"timeoutPrompt" +#define NAMES_timeStamp @"timeStamp" #define NAMES_timeToDestination @"timeToDestination" +#define NAMES_timezoneHourOffset @"tz_hour" +#define NAMES_timezoneMinuteOffset @"tz_minute" #define NAMES_tirePressure @"tirePressure" #define NAMES_totalDistance @"totalDistance" #define NAMES_touchEventAvailable @"touchEventAvailable" @@ -408,3 +428,4 @@ #define NAMES_wiperStatus @"wiperStatus" #define NAMES_x @"x" #define NAMES_y @"y" +#define NAMES_year @"year" diff --git a/SmartDeviceLink/SDLOasisAddress.h b/SmartDeviceLink/SDLOasisAddress.h new file mode 100644 index 000000000..acc219ceb --- /dev/null +++ b/SmartDeviceLink/SDLOasisAddress.h @@ -0,0 +1,75 @@ +// SDLOasisAddress.h +// + +#import "SDLRPCStruct.h" + +@interface SDLOasisAddress : SDLRPCStruct + +- (instancetype)initWithSubThoroughfare:(NSString*)subThoroughfare thoroughfare:(NSString*)thoroughfare locality:(NSString*)locality administrativeArea:(NSString*)administrativeArea postalCode:(NSString*)postalCode countryCode:(NSString*)countryCode; + +- (instancetype)initWithSubThoroughfare:(NSString*)subThoroughfare thoroughfare:(NSString*)thoroughfare locality:(NSString*)locality administrativeArea:(NSString*)administrativeArea postalCode:(NSString*)postalCode countryCode:(NSString*)countryCode countryName:(NSString*)countryName subAdministrativeArea:(NSString*)subAdministrativeArea subLocality:(NSString*)subLocality; + +/** + * @abstract Name of the country (localized) + * + * Optional, max length = 200 + */ +@property (copy, nonatomic) NSString *countryName; + +/** + * @abstract countryCode of the country(ISO 3166-2) + * + * Optional, max length = 200 + */ +@property (copy, nonatomic) NSString *countryCode; + +/** + * @abstract postalCode of location (PLZ, ZIP, PIN, CAP etc.) + * + * Optional, max length = 200 + */ +@property (copy, nonatomic) NSString *postalCode; + +/** + * @abstract Portion of country (e.g. state) + * + * Optional, max length = 200 + */ +@property (copy, nonatomic) NSString *administrativeArea; + +/** + * @abstract Portion of administrativeArea (e.g. county) + * + * Optional, max length = 200 + */ +@property (copy, nonatomic) NSString *subAdministrativeArea; + +/** + * @abstract Hypernym for city/village + * + * Optional, max length = 200 + */ +@property (copy, nonatomic) NSString *locality; + +/** + * @abstract Hypernym for district + * + * Optional, max length = 200 + */ +@property (copy, nonatomic) NSString *subLocality; + +/** + * @abstract Hypernym for street, road etc. + * + * Optional, max length = 200 + */ +@property (copy, nonatomic) NSString *thoroughfare; + +/** + * @abstract Portion of thoroughfare (e.g. house number) + * + * Optional, max length = 200 + */ +@property (copy, nonatomic) NSString *subThoroughfare; + +@end diff --git a/SmartDeviceLink/SDLOasisAddress.m b/SmartDeviceLink/SDLOasisAddress.m new file mode 100644 index 000000000..f674fef86 --- /dev/null +++ b/SmartDeviceLink/SDLOasisAddress.m @@ -0,0 +1,141 @@ +// SDLOasisAddress.m +// + +#import "SDLOasisAddress.h" +#import "SDLNames.h" + +@implementation SDLOasisAddress + +- (instancetype)initWithSubThoroughfare:(NSString*)subThoroughfare thoroughfare:(NSString*)thoroughfare locality:(NSString*)locality administrativeArea:(NSString*)administrativeArea postalCode:(NSString*)postalCode countryCode:(NSString*)countryCode { + return [self initWithSubThoroughfare:subThoroughfare thoroughfare:thoroughfare locality:locality administrativeArea:administrativeArea postalCode:postalCode countryCode:countryCode countryName:nil subAdministrativeArea:nil subLocality:nil]; +} + +- (instancetype)initWithSubThoroughfare:(NSString*)subThoroughfare thoroughfare:(NSString*)thoroughfare locality:(NSString*)locality administrativeArea:(NSString*)administrativeArea postalCode:(NSString*)postalCode countryCode:(NSString*)countryCode countryName:(NSString*)countryName subAdministrativeArea:(NSString*)subAdministrativeArea subLocality:(NSString*)subLocality { + self = [self init]; + if (!self) { + return nil; + } + + self.subThoroughfare = subThoroughfare; + self.thoroughfare = thoroughfare; + self.locality = locality; + self.administrativeArea = administrativeArea; + self.postalCode = postalCode; + self.countryCode = countryCode; + self.countryName = countryName; + self.subAdministrativeArea = subAdministrativeArea; + self.subLocality = subLocality; + + return self; +} + + +- (void)setCountryName:(NSString *)countryName { + if (countryName != nil) { + store[NAMES_countryName] = countryName; + } else { + [store removeObjectForKey:NAMES_countryName]; + } +} + +- (NSString *)countryName { + return store[NAMES_countryName]; +} + +- (void)setCountryCode:(NSString *)countryCode { + if (countryCode != nil) { + store[NAMES_countryCode] = countryCode; + } else { + [store removeObjectForKey:NAMES_countryCode]; + } +} + +- (NSString *)countryCode { + return store[NAMES_countryCode]; +} + +- (void)setPostalCode:(NSString *)postalCode { + if (postalCode != nil) { + store[NAMES_postalCode] = postalCode; + } else { + [store removeObjectForKey:NAMES_postalCode]; + } +} + +- (NSString *)postalCode { + return store[NAMES_postalCode]; +} + +- (void)setAdministrativeArea:(NSString *)administrativeArea { + if (administrativeArea != nil) { + store[NAMES_administrativeArea] = administrativeArea; + } else { + [store removeObjectForKey:NAMES_administrativeArea]; + } +} + +- (NSString *)administrativeArea { + return store[NAMES_administrativeArea]; +} + +- (void)setSubAdministrativeArea:(NSString *)subAdministrativeArea { + if (subAdministrativeArea != nil) { + store[NAMES_subAdministrativeArea] = subAdministrativeArea; + } else { + [store removeObjectForKey:NAMES_subAdministrativeArea]; + } +} + +- (NSString *)subAdministrativeArea { + return store[NAMES_subAdministrativeArea]; +} + +- (void)setLocality:(NSString *)locality { + if (locality != nil) { + store[NAMES_locality] = locality; + } else { + [store removeObjectForKey:NAMES_locality]; + } +} + +- (NSString *)locality { + return store[NAMES_locality]; +} + +- (void)setSubLocality:(NSString *)subLocality { + if (subLocality != nil) { + store[NAMES_subLocality] = subLocality; + } else { + [store removeObjectForKey:NAMES_subLocality]; + } +} + +- (NSString *)subLocality { + return store[NAMES_subLocality]; +} + +- (void)setThoroughfare:(NSString *)thoroughfare { + if (thoroughfare != nil) { + store[NAMES_thoroughfare] = thoroughfare; + } else { + [store removeObjectForKey:NAMES_thoroughfare]; + } +} + +- (NSString *)thoroughfare { + return store[NAMES_thoroughfare]; +} + +- (void)setSubThoroughfare:(NSString *)subThoroughfare { + if (subThoroughfare != nil) { + store[NAMES_subThoroughfare] = subThoroughfare; + } else { + [store removeObjectForKey:NAMES_subThoroughfare]; + } +} + +- (NSString *)subThoroughfare { + return store[NAMES_subThoroughfare]; +} + +@end diff --git a/SmartDeviceLink/SDLProtocolHeader.m b/SmartDeviceLink/SDLProtocolHeader.m index 11a3d0401..91858242e 100644 --- a/SmartDeviceLink/SDLProtocolHeader.m +++ b/SmartDeviceLink/SDLProtocolHeader.m @@ -65,4 +65,4 @@ } } -@end
\ No newline at end of file +@end diff --git a/SmartDeviceLink/SDLSendLocation.h b/SmartDeviceLink/SDLSendLocation.h index cec60c422..d198b807c 100644 --- a/SmartDeviceLink/SDLSendLocation.h +++ b/SmartDeviceLink/SDLSendLocation.h @@ -2,11 +2,12 @@ // SDLSendLocation.h // SmartDeviceLink -#import <Foundation/Foundation.h> - -#import "SDLImage.h" #import "SDLRPCRequest.h" +#import "SDLDateTime.h" +#import "SDLDeliveryMode.h" +#import "SDLImage.h" +#import "SDLOasisAddress.h" @interface SDLSendLocation : SDLRPCRequest @@ -62,4 +63,25 @@ */ @property (strong, nonatomic) SDLImage *locationImage; +/** + * Mode in which the sendLocation request is sent + * + * Optional + */ +@property (strong, nonatomic) SDLDeliveryMode *deliveryMode; + +/** + * Timestamp in ISO 8601 format + * + * Optional + */ +@property (strong, nonatomic) SDLDateTime *timeStamp; + +/** + * Address to be used for setting destination + * + * Optional + */ +@property (strong, nonatomic) SDLOasisAddress *address; + @end diff --git a/SmartDeviceLink/SDLSendLocation.m b/SmartDeviceLink/SDLSendLocation.m index 7bf1c5c70..6ba9def3d 100644 --- a/SmartDeviceLink/SDLSendLocation.m +++ b/SmartDeviceLink/SDLSendLocation.m @@ -116,4 +116,55 @@ } } +- (void)setDeliveryMode:(SDLDeliveryMode *)deliveryMode { + if (deliveryMode != nil) { + parameters[NAMES_deliveryMode] = deliveryMode; + } else { + [parameters removeObjectForKey:NAMES_deliveryMode]; + } +} + +- (SDLDeliveryMode *)deliveryMode { + NSObject *obj = [parameters objectForKey:NAMES_deliveryMode]; + if (obj == nil || [obj isKindOfClass:SDLDeliveryMode.class]) { + return (SDLDeliveryMode *)obj; + } else { + return [SDLDeliveryMode valueOf:(NSString *)obj]; + } +} + +- (void)setTimeStamp:(SDLDateTime *)timeStamp { + if (timeStamp != nil) { + parameters[NAMES_timeStamp] = timeStamp; + } else { + [parameters removeObjectForKey:NAMES_timeStamp]; + } +} + +- (SDLDateTime *)timeStamp { + id obj = parameters[NAMES_timeStamp]; + if (obj == nil || [obj isKindOfClass:[SDLDateTime class]]) { + return (SDLDateTime *)obj; + } else { + return [[SDLDateTime alloc] initWithDictionary:obj]; + } +} + +- (void)setAddress:(SDLOasisAddress *)address { + if (address != nil) { + parameters[NAMES_address] = address; + } else { + [parameters removeObjectForKey:NAMES_address]; + } +} + +- (SDLOasisAddress *)address { + id obj = [parameters objectForKey:NAMES_address]; + if (obj == nil || [obj isKindOfClass:[SDLOasisAddress class]]) { + return (SDLOasisAddress *)obj; + } else { + return [[SDLOasisAddress alloc] initWithDictionary:obj]; + } +} + @end diff --git a/SmartDeviceLink/SmartDeviceLink.h b/SmartDeviceLink/SmartDeviceLink.h index 18bb0f8de..1315b8b2b 100644 --- a/SmartDeviceLink/SmartDeviceLink.h +++ b/SmartDeviceLink/SmartDeviceLink.h @@ -173,6 +173,7 @@ FOUNDATION_EXPORT const unsigned char SmartDeviceLinkVersionString[]; #import "SDLButtonCapabilities.h" #import "SDLChoice.h" #import "SDLClusterModeStatus.h" +#import "SDLDateTime.h" #import "SDLDIDResult.h" #import "SDLDeviceInfo.h" #import "SDLDeviceStatus.h" @@ -223,6 +224,7 @@ FOUNDATION_EXPORT const unsigned char SmartDeviceLinkVersionString[]; #import "SDLCharacterSet.h" #import "SDLCompassDirection.h" #import "SDLComponentVolumeStatus.h" +#import "SDLDeliveryMode.h" #import "SDLDeviceLevelStatus.h" #import "SDLDimension.h" #import "SDLDisplayType.h" diff --git a/SmartDeviceLinkTests/RPCSpecs/EnumSpecs/SDLDeliveryModeSpec.m b/SmartDeviceLinkTests/RPCSpecs/EnumSpecs/SDLDeliveryModeSpec.m new file mode 100644 index 000000000..c569c5ff5 --- /dev/null +++ b/SmartDeviceLinkTests/RPCSpecs/EnumSpecs/SDLDeliveryModeSpec.m @@ -0,0 +1,55 @@ +// SDLDeliverModeSpec.m +// + +#import <Foundation/Foundation.h> + +#import <Quick/Quick.h> +#import <Nimble/Nimble.h> + +#import "SDLDeliveryMode.h" + +QuickSpecBegin(SDLDeliveryModeSpec) + +describe(@"Individual Enum Value Tests", ^ { + it(@"Should match internal values", ^ { + expect([SDLDeliveryMode PROMPT].value).to(equal(@"PROMPT")); + expect([SDLDeliveryMode DESTINATION].value).to(equal(@"DESTINATION")); + expect([SDLDeliveryMode QUEUE].value).to(equal(@"QUEUE")); + }); +}); +describe(@"ValueOf Tests", ^ { + it(@"Should return correct values when valid", ^ { + expect([SDLDeliveryMode valueOf:@"PROMPT"]).to(equal([SDLDeliveryMode PROMPT])); + expect([SDLDeliveryMode valueOf:@"DESTINATION"]).to(equal([SDLDeliveryMode DESTINATION])); + expect([SDLDeliveryMode valueOf:@"QUEUE"]).to(equal([SDLDeliveryMode QUEUE])); + }); + + it(@"Should return nil when invalid", ^ { + expect([SDLDeliveryMode valueOf:nil]).to(beNil()); + expect([SDLDeliveryMode valueOf:@"JKUYTFHYTHJGFRFGYTR"]).to(beNil()); + }); +}); +describe(@"Value List Tests", ^ { + NSArray* storedValues = [SDLDeliveryMode values]; + __block NSArray* definedValues; + beforeSuite(^ { + definedValues = [@[[SDLDeliveryMode PROMPT], + [SDLDeliveryMode DESTINATION], + [SDLDeliveryMode QUEUE], + ] copy]; + }); + + it(@"Should contain all defined enum values", ^ { + for (int i = 0; i < definedValues.count; i++) { + expect(storedValues).to(contain(definedValues[i])); + } + }); + + it(@"Should contain only defined enum values", ^ { + for (int i = 0; i < storedValues.count; i++) { + expect(definedValues).to(contain(storedValues[i])); + } + }); +}); + +QuickSpecEnd diff --git a/SmartDeviceLinkTests/RPCSpecs/RequestSpecs/SDLSendLocationSpec.m b/SmartDeviceLinkTests/RPCSpecs/RequestSpecs/SDLSendLocationSpec.m index ccd4bafdb..65b068843 100644 --- a/SmartDeviceLinkTests/RPCSpecs/RequestSpecs/SDLSendLocationSpec.m +++ b/SmartDeviceLinkTests/RPCSpecs/RequestSpecs/SDLSendLocationSpec.m @@ -20,6 +20,9 @@ describe(@"Send Location RPC", ^{ __block NSArray *someAddressLines = nil; __block NSString *somePhoneNumber = nil; __block SDLImage *someImage = nil; + __block SDLDeliveryMode *someDeliveryMode = nil; + __block SDLDateTime* someTime = nil; + __block SDLOasisAddress* someAddress = nil; describe(@"when initialized with init", ^{ beforeEach(^{ @@ -35,6 +38,9 @@ describe(@"Send Location RPC", ^{ someAddressLines = @[@"3136 Hilton Rd", @"Ferndale, MI", @"48220"]; somePhoneNumber = @"248-591-0333"; someImage = [[SDLImage alloc] init]; + someDeliveryMode = [SDLDeliveryMode PROMPT]; + someTime = [[SDLDateTime alloc] init]; + someAddress = [[SDLOasisAddress alloc] init]; testRequest.longitudeDegrees = someLongitude; testRequest.latitudeDegrees = someLatitude; @@ -43,6 +49,9 @@ describe(@"Send Location RPC", ^{ testRequest.addressLines = someAddressLines; testRequest.phoneNumber = somePhoneNumber; testRequest.locationImage = someImage; + testRequest.deliveryMode = someDeliveryMode; + testRequest.timeStamp = someTime; + testRequest.address = someAddress; }); // Since all the properties are immutable, a copy should be executed as a retain, which means they should be identical @@ -80,6 +89,21 @@ describe(@"Send Location RPC", ^{ expect(testRequest.locationImage).to(equal(someImage)); expect(testRequest.locationImage).to(beIdenticalTo(someImage)); }); + + it(@"should get delivery mode correctly", ^{ + expect(testRequest.deliveryMode).to(equal(someDeliveryMode)); + expect(testRequest.deliveryMode).to(beIdenticalTo(someDeliveryMode)); + }); + + it(@"should get timestamp correctly", ^{ + expect(testRequest.timeStamp).to(equal(someTime)); + expect(testRequest.timeStamp).to(beIdenticalTo(someTime)); + }); + + it(@"should get address correctly", ^{ + expect(testRequest.address).to(equal(someAddress)); + expect(testRequest.address).to(beIdenticalTo(someAddress)); + }); }); context(@"when parameters are not set", ^{ @@ -110,6 +134,18 @@ describe(@"Send Location RPC", ^{ it(@"should return nil for image", ^{ expect(testRequest.locationImage).to(beNil()); }); + + it(@"should return nil for delivery mode", ^{ + expect(testRequest.deliveryMode).to(beNil()); + }); + + it(@"should return nil for timeStamp", ^{ + expect(testRequest.timeStamp).to(beNil()); + }); + + it(@"should return nil for address", ^{ + expect(testRequest.address).to(beNil()); + }); }); }); @@ -123,6 +159,9 @@ describe(@"Send Location RPC", ^{ someAddressLines = @[@"3136 Hilton Rd", @"Ferndale, MI", @"48220"]; somePhoneNumber = @"248-591-0333"; someImage = [[SDLImage alloc] init]; + someDeliveryMode = [SDLDeliveryMode PROMPT]; + someTime = [[SDLDateTime alloc] init]; + someAddress = [[SDLOasisAddress alloc] init]; NSDictionary *initDict = @{ NAMES_request: @{ NAMES_parameters: @{ @@ -132,7 +171,10 @@ describe(@"Send Location RPC", ^{ NAMES_locationDescription: someLocationDescription, NAMES_addressLines: someAddressLines, NAMES_phoneNumber: somePhoneNumber, - NAMES_locationImage: someImage + NAMES_locationImage: someImage, + NAMES_deliveryMode: someDeliveryMode, + NAMES_timeStamp: someTime, + NAMES_address: someAddress } } }; @@ -175,6 +217,21 @@ describe(@"Send Location RPC", ^{ expect(testRequest.locationImage).to(equal(someImage)); expect(testRequest.locationImage).to(beIdenticalTo(someImage)); }); + + it(@"should get delivery mode correctly", ^{ + expect(testRequest.deliveryMode).to(equal(someDeliveryMode)); + expect(testRequest.deliveryMode).to(beIdenticalTo(someDeliveryMode)); + }); + + it(@"should get timestamp correctly", ^{ + expect(testRequest.timeStamp).to(equal(someTime)); + expect(testRequest.timeStamp).to(beIdenticalTo(someTime)); + }); + + it(@"should get address correctly", ^{ + expect(testRequest.address).to(equal(someAddress)); + expect(testRequest.address).to(beIdenticalTo(someAddress)); + }); }); context(@"when parameters are not set", ^{ @@ -215,6 +272,18 @@ describe(@"Send Location RPC", ^{ it(@"should return nil for image", ^{ expect(testRequest.locationImage).to(beNil()); }); + + it(@"should return nil for delivery mode", ^{ + expect(testRequest.deliveryMode).to(beNil()); + }); + + it(@"should return nil for timeStamp", ^{ + expect(testRequest.timeStamp).to(beNil()); + }); + + it(@"should return nil for address", ^{ + expect(testRequest.address).to(beNil()); + }); }); }); }); diff --git a/SmartDeviceLinkTests/RPCSpecs/StructSpecs/SDLDateTimeSpec.m b/SmartDeviceLinkTests/RPCSpecs/StructSpecs/SDLDateTimeSpec.m new file mode 100644 index 000000000..3aee83e11 --- /dev/null +++ b/SmartDeviceLinkTests/RPCSpecs/StructSpecs/SDLDateTimeSpec.m @@ -0,0 +1,82 @@ +// +// SDLDateTimeSpec.m +// SmartDeviceLink-iOS +// +// Created by Muller, Alexander (A.) on 11/1/16. +// Copyright © 2016 smartdevicelink. All rights reserved. +// + +#import <Foundation/Foundation.h> + +#import <Quick/Quick.h> +#import <Nimble/Nimble.h> + +#import "SDLDateTime.h" +#import "SDLNames.h" + +QuickSpecBegin(SDLDateTimeSpec) + +describe(@"Getter/Setter Tests", ^ { + it(@"Should set and get correctly", ^ { + SDLDateTime* testStruct = [[SDLDateTime alloc] init]; + + testStruct.millisecond = @100; + testStruct.second = @4; + testStruct.minute = @12; + testStruct.hour = @20; + testStruct.day = @30; + testStruct.month = @1; + testStruct.year = @4000; + testStruct.timezoneMinuteOffset = @0; + testStruct.timezoneHourOffset = @1000; + + expect(testStruct.millisecond).to(equal(@100)); + expect(testStruct.second).to(equal(@4)); + expect(testStruct.minute).to(equal(@12)); + expect(testStruct.hour).to(equal(@20)); + expect(testStruct.day).to(equal(@30)); + expect(testStruct.month).to(equal(@1)); + expect(testStruct.year).to(equal(@4000)); + expect(testStruct.timezoneMinuteOffset).to(equal(@0)); + expect(testStruct.timezoneHourOffset).to(equal(@1000)); + }); + + it(@"Should get correctly when initialized with dictionary", ^{ + NSMutableDictionary* dict = [@{NAMES_millisecond:@100, + NAMES_second:@4, + NAMES_minute:@12, + NAMES_hour:@20, + NAMES_day:@30, + NAMES_month:@1, + NAMES_year:@4000, + NAMES_timezoneMinuteOffset:@0, + NAMES_timezoneHourOffset:@1000} mutableCopy]; + SDLDateTime* testStruct = [[SDLDateTime alloc] initWithDictionary:dict]; + + expect(testStruct.millisecond).to(equal(@100)); + expect(testStruct.second).to(equal(@4)); + expect(testStruct.minute).to(equal(@12)); + expect(testStruct.hour).to(equal(@20)); + expect(testStruct.day).to(equal(@30)); + expect(testStruct.month).to(equal(@1)); + expect(testStruct.year).to(equal(@4000)); + expect(testStruct.timezoneMinuteOffset).to(equal(@0)); + expect(testStruct.timezoneHourOffset).to(equal(@1000)); + }); + + it(@"Should return nil if not set", ^ { + SDLDateTime* testStruct = [[SDLDateTime alloc] init]; + + expect(testStruct.millisecond).to(beNil()); + expect(testStruct.second).to(beNil()); + expect(testStruct.minute).to(beNil()); + expect(testStruct.hour).to(beNil()); + expect(testStruct.day).to(beNil()); + expect(testStruct.month).to(beNil()); + expect(testStruct.year).to(beNil()); + expect(testStruct.timezoneMinuteOffset).to(beNil()); + expect(testStruct.timezoneHourOffset).to(beNil()); + }); +}); + +QuickSpecEnd diff --git a/SmartDeviceLinkTests/RPCSpecs/StructSpecs/SDLOasisAddressSpec.m b/SmartDeviceLinkTests/RPCSpecs/StructSpecs/SDLOasisAddressSpec.m new file mode 100644 index 000000000..a1de08e68 --- /dev/null +++ b/SmartDeviceLinkTests/RPCSpecs/StructSpecs/SDLOasisAddressSpec.m @@ -0,0 +1,78 @@ +// SDLOasisAddressSpec.m +// + +#import <Foundation/Foundation.h> + +#import <Quick/Quick.h> +#import <Nimble/Nimble.h> + +#import "SDLOasisAddress.h" +#import "SDLNames.h" + +QuickSpecBegin(SDLOasisAddressSpec) + +describe(@"Getter/Setter Tests", ^ { + it(@"Should set and get correctly", ^ { + SDLOasisAddress* testStruct = [[SDLOasisAddress alloc] init]; + + testStruct.countryName = @"United States"; + testStruct.countryCode = @"US"; + testStruct.postalCode = @"123456"; + testStruct.administrativeArea = @"CA"; + testStruct.subAdministrativeArea = @"Santa Clara"; + testStruct.locality = @"Palo Alto"; + testStruct.subLocality = @"18"; + testStruct.thoroughfare = @"Candy Lane"; + testStruct.subThoroughfare = @"123"; + + expect(testStruct.countryName).to(equal(@"United States")); + expect(testStruct.countryCode).to(equal(@"US")); + expect(testStruct.postalCode).to(equal(@"123456")); + expect(testStruct.administrativeArea).to(equal(@"CA")); + expect(testStruct.subAdministrativeArea).to(equal(@"Santa Clara")); + expect(testStruct.locality).to(equal(@"Palo Alto")); + expect(testStruct.subLocality).to(equal(@"18")); + expect(testStruct.thoroughfare).to(equal(@"Candy Lane")); + expect(testStruct.subThoroughfare).to(equal(@"123")); + + }); + + it(@"Should get correctly when initialized", ^ { + NSMutableDictionary* dict = [@{NAMES_countryName:@"United States", + NAMES_countryCode:@"US", + NAMES_postalCode:@"123456", + NAMES_administrativeArea:@"CA", + NAMES_subAdministrativeArea:@"Santa Clara", + NAMES_locality:@"Palo Alto", + NAMES_subLocality:@"18", + NAMES_thoroughfare:@"Candy Lane", + NAMES_subThoroughfare:@"123"} mutableCopy]; + SDLOasisAddress* testStruct = [[SDLOasisAddress alloc] initWithDictionary:dict]; + + expect(testStruct.countryName).to(equal(@"United States")); + expect(testStruct.countryCode).to(equal(@"US")); + expect(testStruct.postalCode).to(equal(@"123456")); + expect(testStruct.administrativeArea).to(equal(@"CA")); + expect(testStruct.subAdministrativeArea).to(equal(@"Santa Clara")); + expect(testStruct.locality).to(equal(@"Palo Alto")); + expect(testStruct.subLocality).to(equal(@"18")); + expect(testStruct.thoroughfare).to(equal(@"Candy Lane")); + expect(testStruct.subThoroughfare).to(equal(@"123")); + }); + + it(@"Should return nil if not set", ^ { + SDLOasisAddress* testStruct = [[SDLOasisAddress alloc] init]; + + expect(testStruct.countryName).to(beNil()); + expect(testStruct.countryCode).to(beNil()); + expect(testStruct.postalCode).to(beNil()); + expect(testStruct.administrativeArea).to(beNil()); + expect(testStruct.subAdministrativeArea).to(beNil()); + expect(testStruct.locality).to(beNil()); + expect(testStruct.subLocality).to(beNil()); + expect(testStruct.thoroughfare).to(beNil()); + expect(testStruct.subThoroughfare).to(beNil()); + }); +}); + +QuickSpecEnd |