-//
-// Copyright (c) 2013 Ford Motor Company
-//
-package com.smartdevicelink.proxy.rpc;
-
-import java.util.Hashtable;
-
-import com.smartdevicelink.proxy.RPCNotification;
-import com.smartdevicelink.proxy.constants.Names;
-import com.smartdevicelink.proxy.rpc.enums.AudioStreamingState;
-import com.smartdevicelink.proxy.rpc.enums.HMILevel;
-import com.smartdevicelink.proxy.rpc.enums.SystemContext;
-import com.smartdevicelink.util.DebugTool;
-
-public class OnHMIStatus extends RPCNotification {
- private Boolean firstRun;
-
- public OnHMIStatus() {
- super("OnHMIStatus");
- }
- public OnHMIStatus(Hashtable hash) {
- super(hash);
- }
- public HMILevel getHmiLevel() {
- Object obj = parameters.get(Names.hmiLevel);
- if (obj instanceof HMILevel) {
- return (HMILevel) obj;
- } else if (obj instanceof String) {
- HMILevel theCode = null;
- try {
- theCode = HMILevel.valueForString((String) obj);
- } catch (Exception e) {
- DebugTool.logError("Failed to parse " + getClass().getSimpleName() + "." + Names.hmiLevel, e);
- }
- return theCode;
- }
- return null;
- }
- public void setHmiLevel( HMILevel hmiLevel ) {
- if (hmiLevel != null) {
- parameters.put(Names.hmiLevel, hmiLevel );
- }
- }
- public AudioStreamingState getAudioStreamingState() {
- Object obj = parameters.get(Names.audioStreamingState);
- if (obj instanceof AudioStreamingState) {
- return (AudioStreamingState) obj;
- } else if (obj instanceof String) {
- AudioStreamingState theCode = null;
- try {
- theCode = AudioStreamingState.valueForString((String) obj);
- } catch (Exception e) {
- DebugTool.logError("Failed to parse " + getClass().getSimpleName() + "." + Names.audioStreamingState, e);
- }
- return theCode;
- }
- return null;
- }
- public void setAudioStreamingState( AudioStreamingState audioStreamingState ) {
- if (audioStreamingState != null) {
- parameters.put(Names.audioStreamingState, audioStreamingState );
- }
- }
- public SystemContext getSystemContext() {
- Object obj = parameters.get(Names.systemContext);
- if (obj instanceof SystemContext) {
- return (SystemContext) obj;
- } else if (obj instanceof String) {
- SystemContext theCode = null;
- try {
- theCode = SystemContext.valueForString((String) obj);
- } catch (Exception e) {
- DebugTool.logError("Failed to parse " + getClass().getSimpleName() + "." + Names.systemContext, e);
- }
- return theCode;
- }
- return null;
- }
- public void setSystemContext( SystemContext systemContext ) {
- if (systemContext != null) {
- parameters.put(Names.systemContext, systemContext );
- }
- }
- public Boolean getFirstRun() {
- return this.firstRun;
- }
- public void setFirstRun(Boolean firstRun) {
- this.firstRun = firstRun;
- }
-}
+package com.smartdevicelink.proxy.rpc;\r
+\r
+import java.util.Hashtable;\r
+\r
+import com.smartdevicelink.proxy.RPCNotification;\r
+import com.smartdevicelink.proxy.constants.Names;\r
+import com.smartdevicelink.proxy.rpc.enums.AudioStreamingState;\r
+import com.smartdevicelink.proxy.rpc.enums.HMILevel;\r
+import com.smartdevicelink.proxy.rpc.enums.SystemContext;\r
+import com.smartdevicelink.util.DebugTool;\r
+/**\r
+ * <p>Notifies an application that HMI conditions have changed for the application. This indicates whether the application \r
+ * can speak phrases, display text, perform interactions, receive button presses and events, stream audio, etc. This \r
+ * notification will be sent to the application when there has been a change in any one or several of the indicated \r
+ * states ({@linkplain HMILevel}, {@linkplain AudioStreamingState} or {@linkplain SystemContext}) for the application</p>\r
+ * <p>All three values are, in principle, independent of each other (though there may be some relationships). A value for \r
+ * one parameter should not be interpreted from the value of another parameter.</p>\r
+ * <p>There are no guarantees about the timeliness or latency of the OnHMIStatus notification. Therefore, for example, \r
+ * information such as {@linkplain AudioStreamingState} may not indicate that the audio stream became inaudible to the user \r
+ * exactly when the OnHMIStatus notification was received.</p>\r
+ * \r
+ * <p>\r
+ * <b>Parameter List:</b>\r
+ * <table border="1" rules="all">\r
+ * <tr>\r
+ * <th>Name</th>\r
+ * <th>Type</th>\r
+ * <th>Description</th>\r
+ * <th>Applink Ver Available</th>\r
+ * </tr>\r
+ * <tr>\r
+ * <td>hmiLevel</td>\r
+ * <td>{@linkplain HMILevel}</td>\r
+ * <td>The current HMI Level in effect for the application.</td>\r
+ * <td>SmartDeviceLink 1.0</td>\r
+ * </tr>\r
+ * <tr>\r
+ * <td>audioStreamingState</td>\r
+ * <td>{@linkplain AudioStreamingState}</td>\r
+ * <td>Current state of audio streaming for the application. \r
+ * When this parameter has a value of NOT_AUDIBLE, \r
+ * the application must stop streaming audio to SMARTDEVICELINK. \r
+ * Informs app whether any currently streaming audio is \r
+ * audible to user (AUDIBLE) or not (NOT_AUDIBLE). A \r
+ * value of NOT_AUDIBLE means that either the \r
+ * application's audio will not be audible to the user, or \r
+ * that the application's audio should not be audible to \r
+ * the user (i.e. some other application on the mobile \r
+ * device may be streaming audio and the application's \r
+ * audio would be blended with that other audio). </td>\r
+ * <td>SmartDeviceLink 1.0</td>\r
+ * </tr>\r
+ * <tr>\r
+ * <td>systemContext</td>\r
+ * <td>{@linkplain SystemContext}</td>\r
+ * <td>Indicates that a user-initiated interaction is in-progress \r
+ * (VRSESSION or MENU), or not (MAIN)</td>\r
+ * <td>SmartDeviceLink 1.0</td>\r
+ * </tr>\r
+ * </table>\r
+ * </p>\r
+ * @since SmartDeviceLink 1.0\r
+ * @see RegisterAppInterface \r
+ */\r
+public class OnHMIStatus extends RPCNotification {\r
+ private Boolean firstRun;\r
+ /**\r
+ *Constructs a newly allocated OnHMIStatus object\r
+ */ \r
+ public OnHMIStatus() {\r
+ super("OnHMIStatus");\r
+ }\r
+ /**\r
+ *<p>Constructs a newly allocated OnHMIStatus object indicated by the Hashtable parameter</p>\r
+ *@param hash The Hashtable to use\r
+ */ \r
+ public OnHMIStatus(Hashtable hash) {\r
+ super(hash);\r
+ }\r
+ /**\r
+ * <p>Get HMILevel in effect for the application</p>\r
+ * @return {@linkplain HMILevel} the current HMI Level in effect for the application\r
+ */ \r
+ public HMILevel getHmiLevel() {\r
+ Object obj = parameters.get(Names.hmiLevel);\r
+ if (obj instanceof HMILevel) {\r
+ return (HMILevel) obj;\r
+ } else if (obj instanceof String) {\r
+ HMILevel theCode = null;\r
+ try {\r
+ theCode = HMILevel.valueForString((String) obj);\r
+ } catch (Exception e) {\r
+ DebugTool.logError("Failed to parse " + getClass().getSimpleName() + "." + Names.hmiLevel, e);\r
+ }\r
+ return theCode;\r
+ }\r
+ return null;\r
+ }\r
+ /**\r
+ * <p>Set the HMILevel of OnHMIStatus</p>\r
+ * @param hmiLevel the HMILevel to set\r
+ */ \r
+ public void setHmiLevel( HMILevel hmiLevel ) {\r
+ if (hmiLevel != null) {\r
+ parameters.put(Names.hmiLevel, hmiLevel );\r
+ }\r
+ }\r
+ /**\r
+ * <p>Get current state of audio streaming for the application</p>\r
+ * @return {@linkplain AudioStreamingState} Returns current state of audio streaming for the application\r
+ */ \r
+ public AudioStreamingState getAudioStreamingState() {\r
+ Object obj = parameters.get(Names.audioStreamingState);\r
+ if (obj instanceof AudioStreamingState) {\r
+ return (AudioStreamingState) obj;\r
+ } else if (obj instanceof String) {\r
+ AudioStreamingState theCode = null;\r
+ try {\r
+ theCode = AudioStreamingState.valueForString((String) obj);\r
+ } catch (Exception e) {\r
+ DebugTool.logError("Failed to parse " + getClass().getSimpleName() + "." + Names.audioStreamingState, e);\r
+ }\r
+ return theCode;\r
+ }\r
+ return null;\r
+ }\r
+ /**\r
+ * <p>Set the audio streaming state</p>\r
+ * @param audioStreamingState the state of audio streaming of the application\r
+ */ \r
+ public void setAudioStreamingState( AudioStreamingState audioStreamingState ) {\r
+ if (audioStreamingState != null) {\r
+ parameters.put(Names.audioStreamingState, audioStreamingState );\r
+ }\r
+ }\r
+ /**\r
+ * <p>Get the System Context</p>\r
+ * @return {@linkplain SystemContext} whether a user-initiated interaction is in-progress (VRSESSION or MENU), or not (MAIN).\r
+ */ \r
+ public SystemContext getSystemContext() {\r
+ Object obj = parameters.get(Names.systemContext);\r
+ if (obj instanceof SystemContext) {\r
+ return (SystemContext) obj;\r
+ } else if (obj instanceof String) {\r
+ SystemContext theCode = null;\r
+ try {\r
+ theCode = SystemContext.valueForString((String) obj);\r
+ } catch (Exception e) {\r
+ DebugTool.logError("Failed to parse " + getClass().getSimpleName() + "." + Names.systemContext, e);\r
+ }\r
+ return theCode;\r
+ }\r
+ return null;\r
+ }\r
+ /**\r
+ * <p>Set the System Context of OnHMIStatus</p>\r
+ * @param systemContext Indicates that a user-initiated interaction is in-progress \r
+ * (VRSESSION or MENU), or not (MAIN)\r
+ */ \r
+ public void setSystemContext( SystemContext systemContext ) {\r
+ if (systemContext != null) {\r
+ parameters.put(Names.systemContext, systemContext );\r
+ }\r
+ }\r
+ /**\r
+ * <p>Query whether it's the first run</p>\r
+ * @return boolean whether it's the first run\r
+ */ \r
+ public Boolean getFirstRun() {\r
+ return this.firstRun;\r
+ }\r
+ /**\r
+ * <p>Set the firstRun value</p>\r
+ * @param firstRun True if it is the first run, False or not\r
+ */ \r
+ public void setFirstRun(Boolean firstRun) {\r
+ this.firstRun = firstRun;\r
+ }\r
+}\r