SDL_Android/SmartDeviceLinkAndroidProxy - added the correct version of the proxy
[profile/ivi/smartdevicelink.git] / SDL_Android / SmartDeviceLinkProxyAndroid / src / com / smartdevicelink / proxy / rpc / UpdateTurnList.java
1 package com.smartdevicelink.proxy.rpc;\r
2 \r
3 import java.util.Hashtable;\r
4 import java.util.Vector;\r
5 \r
6 import com.smartdevicelink.proxy.RPCRequest;\r
7 import com.smartdevicelink.proxy.constants.Names;\r
8 \r
9 /**\r
10  * Updates the list of next maneuvers, which can be requested by the user\r
11  * pressing the softbutton "Turns" on the Navigation base screen. Three\r
12  * softbuttons are predefined by the system: Up, Down, Close\r
13  * <p>\r
14  * Function Group: Navigation\r
15  * <p>\r
16  * <b>HMILevel needs to be FULL, LIMITED or BACKGROUND</b>\r
17  * <p>\r
18  * \r
19  * @since SmartDeviceLink 2.0\r
20  * @see ShowConstantTBT\r
21  */\r
22 public class UpdateTurnList extends RPCRequest {\r
23 \r
24         /**\r
25          * Constructs a new UpdateTurnList object\r
26          */\r
27     public UpdateTurnList() {\r
28         super("UpdateTurnList");\r
29     }\r
30 \r
31         /**\r
32          * Constructs a new UpdateTurnList object indicated by the Hashtable\r
33          * parameter\r
34          * <p>\r
35          * \r
36          * @param hash\r
37          *            The Hashtable to use\r
38          */\r
39     public UpdateTurnList(Hashtable hash) {\r
40         super(hash);\r
41     }\r
42 \r
43         /**\r
44          * Sets a list of turns to be shown to the user\r
45          * \r
46          * @param turnList\r
47          *            a Vector<Turn> value representing a list of turns to be shown\r
48          *            to the user\r
49          *            <p>\r
50          *            <b>Notes: </b>Minsize=1; Maxsize=100\r
51          */\r
52     public void setTurnList(Vector<Turn> turnList) {\r
53         if (turnList != null) {\r
54             parameters.put(Names.turnList, turnList);\r
55         } else {\r
56                 parameters.remove(Names.turnList);\r
57         }\r
58     }\r
59 \r
60         /**\r
61          * Gets a list of turns to be shown to the user\r
62          * \r
63          * @return Vector<Turn> -a Vector value representing a list of turns\r
64          */\r
65     public Vector<Turn> getTurnList() {\r
66         if (parameters.get(Names.turnList) instanceof Vector<?>) {\r
67                 Vector<?> list = (Vector<?>)parameters.get(Names.turnList);\r
68                 if (list != null && list.size() > 0) {\r
69                     Object obj = list.get(0);\r
70                     if (obj instanceof Turn) {\r
71                         return (Vector<Turn>) list;\r
72                     } else if (obj instanceof Hashtable) {\r
73                         Vector<Turn> newList = new Vector<Turn>();\r
74                         for (Object hashObj : list) {\r
75                             newList.add(new Turn((Hashtable)hashObj));\r
76                         }\r
77                         return newList;\r
78                     }\r
79                 }\r
80         }\r
81         return null;\r
82     }\r
83 \r
84         /**\r
85          * Sets soft buttons in the screen. If omitted on supported displays,\r
86          * app-defined SoftButton will be left blank\r
87          * <p>\r
88          * <b>Notes: </b>Minsize=0; Maxsize=1\r
89          * \r
90          * @param softButtons a Vector value\r
91          */\r
92     public void setSoftButtons(Vector<SoftButton> softButtons) {\r
93         if (softButtons != null) {\r
94             parameters.put(Names.softButtons, softButtons);\r
95         } else {\r
96                 parameters.remove(Names.softButtons);\r
97         }\r
98     }\r
99 \r
100         /**\r
101          * Gets soft buttons in the screen\r
102          * @return Vector -a Vector<SoftButton> value\r
103          */\r
104     public Vector<SoftButton> getSoftButtons() {\r
105         if (parameters.get(Names.softButtons) instanceof Vector<?>) {\r
106                 Vector<?> list = (Vector<?>)parameters.get(Names.softButtons);\r
107                 if (list != null && list.size() > 0) {\r
108                     Object obj = list.get(0);\r
109                     if (obj instanceof SoftButton) {\r
110                         return (Vector<SoftButton>) list;\r
111                     } else if (obj instanceof Hashtable) {\r
112                         Vector<SoftButton> newList = new Vector<SoftButton>();\r
113                         for (Object hashObj : list) {\r
114                             newList.add(new SoftButton((Hashtable)hashObj));\r
115                         }\r
116                         return newList;\r
117                     }\r
118                 }\r
119         }\r
120         return null;\r
121     }\r
122 }\r