SDL_Android/SmartDeviceLinkAndroidProxy - added the correct version of the proxy
[profile/ivi/smartdevicelink.git] / SDL_Android / SmartDeviceLinkProxyAndroid / src / com / smartdevicelink / proxy / rpc / enums / ButtonName.java
1 package com.smartdevicelink.proxy.rpc.enums;\r
2 \r
3 /**\r
4  * <p>\r
5  * Defines logical buttons which, on a given SMARTDEVICELINK unit, would correspond to\r
6  * either physical or soft (touchscreen) buttons. These logical buttons present\r
7  * a standard functional abstraction which the developer can rely upon,\r
8  * independent of the SMARTDEVICELINK unit. For example, the developer can rely upon the OK\r
9  * button having the same meaning to the user across SMARTDEVICELINK platforms.\r
10  * </p>\r
11  * <p>\r
12  * The preset buttons (0-9) can typically be interpreted by the application as\r
13  * corresponding to some user-configured choices, though the application is free\r
14  * to interpret these button presses as it sees fit.\r
15  * </p>\r
16  * <p>\r
17  * The application can discover which buttons a given SMARTDEVICELINK unit implements by\r
18  * interrogating the ButtonCapabilities parameter of the\r
19  * RegisterAppInterface response.\r
20  * </p>\r
21  * \r
22  * @since SmartDeviceLink 1.0\r
23  */\r
24 public enum ButtonName{\r
25         /**\r
26          * Represents the button usually labeled "OK". A typical use of this button\r
27          * is for the user to press it to make a selection.\r
28          * \r
29          * @since SmartDeviceLink 1.0\r
30          */\r
31         OK,\r
32         /**\r
33          * Represents the seek-left button. A typical use of this button is for the\r
34          * user to scroll to the left through menu choices one menu item per press.\r
35          * \r
36          * @since SmartDeviceLink 1.0\r
37          */\r
38         SEEKLEFT,\r
39         /**\r
40          * Represents the seek-right button. A typical use of this button is for the\r
41          * user to scroll to the right through menu choices one menu item per press.\r
42          * \r
43          * @since SmartDeviceLink 1.0\r
44          */\r
45         SEEKRIGHT,\r
46         /**\r
47          * Represents a turn of the tuner knob in the clockwise direction one tick.\r
48          * \r
49          * @since SmartDeviceLink 1.0\r
50          */\r
51         TUNEUP,\r
52         /**\r
53          * Represents a turn of the tuner knob in the counter-clockwise direction\r
54          * one tick.\r
55          * \r
56          * @since SmartDeviceLink 1.0\r
57          */\r
58         TUNEDOWN,\r
59         /**\r
60          * Represents the preset 0 button.\r
61          * \r
62          * @since SmartDeviceLink 1.0\r
63          */\r
64         PRESET_0,\r
65         /**\r
66          * Represents the preset 1 button.\r
67          * \r
68          * @since SmartDeviceLink 1.0\r
69          */\r
70         PRESET_1,\r
71         /**\r
72          * Represents the preset 2 button.\r
73          * \r
74          * @since SmartDeviceLink 1.0\r
75          */\r
76         PRESET_2,\r
77         /**\r
78          * Represents the preset 3 button.\r
79          * \r
80          * @since SmartDeviceLink 1.0\r
81          */\r
82         PRESET_3,\r
83         /**\r
84          * Represents the preset 4 button.\r
85          * \r
86          * @since SmartDeviceLink 1.0\r
87          */\r
88         PRESET_4,\r
89         /**\r
90          * Represents the preset 5 button.\r
91          * \r
92          * @since SmartDeviceLink 1.0\r
93          */\r
94         PRESET_5,\r
95         /**\r
96          * Represents the preset 6 button.\r
97          * \r
98          * @since SmartDeviceLink 1.0\r
99          */\r
100         PRESET_6,\r
101         /**\r
102          * Represents the preset 7 button.\r
103          * \r
104          * @since SmartDeviceLink 1.0\r
105          */\r
106         PRESET_7,\r
107         /**\r
108          * Represents the preset 8 button.\r
109          * \r
110          * @since SmartDeviceLink 1.0\r
111          */\r
112         PRESET_8,\r
113         /**\r
114          * Represents the preset 9 button.\r
115          * \r
116          * @since SmartDeviceLink 1.0\r
117          */\r
118         PRESET_9, CUSTOM_BUTTON;\r
119 \r
120     public static ButtonName valueForString(String value) {\r
121         return valueOf(value);\r
122     }\r
123     \r
124     /**\r
125      * indexForPresetButton returns the integer index for preset buttons\r
126      * which match the preset order. E.G.: indexForPresetButton(PRESET_1)\r
127      * returns the value 1. If the buttonName given is not a preset button,\r
128      * the method will return null.\r
129      *  \r
130      * @param buttonName\r
131      * @return Integer\r
132      */\r
133     public static Integer indexForPresetButton(ButtonName buttonName) {\r
134         \r
135         Integer returnIndex = null;\r
136         \r
137         switch(buttonName) {            \r
138                 case PRESET_0:\r
139                         returnIndex = 0;\r
140                         break;\r
141                 case PRESET_1:\r
142                         returnIndex = 1;\r
143                         break;\r
144                 case PRESET_2:\r
145                         returnIndex = 2;\r
146                         break;\r
147                 case PRESET_3:\r
148                         returnIndex = 3;\r
149                         break;\r
150                 case PRESET_4:\r
151                         returnIndex = 4;\r
152                         break;\r
153                 case PRESET_5:\r
154                         returnIndex = 5;\r
155                         break;\r
156                 case PRESET_6:\r
157                         returnIndex = 6;\r
158                         break;\r
159                 case PRESET_7:\r
160                         returnIndex = 7;\r
161                         break;\r
162                 case PRESET_8:\r
163                         returnIndex = 8;\r
164                         break;\r
165                 case PRESET_9:\r
166                         returnIndex = 9;\r
167                         break;\r
168         }\r
169         \r
170         return returnIndex;\r
171     }\r
172 }\r