diff options
author | Justin Gluck <justin.gluck@livio.io> | 2019-07-15 16:10:58 -0400 |
---|---|---|
committer | Justin Gluck <justin.gluck@livio.io> | 2019-07-15 16:10:58 -0400 |
commit | 861b3d48be3f4c746db25e7c3e232eddfa5feca6 (patch) | |
tree | 440310b80603e8e22a08932f32891cc3d5d15571 | |
parent | 2e76407a10b76455b294d6a60db5f89647fbe6bf (diff) | |
download | sdl_ios-861b3d48be3f4c746db25e7c3e232eddfa5feca6.tar.gz |
WIP: setting up ShowAppMenu RPC
-rw-r--r-- | Example Apps/Example Swift/MenuManager.swift | 6 | ||||
-rw-r--r-- | SmartDeviceLink-iOS.podspec | 2 | ||||
-rw-r--r-- | SmartDeviceLink-iOS.xcodeproj/project.pbxproj | 20 | ||||
-rw-r--r-- | SmartDeviceLink.podspec | 2 | ||||
-rw-r--r-- | SmartDeviceLink/SDLNotificationConstants.h | 2 | ||||
-rw-r--r-- | SmartDeviceLink/SDLNotificationConstants.m | 3 | ||||
-rw-r--r-- | SmartDeviceLink/SDLNotificationDispatcher.m | 8 | ||||
-rw-r--r-- | SmartDeviceLink/SDLProxyListener.h | 16 | ||||
-rw-r--r-- | SmartDeviceLink/SDLRPCFunctionNames.h | 1 | ||||
-rw-r--r-- | SmartDeviceLink/SDLRPCFunctionNames.m | 1 | ||||
-rw-r--r-- | SmartDeviceLink/SDLShowAppMenu.h | 25 | ||||
-rw-r--r-- | SmartDeviceLink/SDLShowAppMenu.m | 38 | ||||
-rw-r--r-- | SmartDeviceLink/SDLShowAppMenuResponse.h | 20 | ||||
-rw-r--r-- | SmartDeviceLink/SDLShowAppMenuResponse.m | 23 | ||||
-rw-r--r-- | SmartDeviceLink/SmartDeviceLink.h | 2 | ||||
-rw-r--r-- | SmartDeviceLinkTests/Notifications/SDLNotificationDispatcherSpec.m | 2 | ||||
-rw-r--r-- | SmartDeviceLinkTests/RPCSpecs/RequestSpecs/SDLShowAppMenuSpec.m | 50 |
17 files changed, 218 insertions, 3 deletions
diff --git a/Example Apps/Example Swift/MenuManager.swift b/Example Apps/Example Swift/MenuManager.swift index c5171510d..0cb86dda9 100644 --- a/Example Apps/Example Swift/MenuManager.swift +++ b/Example Apps/Example Swift/MenuManager.swift @@ -120,11 +120,11 @@ private extension MenuManager { /// - Parameter manager: The SDL Manager /// - Returns: A SDLMenuCell object class func menuCellChangeTemplate(with manager: SDLManager) -> SDLMenuCell { - + let ch = SDLChoiceSet(title: <#T##String#>, delegate: <#T##SDLChoiceSetDelegate#>, choices: <#T##[SDLChoiceCell]#>) /// Lets give an example of 2 templates var submenuItems = [SDLMenuCell]() - let errorMessage = "Changing the template failed" - + let errorMessage = "Changing the template failed + let s = SDLSoftButtonState(stateName: <#T##String#>, text: <#T##String?#>, artwork: <#T##SDLArtwork?#>) /// Non-Media let submenuTitleNonMedia = "Non - Media (Default)" submenuItems.append(SDLMenuCell(title: submenuTitleNonMedia, icon: nil, voiceCommands: nil, handler: { (triggerSource) in diff --git a/SmartDeviceLink-iOS.podspec b/SmartDeviceLink-iOS.podspec index 18cb88576..ad0c67197 100644 --- a/SmartDeviceLink-iOS.podspec +++ b/SmartDeviceLink-iOS.podspec @@ -325,6 +325,8 @@ ss.public_header_files = [ 'SmartDeviceLink/SDLSetMediaClockTimer.h', 'SmartDeviceLink/SDLSetMediaClockTimerResponse.h', 'SmartDeviceLink/SDLShow.h', +'SmartDeviceLink/SDLShowAppMenu.h', +'SmartDeviceLink/SDLShowAppMenuResponse.h', 'SmartDeviceLink/SDLShowConstantTBT.h', 'SmartDeviceLink/SDLShowConstantTBTResponse.h', 'SmartDeviceLink/SDLShowResponse.h', diff --git a/SmartDeviceLink-iOS.xcodeproj/project.pbxproj b/SmartDeviceLink-iOS.xcodeproj/project.pbxproj index 077bc10b7..a179cc9e5 100644 --- a/SmartDeviceLink-iOS.xcodeproj/project.pbxproj +++ b/SmartDeviceLink-iOS.xcodeproj/project.pbxproj @@ -1233,6 +1233,11 @@ 752ECDB7228B4D6B00D945F4 /* SDLDynamicMenuUpdateAlgorithm.m in Sources */ = {isa = PBXBuildFile; fileRef = 752ECDB5228B4D6B00D945F4 /* SDLDynamicMenuUpdateAlgorithm.m */; }; 752ECDB9228C42E100D945F4 /* SDLMenuRunScoreSpec.m in Sources */ = {isa = PBXBuildFile; fileRef = 752ECDB8228C42E100D945F4 /* SDLMenuRunScoreSpec.m */; }; 752ECDBB228C532600D945F4 /* SDLMenuUpdateAlgorithmSpec.m in Sources */ = {isa = PBXBuildFile; fileRef = 752ECDBA228C532600D945F4 /* SDLMenuUpdateAlgorithmSpec.m */; }; + 7538764F22D8CEDB00FE8484 /* SDLShowAppMenu.h in Headers */ = {isa = PBXBuildFile; fileRef = 7538764D22D8CEDB00FE8484 /* SDLShowAppMenu.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 7538765022D8CEDB00FE8484 /* SDLShowAppMenu.m in Sources */ = {isa = PBXBuildFile; fileRef = 7538764E22D8CEDB00FE8484 /* SDLShowAppMenu.m */; }; + 7538765322D8D95100FE8484 /* SDLShowAppMenuResponse.h in Headers */ = {isa = PBXBuildFile; fileRef = 7538765122D8D95100FE8484 /* SDLShowAppMenuResponse.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 7538765422D8D95100FE8484 /* SDLShowAppMenuResponse.m in Sources */ = {isa = PBXBuildFile; fileRef = 7538765222D8D95100FE8484 /* SDLShowAppMenuResponse.m */; }; + 7538765622DCAF5400FE8484 /* SDLShowAppMenuSpec.m in Sources */ = {isa = PBXBuildFile; fileRef = 7538765522DCAF5400FE8484 /* SDLShowAppMenuSpec.m */; }; 755F176222A00B7C0041B9CB /* SDLMenuManagerConstants.h in Headers */ = {isa = PBXBuildFile; fileRef = 755F176122A00B7C0041B9CB /* SDLMenuManagerConstants.h */; settings = {ATTRIBUTES = (Public, ); }; }; 756C62762289F11F008B57A2 /* SDLDynamicMenuUpdateRunScore.h in Headers */ = {isa = PBXBuildFile; fileRef = 756C62742289F11F008B57A2 /* SDLDynamicMenuUpdateRunScore.h */; }; 756C62772289F11F008B57A2 /* SDLDynamicMenuUpdateRunScore.m in Sources */ = {isa = PBXBuildFile; fileRef = 756C62752289F11F008B57A2 /* SDLDynamicMenuUpdateRunScore.m */; }; @@ -2895,6 +2900,11 @@ 752ECDB5228B4D6B00D945F4 /* SDLDynamicMenuUpdateAlgorithm.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SDLDynamicMenuUpdateAlgorithm.m; sourceTree = "<group>"; }; 752ECDB8228C42E100D945F4 /* SDLMenuRunScoreSpec.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SDLMenuRunScoreSpec.m; sourceTree = "<group>"; }; 752ECDBA228C532600D945F4 /* SDLMenuUpdateAlgorithmSpec.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SDLMenuUpdateAlgorithmSpec.m; sourceTree = "<group>"; }; + 7538764D22D8CEDB00FE8484 /* SDLShowAppMenu.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SDLShowAppMenu.h; sourceTree = "<group>"; }; + 7538764E22D8CEDB00FE8484 /* SDLShowAppMenu.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SDLShowAppMenu.m; sourceTree = "<group>"; }; + 7538765122D8D95100FE8484 /* SDLShowAppMenuResponse.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SDLShowAppMenuResponse.h; sourceTree = "<group>"; }; + 7538765222D8D95100FE8484 /* SDLShowAppMenuResponse.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SDLShowAppMenuResponse.m; sourceTree = "<group>"; }; + 7538765522DCAF5400FE8484 /* SDLShowAppMenuSpec.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SDLShowAppMenuSpec.m; sourceTree = "<group>"; }; 755F176122A00B7C0041B9CB /* SDLMenuManagerConstants.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SDLMenuManagerConstants.h; sourceTree = "<group>"; }; 756C62742289F11F008B57A2 /* SDLDynamicMenuUpdateRunScore.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SDLDynamicMenuUpdateRunScore.h; sourceTree = "<group>"; }; 756C62752289F11F008B57A2 /* SDLDynamicMenuUpdateRunScore.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SDLDynamicMenuUpdateRunScore.m; sourceTree = "<group>"; }; @@ -3453,6 +3463,7 @@ 162E82581A9BDE8A00906325 /* SDLSetMediaClockTimerSpec.m */, 162E82591A9BDE8A00906325 /* SDLShowConstantTBTSpec.m */, 162E825A1A9BDE8A00906325 /* SDLShowSpec.m */, + 7538765522DCAF5400FE8484 /* SDLShowAppMenuSpec.m */, 162E825B1A9BDE8A00906325 /* SDLSliderSpec.m */, 162E825C1A9BDE8A00906325 /* SDLSpeakSpec.m */, 162E825D1A9BDE8A00906325 /* SDLSubscribeButtonSpec.m */, @@ -4191,6 +4202,8 @@ DA9F7E6E1DCBFFDB00ACAE48 /* SDLGetWayPoints.m */, 5D61FAFF1A84238A00846EE7 /* SDLListFiles.h */, 5D61FB001A84238A00846EE7 /* SDLListFiles.m */, + 7538764D22D8CEDB00FE8484 /* SDLShowAppMenu.h */, + 7538764E22D8CEDB00FE8484 /* SDLShowAppMenu.m */, 88AF11DA220B6B3D00A59985 /* SDLPerformAppServiceInteraction.h */, 88AF11DB220B6B3D00A59985 /* SDLPerformAppServiceInteraction.m */, 5D61FB381A84238B00846EE7 /* SDLPerformAudioPassThru.h */, @@ -4350,6 +4363,8 @@ 5D61FBA71A84238B00846EE7 /* SDLShowConstantTBTResponse.m */, 5D61FBA81A84238B00846EE7 /* SDLShowResponse.h */, 5D61FBA91A84238B00846EE7 /* SDLShowResponse.m */, + 7538765122D8D95100FE8484 /* SDLShowAppMenuResponse.h */, + 7538765222D8D95100FE8484 /* SDLShowAppMenuResponse.m */, 5D61FBB01A84238B00846EE7 /* SDLSliderResponse.h */, 5D61FBB11A84238B00846EE7 /* SDLSliderResponse.m */, 5D61FBBA1A84238B00846EE7 /* SDLSpeakResponse.h */, @@ -6352,6 +6367,7 @@ 5D61FC8A1A84238C00846EE7 /* SDLDiagnosticMessageResponse.h in Headers */, 5D61FC2D1A84238C00846EE7 /* SDLAddCommand.h in Headers */, 88B3BF9C20DA8BBC00943565 /* SDLFuelRange.h in Headers */, + 7538765322D8D95100FE8484 /* SDLShowAppMenuResponse.h in Headers */, 5D61FD931A84238C00846EE7 /* SDLShowConstantTBTResponse.h in Headers */, 5DBF06391E64ABBE00A5CF03 /* SDLLogConfiguration.h in Headers */, 5D61FCCB1A84238C00846EE7 /* SDLIgnitionStatus.h in Headers */, @@ -6598,6 +6614,7 @@ 88A5E7F7220B5BBC00495E8A /* SDLGetAppServiceData.h in Headers */, 1E5AD0441F1F5A1F0029B8AF /* SDLRadioControlCapabilities.h in Headers */, 88F65136220C74FD00CAF321 /* SDLWeatherData.h in Headers */, + 7538764F22D8CEDB00FE8484 /* SDLShowAppMenu.h in Headers */, 1E5AD0841F20B9290029B8AF /* SDLButtonPressResponse.h in Headers */, 1E5AD0681F2080B50029B8AF /* SDLRadioControlData.h in Headers */, 1E5AD0481F1F773E0029B8AF /* SDLModuleType.h in Headers */, @@ -7078,6 +7095,7 @@ 8881AFBF2225E9BB00EA870B /* SDLGetCloudAppPropertiesResponse.m in Sources */, 1E5AD0691F2080B50029B8AF /* SDLRadioControlData.m in Sources */, 888F86FE221DEE200052FE4C /* SDLAsynchronousRPCOperation.m in Sources */, + 7538765422D8D95100FE8484 /* SDLShowAppMenuResponse.m in Sources */, 5D61FCC01A84238C00846EE7 /* SDLHexUtility.m in Sources */, 5DB9964F1F26886C002D8795 /* SDLControlFramePayloadEndService.m in Sources */, 5D61FD821A84238C00846EE7 /* SDLSetAppIconResponse.m in Sources */, @@ -7185,6 +7203,7 @@ 5D61FC4E1A84238C00846EE7 /* SDLBitsPerSample.m in Sources */, 5D00AC701F1511B9004000D9 /* SDLGetSystemCapability.m in Sources */, 5D61FDEA1A84238C00846EE7 /* SDLUnsubscribeButtonResponse.m in Sources */, + 7538765022D8CEDB00FE8484 /* SDLShowAppMenu.m in Sources */, 1E5AD05D1F2064A80029B8AF /* SDLRDSData.m in Sources */, 5D61FCA61A84238C00846EE7 /* SDLEndAudioPassThruResponse.m in Sources */, 5D61FD281A84238C00846EE7 /* SDLPerformAudioPassThruResponse.m in Sources */, @@ -7757,6 +7776,7 @@ 162E834C1A9BDE8B00906325 /* SDLAlertResponseSpec.m in Sources */, 1680B11B1A9CD7AD00DBD79E /* SDLFunctionIDSpec.m in Sources */, 5DB1BCDA1D243D85002FFC37 /* SDLStateMachineSpec.m in Sources */, + 7538765622DCAF5400FE8484 /* SDLShowAppMenuSpec.m in Sources */, 8831FA4B2202402B00B8FFB7 /* SDLAppServicesCapabilitiesSpec.m in Sources */, 5D4346731E6F617D00B639C6 /* TestLogTarget.m in Sources */, 1EE8C43C1F347EAE00FDC2CF /* SDLTemperatureUnitSpec.m in Sources */, diff --git a/SmartDeviceLink.podspec b/SmartDeviceLink.podspec index 97fe847b5..9072d9f8b 100644 --- a/SmartDeviceLink.podspec +++ b/SmartDeviceLink.podspec @@ -326,6 +326,8 @@ sdefault.public_header_files = [ 'SmartDeviceLink/SDLSetMediaClockTimer.h', 'SmartDeviceLink/SDLSetMediaClockTimerResponse.h', 'SmartDeviceLink/SDLShow.h', +'SmartDeviceLink/SDLShowAppMenu.h', +'SmartDeviceLink/SDLShowAppMenuResponse.h', 'SmartDeviceLink/SDLShowConstantTBT.h', 'SmartDeviceLink/SDLShowConstantTBTResponse.h', 'SmartDeviceLink/SDLShowResponse.h', diff --git a/SmartDeviceLink/SDLNotificationConstants.h b/SmartDeviceLink/SDLNotificationConstants.h index 2430e1473..1c323b920 100644 --- a/SmartDeviceLink/SDLNotificationConstants.h +++ b/SmartDeviceLink/SDLNotificationConstants.h @@ -161,6 +161,7 @@ extern SDLNotificationName const SDLDidReceiveSetInteriorVehicleDataResponse; extern SDLNotificationName const SDLDidReceiveSetMediaClockTimerResponse; extern SDLNotificationName const SDLDidReceiveShowConstantTBTResponse; extern SDLNotificationName const SDLDidReceiveShowResponse; +extern SDLNotificationName const SDLDidReceiveShowAppMenuResponse; extern SDLNotificationName const SDLDidReceiveSliderResponse; extern SDLNotificationName const SDLDidReceiveSpeakResponse; extern SDLNotificationName const SDLDidReceiveSubscribeButtonResponse; @@ -220,6 +221,7 @@ extern SDLNotificationName const SDLDidReceiveSetGlobalPropertiesRequest; extern SDLNotificationName const SDLDidReceiveSetInteriorVehicleDataRequest; extern SDLNotificationName const SDLDidReceiveSetMediaClockTimerRequest; extern SDLNotificationName const SDLDidReceiveShowRequest; +extern SDLNotificationName const SDLDidReceiveShowAppMenuRequest; extern SDLNotificationName const SDLDidReceiveShowConstantTBTRequest; extern SDLNotificationName const SDLDidReceiveSliderRequest; extern SDLNotificationName const SDLDidReceiveSpeakRequest; diff --git a/SmartDeviceLink/SDLNotificationConstants.m b/SmartDeviceLink/SDLNotificationConstants.m index 9519555a4..0f79a16a5 100644 --- a/SmartDeviceLink/SDLNotificationConstants.m +++ b/SmartDeviceLink/SDLNotificationConstants.m @@ -69,6 +69,7 @@ SDLNotificationName const SDLDidReceiveSetInteriorVehicleDataResponse = @"com.sd SDLNotificationName const SDLDidReceiveSetMediaClockTimerResponse = @"com.sdl.response.setMediaClockTimer"; SDLNotificationName const SDLDidReceiveShowConstantTBTResponse = @"com.sdl.response.showConstantTBT"; SDLNotificationName const SDLDidReceiveShowResponse = @"com.sdl.response.show"; +SDLNotificationName const SDLDidReceiveShowAppMenuResponse = @"com.sdl.response.showAppMenu"; SDLNotificationName const SDLDidReceiveSliderResponse = @"com.sdl.response.slider"; SDLNotificationName const SDLDidReceiveSpeakResponse = @"com.sdl.response.speak"; SDLNotificationName const SDLDidReceiveSubscribeButtonResponse = @"com.sdl.response.subscribeButton"; @@ -125,6 +126,7 @@ SDLNotificationName const SDLDidReceiveSetGlobalPropertiesRequest = @"com.sdl.re SDLNotificationName const SDLDidReceiveSetInteriorVehicleDataRequest = @"com.sdl.request.setInteriorVehicleData"; SDLNotificationName const SDLDidReceiveSetMediaClockTimerRequest = @"com.sdl.request.setMediaClockTimer"; SDLNotificationName const SDLDidReceiveShowRequest = @"com.sdl.request.show"; +SDLNotificationName const SDLDidReceiveShowAppMenuRequest = @"com.sdl.request.showAppMenu"; SDLNotificationName const SDLDidReceiveShowConstantTBTRequest = @"com.sdl.request.showConstantTBT"; SDLNotificationName const SDLDidReceiveSliderRequest = @"com.sdl.request.slider"; SDLNotificationName const SDLDidReceiveSpeakRequest = @"com.sdl.request.speak"; @@ -212,6 +214,7 @@ SDLNotificationName const SDLDidReceiveWaypointNotification = @"com.sdl.notifica SDLDidReceiveSetMediaClockTimerResponse, SDLDidReceiveShowConstantTBTResponse, SDLDidReceiveShowResponse, + SDLDidReceiveShowAppMenuResponse, SDLDidReceiveSliderResponse, SDLDidReceiveSpeakResponse, SDLDidReceiveSubscribeButtonResponse, diff --git a/SmartDeviceLink/SDLNotificationDispatcher.m b/SmartDeviceLink/SDLNotificationDispatcher.m index f5232a194..53d542c52 100644 --- a/SmartDeviceLink/SDLNotificationDispatcher.m +++ b/SmartDeviceLink/SDLNotificationDispatcher.m @@ -275,6 +275,10 @@ NS_ASSUME_NONNULL_BEGIN [self postRPCResponseNotification:SDLDidReceiveShowResponse response:response]; } +- (void)onShowAppMenuResponse:(SDLShowAppMenuResponse *)response { + [self postRPCResponseNotification:SDLDidReceiveShowAppMenuResponse response:response]; +} + - (void)onSliderResponse:(SDLSliderResponse *)response { [self postRPCResponseNotification:SDLDidReceiveSliderResponse response:response]; } @@ -493,6 +497,10 @@ NS_ASSUME_NONNULL_BEGIN [self postRPCRequestNotification:SDLDidReceiveShowRequest request:request]; } +- (void)onShowAppMenu:(SDLShowAppMenu *)request { + [self postRPCRequestNotification:SDLDidReceiveShowAppMenuRequest request:request]; +} + - (void)onShowConstantTBT:(SDLShowConstantTBT *)request { [self postRPCRequestNotification:SDLDidReceiveShowConstantTBTRequest request:request]; } diff --git a/SmartDeviceLink/SDLProxyListener.h b/SmartDeviceLink/SDLProxyListener.h index ea19fde07..e5bb306ba 100644 --- a/SmartDeviceLink/SDLProxyListener.h +++ b/SmartDeviceLink/SDLProxyListener.h @@ -112,6 +112,8 @@ @class SDLSetMediaClockTimer; @class SDLSetMediaClockTimerResponse; @class SDLShow; +@class SDLShowAppMenu; +@class SDLShowAppMenuResponse; @class SDLShowConstantTBT; @class SDLShowConstantTBTResponse; @class SDLShowResponse; @@ -494,6 +496,13 @@ NS_ASSUME_NONNULL_BEGIN - (void)onShowResponse:(SDLShowResponse *)response; /** + * Called when a ShowAppMenu Response is received from Core + * + * @param response A SDLShowAppMenuResponse object + */ +- (void)onShowAppMenuResponse:(SDLShowAppMenuResponse *)response; + +/** * Called when a Slider Response is received from Core * * @param response A SDLSliderResponse object @@ -874,6 +883,13 @@ NS_ASSUME_NONNULL_BEGIN - (void)onShow:(SDLShow *)request; /** + * Called when a `ShowAppMenu` is received from Core + * + * @param request A SDLShowAppMenu object + */ +- (void)onShowAppMenu:(SDLShowAppMenu *)request; + +/** * Called when a `ShowConstantTBT` request is received from Core * * @param request A SDLShowConstantTBT object diff --git a/SmartDeviceLink/SDLRPCFunctionNames.h b/SmartDeviceLink/SDLRPCFunctionNames.h index 1693d773c..aa2d4b6f7 100644 --- a/SmartDeviceLink/SDLRPCFunctionNames.h +++ b/SmartDeviceLink/SDLRPCFunctionNames.h @@ -81,6 +81,7 @@ extern SDLRPCFunctionName const SDLRPCFunctionNameSetGlobalProperties; extern SDLRPCFunctionName const SDLRPCFunctionNameSetInteriorVehicleData; extern SDLRPCFunctionName const SDLRPCFunctionNameSetMediaClockTimer; extern SDLRPCFunctionName const SDLRPCFunctionNameShow; +extern SDLRPCFunctionName const SDLRPCFunctionNameShowAppMenu; extern SDLRPCFunctionName const SDLRPCFunctionNameShowConstantTBT; extern SDLRPCFunctionName const SDLRPCFunctionNameSlider; extern SDLRPCFunctionName const SDLRPCFunctionNameSpeak; diff --git a/SmartDeviceLink/SDLRPCFunctionNames.m b/SmartDeviceLink/SDLRPCFunctionNames.m index 879ae943b..54c8ae890 100644 --- a/SmartDeviceLink/SDLRPCFunctionNames.m +++ b/SmartDeviceLink/SDLRPCFunctionNames.m @@ -76,6 +76,7 @@ SDLRPCFunctionName const SDLRPCFunctionNameSetGlobalProperties = @"SetGlobalProp SDLRPCFunctionName const SDLRPCFunctionNameSetInteriorVehicleData = @"SetInteriorVehicleData"; SDLRPCFunctionName const SDLRPCFunctionNameSetMediaClockTimer = @"SetMediaClockTimer"; SDLRPCFunctionName const SDLRPCFunctionNameShow = @"Show"; +SDLRPCFunctionName const SDLRPCFunctionNameShowAppMenu = @"ShowAppMenu"; SDLRPCFunctionName const SDLRPCFunctionNameShowConstantTBT = @"ShowConstantTBT"; SDLRPCFunctionName const SDLRPCFunctionNameSlider = @"Slider"; SDLRPCFunctionName const SDLRPCFunctionNameSpeak = @"Speak"; diff --git a/SmartDeviceLink/SDLShowAppMenu.h b/SmartDeviceLink/SDLShowAppMenu.h new file mode 100644 index 000000000..c8263097d --- /dev/null +++ b/SmartDeviceLink/SDLShowAppMenu.h @@ -0,0 +1,25 @@ +// +// SDLOpenMenu.h +// SmartDeviceLink +// +// Created by Justin Gluck on 7/12/19. +// Copyright © 2019 smartdevicelink. All rights reserved. +// + +#import "SDLRPCRequest.h" + +NS_ASSUME_NONNULL_BEGIN + +/** + * Used by an app typically of navigation type to show the apps menu. + */ +@interface SDLShowAppMenu : SDLRPCRequest + +/** + * a Menu ID that identifies the sub menu to open. If not set the top level menu will be opened. + */ +@property (nullable, strong, nonatomic) NSNumber<SDLInt> *menuID; + +@end + +NS_ASSUME_NONNULL_END diff --git a/SmartDeviceLink/SDLShowAppMenu.m b/SmartDeviceLink/SDLShowAppMenu.m new file mode 100644 index 000000000..92a45c4ba --- /dev/null +++ b/SmartDeviceLink/SDLShowAppMenu.m @@ -0,0 +1,38 @@ +// +// SDLOpenMenu.m +// SmartDeviceLink +// +// Created by Justin Gluck on 7/12/19. +// Copyright © 2019 smartdevicelink. All rights reserved. +// + +#import "SDLShowAppMenu.h" +#import "NSMutableDictionary+Store.h" +#import "SDLRPCParameterNames.h" +#import "SDLRPCFunctionNames.h" + +NS_ASSUME_NONNULL_BEGIN + +@implementation SDLShowAppMenu + +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-declarations" +- (instancetype)init { + if (self = [super initWithName:SDLRPCFunctionNameShowAppMenu]) { + } + return self; +} +#pragma clang diagnostic pop + +- (void)setMenuID:(nullable NSNumber<SDLInt> *)menuID { + [self.parameters sdl_setObject:menuID forName:SDLRPCParameterNameMenuId]; +} + +- (nullable NSNumber<SDLInt> *)menuID { + NSError *error = nil; + return [self.parameters sdl_objectForName:SDLRPCParameterNameMenuId ofClass:NSNumber.class error:&error]; +} + +@end + +NS_ASSUME_NONNULL_END diff --git a/SmartDeviceLink/SDLShowAppMenuResponse.h b/SmartDeviceLink/SDLShowAppMenuResponse.h new file mode 100644 index 000000000..d5acd4c34 --- /dev/null +++ b/SmartDeviceLink/SDLShowAppMenuResponse.h @@ -0,0 +1,20 @@ +// +// SDLOpenMenuResponse.h +// SmartDeviceLink +// +// Created by Justin Gluck on 7/12/19. +// Copyright © 2019 smartdevicelink. All rights reserved. +// + +#import "SDLRPCResponse.h" + +NS_ASSUME_NONNULL_BEGIN + +/** + * Response to the request to show the app menu. + */ +@interface SDLShowAppMenuResponse : SDLRPCResponse + +@end + +NS_ASSUME_NONNULL_END diff --git a/SmartDeviceLink/SDLShowAppMenuResponse.m b/SmartDeviceLink/SDLShowAppMenuResponse.m new file mode 100644 index 000000000..281079e7b --- /dev/null +++ b/SmartDeviceLink/SDLShowAppMenuResponse.m @@ -0,0 +1,23 @@ +// +// SDLOpenMenuResponse.m +// SmartDeviceLink +// +// Created by Justin Gluck on 7/12/19. +// Copyright © 2019 smartdevicelink. All rights reserved. +// + +#import "SDLShowAppMenuResponse.h" +#import "SDLRPCFunctionNames.h" + +@implementation SDLShowAppMenuResponse + +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-declarations" +- (instancetype)init { + if (self = [super initWithName:SDLRPCFunctionNameShowAppMenu]) { + } + return self; +} +#pragma clang diagnostic pop + +@end diff --git a/SmartDeviceLink/SmartDeviceLink.h b/SmartDeviceLink/SmartDeviceLink.h index 3b884804f..17805204a 100644 --- a/SmartDeviceLink/SmartDeviceLink.h +++ b/SmartDeviceLink/SmartDeviceLink.h @@ -62,6 +62,7 @@ FOUNDATION_EXPORT const unsigned char SmartDeviceLinkVersionString[]; #import "SDLSetInteriorVehicleData.h" #import "SDLSetMediaClockTimer.h" #import "SDLShow.h" +#import "SDLShowAppMenu.h" #import "SDLShowConstantTBT.h" #import "SDLSlider.h" #import "SDLSpeak.h" @@ -122,6 +123,7 @@ FOUNDATION_EXPORT const unsigned char SmartDeviceLinkVersionString[]; #import "SDLSetMediaClockTimerResponse.h" #import "SDLShowConstantTBTResponse.h" #import "SDLShowResponse.h" +#import "SDLShowAppMenuResponse.h" #import "SDLSliderResponse.h" #import "SDLSpeakResponse.h" #import "SDLSubscribeButtonResponse.h" diff --git a/SmartDeviceLinkTests/Notifications/SDLNotificationDispatcherSpec.m b/SmartDeviceLinkTests/Notifications/SDLNotificationDispatcherSpec.m index 5b3f87212..cfa34340d 100644 --- a/SmartDeviceLinkTests/Notifications/SDLNotificationDispatcherSpec.m +++ b/SmartDeviceLinkTests/Notifications/SDLNotificationDispatcherSpec.m @@ -69,6 +69,7 @@ describe(@"a notification dispatcher", ^{ expect(@([testDispatcher respondsToSelector:@selector(onSetMediaClockTimerResponse:)])).to(beTruthy()); expect(@([testDispatcher respondsToSelector:@selector(onShowConstantTBTResponse:)])).to(beTruthy()); expect(@([testDispatcher respondsToSelector:@selector(onShowResponse:)])).to(beTruthy()); + expect(@([testDispatcher respondsToSelector:@selector(onShowAppMenuResponse:)])).to(beTruthy()); expect(@([testDispatcher respondsToSelector:@selector(onSliderResponse:)])).to(beTruthy()); expect(@([testDispatcher respondsToSelector:@selector(onSpeakResponse:)])).to(beTruthy()); expect(@([testDispatcher respondsToSelector:@selector(onSubscribeButtonResponse:)])).to(beTruthy()); @@ -122,6 +123,7 @@ describe(@"a notification dispatcher", ^{ expect(@([testDispatcher respondsToSelector:@selector(onSetInteriorVehicleData:)])).to(beTruthy()); expect(@([testDispatcher respondsToSelector:@selector(onSetMediaClockTimer:)])).to(beTruthy()); expect(@([testDispatcher respondsToSelector:@selector(onShow:)])).to(beTruthy()); + expect(@([testDispatcher respondsToSelector:@selector(onShowAppMenu:)])).to(beTruthy()); expect(@([testDispatcher respondsToSelector:@selector(onShowConstantTBT:)])).to(beTruthy()); expect(@([testDispatcher respondsToSelector:@selector(onSlider:)])).to(beTruthy()); expect(@([testDispatcher respondsToSelector:@selector(onSpeak:)])).to(beTruthy()); diff --git a/SmartDeviceLinkTests/RPCSpecs/RequestSpecs/SDLShowAppMenuSpec.m b/SmartDeviceLinkTests/RPCSpecs/RequestSpecs/SDLShowAppMenuSpec.m new file mode 100644 index 000000000..4f640b2da --- /dev/null +++ b/SmartDeviceLinkTests/RPCSpecs/RequestSpecs/SDLShowAppMenuSpec.m @@ -0,0 +1,50 @@ +// +// SDLShowAppMenuSpec.m +// SmartDeviceLinkTests +// +// Created by Justin Gluck on 7/15/19. +// Copyright © 2019 smartdevicelink. All rights reserved. +// + +#import <Foundation/Foundation.h> + +#import <Quick/Quick.h> +#import <Nimble/Nimble.h> + +#import "SDLRPCParameterNames.h" +#import "SDLRPCFunctionNames.h" +#import "SDLShowAppMenu.h" + +QuickSpecBegin(SDLShowAppMenuSpec) +describe(@"Getter/Setter Tests", ^ { + __block UInt32 menuId = 4345645; + + it(@"Should set and get correctly", ^ { + SDLShowAppMenu *testRequest = [[SDLShowAppMenu alloc] init]; + + testRequest.menuID = @(menuId); + + expect(testRequest.menuID).to(equal(testRequest.menuID)); + }); + + it(@"Should get correctly when initialized with dictonary", ^ { + NSMutableDictionary<NSString *, id> *dict = [@{SDLRPCParameterNameRequest: + @{SDLRPCParameterNameParameters: + @{SDLRPCParameterNameMenuId:@4345645, + }, + SDLRPCParameterNameOperationName:SDLRPCFunctionNameShowAppMenu}} mutableCopy]; +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-declarations" + SDLShowAppMenu* testRequest = [[SDLShowAppMenu alloc] initWithDictionary:dict]; +#pragma clang diagnostic pop + expect(testRequest.menuID).to(equal(@(menuId))); + }); + + it(@"Should return nil if not set", ^ { + SDLShowAppMenu *testRequest = [[SDLShowAppMenu alloc] init]; + + expect(testRequest.menuID).to(beNil()); + }); + +}); +QuickSpecEnd |