diff options
-rw-r--r-- | SmartDeviceLink-iOS.podspec | 3 | ||||
-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 | 38 | ||||
-rw-r--r-- | SmartDeviceLink/SDLSendLocation.m | 70 | ||||
-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 |
17 files changed, 961 insertions, 25 deletions
diff --git a/SmartDeviceLink-iOS.podspec b/SmartDeviceLink-iOS.podspec index 0ab1edea1..85bd792f0 100644 --- a/SmartDeviceLink-iOS.podspec +++ b/SmartDeviceLink-iOS.podspec @@ -151,6 +151,7 @@ s.public_header_files = [ 'SmartDeviceLink/SDLChoice.h', 'SmartDeviceLink/SDLClusterModeStatus.h', 'SmartDeviceLink/SDLDIDResult.h', +'SmartDeviceLink/SDLDateTime.h', 'SmartDeviceLink/SDLDeviceInfo.h', 'SmartDeviceLink/SDLDeviceStatus.h', 'SmartDeviceLink/SDLDisplayCapabilities.h', @@ -166,6 +167,7 @@ s.public_header_files = [ 'SmartDeviceLink/SDLKeyboardProperties.h', 'SmartDeviceLink/SDLMenuParams.h', 'SmartDeviceLink/SDLMyKey.h', +'SmartDeviceLink/SDLOasisAddress.h', 'SmartDeviceLink/SDLParameterPermissions.h', 'SmartDeviceLink/SDLPermissionItem.h', 'SmartDeviceLink/SDLPresetBankCapabilities.h', @@ -198,6 +200,7 @@ s.public_header_files = [ 'SmartDeviceLink/SDLCharacterSet.h', 'SmartDeviceLink/SDLCompassDirection.h', 'SmartDeviceLink/SDLComponentVolumeStatus.h', +'SmartDeviceLink/SDLDeliveryMode.h', 'SmartDeviceLink/SDLDeviceLevelStatus.h', 'SmartDeviceLink/SDLDimension.h', 'SmartDeviceLink/SDLDisplayType.h', diff --git a/SmartDeviceLink-iOS.xcodeproj/project.pbxproj b/SmartDeviceLink-iOS.xcodeproj/project.pbxproj index 1406102a6..af9b83a83 100644 --- a/SmartDeviceLink-iOS.xcodeproj/project.pbxproj +++ b/SmartDeviceLink-iOS.xcodeproj/project.pbxproj @@ -909,6 +909,15 @@ DA7515C11D95FAA000F29323 /* sdl_logo_white@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = DA7515AF1D95FAA000F29323 /* sdl_logo_white@2x.png */; }; DA7515C21D95FAA000F29323 /* sdl_logo_white@3x.png in Resources */ = {isa = PBXBuildFile; fileRef = DA7515B01D95FAA000F29323 /* sdl_logo_white@3x.png */; }; DA96C0661D4D4F730022F520 /* SDLAppInfoSpec.m in Sources */ = {isa = PBXBuildFile; fileRef = DA96C0651D4D4F730022F520 /* SDLAppInfoSpec.m */; }; + DA9F7E631DCBFAC800ACAE48 /* SDLDateTime.h in Headers */ = {isa = PBXBuildFile; fileRef = DA9F7E611DCBFAC800ACAE48 /* SDLDateTime.h */; settings = {ATTRIBUTES = (Public, ); }; }; + DA9F7E641DCBFAC800ACAE48 /* SDLDateTime.m in Sources */ = {isa = PBXBuildFile; fileRef = DA9F7E621DCBFAC800ACAE48 /* SDLDateTime.m */; }; + DA9F7E671DCBFAD400ACAE48 /* SDLOasisAddress.h in Headers */ = {isa = PBXBuildFile; fileRef = DA9F7E651DCBFAD400ACAE48 /* SDLOasisAddress.h */; settings = {ATTRIBUTES = (Public, ); }; }; + DA9F7E681DCBFAD400ACAE48 /* SDLOasisAddress.m in Sources */ = {isa = PBXBuildFile; fileRef = DA9F7E661DCBFAD400ACAE48 /* SDLOasisAddress.m */; }; + DA9F7E6B1DCBFB0700ACAE48 /* SDLDeliveryMode.h in Headers */ = {isa = PBXBuildFile; fileRef = DA9F7E691DCBFB0700ACAE48 /* SDLDeliveryMode.h */; settings = {ATTRIBUTES = (Public, ); }; }; + DA9F7E6C1DCBFB0700ACAE48 /* SDLDeliveryMode.m in Sources */ = {isa = PBXBuildFile; fileRef = DA9F7E6A1DCBFB0700ACAE48 /* SDLDeliveryMode.m */; }; + DA9F7EB21DCC084300ACAE48 /* SDLDeliveryModeSpec.m in Sources */ = {isa = PBXBuildFile; fileRef = DA9F7EB11DCC084300ACAE48 /* SDLDeliveryModeSpec.m */; }; + DA9F7EB41DCC086400ACAE48 /* SDLDateTimeSpec.m in Sources */ = {isa = PBXBuildFile; fileRef = DA9F7EB31DCC086400ACAE48 /* SDLDateTimeSpec.m */; }; + DA9F7EB61DCC086A00ACAE48 /* SDLOasisAddressSpec.m in Sources */ = {isa = PBXBuildFile; fileRef = DA9F7EB51DCC086A00ACAE48 /* SDLOasisAddressSpec.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 */; }; DAC5725B1D10B81E0004288B /* SDLTouch.m in Sources */ = {isa = PBXBuildFile; fileRef = DAC572591D10B81E0004288B /* SDLTouch.m */; }; @@ -1909,6 +1918,15 @@ DA7515AF1D95FAA000F29323 /* sdl_logo_white@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "sdl_logo_white@2x.png"; sourceTree = "<group>"; }; DA7515B01D95FAA000F29323 /* sdl_logo_white@3x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "sdl_logo_white@3x.png"; sourceTree = "<group>"; }; DA96C0651D4D4F730022F520 /* SDLAppInfoSpec.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SDLAppInfoSpec.m; sourceTree = "<group>"; }; + DA9F7E611DCBFAC800ACAE48 /* SDLDateTime.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDLDateTime.h; sourceTree = "<group>"; }; + DA9F7E621DCBFAC800ACAE48 /* SDLDateTime.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SDLDateTime.m; sourceTree = "<group>"; }; + DA9F7E651DCBFAD400ACAE48 /* SDLOasisAddress.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDLOasisAddress.h; sourceTree = "<group>"; }; + DA9F7E661DCBFAD400ACAE48 /* SDLOasisAddress.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SDLOasisAddress.m; sourceTree = "<group>"; }; + DA9F7E691DCBFB0700ACAE48 /* SDLDeliveryMode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDLDeliveryMode.h; sourceTree = "<group>"; }; + DA9F7E6A1DCBFB0700ACAE48 /* SDLDeliveryMode.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SDLDeliveryMode.m; sourceTree = "<group>"; }; + DA9F7EB11DCC084300ACAE48 /* SDLDeliveryModeSpec.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SDLDeliveryModeSpec.m; sourceTree = "<group>"; }; + DA9F7EB31DCC086400ACAE48 /* SDLDateTimeSpec.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SDLDateTimeSpec.m; sourceTree = "<group>"; }; + DA9F7EB51DCC086A00ACAE48 /* SDLOasisAddressSpec.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SDLOasisAddressSpec.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>"; }; DAC572591D10B81E0004288B /* SDLTouch.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SDLTouch.m; sourceTree = "<group>"; }; @@ -1998,6 +2016,7 @@ 162E81EC1A9BDE8A00906325 /* SDLCharacterSetSpec.m */, 162E81ED1A9BDE8A00906325 /* SDLCompassDirectionSpec.m */, 162E81EE1A9BDE8A00906325 /* SDLComponentVolumeStatusSpec.m */, + DA9F7EB11DCC084300ACAE48 /* SDLDeliveryModeSpec.m */, 162E81EF1A9BDE8A00906325 /* SDLDeviceLevelStatusSpec.m */, 162E81F01A9BDE8A00906325 /* SDLDimensionSpec.m */, 162E81F11A9BDE8A00906325 /* SDLDisplayTypeSpec.m */, @@ -2205,6 +2224,7 @@ 162E82931A9BDE8A00906325 /* SDLButtonCapabilitiesSpec.m */, 162E82941A9BDE8A00906325 /* SDLChoiceSpec.m */, 162E82951A9BDE8A00906325 /* SDLClusterModeStatusSpec.m */, + DA9F7EB31DCC086400ACAE48 /* SDLDateTimeSpec.m */, 162E82961A9BDE8A00906325 /* SDLDeviceInfoSpec.m */, 162E82971A9BDE8A00906325 /* SDLDeviceStatusSpec.m */, 162E82981A9BDE8A00906325 /* SDLDIDResult.m */, @@ -2220,6 +2240,7 @@ 162E82A11A9BDE8A00906325 /* SDLKeyboardPropertiesSpec.m */, 162E82A21A9BDE8A00906325 /* SDLMenuParamsSpec.m */, 162E82A31A9BDE8A00906325 /* SDLMyKeySpec.m */, + DA9F7EB51DCC086A00ACAE48 /* SDLOasisAddressSpec.m */, 162E82A41A9BDE8A00906325 /* SDLParameterPermissionsSpec.m */, 162E82A51A9BDE8A00906325 /* SDLPermissionItemSpec.m */, 162E82A61A9BDE8A00906325 /* SDLPresetBankCapabilitiesSpec.m */, @@ -2743,6 +2764,8 @@ 5D61FA751A84238A00846EE7 /* SDLChoice.m */, 5D61FA761A84238A00846EE7 /* SDLClusterModeStatus.h */, 5D61FA771A84238A00846EE7 /* SDLClusterModeStatus.m */, + DA9F7E611DCBFAC800ACAE48 /* SDLDateTime.h */, + DA9F7E621DCBFAC800ACAE48 /* SDLDateTime.m */, 5D61FA951A84238A00846EE7 /* SDLDeviceInfo.h */, 5D61FA961A84238A00846EE7 /* SDLDeviceInfo.m */, 5D61FA991A84238A00846EE7 /* SDLDeviceStatus.h */, @@ -2775,6 +2798,8 @@ 5D61FB0C1A84238A00846EE7 /* SDLMenuParams.m */, 5D61FB0D1A84238A00846EE7 /* SDLMyKey.h */, 5D61FB0E1A84238A00846EE7 /* SDLMyKey.m */, + DA9F7E651DCBFAD400ACAE48 /* SDLOasisAddress.h */, + DA9F7E661DCBFAD400ACAE48 /* SDLOasisAddress.m */, 5D61FB361A84238B00846EE7 /* SDLParameterPermissions.h */, 5D61FB371A84238B00846EE7 /* SDLParameterPermissions.m */, 5D61FB401A84238B00846EE7 /* SDLPermissionItem.h */, @@ -2846,6 +2871,8 @@ 5D61FA791A84238A00846EE7 /* SDLCompassDirection.m */, 5D61FA7A1A84238A00846EE7 /* SDLComponentVolumeStatus.h */, 5D61FA7B1A84238A00846EE7 /* SDLComponentVolumeStatus.m */, + DA9F7E691DCBFB0700ACAE48 /* SDLDeliveryMode.h */, + DA9F7E6A1DCBFB0700ACAE48 /* SDLDeliveryMode.m */, 5D61FA971A84238A00846EE7 /* SDLDeviceLevelStatus.h */, 5D61FA981A84238A00846EE7 /* SDLDeviceLevelStatus.m */, 5D61FAA11A84238A00846EE7 /* SDLDimension.h */, @@ -3805,6 +3832,7 @@ 5D61FCF61A84238C00846EE7 /* SDLMediaClockFormat.h in Headers */, 5D61FD831A84238C00846EE7 /* SDLSetDisplayLayout.h in Headers */, 5D61FCC91A84238C00846EE7 /* SDLIgnitionStableStatus.h in Headers */, + DA9F7E6B1DCBFB0700ACAE48 /* SDLDeliveryMode.h in Headers */, E9C32B941AB20BA200F283AF /* SDLStreamDelegate.h in Headers */, 5D61FDBB1A84238C00846EE7 /* SDLSystemAction.h in Headers */, 5D61FC9C1A84238C00846EE7 /* SDLEmergencyEventType.h in Headers */, @@ -3859,6 +3887,7 @@ 5D61FDA91A84238C00846EE7 /* SDLSpeechCapabilities.h in Headers */, 5D61FCE01A84238C00846EE7 /* SDLKeyboardEvent.h in Headers */, 5D3E48751D6F3B330000BFEF /* SDLAsynchronousOperation.h in Headers */, + DA9F7E631DCBFAC800ACAE48 /* SDLDateTime.h in Headers */, 5D61FCEA1A84238C00846EE7 /* SDLLayoutMode.h in Headers */, 5D61FD7F1A84238C00846EE7 /* SDLSetAppIcon.h in Headers */, 5D61FDD11A84238C00846EE7 /* SDLTouchCoord.h in Headers */, @@ -3945,6 +3974,7 @@ 5D61FDE51A84238C00846EE7 /* SDLUnregisterAppInterfaceResponse.h in Headers */, 5D61FCF81A84238C00846EE7 /* SDLMenuParams.h in Headers */, 5D61FD651A84238C00846EE7 /* SDLResetGlobalPropertiesResponse.h in Headers */, + DA9F7E671DCBFAD400ACAE48 /* SDLOasisAddress.h in Headers */, 5D61FD611A84238C00846EE7 /* SDLRequestType.h in Headers */, 5D61FCEC1A84238C00846EE7 /* SDLListFiles.h in Headers */, 5D2F58081D0717D5001085CE /* SDLManagerDelegate.h in Headers */, @@ -4438,12 +4468,14 @@ 5D61FCC61A84238C00846EE7 /* SDLHMIZoneCapabilities.m in Sources */, 5D61FD161A84238C00846EE7 /* SDLOnLockScreenStatus.m in Sources */, 5D61FDAE1A84238C00846EE7 /* SDLSubscribeButton.m in Sources */, + DA9F7E6C1DCBFB0700ACAE48 /* SDLDeliveryMode.m in Sources */, 5D61FC581A84238C00846EE7 /* SDLButtonPressMode.m in Sources */, 5D61FDB01A84238C00846EE7 /* SDLSubscribeButtonResponse.m in Sources */, 5DCF76F61ACDBAD300BB647B /* SDLSendLocation.m in Sources */, 5D76E3251D39767000647CFA /* SDLLockScreenPresenter.m in Sources */, 5D61FC771A84238C00846EE7 /* SDLDeleteFile.m in Sources */, 5D61FC811A84238C00846EE7 /* SDLDeleteSubMenuResponse.m in Sources */, + DA9F7E681DCBFAD400ACAE48 /* SDLOasisAddress.m in Sources */, 5D61FC7B1A84238C00846EE7 /* SDLDeleteInteractionChoiceSet.m in Sources */, 5D61FDC01A84238C00846EE7 /* SDLSystemRequest.m in Sources */, 5D61FD021A84238C00846EE7 /* SDLOnAudioPassThru.m in Sources */, @@ -4490,6 +4522,7 @@ 5D61FC851A84238C00846EE7 /* SDLDeviceLevelStatus.m in Sources */, 5D1665AB1CF5F7D000CC4CA1 /* (null) in Sources */, 5D61FD1E1A84238C00846EE7 /* SDLOnTBTClientState.m in Sources */, + DA9F7E641DCBFAC800ACAE48 /* SDLDateTime.m in Sources */, 5D61FD581A84238C00846EE7 /* SDLPutFileResponse.m in Sources */, 5D61FCB21A84238C00846EE7 /* SDLGetDTCs.m in Sources */, 5D61FD441A84238C00846EE7 /* SDLProtocol.m in Sources */, @@ -4611,6 +4644,7 @@ 162E83871A9BDE8B00906325 /* SDLPermissionItemSpec.m in Sources */, 162E82E31A9BDE8B00906325 /* SDLIgnitionStatusSpec.m in Sources */, 162E83511A9BDE8B00906325 /* SDLDeleteInteractionChoiceSetResponseSpec.m in Sources */, + DA9F7EB41DCC086400ACAE48 /* SDLDateTimeSpec.m in Sources */, 162E830E1A9BDE8B00906325 /* SDLRPCRequestFactorySpec.m in Sources */, 162E82E41A9BDE8B00906325 /* SDLImageFieldNameSpec.m in Sources */, 162E83991A9BDE8B00906325 /* SDLEnumSpec.m in Sources */, @@ -4678,6 +4712,7 @@ 162E82F71A9BDE8B00906325 /* SDLResultSpec.m in Sources */, 1680B1141A9CD7AD00DBD79E /* SDLV1ProtocolHeaderSpec.m in Sources */, 1680B1161A9CD7AD00DBD79E /* SDLProtocolMessageSpec.m in Sources */, + DA9F7EB21DCC084300ACAE48 /* SDLDeliveryModeSpec.m in Sources */, 162E83771A9BDE8B00906325 /* SDLClusterModeStatusSpec.m in Sources */, 162E83981A9BDE8B00906325 /* SDLVrHelpItemSpec.m in Sources */, 162E83831A9BDE8B00906325 /* SDLKeyboardPropertiesSpec.m in Sources */, @@ -4769,6 +4804,7 @@ 162E830C1A9BDE8B00906325 /* SDLWarningLightStatusSpec.m in Sources */, 162E82E71A9BDE8B00906325 /* SDLKeyboardEventSpec.m in Sources */, 162E834E1A9BDE8B00906325 /* SDLCreateInteractionChoiceSetResponseSpec.m in Sources */, + DA9F7EB61DCC086A00ACAE48 /* SDLOasisAddressSpec.m in Sources */, 162E83301A9BDE8B00906325 /* SDLGetVehicleDataSpec.m in Sources */, 162E833F1A9BDE8B00906325 /* SDLSliderSpec.m in Sources */, 162E838C1A9BDE8B00906325 /* SDLSoftButtonSpec.m in Sources */, diff --git a/SmartDeviceLink/SDLDateTime.h b/SmartDeviceLink/SDLDateTime.h new file mode 100644 index 000000000..d858c3fe9 --- /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<SDLInt> *millisecond; + +/** + * @abstract Seconds part of time + * + * Required, Integer 0 - 59 + */ +@property (copy, nonatomic) NSNumber<SDLInt> *second; + +/** + * @abstract Minutes part of time + * + * Required, Integer 0 - 59 + */ +@property (copy, nonatomic) NSNumber<SDLInt> *minute; + +/** + * @abstract Hour part of time + * + * Required, Integer 0 - 23 + */ +@property (copy, nonatomic) NSNumber<SDLInt> *hour; + +/** + * @abstract Day of the month + * + * Required, Integer 1 - 31 + */ +@property (copy, nonatomic) NSNumber<SDLInt> *day; + +/** + * @abstract Month of the year + * + * Required, Integer 1 - 12 + */ +@property (copy, nonatomic) NSNumber<SDLInt> *month; + +/** + * @abstract The year in YYYY format + * + * Required, Max Value 4095 + */ +@property (copy, nonatomic) NSNumber<SDLInt> *year; + +/** + * @abstract Time zone offset in Min with regard to UTC + * + * Required, Integer 0 - 59 + */ +@property (copy, nonatomic) NSNumber<SDLInt> *timezoneMinuteOffset; + +/** + * @abstract Time zone offset in Hours with regard to UTC + * + * Required, Integer -12 - 14 + */ +@property (copy, nonatomic) NSNumber<SDLInt> *timezoneHourOffset; + +@end diff --git a/SmartDeviceLink/SDLDateTime.m b/SmartDeviceLink/SDLDateTime.m new file mode 100644 index 000000000..20ede0638 --- /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<SDLInt> *)millisecond { + if (millisecond != nil) { + store[NAMES_millisecond] = millisecond; + } else { + [store removeObjectForKey:NAMES_millisecond]; + } +} + +- (NSNumber<SDLInt> *)millisecond { + return store[NAMES_millisecond]; +} + +- (void)setSecond:(NSNumber<SDLInt> *)second { + if (second != nil) { + store[NAMES_second] = second; + } else { + [store removeObjectForKey:NAMES_second]; + } +} + +- (NSNumber<SDLInt> *)second { + return store[NAMES_second]; +} + +- (void)setMinute:(NSNumber<SDLInt> *)minute { + if (minute != nil) { + store[NAMES_minute] = minute; + } else { + [store removeObjectForKey:NAMES_minute]; + } +} + +- (NSNumber<SDLInt> *)minute { + return store[NAMES_minute]; +} + +- (void)setHour:(NSNumber<SDLInt> *)hour { + if (hour != nil) { + store[NAMES_hour] = hour; + } else { + [store removeObjectForKey:NAMES_hour]; + } +} + +- (NSNumber<SDLInt> *)hour { + return store[NAMES_hour]; +} + +- (void)setDay:(NSNumber<SDLInt> *)day { + if (day != nil) { + store[NAMES_day] = day; + } else { + [store removeObjectForKey:NAMES_day]; + } +} + +- (NSNumber<SDLInt> *)day { + return store[NAMES_day]; +} + +- (void)setMonth:(NSNumber<SDLInt> *)month { + if (month != nil) { + store[NAMES_month] = month; + } else { + [store removeObjectForKey:NAMES_month]; + } +} + +- (NSNumber<SDLInt> *)month { + return store[NAMES_month]; +} + +- (void)setYear:(NSNumber<SDLInt> *)year { + if (year != nil) { + store[NAMES_year] = year; + } else { + [store removeObjectForKey:NAMES_year]; + } +} + +- (NSNumber<SDLInt> *)year { + return store[NAMES_year]; +} + +- (void)setTimezoneMinuteOffset:(NSNumber<SDLInt> *)timezoneMinuteOffset { + if (timezoneMinuteOffset != nil) { + store[NAMES_timezoneMinuteOffset] = timezoneMinuteOffset; + } else { + [store removeObjectForKey:NAMES_timezoneMinuteOffset]; + } +} + +- (NSNumber<SDLInt> *)timezoneMinuteOffset { + return store[NAMES_timezoneMinuteOffset]; +} + +- (void)setTimezoneHourOffset:(NSNumber<SDLInt> *)timezoneHourOffset { + if (timezoneHourOffset != nil) { + store[NAMES_timezoneHourOffset] = timezoneHourOffset; + } else { + [store removeObjectForKey:NAMES_timezoneHourOffset]; + } +} + +- (NSNumber<SDLInt> *)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 f0293f420..65e025c61 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 0b7a77a19..bf867d948 100644 --- a/SmartDeviceLink/SDLSendLocation.h +++ b/SmartDeviceLink/SDLSendLocation.h @@ -2,18 +2,17 @@ // SDLSendLocation.h // SmartDeviceLink +#import "SDLRPCRequest.h" + #import <CoreGraphics/CGBase.h> -#import <Foundation/Foundation.h> +#import "SDLDateTime.h" +#import "SDLDeliveryMode.h" #import "SDLImage.h" -#import "SDLRPCRequest.h" - +#import "SDLOasisAddress.h" @interface SDLSendLocation : SDLRPCRequest -- (instancetype)init; -- (instancetype)initWithDictionary:(NSMutableDictionary *)dict; - - (instancetype)initWithLongitude:(CGFloat)longitude latitude:(CGFloat)latitude locationName:(NSString *)locationName locationDescription:(NSString *)locationDescription address:(NSArray<NSString *> *)address phoneNumber:(NSString *)phoneNumber image:(SDLImage *)image; /** @@ -21,14 +20,14 @@ * * Float, Required, -180.0 - 180.0 */ -@property (copy, nonatomic) NSNumber *longitudeDegrees; +@property (copy, nonatomic) NSNumber<SDLFloat> *longitudeDegrees; /** * The latitudinal coordinate of the location. * * Float, Required, -90.0 - 90.0 */ -@property (copy, nonatomic) NSNumber *latitudeDegrees; +@property (copy, nonatomic) NSNumber<SDLFloat> *latitudeDegrees; /** * Name / title of intended location @@ -49,7 +48,7 @@ * * Contains String, Optional, Max Array Length = 4, Max String Length = 500 */ -@property (copy, nonatomic) NSArray *addressLines; +@property (copy, nonatomic) NSArray<NSString *> *addressLines; /** * Phone number of intended location / establishment @@ -65,4 +64,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 83a420ccc..07b04bb53 100644 --- a/SmartDeviceLink/SDLSendLocation.m +++ b/SmartDeviceLink/SDLSendLocation.m @@ -18,16 +18,7 @@ return self; } -- (instancetype)initWithDictionary:(NSMutableDictionary *)dict { - self = [super initWithDictionary:dict]; - if (!self) { - return nil; - } - - return self; -} - -- (instancetype)initWithLongitude:(CGFloat)longitude latitude:(CGFloat)latitude locationName:(NSString *)locationName locationDescription:(NSString *)locationDescription address:(NSArray *)address phoneNumber:(NSString *)phoneNumber image:(SDLImage *)image { +- (instancetype)initWithLongitude:(CGFloat)longitude latitude:(CGFloat)latitude locationName:(NSString *)locationName locationDescription:(NSString *)locationDescription address:(NSArray<NSString *> *)address phoneNumber:(NSString *)phoneNumber image:(SDLImage *)image { self = [self init]; if (!self) { return nil; @@ -44,7 +35,7 @@ return self; } -- (void)setLongitudeDegrees:(NSNumber *)longitudeDegrees { +- (void)setLongitudeDegrees:(NSNumber<SDLFloat> *)longitudeDegrees { if (longitudeDegrees != nil) { parameters[NAMES_longitudeDegrees] = longitudeDegrees; } else { @@ -52,11 +43,11 @@ } } -- (NSNumber *)longitudeDegrees { +- (NSNumber<SDLFloat> *)longitudeDegrees { return parameters[NAMES_longitudeDegrees]; } -- (void)setLatitudeDegrees:(NSNumber *)latitudeDegrees { +- (void)setLatitudeDegrees:(NSNumber<SDLFloat> *)latitudeDegrees { if (latitudeDegrees != nil) { parameters[NAMES_latitudeDegrees] = latitudeDegrees; } else { @@ -64,7 +55,7 @@ } } -- (NSNumber *)latitudeDegrees { +- (NSNumber<SDLFloat> *)latitudeDegrees { return parameters[NAMES_latitudeDegrees]; } @@ -133,4 +124,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 176bee596..8e2a72262 100644 --- a/SmartDeviceLink/SmartDeviceLink.h +++ b/SmartDeviceLink/SmartDeviceLink.h @@ -172,6 +172,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" @@ -222,6 +223,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 |