1 package com.smartdevicelink.proxy.rpc;
\r
3 import java.util.Hashtable;
\r
5 import com.smartdevicelink.proxy.RPCNotification;
\r
6 import com.smartdevicelink.proxy.constants.Names;
\r
7 import com.smartdevicelink.proxy.rpc.enums.TriggerSource;
\r
8 import com.smartdevicelink.util.DebugTool;
\r
11 * This is called when a command was selected via VR after pressing the PTT button, or selected from the menu after
\r
12 * pressing the MENU button. <p>
\r
13 * <b>Note: </b>Sequence of OnHMIStatus and OnCommand notifications for user-initiated interactions is indeterminate.
\r
15 * <b>HMI Status Requirements:</b>
\r
18 * <ul><li>FULL,LIMITED</li></ul>
\r
19 * AudioStreamingState:
\r
20 * <ul><li>Any</li></ul>
\r
22 * <ul><li>Any</li></ul>
\r
25 * <b>Parameter List:</b>
\r
26 * <table border="1" rules="all">
\r
30 * <th>Description</th>
\r
32 * <th>Applink Ver Available</th>
\r
37 * <td>The cmdID of the command the user selected. This is the cmdID value provided by the application in the AddCommand operation that created the command.</td>
\r
39 * <td>SmartDeviceLink 1.0</td>
\r
42 * <td>triggerSource</td>
\r
43 * <td>{@linkplain TriggerSource}</td>
\r
44 * <td>Indicates whether command was selected via VR or via a menu selection (using the OKbutton).</td>
\r
46 * <td>SmartDeviceLink 1.0</td>
\r
50 * @since SmartDeviceLink 1.0
\r
52 * @see DeleteCommand
\r
53 * @see DeleteSubMenu
\r
55 public class OnCommand extends RPCNotification {
\r
57 *Constructs a newly allocated OnCommand object
\r
59 public OnCommand() {
\r
63 *<p>Constructs a newly allocated OnCommand object indicated by the Hashtable parameter</p>
\r
64 *@param hash The Hashtable to use
\r
66 public OnCommand(Hashtable hash) {
\r
70 * <p>Returns an <i>Integer</i> object representing the Command ID</p>
\r
71 * @return Integer an integer representation of this object
\r
73 public Integer getCmdID() {
\r
74 return (Integer) parameters.get( Names.cmdID );
\r
77 * <p>Sets a Command ID</p>
\r
78 * @param cmdID an integer object representing a Command ID
\r
80 public void setCmdID( Integer cmdID ) {
\r
81 if (cmdID != null) {
\r
82 parameters.put(Names.cmdID, cmdID );
\r
86 * <p>Returns a <I>TriggerSource</I> object which will be shown in the HMI</p>
\r
87 * @return TriggerSource a TriggerSource object
\r
89 public TriggerSource getTriggerSource() {
\r
90 Object obj = parameters.get(Names.triggerSource);
\r
91 if (obj instanceof TriggerSource) {
\r
92 return (TriggerSource) obj;
\r
93 } else if (obj instanceof String) {
\r
94 TriggerSource theCode = null;
\r
96 theCode = TriggerSource.valueForString((String) obj);
\r
97 } catch (Exception e) {
\r
98 DebugTool.logError("Failed to parse " + getClass().getSimpleName() + "." + Names.triggerSource, e);
\r
105 * <p>Sets TriggerSource<br/>
\r
106 * Indicates whether command was selected via VR or via a menu selection (using the OK button).</p>
\r
107 * @param triggerSource a TriggerSource object
\r
109 public void setTriggerSource( TriggerSource triggerSource ) {
\r
110 if (triggerSource != null) {
\r
111 parameters.put(Names.triggerSource, triggerSource );
\r