diff options
author | Bilal Alsharifi <bilal.alsharifi@gmail.com> | 2020-08-13 15:27:08 -0400 |
---|---|---|
committer | Bilal Alsharifi <bilal.alsharifi@gmail.com> | 2020-08-13 15:27:08 -0400 |
commit | 8dbe34956482143bcafcdc0df59bccbf706d398e (patch) | |
tree | 00687db245a9a956c0c14dcffbbc768b7118413e /base/src/main/java/com/smartdevicelink | |
parent | db70724be0114674dd0cc814e7ec47a81af9025b (diff) | |
parent | 9a1a356160e0d994349306da87b448e881159195 (diff) | |
download | sdl_android-8dbe34956482143bcafcdc0df59bccbf706d398e.tar.gz |
Merge branch 'develop' into feature/issue_1446_remove_deprecated_rpcs
# Conflicts:
# base/src/main/java/com/smartdevicelink/protocol/enums/FunctionID.java
Diffstat (limited to 'base/src/main/java/com/smartdevicelink')
7 files changed, 463 insertions, 4 deletions
diff --git a/base/src/main/java/com/smartdevicelink/protocol/enums/FunctionID.java b/base/src/main/java/com/smartdevicelink/protocol/enums/FunctionID.java index 69bd06f1e..5c2d92ece 100644 --- a/base/src/main/java/com/smartdevicelink/protocol/enums/FunctionID.java +++ b/base/src/main/java/com/smartdevicelink/protocol/enums/FunctionID.java @@ -110,6 +110,7 @@ public enum FunctionID{ DELETE_WINDOW(61, "DeleteWindow"),
GET_INTERIOR_VEHICLE_DATA_CONSENT(62, "GetInteriorVehicleDataConsent"),
RELEASE_INTERIOR_VEHICLE_MODULE(63, "ReleaseInteriorVehicleDataModule"),
+ SUBTLE_ALERT(64, "SubtleAlert"),
// NOTIFICATIONS
ON_HMI_STATUS(32768, "OnHMIStatus"),
ON_APP_INTERFACE_UNREGISTERED(32769, "OnAppInterfaceUnregistered"),
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/CancelInteraction.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/CancelInteraction.java index 7df082734..9016458a6 100644 --- a/base/src/main/java/com/smartdevicelink/proxy/rpc/CancelInteraction.java +++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/CancelInteraction.java @@ -91,8 +91,8 @@ public class CancelInteraction extends RPCRequest { // Custom Getters / Setters /** - * The ID of the type of interaction to dismiss. - * Only values 10 (PerformInteractionID), 12 (AlertID), 25 (ScrollableMessageID), and 26 (SliderID) are permitted. + * Gets the ID of the type of interaction the developer wants to dismiss. + * Only values 10 (PerformInteractionID), 12 (AlertID), 25 (ScrollableMessageID), 26 (SliderID), and 64 (SubtleAlertID) are permitted. * @return - the functionID */ public Integer getInteractionFunctionID() { @@ -100,8 +100,8 @@ public class CancelInteraction extends RPCRequest { } /** - * The ID of the type of interaction to dismiss. - * Only values 10 (PerformInteractionID), 12 (AlertID), 25 (ScrollableMessageID), and 26 (SliderID) are permitted. + * Sets the ID of the type of interaction the developer wants to dismiss. + * Only values 10 (PerformInteractionID), 12 (AlertID), 25 (ScrollableMessageID), 26 (SliderID), and 64 (SubtleAlertID) are permitted. * @param functionID - the functionID */ public void setInteractionFunctionID(@NonNull Integer functionID) { diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/OnSubtleAlertPressed.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/OnSubtleAlertPressed.java new file mode 100644 index 000000000..6715cd0c6 --- /dev/null +++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/OnSubtleAlertPressed.java @@ -0,0 +1,62 @@ +/* + * Copyright (c) 2020 Livio, 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 Livio 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.RPCNotification; + +import java.util.Hashtable; + +/** + * Sent when the alert itself is touched (outside of a soft button). Touching (or otherwise + * selecting) the alert should open the app before sending this notification. + * + * @since SmartDeviceLink 7.0.0 + */ +public class OnSubtleAlertPressed extends RPCNotification { + + /** + * Constructs a new OnSubtleAlertPressed object + */ + public OnSubtleAlertPressed() { + super(FunctionID.ON_SUBTLE_ALERT_PRESSED.toString()); + } + + /** + * Constructs a new OnSubtleAlertPressed object indicated by the Hashtable parameter + * + * @param hash The Hashtable to use + */ + public OnSubtleAlertPressed(Hashtable<String, Object> hash) { + super(hash); + } +} diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/SubtleAlert.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/SubtleAlert.java new file mode 100644 index 000000000..42752ff8d --- /dev/null +++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/SubtleAlert.java @@ -0,0 +1,275 @@ +/* + * Copyright (c) 2020 Livio, 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 Livio 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 java.util.Hashtable; +import java.util.List; + +/** + * Shows an alert which typically consists of text-to-speech message and text on the display. + * At least either alertText1, alertText2 or ttsChunks need to be provided. + * + * <p><b>Parameter List</b></p> + * + * <table border="1" rules="all"> + * <tr> + * <th>Param Name</th> + * <th>Type</th> + * <th>Description</th> + * <th>Required</th> + * <th>Notes</th> + * <th>Version Available</th> + * </tr> + * <tr> + * <td>alertText1</td> + * <td>String</td> + * <td>The first line of the alert text field</td> + * <td>N</td> + * <td>Max Value: 500</td> + * <td></td> + * </tr> + * <tr> + * <td>alertText2</td> + * <td>String</td> + * <td>The second line of the alert text field</td> + * <td>N</td> + * <td>Max Value: 500</td> + * <td></td> + * </tr> + * <tr> + * <td>alertIcon</td> + * <td>Image</td> + * <td>Image to be displayed for the corresponding alert. See Image. If omitted on supported displays, no (or the default if applicable) icon should be displayed.</td> + * <td>N</td> + * <td></td> + * <td></td> + * </tr> + * <tr> + * <td>ttsChunks</td> + * <td>List<TTSChunk></td> + * <td>An array of text chunks of type TTSChunk. See TTSChunk. The array must have at least oneitem.</td> + * <td>N</td> + * <td>Min Value: 1; Max Value: 100</td> + * <td></td> + * </tr> + * <tr> + * <td>duration</td> + * <td>Integer</td> + * <td>Timeout in milliseconds. Typical timeouts are 3-5 seconds. If omitted, timeout is set to5s.</td> + * <td>N</td> + * <td>Min Value: 3000; Max Value: 10000; Default Value: 5000</td> + * <td></td> + * </tr> + * <tr> + * <td>softButtons</td> + * <td>List<SoftButton></td> + * <td>App defined SoftButtons. If omitted on supported displays, the displayed alert shall nothave any SoftButtons.</td> + * <td>N</td> + * <td>Min Value: 0; Max Value: 2</td> + * <td></td> + * </tr> + * <tr> + * <td>cancelID</td> + * <td>Integer</td> + * <td>An ID for this specific alert to allow cancellation through the `CancelInteraction` RPC.</td> + * <td>N</td> + * <td></td> + * <td></td> + * </tr> + * </table> + * + * @since SmartDeviceLink 7.0.0 + */ +public class SubtleAlert extends RPCRequest { + public static final String KEY_ALERT_TEXT_1 = "alertText1"; + public static final String KEY_ALERT_TEXT_2 = "alertText2"; + public static final String KEY_ALERT_ICON = "alertIcon"; + public static final String KEY_TTS_CHUNKS = "ttsChunks"; + public static final String KEY_DURATION = "duration"; + public static final String KEY_SOFT_BUTTONS = "softButtons"; + public static final String KEY_CANCEL_ID = "cancelID"; + + /** + * Constructs a new SubtleAlert object + */ + public SubtleAlert() { + super(FunctionID.SUBTLE_ALERT.toString()); + } + + /** + * Constructs a new SubtleAlert object indicated by the Hashtable parameter + * + * @param hash The Hashtable to use + */ + public SubtleAlert(Hashtable<String, Object> hash) { + super(hash); + } + + /** + * Sets the alertText1. + * + * @param alertText1 The first line of the alert text field + */ + public void setAlertText1(String alertText1) { + setParameters(KEY_ALERT_TEXT_1, alertText1); + } + + /** + * Gets the alertText1. + * + * @return String The first line of the alert text field + */ + public String getAlertText1() { + return getString(KEY_ALERT_TEXT_1); + } + + /** + * Sets the alertText2. + * + * @param alertText2 The second line of the alert text field + */ + public void setAlertText2(String alertText2) { + setParameters(KEY_ALERT_TEXT_2, alertText2); + } + + /** + * Gets the alertText2. + * + * @return String The second line of the alert text field + */ + public String getAlertText2() { + return getString(KEY_ALERT_TEXT_2); + } + + /** + * Sets the alertIcon. + * + * @param alertIcon Image to be displayed for the corresponding alert. See Image. If omitted on supported + * displays, no (or the default if applicable) icon should be displayed. + */ + public void setAlertIcon(Image alertIcon) { + setParameters(KEY_ALERT_ICON, alertIcon); + } + + /** + * Gets the alertIcon. + * + * @return Image Image to be displayed for the corresponding alert. See Image. If omitted on supported + * displays, no (or the default if applicable) icon should be displayed. + */ + public Image getAlertIcon() { + return (Image) getObject(Image.class, KEY_ALERT_ICON); + } + + /** + * Sets the ttsChunks. + * + * @param ttsChunks An array of text chunks of type TTSChunk. See TTSChunk. The array must have at least one + * item. + */ + public void setTtsChunks(List<TTSChunk> ttsChunks) { + setParameters(KEY_TTS_CHUNKS, ttsChunks); + } + + /** + * Gets the ttsChunks. + * + * @return List<TTSChunk> An array of text chunks of type TTSChunk. See TTSChunk. The array must have at least one + * item. + */ + @SuppressWarnings("unchecked") + public List<TTSChunk> getTtsChunks() { + return (List<TTSChunk>) getObject(TTSChunk.class, KEY_TTS_CHUNKS); + } + + /** + * Sets the duration. + * + * @param duration Timeout in milliseconds. Typical timeouts are 3-5 seconds. If omitted, timeout is set to + * 5s. + */ + public void setDuration(Integer duration) { + setParameters(KEY_DURATION, duration); + } + + /** + * Gets the duration. + * + * @return Integer Timeout in milliseconds. Typical timeouts are 3-5 seconds. If omitted, timeout is set to + * 5s. + */ + public Integer getDuration() { + return getInteger(KEY_DURATION); + } + + /** + * Sets the softButtons. + * + * @param softButtons App defined SoftButtons. If omitted on supported displays, the displayed alert shall not + * have any SoftButtons. + */ + public void setSoftButtons(List<SoftButton> softButtons) { + setParameters(KEY_SOFT_BUTTONS, softButtons); + } + + /** + * Gets the softButtons. + * + * @return List<SoftButton> App defined SoftButtons. If omitted on supported displays, the displayed alert shall not + * have any SoftButtons. + */ + @SuppressWarnings("unchecked") + public List<SoftButton> getSoftButtons() { + return (List<SoftButton>) getObject(SoftButton.class, KEY_SOFT_BUTTONS); + } + + /** + * Sets the cancelID. + * + * @param cancelID An ID for this specific alert to allow cancellation through the `CancelInteraction` RPC. + */ + public void setCancelID(Integer cancelID) { + setParameters(KEY_CANCEL_ID, cancelID); + } + + /** + * Gets the cancelID. + * + * @return Integer An ID for this specific alert to allow cancellation through the `CancelInteraction` RPC. + */ + public Integer getCancelID() { + return getInteger(KEY_CANCEL_ID); + } +} diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/SubtleAlertResponse.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/SubtleAlertResponse.java new file mode 100644 index 000000000..a15dbe13b --- /dev/null +++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/SubtleAlertResponse.java @@ -0,0 +1,97 @@ +/* + * Copyright (c) 2020 Livio, 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 Livio 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 androidx.annotation.NonNull; + +import com.smartdevicelink.protocol.enums.FunctionID; +import com.smartdevicelink.proxy.RPCResponse; +import com.smartdevicelink.proxy.rpc.enums.Result; + +import java.util.Hashtable; + +/** + * @since SmartDeviceLink 7.0.0 + */ +public class SubtleAlertResponse extends RPCResponse { + public static final String KEY_TRY_AGAIN_TIME = "tryAgainTime"; + + /** + * Constructs a new SubtleAlertResponse object + */ + public SubtleAlertResponse() { + super(FunctionID.SUBTLE_ALERT.toString()); + } + + /** + * Constructs a new SubtleAlertResponse object indicated by the Hashtable parameter + * + * @param hash The Hashtable to use + */ + public SubtleAlertResponse(Hashtable<String, Object> hash) { + super(hash); + } + + /** + * Constructs a new SubtleAlertResponse object + * + * @param success whether the request is successfully processed + * @param resultCode additional information about a response returning a failed outcome + */ + public SubtleAlertResponse(@NonNull Boolean success, @NonNull Result resultCode) { + this(); + setSuccess(success); + setResultCode(resultCode); + } + + /** + * Sets the tryAgainTime. + * + * @param tryAgainTime Amount of time (in milliseconds) that an app must wait before resending an alert. + * If provided, another system event or overlay currently has a higher priority than this alert. + * An app must not send an alert without waiting at least the amount of time dictated. + */ + public void setTryAgainTime(Integer tryAgainTime) { + setParameters(KEY_TRY_AGAIN_TIME, tryAgainTime); + } + + /** + * Gets the tryAgainTime. + * + * @return Integer Amount of time (in milliseconds) that an app must wait before resending an alert. + * If provided, another system event or overlay currently has a higher priority than this alert. + * An app must not send an alert without waiting at least the amount of time dictated. + */ + public Integer getTryAgainTime() { + return getInteger(KEY_TRY_AGAIN_TIME); + } +} diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/ImageFieldName.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/ImageFieldName.java index 9c7aa2722..cc5572ef2 100644 --- a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/ImageFieldName.java +++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/ImageFieldName.java @@ -109,6 +109,12 @@ public enum ImageFieldName { * @since SmartDeviceLink 6.0.0
*/
alertIcon,
+ /**
+ * The image of the subtle alert; applies to `SubtleAlert` `alertIcon`
+ *
+ * @since SmartDeviceLink 7.0.0
+ */
+ subtleAlertIcon
;
/**
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/TextFieldName.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/TextFieldName.java index a8fe4bd38..cf33b73e0 100644 --- a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/TextFieldName.java +++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/TextFieldName.java @@ -186,6 +186,24 @@ public enum TextFieldName { * @since SmartDeviceLink 6.0
*/
templateTitle,
+ /**
+ * The first line of the subtle alert text field; applies to `SubtleAlert` `alertText1`
+ *
+ * @since SmartDeviceLink 7.0.0
+ */
+ subtleAlertText1,
+ /**
+ * The second line of the subtle alert text field; applies to `SubtleAlert` `alertText2`
+ *
+ * @since SmartDeviceLink 7.0.0
+ */
+ subtleAlertText2,
+ /**
+ * A text field in the soft button of a subtle alert; applies to `SubtleAlert` `softButtons`
+ *
+ * @since SmartDeviceLink 7.0.0
+ */
+ subtleAlertSoftButtonText;
;
/**
* Convert String to TextFieldName
|