blob: 243ec2bea84a4062992744580686cdb3515fd91f (
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
|
package com.smartdevicelink.proxy.rpc;
import java.util.Hashtable;
import com.smartdevicelink.proxy.RPCRequest;
import com.smartdevicelink.proxy.constants.Names;
import com.smartdevicelink.proxy.rpc.enums.Language;
import com.smartdevicelink.util.DebugTool;
/**
* If the app recognizes during the app registration that the SmartDeviceLink HMI language
* (voice/TTS and/or display) does not match the app language, the app will be
* able (but does not need) to change this registration with changeRegistration
* prior to app being brought into focus
* <p>
* Function Group: Base
* <p>
* <b>HMILevel can by any</b>
* <p>
*
* @since SmartDeviceLink 2.0
* @see RegisterAppInterface
*/
public class ChangeRegistration extends RPCRequest {
/**
* Constructs a new ChangeRegistration object
*/
public ChangeRegistration() {
super("ChangeRegistration");
}
/**
* Constructs a new ChangeRegistration object indicated by the Hashtable
* parameter
* <p>
*
* @param hash
* The Hashtable to use
*/
public ChangeRegistration(Hashtable hash) {
super(hash);
}
/**
* Sets language
*
* @param language
* a language value
*/
public void setLanguage(Language language) {
if (language != null) {
parameters.put(Names.language, language);
} else {
parameters.remove(Names.language);
}
}
/**
* Gets language
*
* @return Language -a Language value
*/
public Language getLanguage() {
Object obj = parameters.get(Names.language);
if (obj instanceof Language) {
return (Language) obj;
} else if (obj instanceof String) {
Language theCode = null;
try {
theCode = Language.valueForString((String) obj);
} catch (Exception e) {
DebugTool.logError("Failed to parse " + getClass().getSimpleName() + "." + Names.language, e);
}
return theCode;
}
return null;
}
/**
* Sets HMI display language
*
* @param hmiDisplayLanguage
* a Language value
*/
public void setHmiDisplayLanguage(Language hmiDisplayLanguage) {
if (hmiDisplayLanguage != null) {
parameters.put(Names.hmiDisplayLanguage, hmiDisplayLanguage);
} else {
parameters.remove(Names.hmiDisplayLanguage);
}
}
/**
* Gets HMI display language
*
* @return Language -a Language value
*/
public Language getHmiDisplayLanguage() {
Object obj = parameters.get(Names.hmiDisplayLanguage);
if (obj instanceof Language) {
return (Language) obj;
} else if (obj instanceof String) {
Language theCode = null;
try {
theCode = Language.valueForString((String) obj);
} catch (Exception e) {
DebugTool.logError("Failed to parse " + getClass().getSimpleName() + "." + Names.hmiDisplayLanguage, e);
}
return theCode;
}
return null;
}
}
|