1 package com.smartdevicelink.proxy.rpc;
\r
3 import java.util.Hashtable;
\r
5 import com.smartdevicelink.proxy.RPCStruct;
\r
6 import com.smartdevicelink.proxy.constants.Names;
\r
7 import com.smartdevicelink.proxy.rpc.enums.ButtonName;
\r
8 import com.smartdevicelink.util.DebugTool;
\r
11 * Provides information about the capabilities of a SMARTDEVICELINK HMI button.
\r
12 * <p><b> Parameter List
\r
13 * <table border="1" rules="all">
\r
17 * <th>Description</th>
\r
18 * <th>SmartDeviceLink Ver. Available</th>
\r
22 * <td>ButtonName</td>
\r
23 * <td>The name of theSMARTDEVICELINK HMI button.</td>
\r
24 * <td>SmartDeviceLink 1.0</td>
\r
27 * <td>shortPressAvailable</td>
\r
29 * <td>The button supports a SHORT press. See ButtonPressMode for more information.</td>
\r
30 * <td>SmartDeviceLink 1.0</td>
\r
33 * <td>longPressAvailable</td>
\r
35 * <td>The button supports a LONG press. See ButtonPressMode for more information.</td>
\r
36 * <td>SmartDeviceLink 1.0</td>
\r
39 * <td>upDownAvailable</td>
\r
41 * <td>The button supports "button down" and "button up". When the button is depressed, the <i>{@linkplain OnButtonEvent}</i> notification will be invoked with a value of BUTTONDOWN.
\r
42 * <p> When the button is released, the <i>{@linkplain OnButtonEvent}</i> notification will be invoked with a value of BUTTONUP.</td>
\r
43 * <td>SmartDeviceLink 1.0</td>
\r
46 * @since SmartDeviceLink 1.0
\r
48 public class ButtonCapabilities extends RPCStruct {
\r
50 * Constructs a newly allocated ButtonCapabilities object
\r
52 public ButtonCapabilities() { }
\r
54 * Constructs a newly allocated ButtonCapabilities object indicated by the Hashtable parameter
\r
55 * @param hash The Hashtable to use
\r
57 public ButtonCapabilities(Hashtable hash) {
\r
61 * Get the name of theSMARTDEVICELINK HMI button.
\r
62 * @return ButtonName the name of the Button
\r
64 public ButtonName getName() {
\r
65 Object obj = store.get(Names.name);
\r
66 if (obj instanceof ButtonName) {
\r
67 return (ButtonName) obj;
\r
68 } else if (obj instanceof String) {
\r
69 ButtonName theCode = null;
\r
71 theCode = ButtonName.valueForString((String) obj);
\r
72 } catch (Exception e) {
\r
73 DebugTool.logError("Failed to parse " + getClass().getSimpleName() + "." + Names.name, e);
\r
80 * Set the name of theSMARTDEVICELINK HMI button.
\r
81 * @param name the name of button
\r
83 public void setName( ButtonName name ) {
\r
85 store.put(Names.name, name );
\r
89 * Whether the button supports a SHORT press. See <i>{@linkplain com.smartdevicelink.proxy.rpc.enums.ButtonPressMode}</i> for more information.
\r
90 * @return True if support otherwise False.
\r
92 public Boolean getShortPressAvailable() {
\r
93 return (Boolean) store.get( Names.shortPressAvailable );
\r
96 * Set the button supports a SHORT press. See <i>{@linkplain com.smartdevicelink.proxy.rpc.enums.ButtonPressMode}</i> for more information.
\r
97 * @param shortPressAvailable True if support otherwise False.
\r
99 public void setShortPressAvailable( Boolean shortPressAvailable ) {
\r
100 if (shortPressAvailable != null) {
\r
101 store.put(Names.shortPressAvailable, shortPressAvailable );
\r
105 * Whether the button supports a LONG press. See <i>{@linkplain com.smartdevicelink.proxy.rpc.enums.ButtonPressMode}</i> for more information.
\r
106 * @return True if support otherwise False.
\r
108 public Boolean getLongPressAvailable() {
\r
109 return (Boolean) store.get( Names.longPressAvailable );
\r
112 * Set the button supports a LONG press. See <i>{@linkplain com.smartdevicelink.proxy.rpc.enums.ButtonPressMode}</i> for more information.
\r
113 * @param longPressAvailable True if support otherwise False.
\r
115 public void setLongPressAvailable( Boolean longPressAvailable ) {
\r
116 if (longPressAvailable != null) {
\r
117 store.put(Names.longPressAvailable, longPressAvailable );
\r
121 * Whether the button supports "button down" and "button up". When the button is depressed, the <i>{@linkplain OnButtonEvent}</i> notification will be invoked with a value of BUTTONDOWN.
\r
122 * @return True if support otherwise False.
\r
124 public Boolean getUpDownAvailable() {
\r
125 return (Boolean) store.get( Names.upDownAvailable );
\r
128 * Set the button supports "button down" and "button up". When the button is depressed, the <i>{@linkplain OnButtonEvent}</i> notification will be invoked with a value of BUTTONDOWN.
\r
129 * @param upDownAvailable True if support otherwise False.
\r
131 public void setUpDownAvailable( Boolean upDownAvailable ) {
\r
132 if (upDownAvailable != null) {
\r
133 store.put(Names.upDownAvailable, upDownAvailable );
\r