diff options
author | BrettyWhite <geekman3454@protonmail.com> | 2019-07-18 14:54:43 -0400 |
---|---|---|
committer | BrettyWhite <geekman3454@protonmail.com> | 2019-07-18 14:54:43 -0400 |
commit | 0234630449df3b469e8679792649a2d6fb6e42f7 (patch) | |
tree | 15ebddf896a237445bc42d16441765a6fe64f403 | |
parent | cb448da8a33ef05dcd113fb84358ea454e3c236a (diff) | |
download | sdl_android-0234630449df3b469e8679792649a2d6fb6e42f7.tar.gz |
update setGlobalProperties
3 files changed, 66 insertions, 36 deletions
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/Test.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/Test.java index 110e5f1e6..d1c1df170 100644 --- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/Test.java +++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/Test.java @@ -400,6 +400,7 @@ public class Test { public static final LightControlData GENERAL_LIGHTCONTROLDATA = new LightControlData(); public static final HMISettingsControlData GENERAL_HMISETTINGSCONTROLDATA = new HMISettingsControlData(); public static final SdlArtwork GENERAL_ARTWORK = new SdlArtwork("sdl", FileType.GRAPHIC_PNG, R.drawable.ic_sdl, false); + public static final MenuLayout GENERAL_MENU_LAYOUT = MenuLayout.LIST; public static final HMICapabilities GENERAL_HMICAPABILITIES = new HMICapabilities(); diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/SetGlobalPropertiesTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/SetGlobalPropertiesTests.java index 969ae9522..1ca333e73 100644 --- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/SetGlobalPropertiesTests.java +++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/SetGlobalPropertiesTests.java @@ -8,6 +8,7 @@ import com.smartdevicelink.proxy.rpc.KeyboardProperties; import com.smartdevicelink.proxy.rpc.SetGlobalProperties; import com.smartdevicelink.proxy.rpc.TTSChunk; import com.smartdevicelink.proxy.rpc.VrHelpItem; +import com.smartdevicelink.proxy.rpc.enums.MenuLayout; import com.smartdevicelink.test.BaseRpcTests; import com.smartdevicelink.test.JsonUtils; import com.smartdevicelink.test.Test; @@ -24,7 +25,7 @@ import java.util.List; /** * This is a unit test class for the SmartDeviceLink library project class : - * {@link com.smartdevicelink.rpc.SetGlobalProperties} + * {@link com.smartdevicelink.proxy.rpc.SetGlobalProperties} */ public class SetGlobalPropertiesTests extends BaseRpcTests { @@ -39,6 +40,7 @@ public class SetGlobalPropertiesTests extends BaseRpcTests { msg.setHelpPrompt(Test.GENERAL_TTSCHUNK_LIST); msg.setTimeoutPrompt(Test.GENERAL_TTSCHUNK_LIST); msg.setKeyboardProperties(Test.GENERAL_KEYBOARDPROPERTIES); + msg.setMenuLayout(Test.GENERAL_MENU_LAYOUT); return msg; } @@ -64,7 +66,8 @@ public class SetGlobalPropertiesTests extends BaseRpcTests { result.put(SetGlobalProperties.KEY_TIMEOUT_PROMPT, Test.JSON_TTSCHUNKS); result.put(SetGlobalProperties.KEY_MENU_TITLE, Test.GENERAL_STRING); result.put(SetGlobalProperties.KEY_VR_HELP_TITLE, Test.GENERAL_STRING); - result.put(SetGlobalProperties.KEY_KEYBOARD_PROPERTIES, Test.JSON_KEYBOARDPROPERTIES); + result.put(SetGlobalProperties.KEY_KEYBOARD_PROPERTIES, Test.JSON_KEYBOARDPROPERTIES); + result.put(SetGlobalProperties.KEY_MENU_LAYOUT, Test.GENERAL_MENU_LAYOUT); } catch (JSONException e) { fail(Test.JSON_FAIL); } @@ -84,6 +87,7 @@ public class SetGlobalPropertiesTests extends BaseRpcTests { List<TTSChunk> testTimeout = ( (SetGlobalProperties) msg ).getTimeoutPrompt(); List<VrHelpItem> testVrHelpItems = ( (SetGlobalProperties) msg ).getVrHelp(); KeyboardProperties testKeyboardProperties = ( (SetGlobalProperties) msg ).getKeyboardProperties(); + MenuLayout testMenuLayout = ( (SetGlobalProperties) msg ).getMenuLayout(); // Valid Tests assertEquals(Test.MATCH, Test.GENERAL_STRING, testMenuTitle); @@ -93,6 +97,7 @@ public class SetGlobalPropertiesTests extends BaseRpcTests { assertTrue(Test.TRUE, Validator.validateTtsChunks(Test.GENERAL_TTSCHUNK_LIST, testHelpPrompt)); assertTrue(Test.TRUE, Validator.validateTtsChunks(Test.GENERAL_TTSCHUNK_LIST, testTimeout)); assertTrue(Test.TRUE, Validator.validateKeyboardProperties(Test.GENERAL_KEYBOARDPROPERTIES, testKeyboardProperties)); + assertEquals(Test.MATCH, Test.GENERAL_MENU_LAYOUT, testMenuLayout); // Invalid/Null Tests SetGlobalProperties msg = new SetGlobalProperties(); @@ -106,6 +111,7 @@ public class SetGlobalPropertiesTests extends BaseRpcTests { assertNull(Test.NULL, msg.getTimeoutPrompt()); assertNull(Test.NULL, msg.getKeyboardProperties()); assertNull(Test.NULL, msg.getVrHelpTitle()); + assertNull(Test.NULL, msg.getMenuLayout()); } /** @@ -129,6 +135,8 @@ public class SetGlobalPropertiesTests extends BaseRpcTests { JSONObject parameters = JsonUtils.readJsonObjectFromJsonObject(body, RPCMessage.KEY_PARAMETERS); assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(parameters, SetGlobalProperties.KEY_VR_HELP_TITLE), cmd.getVrHelpTitle()); assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(parameters, SetGlobalProperties.KEY_MENU_TITLE), cmd.getMenuTitle()); + + assertEquals(Test.MATCH, JsonUtils.readObjectFromJsonObject(parameters, SetGlobalProperties.KEY_MENU_LAYOUT), cmd.getMenuLayout()); JSONObject menuIcon = JsonUtils.readJsonObjectFromJsonObject(parameters, SetGlobalProperties.KEY_MENU_ICON); Image referenceMenuIcon = new Image(JsonRPCMarshaller.deserializeJSONObject(menuIcon)); diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/SetGlobalProperties.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/SetGlobalProperties.java index 62aca4657..bf5bcd2df 100644 --- a/base/src/main/java/com/smartdevicelink/proxy/rpc/SetGlobalProperties.java +++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/SetGlobalProperties.java @@ -1,38 +1,39 @@ -/* - * Copyright (c) 2017 - 2019, SmartDeviceLink Consortium, Inc. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the SmartDeviceLink Consortium, Inc. nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ +/*
+ * Copyright (c) 2017 - 2019, SmartDeviceLink Consortium, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the SmartDeviceLink Consortium, Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
package com.smartdevicelink.proxy.rpc;
import com.smartdevicelink.protocol.enums.FunctionID;
import com.smartdevicelink.proxy.RPCRequest;
+import com.smartdevicelink.proxy.rpc.enums.MenuLayout;
import java.util.Hashtable;
import java.util.List;
@@ -87,7 +88,7 @@ import java.util.List; * </tr>
* <tr>
* <td>vrHelp</td>
- * <td>VrHelep</td>
+ * <td>VrHelp</td>
* <td>Items listed in the VR help screen used in an interaction started by PTT.</td>
* <td>N</td>
* <td>If omitted on supported displays, the default SDL VR help / What Can I Say? screen will be used<p>If the list of VR Help Items contains nonsequential positions (e.g. [1,2,4]), the RPC will be rejected.</p><p>If omitted and a vrHelpTitle is provided, the request will be rejected.</p>minsize:1; maxsize: 100 </td>
@@ -112,7 +113,7 @@ import java.util.List; * <tr>
* <td>keyboardProperties</td>
* <td>KeyboardProperties</td>
- * <td>On-screen keybaord configuration (if available).</td>
+ * <td>On-screen keyboard configuration (if available).</td>
* <td>N</td>
* <td></td>
* <td>SmartDeviceLink 1.0</td>
@@ -144,6 +145,7 @@ public class SetGlobalProperties extends RPCRequest { public static final String KEY_HELP_PROMPT = "helpPrompt";
public static final String KEY_TIMEOUT_PROMPT = "timeoutPrompt";
public static final String KEY_VR_HELP = "vrHelp";
+ public static final String KEY_MENU_LAYOUT = "menuLayout";
/**
* Constructs a new SetGlobalProperties object
*/
@@ -305,6 +307,25 @@ public class SetGlobalProperties extends RPCRequest { @SuppressWarnings("unchecked")
public KeyboardProperties getKeyboardProperties() {
return (KeyboardProperties) getObject(KeyboardProperties.class, KEY_KEYBOARD_PROPERTIES);
- }
+ }
+
+ /**
+ * Sets the layout of the main menu screen. If this is sent while a menu is already on-screen,
+ * the head unit will change the display to the new layout type.
+ * @param menuLayout - the menuLayout
+ */
+ public void setMenuLayout(MenuLayout menuLayout) {
+ setParameters(KEY_MENU_LAYOUT, menuLayout);
+ }
+
+ /**
+ * Sets the layout of the main menu screen. If this is sent while a menu is already on-screen,
+ * the head unit will change the display to the new layout type.
+ * @return the MenuLayout
+ */
+ @SuppressWarnings("unchecked")
+ public MenuLayout getMenuLayout() {
+ return (MenuLayout) getObject(MenuLayout.class, KEY_MENU_LAYOUT);
+ }
}
|