summaryrefslogtreecommitdiff
path: root/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/Slider.java
blob: 31fb55b1e40d57874529108ffe0de97ee8b19fe7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
package com.smartdevicelink.proxy.rpc;

import com.smartdevicelink.protocol.enums.FunctionID;
import com.smartdevicelink.proxy.RPCRequest;

import java.util.Hashtable;
import java.util.List;

/**
 * <p>Creates a full screen or pop-up overlay (depending on platform) with a single
 * user controlled slider.</p>
 *
 * <p>Function Group: Base</p>
 * 
 * <p><b>HMILevel needs to be FULL</b></p>
 * 
 * <p><b>Parameter List</b></p>
 * <table border="1" rules="all">
 * 		<tr>
 * 			<th>Param Name</th>
 * 			<th>Type</th>
 * 			<th>Description</th>
 *                 <th> Req.</th>
 * 			<th>Notes</th>
 * 			<th>Version Available</th>
 * 		</tr>
 * 		<tr>
 * 			<td>numTicks</td>
 * 			<td>Integer</td>
 * 			<td>Number of selectable items on a horizontal axis.</td>
 *                 <td>Y</td>
 * 			<td>Minvalue=2; Maxvalue=26</td>
 * 			<td>SmartDeviceLink 2.0</td>
 * 		</tr>
 *
 * 		<tr>
 * 			<td>position</td>
 * 			<td>Integer</td>
 * 			<td>Initial position of slider control (cannot exceed numTicks),</td>
 *                 <td>Y</td>
 * 			<td>Minvalue=1; Maxvalue=26</td>
 * 			<td>SmartDeviceLink 2.0</td>
 * 		</tr>
 * 		<tr>
 * 			<td>sliderHeader</td>
 * 			<td>String</td>
 * 			<td>Text header to display</td>
 *                 <td>N</td>
 * 			<td>Maxlength=500</td>
 * 			<td>SmartDeviceLink 2.0</td>
 * 		</tr>
 * 		<tr>
 * 			<td>sliderFooter</td>
 * 			<td>Integer</td>
 * 			<td><p>Text footer to display (meant to display min/max threshold descriptors).</p>For a static text footer, only one footer string shall be provided in the array. For a dynamic text footer, the number of footer text string in the array must match the numTicks value.For a dynamic text footer, text array string should correlate with potential slider position index.If omitted on supported displays, no footer text shall be displayed.</td>
 *                 <td>N</td>
 * 			<td>Maxlength=500; Minvalue=1; Maxvalue=26</td>
 * 			<td>SmartDeviceLink 2.0</td>
 * 		</tr>
 *
 * 		<tr>
 * 			<td>timeout</td>
 * 			<td>String</td>
 * 			<td>App defined timeout.  Indicates how long of a timeout from the last action (i.e. sliding control resets timeout). If omitted, the value is set to 10000.</td>
 *                 <td>N</td>
 * 			<td>Minvalue=0; Maxvalue=65535; Defvalue= 10000</td>
 * 			<td>SmartDeviceLink 2.0</td>
 * 		</tr>
 *  </table>
*<p><b>Response </b></p>
*
*<p><b>Non-default Result Codes:</b></p>
*	<p> SAVED </p>
*	<p> INVALID_DATA</p>
*	<p>OUT_OF_MEMORY</p>
*	<p>TOO_MANY_PENDING_REQUESTS</p>
*	<p>APPLICATION_NOT_REGISTERED</p>
*	<p>GENERIC_ERROR</p>
*<p>	DISALLOWED</p>
*<p>	UNSUPPORTED_RESOURCE </p>    
*<p>	 REJECTED   </p>
*	<p>ABORTED </p>
* 
 * @since SmartDeviceLink 2.0
 * 
 */
public class Slider extends RPCRequest {

	public static final String KEY_NUM_TICKS = "numTicks";
	public static final String KEY_SLIDER_HEADER = "sliderHeader";
	public static final String KEY_SLIDER_FOOTER = "sliderFooter";
	public static final String KEY_POSITION = "position";
	public static final String KEY_TIMEOUT = "timeout";
	/**
	 * Constructs a new Slider object
	 */
    public Slider() {
        super(FunctionID.SLIDER.toString());
    }

	/**
	 * Constructs a new Slider object indicated by the Hashtable parameter
	 * <p></p>
	 * 
	 * @param hash
	 *            The Hashtable to use
	 */
    public Slider(Hashtable<String, Object> hash) {
        super(hash);
    }

	/**
	 * Sets a number of selectable items on a horizontal axis
	 * 
	 * @param numTicks
	 *            an Integer value representing a number of selectable items on
	 *            a horizontal axis
	 *            <p></p>
	 *            <b>Notes: </b>Minvalue=2; Maxvalue=26
	 */
    public void setNumTicks(Integer numTicks) {
    	setParameters(KEY_NUM_TICKS, numTicks);
    }

	/**
	 * Gets a number of selectable items on a horizontal axis
	 * 
	 * @return Integer -an Integer value representing a number of selectable
	 *         items on a horizontal axis
	 */
    public Integer getNumTicks() {
    	return getInteger(KEY_NUM_TICKS);
    }

	/**
	 * Sets an Initial position of slider control
	 * 
	 * @param position
	 *            an Integer value representing an Initial position of slider
	 *            control
	 *            <p></p>
	 *            <b>Notes: </b>Minvalue=1; Maxvalue=26
	 */
    public void setPosition(Integer position) {
    	setParameters(KEY_POSITION, position);
    }

	/**
	 * Gets an Initial position of slider control
	 * 
	 * @return Integer -an Integer value representing an Initial position of
	 *         slider control
	 */
    public Integer getPosition() {
    	return getInteger(KEY_POSITION);
    }

	/**
	 * Sets a text header to display
	 * 
	 * @param sliderHeader
	 *            a String value
	 *            <p></p>
	 *            <b>Notes: </b>Maxlength=500
	 */
    public void setSliderHeader(String sliderHeader) {
    	setParameters(KEY_SLIDER_HEADER, sliderHeader);
    }

	/**
	 * Gets a text header to display
	 * 
	 * @return String -a String value representing a text header to display
	 */
    public String getSliderHeader() {
    	return getString(KEY_SLIDER_HEADER);
    }

	/**
	 * Sets a text footer to display
	 * 
	 * @param sliderFooter
	 *            a List<String> value representing a text footer to display
	 *            <p></p>
	 *            <b>Notes: </b>Maxlength=500; Minvalue=1; Maxvalue=26
	 */
    public void setSliderFooter(List<String> sliderFooter) {
    	setParameters(KEY_SLIDER_FOOTER, sliderFooter);
    }

	/**
	 * Gets a text footer to display
	 * 
	 * @return String -a String value representing a text footer to display
	 */
    @SuppressWarnings("unchecked")
    public List<String> getSliderFooter() {
		return (List<String>) getObject(String.class, KEY_SLIDER_FOOTER);
    }

	/**
	 * Sets an App defined timeout
	 * 
	 * @param timeout
	 *            an Integer value representing an App defined timeout
	 *            <p></p>
	 *            <b>Notes: </b>Minvalue=0; Maxvalue=65535; Defvalue=10000
	 */
    public void setTimeout(Integer timeout) {
    	setParameters(KEY_TIMEOUT, timeout);
    }

	/**
	 * Gets an App defined timeout
	 * @return Integer -an Integer value representing an App defined timeout
	 */
    public Integer getTimeout() {
    	return getInteger(KEY_TIMEOUT);
    }
}