1 package com.smartdevicelink.proxy;
\r
3 import java.util.Vector;
\r
5 import com.smartdevicelink.exception.SmartDeviceLinkException;
\r
6 import com.smartdevicelink.exception.SmartDeviceLinkExceptionCause;
\r
7 import com.smartdevicelink.proxy.rpc.smartdevicelinkMsgVersion;
\r
8 import com.smartdevicelink.proxy.rpc.enums.Language;
\r
9 import com.smartdevicelink.trace.SmartDeviceLinkTrace;
\r
10 import com.smartdevicelink.transport.BTTransportConfig;
\r
11 import com.smartdevicelink.transport.BaseTransportConfig;
\r
12 import com.smartdevicelink.transport.TransportType;
\r
14 public class SmartDeviceLinkProxy extends SmartDeviceLinkProxyBase<IProxyListener> {
\r
16 private static final String SMARTDEVICELINK_LIB_TRACE_KEY = "42baba60-eb57-11df-98cf-0800200c9a66";
\r
17 private static final String SMARTDEVICELINK_LIB_PRIVATE_TOKEN = "{DAE1A88C-6C16-4768-ACA5-6F1247EA01C2}";
\r
20 * Constructor for the SmartDeviceLinkProxy object, the proxy for communicating between the App and SMARTDEVICELINK.
\r
22 * @param listener - Reference to the object in the App listening to callbacks from SMARTDEVICELINK.
\r
23 * @throws SmartDeviceLinkException
\r
26 public SmartDeviceLinkProxy(IProxyListener listener) throws SmartDeviceLinkException {
\r
28 /*application context*/null,
\r
29 /*enable advanced lifecycle management*/false,
\r
32 /*ngn media screen app name*/null,
\r
33 /*vr synonyms*/null,
\r
34 /*is media app*/ null,
\r
35 /*smartDeviceLinkMsgVersion*/null,
\r
36 /*language desired*/null,
\r
37 /*HMI Display Language Desired*/null,
\r
40 /*autoActivateID*/null,
\r
41 /*callbackToUIThread*/ true,
\r
42 new BTTransportConfig());
\r
44 SmartDeviceLinkTrace.logProxyEvent("Application constructed SmartDeviceLinkProxy instance passing in: IProxyListener.", SMARTDEVICELINK_LIB_TRACE_KEY);
\r
48 * Constructor for the SmartDeviceLinkProxy object, the proxy for communicating between the App and SMARTDEVICELINK.
\r
50 * @param listener - Reference to the object in the App listening to callbacks from SMARTDEVICELINK.
\r
51 * @param smartDeviceLinkProxyConfigurationResources
\r
52 * @throws SmartDeviceLinkException
\r
55 public SmartDeviceLinkProxy(IProxyListener listener, SmartDeviceLinkProxyConfigurationResources smartDeviceLinkProxyConfigurationResources)
\r
56 throws SmartDeviceLinkException {
\r
58 smartDeviceLinkProxyConfigurationResources,
\r
59 /*enable advanced lifecycle management*/false,
\r
62 /*ngn media screen app name*/null,
\r
63 /*vr synonyms*/null,
\r
64 /*is media app*/ null,
\r
65 /*smartDeviceLinkMsgVersion*/null,
\r
66 /*language desired*/null,
\r
67 /*HMI Display Language Desired*/null,
\r
70 /*autoActivateID*/null,
\r
71 /*callbackToUIThread*/ true,
\r
72 new BTTransportConfig());
\r
74 SmartDeviceLinkTrace.logProxyEvent("Application constructed SmartDeviceLinkProxy instance passing in: IProxyListener, SmartDeviceLinkProxyConfigurationResources.", SMARTDEVICELINK_LIB_TRACE_KEY);
\r
78 * Constructor for the SmartDeviceLinkProxy object, the proxy for communicating between the App and SMARTDEVICELINK.
\r
80 * @param listener - Reference to the object in the App listening to callbacks from SMARTDEVICELINK.
\r
81 * @param callbackToUIThread - If true, all callbacks will occur on the UI thread.
\r
82 * @throws SmartDeviceLinkException
\r
85 public SmartDeviceLinkProxy(IProxyListener listener, boolean callbackToUIThread) throws SmartDeviceLinkException {
\r
87 /*smartDeviceLink proxy configuration resources*/null,
\r
88 /*enable advanced lifecycle management*/false,
\r
91 /*ngn media screen app name*/null,
\r
92 /*vr synonyms*/null,
\r
93 /*is media app*/ null,
\r
94 /*smartDeviceLinkMsgVersion*/null,
\r
95 /*language desired*/null,
\r
96 /*HMI Display Language Desired*/null,
\r
99 /*autoActivateID*/null,
\r
100 callbackToUIThread,
\r
101 new BTTransportConfig());
\r
103 SmartDeviceLinkTrace.logProxyEvent("Application constructed SmartDeviceLinkProxy instance passing in: IProxyListener, callBackToUIThread.", SMARTDEVICELINK_LIB_TRACE_KEY);
\r
107 * Constructor for the SmartDeviceLinkProxy object, the proxy for communicating between the App and SMARTDEVICELINK.
\r
109 * @param listener - Reference to the object in the App listening to callbacks from SMARTDEVICELINK.
\r
110 * @param smartDeviceLinkProxyConfigurationResources
\r
111 * @param callbackToUIThread - If true, all callbacks will occur on the UI thread.
\r
112 * @throws SmartDeviceLinkException
\r
115 public SmartDeviceLinkProxy(IProxyListener listener, SmartDeviceLinkProxyConfigurationResources smartDeviceLinkProxyConfigurationResources,
\r
116 boolean callbackToUIThread) throws SmartDeviceLinkException {
\r
118 smartDeviceLinkProxyConfigurationResources,
\r
119 /*enable advanced lifecycle management*/false,
\r
122 /*ngn media screen app name*/null,
\r
123 /*vr synonyms*/null,
\r
124 /*is media app*/ null,
\r
125 /*smartDeviceLinkMsgVersion*/null,
\r
126 /*language desired*/null,
\r
127 /*HMI Display Language Desired*/null,
\r
130 /*autoActivateID*/null,
\r
131 callbackToUIThread,
\r
132 new BTTransportConfig());
\r
134 SmartDeviceLinkTrace.logProxyEvent("Application constructed SmartDeviceLinkProxy instance passing in: IProxyListener, callBackToUIThread.", SMARTDEVICELINK_LIB_TRACE_KEY);
\r
137 /********************************************** TRANSPORT SWITCHING SUPPORT *****************************************/
\r
140 * Constructor for the SmartDeviceLinkProxy object, the proxy for communicating between the App and SMARTDEVICELINK.
\r
142 * @param listener - Reference to the object in the App listening to callbacks from SMARTDEVICELINK.
\r
143 * @param transportConfig Initial configuration for transport.
\r
144 * @throws SmartDeviceLinkException
\r
147 public SmartDeviceLinkProxy(IProxyListener listener, BaseTransportConfig transportConfig) throws SmartDeviceLinkException {
\r
149 /*application context*/null,
\r
150 /*enable advanced lifecycle management*/false,
\r
153 /*ngn media screen app name*/null,
\r
154 /*vr synonyms*/null,
\r
155 /*is media app*/ null,
\r
156 /*smartDeviceLinkMsgVersion*/null,
\r
157 /*language desired*/null,
\r
158 /*HMI Display Language Desired*/null,
\r
161 /*autoActivateID*/null,
\r
162 /*callbackToUIThread*/ true,
\r
165 SmartDeviceLinkTrace.logProxyEvent("Application constructed SmartDeviceLinkProxy instance passing in: IProxyListener.", SMARTDEVICELINK_LIB_TRACE_KEY);
\r
169 * Constructor for the SmartDeviceLinkProxy object, the proxy for communicating between the App and SMARTDEVICELINK.
\r
171 * @param listener - Reference to the object in the App listening to callbacks from SMARTDEVICELINK.
\r
172 * @param smartDeviceLinkProxyConfigurationResources
\r
173 * @param transportConfig Initial configuration for transport.
\r
174 * @throws SmartDeviceLinkException
\r
177 public SmartDeviceLinkProxy(IProxyListener listener, SmartDeviceLinkProxyConfigurationResources smartDeviceLinkProxyConfigurationResources,
\r
178 BaseTransportConfig transportConfig)
\r
179 throws SmartDeviceLinkException {
\r
181 smartDeviceLinkProxyConfigurationResources,
\r
182 /*enable advanced lifecycle management*/false,
\r
185 /*ngn media screen app name*/null,
\r
186 /*vr synonyms*/null,
\r
187 /*is media app*/ null,
\r
188 /*smartDeviceLinkMsgVersion*/null,
\r
189 /*language desired*/null,
\r
190 /*HMI Display Language Desired*/null,
\r
193 /*autoActivateID*/null,
\r
194 /*callbackToUIThread*/ true,
\r
197 SmartDeviceLinkTrace.logProxyEvent("Application constructed SmartDeviceLinkProxy instance passing in: IProxyListener, SmartDeviceLinkProxyConfigurationResources.", SMARTDEVICELINK_LIB_TRACE_KEY);
\r
201 * Constructor for the SmartDeviceLinkProxy object, the proxy for communicating between the App and SMARTDEVICELINK.
\r
203 * @param listener - Reference to the object in the App listening to callbacks from SMARTDEVICELINK.
\r
204 * @param callbackToUIThread - If true, all callbacks will occur on the UI thread.
\r
205 * @param transportConfig Initial configuration for transport.
\r
206 * @throws SmartDeviceLinkException
\r
209 public SmartDeviceLinkProxy(IProxyListener listener, boolean callbackToUIThread, BaseTransportConfig transportConfig) throws SmartDeviceLinkException {
\r
211 /*smartDeviceLink proxy configuration resources*/null,
\r
212 /*enable advanced lifecycle management*/false,
\r
215 /*ngn media screen app name*/null,
\r
216 /*vr synonyms*/null,
\r
217 /*is media app*/ null,
\r
218 /*smartDeviceLinkMsgVersion*/null,
\r
219 /*language desired*/null,
\r
220 /*HMI Display Language Desired*/null,
\r
223 /*autoActivateID*/null,
\r
224 callbackToUIThread,
\r
227 SmartDeviceLinkTrace.logProxyEvent("Application constructed SmartDeviceLinkProxy instance passing in: IProxyListener, callBackToUIThread.", SMARTDEVICELINK_LIB_TRACE_KEY);
\r
231 * Constructor for the SmartDeviceLinkProxy object, the proxy for communicating between the App and SMARTDEVICELINK.
\r
233 * @param listener - Reference to the object in the App listening to callbacks from SMARTDEVICELINK.
\r
234 * @param smartDeviceLinkProxyConfigurationResources
\r
235 * @param callbackToUIThread - If true, all callbacks will occur on the UI thread.
\r
236 * @param transportConfig Initial configuration for transport.
\r
237 * @throws SmartDeviceLinkException
\r
240 public SmartDeviceLinkProxy(IProxyListener listener, SmartDeviceLinkProxyConfigurationResources smartDeviceLinkProxyConfigurationResources,
\r
241 boolean callbackToUIThread, BaseTransportConfig transportConfig) throws SmartDeviceLinkException {
\r
243 smartDeviceLinkProxyConfigurationResources,
\r
244 /*enable advanced lifecycle management*/false,
\r
247 /*ngn media screen app name*/null,
\r
248 /*vr synonyms*/null,
\r
249 /*is media app*/ null,
\r
250 /*smartDeviceLinkMsgVersion*/null,
\r
251 /*language desired*/null,
\r
252 /*HMI Display Language Desired*/null,
\r
255 /*autoActivateID*/null,
\r
256 callbackToUIThread,
\r
259 SmartDeviceLinkTrace.logProxyEvent("Application constructed SmartDeviceLinkProxy instance passing in: IProxyListener, callBackToUIThread.", SMARTDEVICELINK_LIB_TRACE_KEY);
\r
262 /******************** Public Helper Methods *************************/
\r
266 * Sends a RegisterAppInterface RPCRequest to SMARTDEVICELINK. Responses are captured through callback on IProxyListener.
\r
268 * @param smartDeviceLinkMsgVersion
\r
270 * @param ngnMediaScreenAppName
\r
271 * @param vrSynonyms
\r
272 * @param isMediaApp
\r
273 * @param languageDesired
\r
274 * @param autoActivateID
\r
275 * @param correlationID
\r
277 * @throws SmartDeviceLinkException
\r
280 public void registerAppInterface(
\r
281 smartdevicelinkMsgVersion smartDeviceLinkMsgVersion, String appName, String ngnMediaScreenAppName,
\r
282 Vector<String> vrSynonyms, Boolean isMediaApp, Language languageDesired, Language hmiDisplayLanguageDesired,
\r
283 String appID, String autoActivateID, Integer correlationID)
\r
284 throws SmartDeviceLinkException {
\r
286 // Test if proxy has been disposed
\r
287 if (_proxyDisposed) {
\r
288 throw new SmartDeviceLinkException("This SmartDeviceLinkProxy object has been disposed, it is no long capable of sending requests.", SmartDeviceLinkExceptionCause.SMARTDEVICELINK_PROXY_DISPOSED);
\r
291 registerAppInterfacePrivate(
\r
292 smartDeviceLinkMsgVersion,
\r
295 ngnMediaScreenAppName,
\r
299 hmiDisplayLanguageDesired,
\r
307 * Sends a RegisterAppInterface RPCRequest to SMARTDEVICELINK. Responses are captured through callback on IProxyListener.
\r
310 * @param isMediaApp
\r
311 * @param autoActivateID
\r
312 * @throws SmartDeviceLinkException
\r
315 public void registerAppInterface(
\r
316 String appName, Boolean isMediaApp, String appID, String autoActivateID, Integer correlationID)
\r
317 throws SmartDeviceLinkException {
\r
319 registerAppInterface(
\r
320 /*smartDeviceLinkMsgVersion*/null,
\r
322 /*ngnMediaScreenAppName*/null,
\r
323 /*vrSynonyms*/null,
\r
325 /*languageDesired*/null,
\r
326 /*hmiDisplayLanguageDesired*/null,
\r
333 * Sends a RegisterAppInterface RPCRequest to SMARTDEVICELINK. Responses are captured through callback on IProxyListener.
\r
336 * @throws SmartDeviceLinkException
\r
339 public void registerAppInterface(String appName, String appID, Integer correlationID)
\r
340 throws SmartDeviceLinkException {
\r
342 registerAppInterface(appName, false, appID, "", correlationID);
\r
346 * Sends an UnregisterAppInterface RPCRequest to SMARTDEVICELINK. Responses are captured through callback on IProxyListener.
\r
348 * @param correlationID
\r
349 * @throws SmartDeviceLinkException
\r
352 public void unregisterAppInterface(Integer correlationID)
\r
353 throws SmartDeviceLinkException {
\r
354 // Test if proxy has been disposed
\r
355 if (_proxyDisposed) {
\r
356 throw new SmartDeviceLinkException("This SmartDeviceLinkProxy object has been disposed, it is no long capable of executing methods.",
\r
357 SmartDeviceLinkExceptionCause.SMARTDEVICELINK_PROXY_DISPOSED);
\r
360 unregisterAppInterfacePrivate(correlationID);
\r
364 * Returns is isConnected state of the SMARTDEVICELINK transport.
\r
366 * @return Boolean isConnected
\r
369 public Boolean getIsConnected() {
\r
370 return super.getIsConnected();
\r