summaryrefslogtreecommitdiff
path: root/base/src/main/java/com/smartdevicelink/proxy/rpc/RadioControlData.java
blob: 4de584a9fe44b1331b3c2a8b9d35336c3337059c (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
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
/*
 * Copyright (c) 2017 - 2019, SmartDeviceLink Consortium, Inc.
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are met:
 *
 * Redistributions of source code must retain the above copyright notice, this
 * list of conditions and the following disclaimer.
 *
 * Redistributions in binary form must reproduce the above copyright notice,
 * this list of conditions and the following
 * disclaimer in the documentation and/or other materials provided with the
 * distribution.
 *
 * Neither the name of the SmartDeviceLink Consortium, Inc. nor the names of its
 * contributors may be used to endorse or promote products derived from this 
 * software without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 * POSSIBILITY OF SUCH DAMAGE.
 */
package com.smartdevicelink.proxy.rpc;

import com.smartdevicelink.proxy.RPCStruct;
import com.smartdevicelink.proxy.rpc.enums.RadioBand;
import com.smartdevicelink.proxy.rpc.enums.RadioState;

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

/**
 * Include information (both read-only and changeable data) about a
 * remote control radio module.
 */
public class RadioControlData extends RPCStruct{
    public static final String KEY_FREQUENCY_INTEGER= "frequencyInteger";
    public static final String KEY_FREQUENCY_FRACTION= "frequencyFraction";
    public static final String KEY_BAND= "band";
    public static final String KEY_RDS_DATA= "rdsData";
    public static final String KEY_AVAILABLE_HDS= "availableHDs";
    public static final String KEY_HD_CHANNEL= "hdChannel";
    public static final String KEY_SIGNAL_STRENGTH= "signalStrength";
    public static final String KEY_SIGNAL_CHANGE_THRESHOLD= "signalChangeThreshold";
    public static final String KEY_RADIO_ENABLE= "radioEnable";
    public static final String KEY_STATE= "state";
    public static final String KEY_HD_RADIO_ENABLE = "hdRadioEnable";
    public static final String KEY_SIS_DATA = "sisData";
    public static final String KEY_AVAILABLE_HD_CHANNELS= "availableHdChannels";

    public RadioControlData() {
    }

    public RadioControlData(Hashtable<String, Object> hash) {
        super(hash);
    }

    /**
     * Sets the frequencyInteger portion of the RadioControlData class
     *
     * @param frequencyInteger
     * The integer part of the frequency i.e. for 101.7 this value should be 101
     */
    public void setFrequencyInteger(Integer frequencyInteger) {
        setValue(KEY_FREQUENCY_INTEGER, frequencyInteger);
    }

    /**
     * Gets the frequencyInteger portion of the RadioControlData class
     *
     * @return Integer - The integer part of the frequency i.e. for 101.7 this value should be 101.
     */
    public Integer getFrequencyInteger() {
        return getInteger(KEY_FREQUENCY_INTEGER);
    }

    /**
     * Sets the frequencyFraction portion of the RadioControlData class
     *
     * @param frequencyFraction
     * The fractional part of the frequency i.e. for 101.7 is 7.
     */
    public void setFrequencyFraction(Integer frequencyFraction) {
        setValue(KEY_FREQUENCY_FRACTION, frequencyFraction);
    }

    /**
     * Gets the frequencyFraction portion of the RadioControlData class
     *
     * @return Integer - The fractional part of the frequency i.e. for 101.7 is 7.
     */
    public Integer getFrequencyFraction() {
        return getInteger(KEY_FREQUENCY_FRACTION);
    }

    /**
     * Sets the band portion of the RadioControlData class
     *
     * @param band
     * The radio band (AM|FM|XM) of the radio tuner.
     */
    public void setBand(RadioBand band) {
        setValue(KEY_BAND, band);
    }

    /**
     * Gets the band portion of the RadioControlData class
     *
     * @return RadioBand - The radio band (AM|FM|XM) of the radio tuner.
     */
    public RadioBand getBand() {
        return (RadioBand) getObject(RadioBand.class, KEY_BAND);
    }

    /**
     * Sets the rdsData portion of the RadioControlData class
     *
     * @param rdsData
     * Read only parameter. See RdsData data type for details.
     */
    public void setRdsData(RdsData rdsData) {
        setValue(KEY_RDS_DATA, rdsData);
    }

    /**
     * Gets the rdsData portion of the RadioControlData class
     *
     * @return RdsData - Read only parameter. See RdsData data type for details.
     */
    public RdsData getRdsData() {
        return (RdsData) getObject(RdsData.class, KEY_RDS_DATA);
    }

    /**
     * Sets the availableHDs portion of the RadioControlData class
     *
     * @param availableHDs
     * Number of HD sub-channels if available.
     */
    @Deprecated
    public void setAvailableHDs(Integer availableHDs) {
        setValue(KEY_AVAILABLE_HDS, availableHDs);
    }

    /**
     * Gets the availableHDs portion of the RadioControlData class
     *
     * @return Integer - Number of HD sub-channels if available.
     */
    @Deprecated
    public Integer getAvailableHDs() {
        return getInteger(KEY_AVAILABLE_HDS);
    }

    /**
     * Sets the hdChannel portion of the RadioControlData class
     *
     * @param hdChannel
     * Current HD sub-channel if available.
     */
    public void setHdChannel(Integer hdChannel) {
        setValue(KEY_HD_CHANNEL, hdChannel);
    }

    /**
     * Gets the hdChannel portion of the RadioControlData class
     *
     * @return Integer - Current HD sub-channel if available.
     */
    public Integer getHdChannel() {
        return getInteger(KEY_HD_CHANNEL);
    }

    /**
     * Sets the signalStrength portion of the RadioControlData class
     *
     * @param signalStrength
     * Read only parameter. Indicates the strength of receiving radio signal in current frequency.
     */
    public void setSignalStrength(Integer signalStrength) {
        setValue(KEY_SIGNAL_STRENGTH, signalStrength);
    }

    /**
     * Gets the signalStrength portion of the RadioControlData class
     *
     * @return Integer - Read only parameter. Indicates the strength of receiving radio signal in current frequency.
     */
    public Integer getSignalStrength() {
        return getInteger(KEY_SIGNAL_STRENGTH);
    }

    /**
     * Sets the signalChangeThreshold portion of the RadioControlData class
     *
     * @param signalChangeThreshold
     * If the signal strength falls below the set value for this parameter, the radio will tune to an alternative frequency.
     */
    public void setSignalChangeThreshold(Integer signalChangeThreshold) {
        setValue(KEY_SIGNAL_CHANGE_THRESHOLD, signalChangeThreshold);
    }

    /**
     * Gets the signalChangeThreshold portion of the RadioControlData class
     *
     * @return Integer - If the signal strength falls below the set value for this parameter, the radio will tune to an alternative frequency.
     */
    public Integer getSignalChangeThreshold() {
        return getInteger(KEY_SIGNAL_CHANGE_THRESHOLD);
    }

    /**
     * Sets the radioEnable portion of the RadioControlData class
     * <br><b>Note: </b> If this is set to false, no other data will be included.
     * <br><b>Note: </b> This setting is normally a <b>READ-ONLY</b> setting.
     *
     * @param radioEnable
     * True if the radio is on, false is the radio is off.
     */
    public void setRadioEnable(Boolean radioEnable) {
        setValue(KEY_RADIO_ENABLE, radioEnable);
    }

    /**
     * Gets the radioEnable portion of the RadioControlData class
     * <br><b>Note: </b> If this is set to false, no other data will be included.
     *
     * @return Boolean - True if the radio is on, false is the radio is off.
     */
    public Boolean getRadioEnable() {
        return getBoolean(KEY_RADIO_ENABLE);
    }

    /**
     * Sets the state portion of the RadioControlData class
     *
     * @param state
     * Read only parameter. See RadioState data type for details.
     */
    public void setState(RadioState state) {
        setValue(KEY_STATE, state);
    }

    /**
     * Gets the state portion of the RadioControlData class
     *
     * @return RadioState - Read only parameter. See RadioState data type for details.
     */
    public RadioState getState() {
        return (RadioState) getObject(RadioState.class, KEY_STATE);
    }

    /**
     * Sets the hdRadioEnable portion of the RadioControlData class
     *
     * @param hdRadioEnable True if the hd radio is on, false if the radio is off.
     */
    public void setHdRadioEnable(Boolean hdRadioEnable) {
        setValue(KEY_HD_RADIO_ENABLE, hdRadioEnable);
    }

    /**
     * Gets the hdRadioEnable portion of the RadioControlData class
     *
     * @return Boolean - True if the hd radio is on, false if the radio is off.
     */
    public Boolean getHdRadioEnable() {
        return getBoolean(KEY_HD_RADIO_ENABLE);
    }

    /**
     * Sets the sisData portion of the RadioControlData class
     *
     * @param sisData Read-only Station Information Service (SIS) data provides basic information about the station such as call sign, as well as information not displayable to the consumer such as the station identification number.
     */
    public void setSisData(SisData sisData) {
        setValue(KEY_SIS_DATA, sisData);
    }

    /**
     * Gets the sisData portion of the RadioControlData class
     *
     * @return SisData - Read-only Station Information Service (SIS) data provides basic information about the station such as call sign, as well as information not displayable to the consumer such as the station identification number.
     */
    public SisData getSisData() {
        return (SisData) getObject(SisData.class, KEY_SIS_DATA);
    }

    /**
     * Sets the availableHdChannels portion of the RadioControlData class
     *
     * @param availableHdChannels List of available hd sub-channel indexes, empty list means no Hd channel is available, read-only.
     */
    public void setAvailableHdChannels(List<Integer> availableHdChannels){
        setValue(KEY_AVAILABLE_HD_CHANNELS, availableHdChannels);
    }

    /**
     * Gets the availableHdChannels portion of the RadioControlData class
     *
     * @return List<Integer> - List of available hd sub-channel indexes, empty list means no Hd channel is available, read-only.
     */
    @SuppressWarnings("unchecked")
    public List<Integer> getAvailableHdChannels(){
        return (List<Integer>) getObject(Integer.class,KEY_AVAILABLE_HD_CHANNELS);
    }
}