SDL_Android/SmartDeviceLinkAndroidProxy - added the correct version of the proxy
[profile/ivi/smartdevicelink.git] / SDL_Android / SmartDeviceLinkProxyAndroid / src / com / smartdevicelink / proxy / rpc / ButtonCapabilities.java
1 package com.smartdevicelink.proxy.rpc;\r
2 \r
3 import java.util.Hashtable;\r
4 \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
9 \r
10 /**\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
14  *              <tr>\r
15  *                      <th>Name</th>\r
16  *                      <th>Type</th>\r
17  *                      <th>Description</th>\r
18  *                      <th>SmartDeviceLink Ver. Available</th>\r
19  *              </tr>\r
20  *              <tr>\r
21  *                      <td>name</td>\r
22  *                      <td>ButtonName</td>\r
23  *                      <td>The name of theSMARTDEVICELINK HMI button.</td>\r
24  *                      <td>SmartDeviceLink 1.0</td>\r
25  *              </tr>\r
26  *              <tr>\r
27  *                      <td>shortPressAvailable</td>\r
28  *                      <td>Boolean</td>\r
29  *                      <td>The button supports a SHORT press. See ButtonPressMode for more information.</td>\r
30  *                      <td>SmartDeviceLink 1.0</td>\r
31  *              </tr>\r
32  *     <tr>\r
33  *                      <td>longPressAvailable</td>\r
34  *                      <td>Boolean</td>\r
35  *                      <td>The button supports a LONG press. See ButtonPressMode for more information.</td>\r
36  *                      <td>SmartDeviceLink 1.0</td>\r
37  *              </tr>\r
38  *     <tr>\r
39  *                      <td>upDownAvailable</td>\r
40  *                      <td>Boolean</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
44  *              </tr>\r
45  * </table>\r
46  * @since SmartDeviceLink 1.0\r
47  */\r
48 public class ButtonCapabilities extends RPCStruct {\r
49         /**\r
50          * Constructs a newly allocated ButtonCapabilities object\r
51          */\r
52     public ButtonCapabilities() { }\r
53     /**\r
54      * Constructs a newly allocated ButtonCapabilities object indicated by the Hashtable parameter\r
55      * @param hash The Hashtable to use\r
56      */\r
57     public ButtonCapabilities(Hashtable hash) {\r
58         super(hash);\r
59     }\r
60     /**\r
61      * Get the name of theSMARTDEVICELINK HMI button.\r
62      * @return ButtonName the name of the Button\r
63      */    \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
70             try {\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
74             }\r
75             return theCode;\r
76         }\r
77         return null;\r
78     }\r
79     /**\r
80      * Set the name of theSMARTDEVICELINK HMI button.\r
81      * @param name the name of button\r
82      */    \r
83     public void setName( ButtonName name ) {\r
84         if (name != null) {\r
85             store.put(Names.name, name );\r
86         }\r
87     }\r
88     /**\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
91      */    \r
92     public Boolean getShortPressAvailable() {\r
93         return (Boolean) store.get( Names.shortPressAvailable );\r
94     }\r
95     /**\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
98      */    \r
99     public void setShortPressAvailable( Boolean shortPressAvailable ) {\r
100         if (shortPressAvailable != null) {\r
101             store.put(Names.shortPressAvailable, shortPressAvailable );\r
102         }\r
103     }\r
104     /**\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
107      */\r
108     public Boolean getLongPressAvailable() {\r
109         return (Boolean) store.get( Names.longPressAvailable );\r
110     }\r
111     /**\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
114      */    \r
115     public void setLongPressAvailable( Boolean longPressAvailable ) {\r
116         if (longPressAvailable != null) {\r
117             store.put(Names.longPressAvailable, longPressAvailable );\r
118         }\r
119     }\r
120     /**\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
123      */    \r
124     public Boolean getUpDownAvailable() {\r
125         return (Boolean) store.get( Names.upDownAvailable );\r
126     }\r
127     /**\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
130      */    \r
131     public void setUpDownAvailable( Boolean upDownAvailable ) {\r
132         if (upDownAvailable != null) {\r
133             store.put(Names.upDownAvailable, upDownAvailable );\r
134         }\r
135     }\r
136 }\r