SDL_Android/SmartDeviceLinkAndroidProxy - added the correct version of the proxy
[profile/ivi/smartdevicelink.git] / SDL_Android / SmartDeviceLinkProxyAndroid / src / com / smartdevicelink / proxy / rpc / ReadDID.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  * Non periodic vehicle data read request. This is an RPC to get diagnostics\r
11  * data from certain vehicle modules. DIDs of a certain module might differ from\r
12  * vehicle type to vehicle type\r
13  * <p>\r
14  * Function Group: ProprietaryData\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  */\r
21 public class ReadDID extends RPCRequest {\r
22 \r
23         /**\r
24          * Constructs a new ReadDID object\r
25          */\r
26     public ReadDID() {\r
27         super("ReadDID");\r
28     }\r
29 \r
30         /**\r
31          * Constructs a new ReadDID object indicated by the Hashtable parameter\r
32          * <p>\r
33          * \r
34          * @param hash\r
35          *            The Hashtable to use\r
36          */\r
37     public ReadDID(Hashtable hash) {\r
38         super(hash);\r
39     }\r
40 \r
41         /**\r
42          * Sets an ID of the vehicle module\r
43          * \r
44          * @param ecuName\r
45          *            an Integer value representing the ID of the vehicle module\r
46          *            <p>\r
47          *            <b>Notes: </b>Minvalue:0; Maxvalue:65535\r
48          */\r
49     public void setEcuName(Integer ecuName) {\r
50         if (ecuName != null) {\r
51                 parameters.put(Names.ecuName, ecuName);\r
52         } else {\r
53                 parameters.remove(Names.ecuName);\r
54         }\r
55     }\r
56 \r
57         /**\r
58          * Gets the ID of the vehicle module\r
59          * \r
60          * @return Integer -an Integer value representing the ID of the vehicle\r
61          *         module\r
62          */\r
63     public Integer getEcuName() {\r
64         return (Integer) parameters.get(Names.ecuName);\r
65     }\r
66 \r
67         /**\r
68          * Sets raw data from vehicle data DID location(s)\r
69          * \r
70          * @param didLocation\r
71          *            a Vector<Integer> value representing raw data from vehicle\r
72          *            data DID location(s)\r
73          *            <p>\r
74          *            <b>Notes: </b>\r
75          *            <ul>\r
76          *            <li>Minvalue:0; Maxvalue:65535</li>\r
77          *            <li>ArrayMin:0; ArrayMax:1000</li>\r
78          *            </ul>\r
79          */\r
80     public void setDidLocation(Vector<Integer> didLocation) {\r
81         if (didLocation != null) {\r
82                 parameters.put(Names.didLocation, didLocation);\r
83         } else {\r
84                 parameters.remove(Names.didLocation);\r
85         }\r
86     }\r
87 \r
88         /**\r
89          * Gets raw data from vehicle data DID location(s)\r
90          * \r
91          * @return Vector<Integer> -a Vector<Integer> value representing raw data\r
92          *         from vehicle data DID location(s)\r
93          */\r
94     public Vector<Integer> getDidLocation() {\r
95         if (parameters.get(Names.didLocation) instanceof Vector<?>) {\r
96                 Vector<?> list = (Vector<?>)parameters.get(Names.didLocation);\r
97                 if (list != null && list.size() > 0) {\r
98                         Object obj = list.get(0);\r
99                         if (obj instanceof Integer) {\r
100                         return (Vector<Integer>) list;                          \r
101                         }\r
102                 }\r
103         }\r
104         return null;\r
105     }\r
106 }\r