SDL_Android/SmartDeviceLinkAndroidProxy - added the correct version of the proxy
[profile/ivi/smartdevicelink.git] / SDL_Android / SmartDeviceLinkProxyAndroid / src / com / smartdevicelink / proxy / rpc / Image.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.ImageType;\r
8 import com.smartdevicelink.util.DebugTool;\r
9 \r
10 /**\r
11  *Specifies, which image shall be used, e.g. in Alerts or on Softbuttons provided the display supports it.\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>value</td>\r
22  *                      <td>String</td>\r
23  *                      <td>Either the static hex icon value or the binary image file name identifier (sent by PutFile).\r
24  *                                      <ul>\r
25  *                                      <li>Min: 0</li>\r
26  *                                      <li>Max: 65535</li>\r
27  *                                      </ul>\r
28  *                      </td>\r
29  *                      <td>SmartDeviceLink 2.0</td>\r
30  *              </tr>\r
31  *              <tr>\r
32  *                      <td>imageType</td>\r
33  *                      <td>ImageType</td>\r
34  *                      <td>Describes, whether it is a static or dynamic image.</td>\r
35  *                      <td>SmartDeviceLink 2.0</td>\r
36  *              </tr>\r
37  *  </table>\r
38  * @since SmartDeviceLink 2.0\r
39  */\r
40 public class Image extends RPCStruct {\r
41 \r
42         /**\r
43          * Constructs a newly allocated Image object\r
44          */\r
45     public Image() { }\r
46     \r
47     /**\r
48      * Constructs a newly allocated Image object indicated by the Hashtable parameter\r
49      * @param hash The Hashtable to use\r
50      */      \r
51     public Image(Hashtable hash) {\r
52         super(hash);\r
53     }\r
54     \r
55     /**\r
56      * set either the static hex icon value or the binary image file name identifier (sent by PutFile)\r
57      * @param value either the static hex icon value or the binary image file name identifier (sent by PutFile)\r
58      */\r
59     public void setValue(String value) {\r
60         if (value != null) {\r
61             store.put(Names.value, value);\r
62         } else {\r
63                 store.remove(Names.value);\r
64         }\r
65     }\r
66     \r
67     /**\r
68      * get either the static hex icon value or the binary image file name identifier (sent by PutFile)\r
69      * @return  either the static hex icon value or the binary image file name identifier (sent by PutFile)\r
70      */\r
71     public String getValue() {\r
72         return (String) store.get(Names.value);\r
73     }\r
74     \r
75     /**\r
76      * set the image type\r
77      * @param imageType whether it is a static or dynamic image\r
78      */\r
79     public void setImageType(ImageType imageType) {\r
80         if (imageType != null) {\r
81             store.put(Names.imageType, imageType);\r
82         } else {\r
83                 store.remove(Names.imageType);\r
84         }\r
85     }\r
86     \r
87     /**\r
88      * get image type\r
89      * @return the image type\r
90      */\r
91     public ImageType getImageType() {\r
92         Object obj = store.get(Names.imageType);\r
93         if (obj instanceof ImageType) {\r
94             return (ImageType) obj;\r
95         } else if (obj instanceof String) {\r
96                 ImageType theCode = null;\r
97             try {\r
98                 theCode = ImageType.valueForString((String) obj);\r
99             } catch (Exception e) {\r
100                 DebugTool.logError("Failed to parse " + getClass().getSimpleName() + "." + Names.imageType, e);\r
101             }\r
102             return theCode;\r
103         }\r
104         return null;\r
105     }\r
106 }\r