summaryrefslogtreecommitdiff
path: root/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/AudioControlData.java
blob: 9403fa9ab6d62df4afceaf2f12a7331d89183e92 (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
package com.smartdevicelink.proxy.rpc;

import com.smartdevicelink.proxy.RPCStruct;
import com.smartdevicelink.proxy.rpc.enums.PrimaryAudioSource;

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

public class AudioControlData extends RPCStruct {
	public static final String KEY_SOURCE = "source";
	public static final String KEY_KEEP_CONTEXT = "keepContext";
	public static final String KEY_VOLUME = "volume";
	public static final String KEY_EQUALIZER_SETTINGS = "equalizerSettings";

	/**
	 * Constructs a newly allocated AudioControlData object
	 */
	public AudioControlData() {
	}

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

	/**
	 * Sets the source portion of the AudioControlData class
	 *
	 * @param source In a getter response or a notification, it is the current primary audio source of the system.
	 *               In a setter request, it is the target audio source that the system shall switch to.
	 *               If the value is MOBILE_APP, the system shall switch to the mobile media app that issues the setter RPC.
	 */
	public void setSource(PrimaryAudioSource source) {
		setValue(KEY_SOURCE, source);
	}

	/**
	 * Gets the source portion of the AudioControlData class
	 *
	 * @return PrimaryAudioSource - In a getter response or a notification, it is the current primary audio source of the system.
	 * In a setter request, it is the target audio source that the system shall switch to.
	 * If the value is MOBILE_APP, the system shall switch to the mobile media app that issues the setter RPC.
	 */
	public PrimaryAudioSource getSource() {
		return (PrimaryAudioSource) getObject(PrimaryAudioSource.class, KEY_SOURCE);
	}

	/**
	 * Sets the keepContext portion of the AudioControlData class
	 *
	 * @param keepContext This parameter shall not be present in any getter responses or notifications.
	 *                    This parameter is optional in a setter request. The default value is false.
	 *                    If it is true, the system not only changes the audio source but also brings the default infotainment system UI associated with the audio source to foreground and set the application to background.
	 *                    If it is false, the system changes the audio source, but keeps the current application's context.
	 */
	public void setKeepContext(Boolean keepContext) {
		setValue(KEY_KEEP_CONTEXT, keepContext);
	}

	/**
	 * Gets the keepContext portion of the AudioControlData class
	 *
	 * @return Boolean - This parameter shall not be present in any getter responses or notifications.
	 * This parameter is optional in a setter request. The default value is false.
	 * If it is true, the system not only changes the audio source but also brings the default infotainment system UI associated with the audio source to foreground and set the application to background.
	 * If it is false, the system changes the audio source, but keeps the current application's context.
	 */
	public Boolean getKeepContext() {
		return getBoolean(KEY_KEEP_CONTEXT);
	}

	/**
	 * Sets the volume portion of the AudioControlData class
	 *
	 * @param volume Reflects the volume of audio, from 0%-100%.
	 */
	public void setVolume(Integer volume) {
		setValue(KEY_VOLUME, volume);
	}

	/**
	 * Gets the volume portion of the AudioControlData class
	 *
	 * @return Integer - Reflects the volume of audio, from 0%-100%.
	 */
	public Integer getVolume() {
		return getInteger(KEY_VOLUME);
	}

	/**
	 * Gets the equalizerSettings portion of the AudioControlData class
	 *
	 * @return List<EqualizerSettings> - Defines the list of supported channels (band) and their current/desired settings on HMI.
	 */
	@SuppressWarnings("unchecked")
	public List<EqualizerSettings> getEqualizerSettings() {
		return (List<EqualizerSettings>) getObject(EqualizerSettings.class, KEY_EQUALIZER_SETTINGS);
	}

	/**
	 * Sets the equalizerSettings portion of the AudioControlData class
	 *
	 * @param equalizerSettings Defines the list of supported channels (band) and their current/desired settings on HMI.
	 */
	public void setEqualizerSettings(List<EqualizerSettings> equalizerSettings) {
		setValue(KEY_EQUALIZER_SETTINGS, equalizerSettings);
	}

}