1 package com.smartdevicelink.proxy.rpc;
\r
3 import java.util.Hashtable;
\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
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
17 * <th>Description</th>
\r
18 * <th>SmartDeviceLink Ver. Available</th>
\r
23 * <td>Either the static hex icon value or the binary image file name identifier (sent by PutFile).
\r
26 * <li>Max: 65535</li>
\r
29 * <td>SmartDeviceLink 2.0</td>
\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
38 * @since SmartDeviceLink 2.0
\r
40 public class Image extends RPCStruct {
\r
43 * Constructs a newly allocated Image object
\r
48 * Constructs a newly allocated Image object indicated by the Hashtable parameter
\r
49 * @param hash The Hashtable to use
\r
51 public Image(Hashtable hash) {
\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
59 public void setValue(String value) {
\r
60 if (value != null) {
\r
61 store.put(Names.value, value);
\r
63 store.remove(Names.value);
\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
71 public String getValue() {
\r
72 return (String) store.get(Names.value);
\r
76 * set the image type
\r
77 * @param imageType whether it is a static or dynamic image
\r
79 public void setImageType(ImageType imageType) {
\r
80 if (imageType != null) {
\r
81 store.put(Names.imageType, imageType);
\r
83 store.remove(Names.imageType);
\r
89 * @return the image type
\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
98 theCode = ImageType.valueForString((String) obj);
\r
99 } catch (Exception e) {
\r
100 DebugTool.logError("Failed to parse " + getClass().getSimpleName() + "." + Names.imageType, e);
\r