diff options
author | Joey Grover <joeygrover@gmail.com> | 2016-03-09 13:47:43 -0500 |
---|---|---|
committer | Joey Grover <joeygrover@gmail.com> | 2016-03-09 13:47:43 -0500 |
commit | 589b726a53678c930c78a9835dfaa3e8446a0008 (patch) | |
tree | 4a28b2c35a64e5e1ecbdc77878ad045029a99346 | |
parent | 001396c888757be9afcbe3f0f721dcaf38672541 (diff) | |
parent | b8c33a544065885bcad1c31f1424ff2c9a78f296 (diff) | |
download | sdl_android-589b726a53678c930c78a9835dfaa3e8446a0008.tar.gz |
Merge branch 'develop' of https://github.com/smartdevicelink/sdl_android into feature/multiplexing
13 files changed, 595 insertions, 124 deletions
diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 000000000..47ad9677a --- /dev/null +++ b/.travis.yml @@ -0,0 +1,12 @@ +language: android +android: + components: + # use the latest revision of Android SDK Tools + - platform-tools + - tools + + # The BuildTools version used by your project + - build-tools-23.0.2 + + # The SDK version used to compile your project + - android-18
\ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 387e19d5e..d0afe5b87 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,79 +1,12 @@ -# 4.0.0 Release Notes +# 4.0.1 Release Notes ### API New Features & Breaking Changes -* Updated to v4.0 RPCs and enums. - * Enums updated: - * LayoutMode (Add and deprecate) - * AppInterfaceUnregisteredReason - * TextFieldName - * ImageFieldName - * VehicleDataResultCode - * KeyboardEvent - * RequestType - * RPCs updated - * TouchEvent - Changed timestamp (ts) to use Long instead of Integers - * HMICapabilities (new) - * RegisterAppInterface (response) - * PutFile (request) - Changed offset and length to use Long instead of Integers - * DialNumber (new - request, response) - * OnSystemRequest (notification) (Changed offset and length to use Long instead of Integers) -* Removed unused classes StringEnumer, Base64, and utl/Mime -* Removed unused methods including these public/protected methods: - * `com/smartDeviceLink/streaming/AbstractPacketizer` - * printBuffer(byte[],int,int) - * `com/smartDeviceLink/trace/Mime` - * base64Decode(String) - * `com/smartDeviceLink/trace/SdlTrace` - * setTracingEnable(Boolean) -* Moved TransportType enum to new package which will contain all new enums for the transport package, `com/smartDeviceLink/transport/enums` -* Removed unused enums - * GearShiftAdviceStatus - * LightSwitchStatus - * MaintenanceModeStatus - * MessageType - * PermissionStatus - * TirePressureTellTale - * VehicleDataActiveStatus -* Video/Audio streaming are now enabled. *[(See spec for more detail)](https://github.com/smartdevicelink/protocol_spec)* -* Changed the USB metadata information to use SDL as the manufacturer and Core as the model - + * Added ability to retrieve HMICapabilities and SystemSoftwareVersion from the proxy object. ### Enhancements -* Modified generics to follow Java convention -* Made FunctionID an enum rather than class with constants -* Added more robust parameter checking -* Changed some logging methods to return boolean for easier unit tests -* Changed putFile building methods to accept Longs instead of ints. Old methods were deprecated. -* Cleaned up SdlDataTypeConverter in terms of readability. -* MTU size increased to 128kb up from 1.5k for v4. This will be the expected MTU for this version. -* Added a SDL Proxy builder that will enable simpler building of proxy objects as the large amount of constructors could be confusing. -* Changed the outgoing message queues to actually be FIFO queues. -* Heartbeat is now fully implemented which is needed for audio and video streaming. *[(See spec for more details)](https://github.com/smartdevicelink/protocol_spec).* -* Device info will now automatically populate in the Register App Interface RPC. - + * Added RPC request callbacks. Developers can now set a listener object into any RPC request and recieve the response through it. + * Added RPC notification listeners. Developers can now designate a listener for each notifcation type. + * Added a correlation id generator. Id's can be generated through this class to avoid having to keep track between multiple classes. -### Bugfixes -* Fixed issue with onProxyClosed not always called in multiple session scenario -* Removed recursion from HandleReceivedBytes -* Fixed wrong key issue in UpdateTurnList during turn list retrieval -* Fixed class cast exception caused by calling toArray from enums: - * FrameData - * FrameDataControlFrameType - * FrameType - * SessionType -* Redirected deprecated methods to new methods when available for following classes: - * GetVehicleData - * GetVehicleDataResponse - * OnVehicleData - * SubscribeVehicleData - * SubscribeVehicleDataResponse - * UnsubscribeVehicleData - * UnsubscribeVehicleDataResponse -* Fixed incorrect naming conventions of variables (SdlTrace) -* Fixed an issue RPC base classes that allowed for null values to be passed and cause issues with the underlying hashtable. -* Fixed issue where different types of RPC’s (response, request, notification) could be used in their parent class (RPCMessage) state to create other children of that class. -* Fixed SendLocation to use Doubles instead of Floats for degrees -* Fixed naming of SessionTypes to reflect spec and Sava naming conventions -* Fixed ByteEnumer to catch class cast exceptions -* Removed outdated logging. -* Implemented missing callbacks for turn by turn RPCs. +### Bug Fixes + * Removed unused imports diff --git a/build.gradle b/build.gradle new file mode 100644 index 000000000..241c951c6 --- /dev/null +++ b/build.gradle @@ -0,0 +1,47 @@ +buildscript { + repositories { + jcenter() + } + dependencies { + classpath 'com.android.tools.build:gradle:1.1.0' + } +} +apply plugin: 'com.android.library' + +dependencies { + compile fileTree(dir: 'libs', include: '*.jar') +} + +android { + compileSdkVersion 18 + buildToolsVersion "23.0.2" + + lintOptions { + // When we start automating build deployments this should be removed + abortOnError false + } + + sourceSets { + main { + manifest.srcFile 'sdl_android_lib/AndroidManifest.xml' + java.srcDirs = ['src'] + resources.srcDirs = ['src'] + aidl.srcDirs = ['src'] + renderscript.srcDirs = ['src'] + res.srcDirs = ['res'] + assets.srcDirs = ['assets'] + } + + // Move the tests to tests/java, tests/res, etc... + instrumentTest.setRoot('tests') + + // Move the build types to build-types/<type> + // For instance, build-types/debug/java, build-types/debug/AndroidManifest.xml, ... + // This moves them out of them default location under src/<type>/... which would + // conflict with src/ being used by the main source set. + // Adding new build types or product flavors should be accompanied + // by a similar customization. + debug.setRoot('build-types/debug') + release.setRoot('build-types/release') + } +} diff --git a/sdl_android_lib/src/com/smartdevicelink/proxy/RPCMessage.java b/sdl_android_lib/src/com/smartdevicelink/proxy/RPCMessage.java index 8f68a1ebe..8d3794075 100644 --- a/sdl_android_lib/src/com/smartdevicelink/proxy/RPCMessage.java +++ b/sdl_android_lib/src/com/smartdevicelink/proxy/RPCMessage.java @@ -2,6 +2,8 @@ package com.smartdevicelink.proxy; import java.util.Hashtable;
+import com.smartdevicelink.proxy.rpc.listeners.OnRPCResponseListener;
+
public class RPCMessage extends RPCStruct {
public static final String KEY_REQUEST = "request";
@@ -51,7 +53,7 @@ public class RPCMessage extends RPCStruct { protected String messageType;
protected Hashtable<String, Object> parameters;
protected Hashtable<String, Object> function;
-
+
public String getFunctionName() {
return (String)function.get(KEY_FUNCTION_NAME);
}
@@ -80,4 +82,5 @@ public class RPCMessage extends RPCStruct { public Object getParameters(String functionName) {
return parameters.get(functionName);
}
+
}
diff --git a/sdl_android_lib/src/com/smartdevicelink/proxy/RPCRequest.java b/sdl_android_lib/src/com/smartdevicelink/proxy/RPCRequest.java index c9645426a..50493870d 100644 --- a/sdl_android_lib/src/com/smartdevicelink/proxy/RPCRequest.java +++ b/sdl_android_lib/src/com/smartdevicelink/proxy/RPCRequest.java @@ -5,8 +5,12 @@ package com.smartdevicelink.proxy; import java.util.Hashtable;
+import com.smartdevicelink.proxy.rpc.listeners.OnRPCResponseListener;
+
public class RPCRequest extends RPCMessage {
+ protected OnRPCResponseListener onResponseListener;
+
public RPCRequest(String functionName) {
super(functionName, RPCMessage.KEY_REQUEST);
messageType = RPCMessage.KEY_REQUEST;
@@ -27,4 +31,11 @@ public class RPCRequest extends RPCMessage { function.remove(RPCMessage.KEY_CORRELATION_ID);
}
}
+ public void setOnRPCResponseListener(OnRPCResponseListener listener){
+ onResponseListener = listener;
+ }
+
+ public OnRPCResponseListener getOnRPCResponseListener(){
+ return this.onResponseListener;
+ }
}
diff --git a/sdl_android_lib/src/com/smartdevicelink/proxy/SdlProxyALM.java b/sdl_android_lib/src/com/smartdevicelink/proxy/SdlProxyALM.java index 3b27cc961..8b9174a19 100644 --- a/sdl_android_lib/src/com/smartdevicelink/proxy/SdlProxyALM.java +++ b/sdl_android_lib/src/com/smartdevicelink/proxy/SdlProxyALM.java @@ -12,6 +12,7 @@ import com.smartdevicelink.proxy.interfaces.IProxyListenerALM; import com.smartdevicelink.proxy.rpc.AudioPassThruCapabilities;
import com.smartdevicelink.proxy.rpc.ButtonCapabilities;
import com.smartdevicelink.proxy.rpc.DisplayCapabilities;
+import com.smartdevicelink.proxy.rpc.HMICapabilities;
import com.smartdevicelink.proxy.rpc.PresetBankCapabilities;
import com.smartdevicelink.proxy.rpc.SdlMsgVersion;
import com.smartdevicelink.proxy.rpc.SoftButtonCapabilities;
@@ -1378,7 +1379,7 @@ public class SdlProxyALM extends SdlProxyBase<IProxyListenerALM> { * Gets AudioPassThruCapabilities set when application interface is registered.
*
* @return AudioPassThruCapabilities
- * @throws SyncException
+ * @throws SdlException
*/
public List<AudioPassThruCapabilities> getAudioPassThruCapabilities() throws SdlException {
// Test if proxy has been disposed
@@ -1386,9 +1387,9 @@ public class SdlProxyALM extends SdlProxyBase<IProxyListenerALM> { throw new SdlException("This object has been disposed, it is no long capable of executing methods.", SdlExceptionCause.SDL_PROXY_DISPOSED);
}
- // Test SYNC availability
+ // Test SDL availability
if (!_appInterfaceRegisterd) {
- throw new SdlException("SYNC is not connected. Unable to get the vehicleType.", SdlExceptionCause.SDL_UNAVAILABLE);
+ throw new SdlException("SDL is not connected. Unable to get the vehicleType.", SdlExceptionCause.SDL_UNAVAILABLE);
}
return _audioPassThruCapabilities;
}
@@ -1406,6 +1407,33 @@ public class SdlProxyALM extends SdlProxyBase<IProxyListenerALM> { return _diagModes;
}
+ public HMICapabilities getHmiCapabilities() throws SdlException {
+ // Test if proxy has been disposed
+ if (_proxyDisposed) {
+ throw new SdlException("This object has been disposed, it is no long capable of executing methods.", SdlExceptionCause.SDL_PROXY_DISPOSED);
+ }
+
+ // Test SDL availability
+ if (!_appInterfaceRegisterd) {
+ throw new SdlException("SDL is not connected. Unable to get the HMICapabilities.", SdlExceptionCause.SDL_UNAVAILABLE);
+ }
+ return _hmiCapabilities;
+ }
+
+
+ public String getSystemSoftwareVersion() throws SdlException {
+ // Test if proxy has been disposed
+ if (_proxyDisposed) {
+ throw new SdlException("This object has been disposed, it is no long capable of executing methods.", SdlExceptionCause.SDL_PROXY_DISPOSED);
+ }
+
+ // Test SDL availability
+ if (!_appInterfaceRegisterd) {
+ throw new SdlException("SDL is not connected. Unable to get the SystemSoftwareVersion.", SdlExceptionCause.SDL_UNAVAILABLE);
+ }
+ return _systemSoftwareVersion;
+ }
+
public boolean isAppResumeSuccess() throws SdlException {
// Test if proxy has been disposed
if (_proxyDisposed) {
diff --git a/sdl_android_lib/src/com/smartdevicelink/proxy/SdlProxyBase.java b/sdl_android_lib/src/com/smartdevicelink/proxy/SdlProxyBase.java index d243efc11..c5937886c 100644 --- a/sdl_android_lib/src/com/smartdevicelink/proxy/SdlProxyBase.java +++ b/sdl_android_lib/src/com/smartdevicelink/proxy/SdlProxyBase.java @@ -33,6 +33,7 @@ import android.os.Handler; import android.os.Looper;
import android.telephony.TelephonyManager;
import android.util.Log;
+import android.util.SparseArray;
import android.view.Surface;
import com.smartdevicelink.Dispatcher.IDispatchingStrategy;
@@ -83,6 +84,9 @@ import com.smartdevicelink.proxy.rpc.enums.SystemContext; import com.smartdevicelink.proxy.rpc.enums.TextAlignment;
import com.smartdevicelink.proxy.rpc.enums.UpdateMode;
import com.smartdevicelink.proxy.rpc.enums.VrCapabilities;
+import com.smartdevicelink.proxy.rpc.listeners.OnPutFileUpdateListener;
+import com.smartdevicelink.proxy.rpc.listeners.OnRPCNotificationListener;
+import com.smartdevicelink.proxy.rpc.listeners.OnRPCResponseListener;
import com.smartdevicelink.streaming.StreamRPCPacketizer;
import com.smartdevicelink.trace.SdlTrace;
import com.smartdevicelink.trace.TraceDeviceInfo;
@@ -113,7 +117,9 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase> private static final Object CONNECTION_REFERENCE_LOCK = new Object(),
INCOMING_MESSAGE_QUEUE_THREAD_LOCK = new Object(),
OUTGOING_MESSAGE_QUEUE_THREAD_LOCK = new Object(),
- INTERNAL_MESSAGE_QUEUE_THREAD_LOCK = new Object();
+ INTERNAL_MESSAGE_QUEUE_THREAD_LOCK = new Object(),
+ ON_UPDATE_LISTENER_LOCK = new Object(),
+ ON_NOTIFICATION_LISTENER_LOCK = new Object();
private Object APP_INTERFACE_REGISTERED_LOCK = new Object();
@@ -199,6 +205,8 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase> protected List<VrCapabilities> _vrCapabilities = null;
protected VehicleType _vehicleType = null;
protected List<AudioPassThruCapabilities> _audioPassThruCapabilities = null;
+ protected HMICapabilities _hmiCapabilities = null;
+ protected String _systemSoftwareVersion = null;
protected List<Integer> _diagModes = null;
protected Boolean firstTimeFull = true;
protected String _proxyVersionInfo = null; @@ -208,6 +216,9 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase> protected byte _wiproVersion = 1;
+ protected SparseArray<OnRPCResponseListener> rpcResponseListeners = null;
+ protected SparseArray<OnRPCNotificationListener> rpcNotificationListeners = null;
+
// Interface broker
private SdlInterfaceBroker _interfaceBroker = null;
@@ -623,6 +634,9 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase> });
}
+ rpcResponseListeners = new SparseArray<OnRPCResponseListener>();
+ rpcNotificationListeners = new SparseArray<OnRPCNotificationListener>();
+
// Initialize the proxy
try {
initializeProxy();
@@ -1224,6 +1238,9 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase> }
}
+ rpcResponseListeners.clear();
+ rpcNotificationListeners.clear(); //TODO make sure we want to clear this
+
// Clean up SDL Connection
synchronized(CONNECTION_REFERENCE_LOCK) {
if (sdlSession != null) sdlSession.close();
@@ -1277,6 +1294,9 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase> }
_traceDeviceInterrogator = null;
+
+ rpcResponseListeners = null;
+
} catch (SdlException e) {
throw e;
} finally {
@@ -1335,7 +1355,8 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase> private void dispatchIncomingMessage(ProtocolMessage message) {
try{
// Dispatching logic
- if (message.getSessionType().equals(SessionType.RPC)) {
+ if (message.getSessionType().equals(SessionType.RPC)
+ ||message.getSessionType().equals(SessionType.BULK_DATA) ) {
try {
if (_wiproVersion == 1) {
if (message.getVersion() > 1) setWiProVersion(message.getVersion());
@@ -1562,6 +1583,11 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase> synchronized(OUTGOING_MESSAGE_QUEUE_THREAD_LOCK) {
if (_outgoingProxyMessageDispatcher != null) {
_outgoingProxyMessageDispatcher.queueMessage(pm);
+ //Since the message is queued we can add it's listener to our list
+ OnRPCResponseListener listener = request.getOnRPCResponseListener();
+ if(request.getMessageType().equals(RPCMessage.KEY_REQUEST)){//We might want to include other message types in the future
+ addOnRPCResponseListener(listener, request.getCorrelationID(), msgBytes.length);
+ }
}
}
} catch (OutOfMemoryError e) {
@@ -1570,6 +1596,100 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase> }
}
+ /**
+ * Only call this method for a PutFile response. It will cause a class cast exception if not.
+ * @param correlationId
+ * @param bytesWritten
+ * @param totalSize
+ */
+ public void onPacketProgress(int correlationId, long bytesWritten, long totalSize){
+ synchronized(ON_UPDATE_LISTENER_LOCK){
+ if(rpcResponseListeners !=null
+ && rpcResponseListeners.indexOfKey(correlationId)>=0){
+ ((OnPutFileUpdateListener)rpcResponseListeners.get(correlationId)).onUpdate(correlationId, bytesWritten, totalSize);
+ }
+ }
+
+ }
+
+ /**
+ * Will provide callback to the listener either onFinish or onError depending on the RPCResponses result code,
+ * <p>Will automatically remove the listener for the list of listeners on completion.
+ * @param msg
+ * @return if a listener was called or not
+ */
+ private boolean onRPCResponseReceived(RPCResponse msg){
+ synchronized(ON_UPDATE_LISTENER_LOCK){
+ int correlationId = msg.getCorrelationID();
+ if(rpcResponseListeners !=null
+ && rpcResponseListeners.indexOfKey(correlationId)>=0){
+ OnRPCResponseListener listener = rpcResponseListeners.get(correlationId);
+ if(msg.getSuccess()){
+ listener.onResponse(correlationId, msg);
+ }else{
+ listener.onError(correlationId, msg.getResultCode(), msg.getInfo());
+ }
+ rpcResponseListeners.remove(correlationId);
+ return true;
+ }
+ return false;
+ }
+ }
+
+/**
+ *
+ * @param listener
+ * @param correlationId
+ * @param totalSize only include if this is an OnPutFileUpdateListener. Otherwise it will be ignored.
+ */
+ public void addOnRPCResponseListener(OnRPCResponseListener listener,int correlationId, int totalSize){
+ synchronized(ON_UPDATE_LISTENER_LOCK){
+ if(rpcResponseListeners!=null
+ && listener !=null){
+ if(listener.getListenerType() == OnRPCResponseListener.UPDATE_LISTENER_TYPE_PUT_FILE){
+ ((OnPutFileUpdateListener)listener).setTotalSize(totalSize);
+ }
+ listener.onStart(correlationId);
+ rpcResponseListeners.put(correlationId, listener);
+ }
+ }
+ }
+
+ public SparseArray<OnRPCResponseListener> getResponseListeners(){
+ synchronized(ON_UPDATE_LISTENER_LOCK){
+ return this.rpcResponseListeners;
+ }
+ }
+
+ public boolean onRPCNotificationReceived(RPCNotification notification){
+ synchronized(ON_NOTIFICATION_LISTENER_LOCK){
+ OnRPCNotificationListener listener = rpcNotificationListeners.get(FunctionID.getFunctionId(notification.getFunctionName()));
+ if(listener!=null){
+ listener.onNotified(notification);
+ return true;
+ }
+ return false;
+ }
+ }
+
+ /**
+ * This will ad a listener for the specific type of notification. As of now it will only allow
+ * a single listener per notification function id
+ * @param notification The notification type that this listener is designated for
+ * @param listener The listener that will be called when a notification of the provided type is received
+ */
+ public void addOnRPCNotificationListener(FunctionID notificationId,OnRPCNotificationListener listener){
+ synchronized(ON_NOTIFICATION_LISTENER_LOCK){
+ rpcNotificationListeners.put(notificationId.getId(), listener);
+ }
+ }
+
+ public void removeOnRPCNotificationListener(FunctionID notificationId){
+ synchronized(ON_NOTIFICATION_LISTENER_LOCK){
+ rpcNotificationListeners.delete(notificationId.getId());
+ }
+ }
+
private void handleRPCMessage(Hashtable<String, Object> hash) {
RPCMessage rpcMsg = new RPCMessage(hash);
String functionName = rpcMsg.getFunctionName();
@@ -1577,7 +1697,7 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase> if (messageType.equals(RPCMessage.KEY_RESPONSE)) {
SdlTrace.logRPCEvent(InterfaceActivityDirection.Receive, new RPCResponse(rpcMsg), SDL_LIB_TRACE_KEY);
-
+
// Check to ensure response is not from an internal message (reserved correlation ID)
if (isCorrelationIDProtected((new RPCResponse(hash)).getCorrelationID())) {
// This is a response generated from an internal message, it can be trapped here
@@ -1615,6 +1735,8 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase> _vrCapabilities = msg.getVrCapabilities();
_vehicleType = msg.getVehicleType();
_audioPassThruCapabilities = msg.getAudioPassThruCapabilities();
+ _hmiCapabilities = msg.getHmiCapabilities();
+ _systemSoftwareVersion = msg.getSystemSoftwareVersion();
_proxyVersionInfo = msg.getProxyVersionInfo();
if (_bAppResumeEnabled)
@@ -1664,6 +1786,7 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase> } else if (_proxyListener instanceof IProxyListenerALM) {
//((IProxyListenerALM)_proxyListener).onRegisterAppInterfaceResponse(msg);
}
+ onRPCResponseReceived(msg);
}
});
} else {
@@ -1672,6 +1795,7 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase> } else if (_proxyListener instanceof IProxyListenerALM) {
//((IProxyListenerALM)_proxyListener).onRegisterAppInterfaceResponse(msg);
}
+ onRPCResponseReceived(msg);
}
} else if ((new RPCResponse(hash)).getCorrelationID() == POLICIES_CORRELATION_ID
&& functionName.equals(FunctionID.ON_ENCODED_SYNC_P_DATA.toString())) {
@@ -1764,6 +1888,8 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase> _vrCapabilities = msg.getVrCapabilities();
_vehicleType = msg.getVehicleType();
_audioPassThruCapabilities = msg.getAudioPassThruCapabilities();
+ _hmiCapabilities = msg.getHmiCapabilities();
+ _systemSoftwareVersion = msg.getSystemSoftwareVersion();
_proxyVersionInfo = msg.getProxyVersionInfo();
if (_bAppResumeEnabled)
@@ -1810,6 +1936,7 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase> } else if (_proxyListener instanceof IProxyListenerALM) {
//((IProxyListenerALM)_proxyListener).onRegisterAppInterfaceResponse(msg);
}
+ onRPCResponseReceived(msg);
}
});
} else {
@@ -1818,6 +1945,7 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase> } else if (_proxyListener instanceof IProxyListenerALM) {
//((IProxyListenerALM)_proxyListener).onRegisterAppInterfaceResponse(msg);
}
+ onRPCResponseReceived(msg);
}
}
} else if (functionName.equals(FunctionID.SPEAK.toString())) {
@@ -1830,10 +1958,12 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase> @Override
public void run() {
_proxyListener.onSpeakResponse(msg);
+ onRPCResponseReceived(msg);
}
});
} else {
- _proxyListener.onSpeakResponse(msg);
+ _proxyListener.onSpeakResponse(msg);
+ onRPCResponseReceived(msg);
}
} else if (functionName.equals(FunctionID.ALERT.toString())) {
// AlertResponse
@@ -1845,10 +1975,12 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase> @Override
public void run() {
_proxyListener.onAlertResponse(msg);
+ onRPCResponseReceived(msg);
}
});
} else {
- _proxyListener.onAlertResponse(msg);
+ _proxyListener.onAlertResponse(msg);
+ onRPCResponseReceived(msg);
}
} else if (functionName.equals(FunctionID.SHOW.toString())) {
// ShowResponse
@@ -1860,10 +1992,12 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase> @Override
public void run() {
_proxyListener.onShowResponse((ShowResponse)msg);
+ onRPCResponseReceived(msg);
}
});
} else {
- _proxyListener.onShowResponse((ShowResponse)msg);
+ _proxyListener.onShowResponse((ShowResponse)msg);
+ onRPCResponseReceived(msg);
}
} else if (functionName.equals(FunctionID.ADD_COMMAND.toString())) {
// AddCommand
@@ -1875,10 +2009,12 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase> @Override
public void run() {
_proxyListener.onAddCommandResponse((AddCommandResponse)msg);
+ onRPCResponseReceived(msg);
}
});
} else {
- _proxyListener.onAddCommandResponse((AddCommandResponse)msg);
+ _proxyListener.onAddCommandResponse((AddCommandResponse)msg);
+ onRPCResponseReceived(msg);
}
} else if (functionName.equals(FunctionID.DELETE_COMMAND.toString())) {
// DeleteCommandResponse
@@ -1890,10 +2026,12 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase> @Override
public void run() {
_proxyListener.onDeleteCommandResponse((DeleteCommandResponse)msg);
+ onRPCResponseReceived(msg);
}
});
} else {
- _proxyListener.onDeleteCommandResponse((DeleteCommandResponse)msg);
+ _proxyListener.onDeleteCommandResponse((DeleteCommandResponse)msg);
+ onRPCResponseReceived(msg);
}
} else if (functionName.equals(FunctionID.ADD_SUB_MENU.toString())) {
// AddSubMenu
@@ -1905,10 +2043,12 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase> @Override
public void run() {
_proxyListener.onAddSubMenuResponse((AddSubMenuResponse)msg);
+ onRPCResponseReceived(msg);
}
});
} else {
- _proxyListener.onAddSubMenuResponse((AddSubMenuResponse)msg);
+ _proxyListener.onAddSubMenuResponse((AddSubMenuResponse)msg);
+ onRPCResponseReceived(msg);
}
} else if (functionName.equals(FunctionID.DELETE_SUB_MENU.toString())) {
// DeleteSubMenu
@@ -1920,10 +2060,12 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase> @Override
public void run() {
_proxyListener.onDeleteSubMenuResponse((DeleteSubMenuResponse)msg);
+ onRPCResponseReceived(msg);
}
});
} else {
- _proxyListener.onDeleteSubMenuResponse((DeleteSubMenuResponse)msg);
+ _proxyListener.onDeleteSubMenuResponse((DeleteSubMenuResponse)msg);
+ onRPCResponseReceived(msg);
}
} else if (functionName.equals(FunctionID.SUBSCRIBE_BUTTON.toString())) {
// SubscribeButton
@@ -1935,10 +2077,12 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase> @Override
public void run() {
_proxyListener.onSubscribeButtonResponse((SubscribeButtonResponse)msg);
+ onRPCResponseReceived(msg);
}
});
} else {
- _proxyListener.onSubscribeButtonResponse((SubscribeButtonResponse)msg);
+ _proxyListener.onSubscribeButtonResponse((SubscribeButtonResponse)msg);
+ onRPCResponseReceived(msg);
}
} else if (functionName.equals(FunctionID.UNSUBSCRIBE_BUTTON.toString())) {
// UnsubscribeButton
@@ -1950,10 +2094,12 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase> @Override
public void run() {
_proxyListener.onUnsubscribeButtonResponse((UnsubscribeButtonResponse)msg);
+ onRPCResponseReceived(msg);
}
});
} else {
- _proxyListener.onUnsubscribeButtonResponse((UnsubscribeButtonResponse)msg);
+ _proxyListener.onUnsubscribeButtonResponse((UnsubscribeButtonResponse)msg);
+ onRPCResponseReceived(msg);
}
} else if (functionName.equals(FunctionID.SET_MEDIA_CLOCK_TIMER.toString())) {
// SetMediaClockTimer
@@ -1965,10 +2111,12 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase> @Override
public void run() {
_proxyListener.onSetMediaClockTimerResponse((SetMediaClockTimerResponse)msg);
+ onRPCResponseReceived(msg);
}
});
} else {
- _proxyListener.onSetMediaClockTimerResponse((SetMediaClockTimerResponse)msg);
+ _proxyListener.onSetMediaClockTimerResponse((SetMediaClockTimerResponse)msg);
+ onRPCResponseReceived(msg);
}
} else if (functionName.equals(FunctionID.ENCODED_SYNC_P_DATA.toString())) {
@@ -1988,11 +2136,13 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase> _mainUIHandler.post(new Runnable() {
@Override
public void run() {
- _proxyListener.onSystemRequestResponse(msg);
+ _proxyListener.onSystemRequestResponse(msg);
+ onRPCResponseReceived(msg);
}
});
} else {
- _proxyListener.onSystemRequestResponse(msg);
+ _proxyListener.onSystemRequestResponse(msg);
+ onRPCResponseReceived(msg);
}
} else if (functionName.equals(FunctionID.CREATE_INTERACTION_CHOICE_SET.toString())) {
// CreateInteractionChoiceSet
@@ -2004,10 +2154,12 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase> @Override
public void run() {
_proxyListener.onCreateInteractionChoiceSetResponse((CreateInteractionChoiceSetResponse)msg);
+ onRPCResponseReceived(msg);
}
});
} else {
- _proxyListener.onCreateInteractionChoiceSetResponse((CreateInteractionChoiceSetResponse)msg);
+ _proxyListener.onCreateInteractionChoiceSetResponse((CreateInteractionChoiceSetResponse)msg);
+ onRPCResponseReceived(msg);
}
} else if (functionName.equals(FunctionID.DELETE_INTERACTION_CHOICE_SET.toString())) {
// DeleteInteractionChoiceSet
@@ -2019,10 +2171,12 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase> @Override
public void run() {
_proxyListener.onDeleteInteractionChoiceSetResponse((DeleteInteractionChoiceSetResponse)msg);
+ onRPCResponseReceived(msg);
}
});
} else {
- _proxyListener.onDeleteInteractionChoiceSetResponse((DeleteInteractionChoiceSetResponse)msg);
+ _proxyListener.onDeleteInteractionChoiceSetResponse((DeleteInteractionChoiceSetResponse)msg);
+ onRPCResponseReceived(msg);
}
} else if (functionName.equals(FunctionID.PERFORM_INTERACTION.toString())) {
// PerformInteraction
@@ -2034,10 +2188,12 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase> @Override
public void run() {
_proxyListener.onPerformInteractionResponse((PerformInteractionResponse)msg);
+ onRPCResponseReceived(msg);
}
});
} else {
- _proxyListener.onPerformInteractionResponse((PerformInteractionResponse)msg);
+ _proxyListener.onPerformInteractionResponse((PerformInteractionResponse)msg);
+ onRPCResponseReceived(msg);
}
} else if (functionName.equals(FunctionID.SET_GLOBAL_PROPERTIES.toString())) {
// SetGlobalPropertiesResponse
@@ -2049,10 +2205,12 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase> @Override
public void run() {
_proxyListener.onSetGlobalPropertiesResponse((SetGlobalPropertiesResponse)msg);
+ onRPCResponseReceived(msg);
}
});
} else {
- _proxyListener.onSetGlobalPropertiesResponse((SetGlobalPropertiesResponse)msg);
+ _proxyListener.onSetGlobalPropertiesResponse((SetGlobalPropertiesResponse)msg);
+ onRPCResponseReceived(msg);
}
} else if (functionName.equals(FunctionID.RESET_GLOBAL_PROPERTIES.toString())) {
// ResetGlobalProperties
@@ -2064,10 +2222,12 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase> @Override
public void run() {
_proxyListener.onResetGlobalPropertiesResponse((ResetGlobalPropertiesResponse)msg);
+ onRPCResponseReceived(msg);
}
});
} else {
- _proxyListener.onResetGlobalPropertiesResponse((ResetGlobalPropertiesResponse)msg);
+ _proxyListener.onResetGlobalPropertiesResponse((ResetGlobalPropertiesResponse)msg);
+ onRPCResponseReceived(msg);
}
} else if (functionName.equals(FunctionID.UNREGISTER_APP_INTERFACE.toString())) {
// UnregisterAppInterface
@@ -2099,6 +2259,7 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase> } else if (_proxyListener instanceof IProxyListenerALM) {
//((IProxyListenerALM)_proxyListener).onUnregisterAppInterfaceResponse(msg);
}
+ onRPCResponseReceived(msg);
}
});
} else {
@@ -2107,6 +2268,7 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase> } else if (_proxyListener instanceof IProxyListenerALM) {
//((IProxyListenerALM)_proxyListener).onUnregisterAppInterfaceResponse(msg);
}
+ onRPCResponseReceived(msg);
}
notifyProxyClosed("UnregisterAppInterfaceResponse", null, SdlDisconnectedReason.APP_INTERFACE_UNREG);
@@ -2119,10 +2281,12 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase> @Override
public void run() {
_proxyListener.onGenericResponse((GenericResponse)msg);
+ onRPCResponseReceived(msg);
}
});
} else {
- _proxyListener.onGenericResponse((GenericResponse)msg);
+ _proxyListener.onGenericResponse((GenericResponse)msg);
+ onRPCResponseReceived(msg);
}
} else if (functionName.equals(FunctionID.SLIDER.toString())) {
// Slider
@@ -2133,10 +2297,12 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase> @Override
public void run() {
_proxyListener.onSliderResponse((SliderResponse)msg);
+ onRPCResponseReceived(msg);
}
});
} else {
- _proxyListener.onSliderResponse((SliderResponse)msg);
+ _proxyListener.onSliderResponse((SliderResponse)msg);
+ onRPCResponseReceived(msg);
}
} else if (functionName.equals(FunctionID.PUT_FILE.toString())) {
// PutFile
@@ -2147,11 +2313,13 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase> @Override
public void run() {
_proxyListener.onPutFileResponse((PutFileResponse)msg);
+ onRPCResponseReceived(msg);
notifyPutFileStreamResponse(msg);
}
});
} else {
_proxyListener.onPutFileResponse((PutFileResponse)msg);
+ onRPCResponseReceived(msg);
notifyPutFileStreamResponse(msg);
}
} else if (functionName.equals(FunctionID.DELETE_FILE.toString())) {
@@ -2163,10 +2331,12 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase> @Override
public void run() {
_proxyListener.onDeleteFileResponse((DeleteFileResponse)msg);
+ onRPCResponseReceived(msg);
}
});
} else {
- _proxyListener.onDeleteFileResponse((DeleteFileResponse)msg);
+ _proxyListener.onDeleteFileResponse((DeleteFileResponse)msg);
+ onRPCResponseReceived(msg);
}
} else if (functionName.equals(FunctionID.LIST_FILES.toString())) {
// ListFiles
@@ -2177,10 +2347,12 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase> @Override
public void run() {
_proxyListener.onListFilesResponse((ListFilesResponse)msg);
+ onRPCResponseReceived(msg);
}
});
} else {
- _proxyListener.onListFilesResponse((ListFilesResponse)msg);
+ _proxyListener.onListFilesResponse((ListFilesResponse)msg);
+ onRPCResponseReceived(msg);
}
} else if (functionName.equals(FunctionID.SET_APP_ICON.toString())) {
// SetAppIcon
@@ -2191,10 +2363,12 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase> @Override
public void run() {
_proxyListener.onSetAppIconResponse((SetAppIconResponse)msg);
+ onRPCResponseReceived(msg);
}
});
} else {
- _proxyListener.onSetAppIconResponse((SetAppIconResponse)msg);
+ _proxyListener.onSetAppIconResponse((SetAppIconResponse)msg);
+ onRPCResponseReceived(msg);
}
} else if (functionName.equals(FunctionID.SCROLLABLE_MESSAGE.toString())) {
// ScrollableMessage
@@ -2205,10 +2379,12 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase> @Override
public void run() {
_proxyListener.onScrollableMessageResponse((ScrollableMessageResponse)msg);
+ onRPCResponseReceived(msg);
}
});
} else {
- _proxyListener.onScrollableMessageResponse((ScrollableMessageResponse)msg);
+ _proxyListener.onScrollableMessageResponse((ScrollableMessageResponse)msg);
+ onRPCResponseReceived(msg);
}
} else if (functionName.equals(FunctionID.CHANGE_REGISTRATION.toString())) {
// ChangeLanguageRegistration
@@ -2219,10 +2395,12 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase> @Override
public void run() {
_proxyListener.onChangeRegistrationResponse((ChangeRegistrationResponse)msg);
+ onRPCResponseReceived(msg);
}
});
} else {
- _proxyListener.onChangeRegistrationResponse((ChangeRegistrationResponse)msg);
+ _proxyListener.onChangeRegistrationResponse((ChangeRegistrationResponse)msg);
+ onRPCResponseReceived(msg);
}
} else if (functionName.equals(FunctionID.SET_DISPLAY_LAYOUT.toString())) {
// SetDisplayLayout
@@ -2242,10 +2420,12 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase> @Override
public void run() {
_proxyListener.onSetDisplayLayoutResponse((SetDisplayLayoutResponse)msg);
+ onRPCResponseReceived(msg);
}
});
} else {
_proxyListener.onSetDisplayLayoutResponse((SetDisplayLayoutResponse)msg);
+ onRPCResponseReceived(msg);
}
} else if (functionName.equals(FunctionID.PERFORM_AUDIO_PASS_THRU.toString())) {
// PerformAudioPassThru
@@ -2256,10 +2436,12 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase> @Override
public void run() {
_proxyListener.onPerformAudioPassThruResponse((PerformAudioPassThruResponse)msg);
+ onRPCResponseReceived(msg);
}
});
} else {
- _proxyListener.onPerformAudioPassThruResponse((PerformAudioPassThruResponse)msg);
+ _proxyListener.onPerformAudioPassThruResponse((PerformAudioPassThruResponse)msg);
+ onRPCResponseReceived(msg);
}
} else if (functionName.equals(FunctionID.END_AUDIO_PASS_THRU.toString())) {
// EndAudioPassThru
@@ -2270,10 +2452,12 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase> @Override
public void run() {
_proxyListener.onEndAudioPassThruResponse((EndAudioPassThruResponse)msg);
+ onRPCResponseReceived(msg);
}
});
} else {
_proxyListener.onEndAudioPassThruResponse((EndAudioPassThruResponse)msg);
+ onRPCResponseReceived(msg);
}
} else if (functionName.equals(FunctionID.SUBSCRIBE_VEHICLE_DATA.toString())) {
// SubscribeVehicleData
@@ -2284,10 +2468,12 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase> @Override
public void run() {
_proxyListener.onSubscribeVehicleDataResponse((SubscribeVehicleDataResponse)msg);
+ onRPCResponseReceived(msg);
}
});
} else {
- _proxyListener.onSubscribeVehicleDataResponse((SubscribeVehicleDataResponse)msg);
+ _proxyListener.onSubscribeVehicleDataResponse((SubscribeVehicleDataResponse)msg);
+ onRPCResponseReceived(msg);
}
} else if (functionName.equals(FunctionID.UNSUBSCRIBE_VEHICLE_DATA.toString())) {
// UnsubscribeVehicleData
@@ -2298,10 +2484,12 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase> @Override
public void run() {
_proxyListener.onUnsubscribeVehicleDataResponse((UnsubscribeVehicleDataResponse)msg);
+ onRPCResponseReceived(msg);
}
});
} else {
- _proxyListener.onUnsubscribeVehicleDataResponse((UnsubscribeVehicleDataResponse)msg);
+ _proxyListener.onUnsubscribeVehicleDataResponse((UnsubscribeVehicleDataResponse)msg);
+ onRPCResponseReceived(msg);
}
} else if (functionName.equals(FunctionID.GET_VEHICLE_DATA.toString())) {
// GetVehicleData
@@ -2312,10 +2500,12 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase> @Override
public void run() {
_proxyListener.onGetVehicleDataResponse((GetVehicleDataResponse)msg);
+ onRPCResponseReceived(msg);
}
});
} else {
- _proxyListener.onGetVehicleDataResponse((GetVehicleDataResponse)msg);
+ _proxyListener.onGetVehicleDataResponse((GetVehicleDataResponse)msg);
+ onRPCResponseReceived(msg);
}
} else if (functionName.equals(FunctionID.READ_DID.toString())) {
final ReadDIDResponse msg = new ReadDIDResponse(hash);
@@ -2325,10 +2515,12 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase> @Override
public void run() {
_proxyListener.onReadDIDResponse((ReadDIDResponse)msg);
+ onRPCResponseReceived(msg);
}
});
} else {
- _proxyListener.onReadDIDResponse((ReadDIDResponse)msg);
+ _proxyListener.onReadDIDResponse((ReadDIDResponse)msg);
+ onRPCResponseReceived(msg);
}
} else if (functionName.equals(FunctionID.GET_DTCS.toString())) {
final GetDTCsResponse msg = new GetDTCsResponse(hash);
@@ -2338,10 +2530,12 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase> @Override
public void run() {
_proxyListener.onGetDTCsResponse((GetDTCsResponse)msg);
+ onRPCResponseReceived(msg);
}
});
} else {
- _proxyListener.onGetDTCsResponse((GetDTCsResponse)msg);
+ _proxyListener.onGetDTCsResponse((GetDTCsResponse)msg);
+ onRPCResponseReceived(msg);
}
} else if (functionName.equals(FunctionID.DIAGNOSTIC_MESSAGE.toString())) {
final DiagnosticMessageResponse msg = new DiagnosticMessageResponse(hash);
@@ -2351,10 +2545,12 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase> @Override
public void run() {
_proxyListener.onDiagnosticMessageResponse((DiagnosticMessageResponse)msg);
+ onRPCResponseReceived(msg);
}
});
} else {
- _proxyListener.onDiagnosticMessageResponse((DiagnosticMessageResponse)msg);
+ _proxyListener.onDiagnosticMessageResponse((DiagnosticMessageResponse)msg);
+ onRPCResponseReceived(msg);
}
}
else if (functionName.equals(FunctionID.SYSTEM_REQUEST.toString())) {
@@ -2366,10 +2562,12 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase> @Override
public void run() {
_proxyListener.onSystemRequestResponse((SystemRequestResponse)msg);
+ onRPCResponseReceived(msg);
}
});
} else {
- _proxyListener.onSystemRequestResponse((SystemRequestResponse)msg);
+ _proxyListener.onSystemRequestResponse((SystemRequestResponse)msg);
+ onRPCResponseReceived(msg);
}
}
else if (functionName.equals(FunctionID.SEND_LOCATION.toString())) {
@@ -2381,10 +2579,12 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase> @Override
public void run() {
_proxyListener.onSendLocationResponse(msg);
+ onRPCResponseReceived(msg);
}
});
} else {
- _proxyListener.onSendLocationResponse(msg);
+ _proxyListener.onSendLocationResponse(msg);
+ onRPCResponseReceived(msg);
}
}
else if (functionName.equals(FunctionID.DIAL_NUMBER.toString())) {
@@ -2396,10 +2596,12 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase> @Override
public void run() {
_proxyListener.onDialNumberResponse(msg);
+ onRPCResponseReceived(msg);
}
});
} else {
- _proxyListener.onDialNumberResponse(msg);
+ _proxyListener.onDialNumberResponse(msg);
+ onRPCResponseReceived(msg);
}
}
else if (functionName.equals(FunctionID.SHOW_CONSTANT_TBT.toString())) {
@@ -2409,10 +2611,12 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase> @Override
public void run() {
_proxyListener.onShowConstantTbtResponse(msg);
+ onRPCResponseReceived(msg);
}
});
} else {
_proxyListener.onShowConstantTbtResponse(msg);
+ onRPCResponseReceived(msg);
}
}
else if (functionName.equals(FunctionID.ALERT_MANEUVER.toString())) {
@@ -2422,10 +2626,12 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase> @Override
public void run() {
_proxyListener.onAlertManeuverResponse(msg);
+ onRPCResponseReceived(msg);
}
});
} else {
_proxyListener.onAlertManeuverResponse(msg);
+ onRPCResponseReceived(msg);
}
} else if (functionName.equals(FunctionID.UPDATE_TURN_LIST.toString())) {
final UpdateTurnListResponse msg = new UpdateTurnListResponse(hash);
@@ -2434,10 +2640,12 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase> @Override
public void run() {
_proxyListener.onUpdateTurnListResponse(msg);
+ onRPCResponseReceived(msg);
}
});
} else {
_proxyListener.onUpdateTurnListResponse(msg);
+ onRPCResponseReceived(msg);
}
}
else {
@@ -2448,6 +2656,7 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase> DebugTool.logError("Unrecognized response Message: " + functionName.toString());
}
} // end-if
+
} else if (messageType.equals(RPCMessage.KEY_NOTIFICATION)) {
SdlTrace.logRPCEvent(InterfaceActivityDirection.Receive, new RPCNotification(rpcMsg), SDL_LIB_TRACE_KEY);
if (functionName.equals(FunctionID.ON_HMI_STATUS.toString())) {
@@ -2472,11 +2681,13 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase> public void run() {
_proxyListener.onOnHMIStatus((OnHMIStatus)msg);
_proxyListener.onOnLockScreenNotification(sdlSession.getLockScreenMan().getLockObj());
+ onRPCNotificationReceived(msg);
}
});
} else {
_proxyListener.onOnHMIStatus((OnHMIStatus)msg);
_proxyListener.onOnLockScreenNotification(sdlSession.getLockScreenMan().getLockObj());
+ onRPCNotificationReceived(msg);
}
}
} else if (functionName.equals(FunctionID.ON_COMMAND.toString())) {
@@ -2489,10 +2700,12 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase> @Override
public void run() {
_proxyListener.onOnCommand((OnCommand)msg);
+ onRPCNotificationReceived(msg);
}
});
} else {
_proxyListener.onOnCommand((OnCommand)msg);
+ onRPCNotificationReceived(msg);
}
} else if (functionName.equals(FunctionID.ON_DRIVER_DISTRACTION.toString())) {
// OnDriverDistration
@@ -2518,11 +2731,13 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase> public void run() {
_proxyListener.onOnDriverDistraction(msg);
_proxyListener.onOnLockScreenNotification(sdlSession.getLockScreenMan().getLockObj());
+ onRPCNotificationReceived(msg);
}
});
} else {
_proxyListener.onOnDriverDistraction(msg);
_proxyListener.onOnLockScreenNotification(sdlSession.getLockScreenMan().getLockObj());
+ onRPCNotificationReceived(msg);
}
} else if (functionName.equals(FunctionID.ON_ENCODED_SYNC_P_DATA.toString())) {
@@ -2542,10 +2757,12 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase> @Override
public void run() {
_proxyListener.onOnSystemRequest(msg);
+ onRPCNotificationReceived(msg);
}
});
} else {
_proxyListener.onOnSystemRequest(msg);
+ onRPCNotificationReceived(msg);
}
} else {
updateBroadcastIntent(sendIntent, "COMMENT1", "Sending to cloud: " + msg.getUrl());
@@ -2575,10 +2792,12 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase> @Override
public void run() {
_proxyListener.onOnPermissionsChange(msg);
+ onRPCNotificationReceived(msg);
}
});
} else {
_proxyListener.onOnPermissionsChange(msg);
+ onRPCNotificationReceived(msg);
}
} else if (functionName.equals(FunctionID.ON_TBT_CLIENT_STATE.toString())) {
// OnTBTClientState
@@ -2590,10 +2809,12 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase> @Override
public void run() {
_proxyListener.onOnTBTClientState(msg);
+ onRPCNotificationReceived(msg);
}
});
} else {
_proxyListener.onOnTBTClientState(msg);
+ onRPCNotificationReceived(msg);
}
} else if (functionName.equals(FunctionID.ON_BUTTON_PRESS.toString())) {
// OnButtonPress
@@ -2605,10 +2826,12 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase> @Override
public void run() {
_proxyListener.onOnButtonPress((OnButtonPress)msg);
+ onRPCNotificationReceived(msg);
}
});
} else {
_proxyListener.onOnButtonPress((OnButtonPress)msg);
+ onRPCNotificationReceived(msg);
}
} else if (functionName.equals(FunctionID.ON_BUTTON_EVENT.toString())) {
// OnButtonEvent
@@ -2620,10 +2843,12 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase> @Override
public void run() {
_proxyListener.onOnButtonEvent((OnButtonEvent)msg);
+ onRPCNotificationReceived(msg);
}
});
} else {
_proxyListener.onOnButtonEvent((OnButtonEvent)msg);
+ onRPCNotificationReceived(msg);
}
} else if (functionName.equals(FunctionID.ON_LANGUAGE_CHANGE.toString())) {
// OnLanguageChange
@@ -2635,10 +2860,12 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase> @Override
public void run() {
_proxyListener.onOnLanguageChange((OnLanguageChange)msg);
+ onRPCNotificationReceived(msg);
}
});
} else {
_proxyListener.onOnLanguageChange((OnLanguageChange)msg);
+ onRPCNotificationReceived(msg);
}
} else if (functionName.equals(FunctionID.ON_HASH_CHANGE.toString())) {
// OnLanguageChange
@@ -2650,6 +2877,7 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase> @Override
public void run() {
_proxyListener.onOnHashChange((OnHashChange)msg);
+ onRPCNotificationReceived(msg);
if (_bAppResumeEnabled)
{
_lastHashID = msg.getHashID();
@@ -2658,6 +2886,7 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase> });
} else {
_proxyListener.onOnHashChange((OnHashChange)msg);
+ onRPCNotificationReceived(msg);
if (_bAppResumeEnabled)
{
_lastHashID = msg.getHashID();
@@ -2694,10 +2923,12 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase> @Override
public void run() {
_proxyListener.onOnSystemRequest((OnSystemRequest)msg);
+ onRPCNotificationReceived(msg);
}
});
} else {
_proxyListener.onOnSystemRequest((OnSystemRequest)msg);
+ onRPCNotificationReceived(msg);
}
} else if (functionName.equals(FunctionID.ON_AUDIO_PASS_THRU.toString())) {
// OnAudioPassThru
@@ -2708,10 +2939,12 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase> @Override
public void run() {
_proxyListener.onOnAudioPassThru((OnAudioPassThru)msg);
+ onRPCNotificationReceived(msg);
}
});
} else {
_proxyListener.onOnAudioPassThru((OnAudioPassThru)msg);
+ onRPCNotificationReceived(msg);
}
} else if (functionName.equals(FunctionID.ON_VEHICLE_DATA.toString())) {
// OnVehicleData
@@ -2722,10 +2955,12 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase> @Override
public void run() {
_proxyListener.onOnVehicleData((OnVehicleData)msg);
+ onRPCNotificationReceived(msg);
}
});
} else {
_proxyListener.onOnVehicleData((OnVehicleData)msg);
+ onRPCNotificationReceived(msg);
}
}
else if (functionName.equals(FunctionID.ON_APP_INTERFACE_UNREGISTERED.toString())) {
@@ -2754,10 +2989,12 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase> @Override
public void run() {
((IProxyListener)_proxyListener).onOnAppInterfaceUnregistered(msg);
+ onRPCNotificationReceived(msg);
}
});
} else {
((IProxyListener)_proxyListener).onOnAppInterfaceUnregistered(msg);
+ onRPCNotificationReceived(msg);
}
notifyProxyClosed("OnAppInterfaceUnregistered", null, SdlDisconnectedReason.APP_INTERFACE_UNREG);
}
@@ -2770,10 +3007,12 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase> @Override
public void run() {
_proxyListener.onOnKeyboardInput((OnKeyboardInput)msg);
+ onRPCNotificationReceived(msg);
}
});
} else {
_proxyListener.onOnKeyboardInput((OnKeyboardInput)msg);
+ onRPCNotificationReceived(msg);
}
}
else if (functionName.equals(FunctionID.ON_TOUCH_EVENT.toString())) {
@@ -2784,10 +3023,12 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase> @Override
public void run() {
_proxyListener.onOnTouchEvent((OnTouchEvent)msg);
+ onRPCNotificationReceived(msg);
}
});
} else {
_proxyListener.onOnTouchEvent((OnTouchEvent)msg);
+ onRPCNotificationReceived(msg);
}
}
else {
@@ -2799,7 +3040,7 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase> }
} // end-if
} // end-if notification
-
+
SdlTrace.logProxyEvent("Proxy received RPC Message: " + functionName, SDL_LIB_TRACE_KEY);
}
@@ -4832,8 +5073,9 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase> * core to elsewhere in the system.
* @throws SdlException
*/
- public void putFileStream(InputStream inputStream, String fileName, Long offset, Long length, FileType fileType, Boolean isPersistentFile, Boolean isSystemFile) throws SdlException {
+ public void putFileStream(InputStream inputStream, String fileName, Long offset, Long length, FileType fileType, Boolean isPersistentFile, Boolean isSystemFile, OnPutFileUpdateListener cb) throws SdlException {
PutFile msg = RPCRequestFactory.buildPutFile(fileName, offset, length);
+ msg.setOnPutFileUpdateListener(cb);
startRPCStream(inputStream, msg);
}
@@ -4876,8 +5118,9 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase> * core to elsewhere in the system.
* @throws SdlException
*/
- public OutputStream putFileStream(String fileName, Long offset, Long length, FileType fileType, Boolean isPersistentFile, Boolean isSystemFile) throws SdlException {
+ public OutputStream putFileStream(String fileName, Long offset, Long length, FileType fileType, Boolean isPersistentFile, Boolean isSystemFile, OnPutFileUpdateListener cb) throws SdlException {
PutFile msg = RPCRequestFactory.buildPutFile(fileName, offset, length);
+ msg.setOnPutFileUpdateListener(cb);
return startRPCStream(msg);
}
@@ -4926,8 +5169,9 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase> * returned .
* @throws SdlException
*/
- public RPCStreamController putFileStream(String path, String fileName, Long offset, FileType fileType, Boolean isPersistentFile, Boolean isSystemFile, Integer correlationId) throws SdlException {
+ public RPCStreamController putFileStream(String path, String fileName, Long offset, FileType fileType, Boolean isPersistentFile, Boolean isSystemFile, Integer correlationId,OnPutFileUpdateListener cb ) throws SdlException {
PutFile msg = RPCRequestFactory.buildPutFile(fileName, offset, 0L, fileType, isPersistentFile, isSystemFile, correlationId);
+ msg.setOnPutFileUpdateListener(cb);
return startPutFileStream(path,msg);
}
diff --git a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/PutFile.java b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/PutFile.java index 2f76f862a..e47c95bda 100644 --- a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/PutFile.java +++ b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/PutFile.java @@ -5,6 +5,8 @@ import java.util.Hashtable; import com.smartdevicelink.protocol.enums.FunctionID;
import com.smartdevicelink.proxy.RPCRequest;
import com.smartdevicelink.proxy.rpc.enums.FileType;
+import com.smartdevicelink.proxy.rpc.listeners.OnPutFileUpdateListener;
+import com.smartdevicelink.proxy.rpc.listeners.OnRPCResponseListener;
/**
* Used to push a binary data onto the SDL module from a mobile device, such as
@@ -219,4 +221,18 @@ public class PutFile extends RPCRequest { else
return null;
}
+
+
+ @Override
+ public final void setOnRPCResponseListener(OnRPCResponseListener listener) {
+ super.setOnRPCResponseListener(listener);
+ }
+
+ public void setOnPutFileUpdateListener(OnPutFileUpdateListener listener) {
+ super.setOnRPCResponseListener(listener); //We can use the same method because it get stored as a parent class
+ }
+
+ public OnPutFileUpdateListener getOnPutFileUpdateListener() {
+ return (OnPutFileUpdateListener)getOnRPCResponseListener();
+ }
}
diff --git a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/listeners/OnPutFileUpdateListener.java b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/listeners/OnPutFileUpdateListener.java new file mode 100644 index 000000000..1a8e4f35f --- /dev/null +++ b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/listeners/OnPutFileUpdateListener.java @@ -0,0 +1,48 @@ +package com.smartdevicelink.proxy.rpc.listeners; + +import com.smartdevicelink.proxy.RPCResponse; + +public abstract class OnPutFileUpdateListener extends OnRPCResponseListener{ + + long totalSize = 0; + + public OnPutFileUpdateListener(){ + setListenerType(UPDATE_LISTENER_TYPE_PUT_FILE); + } + + @Override + public final void onStart(int correlationId) { + super.onStart(correlationId); + onStart(correlationId, totalSize); //We do this so we can send back the total size + } + + public void onStart(int correlationId, long totalSize){ + + } + + @Override + public final void onResponse(int correlationId, RPCResponse response) { + onResponse(correlationId, response, totalSize); //Calling our special abstract method + } + /** + * Called when the putfile request is responded to. + * @param correlationId + * @param message + * @param totalSize + */ + public abstract void onResponse(int correlationId, RPCResponse response, long totalSize); + + /** + * onUpdate is called during a putfile stream request + * @param correlationId of the original request + * @param bytesWritten + * @param totalSize + */ + public void onUpdate(int correlationId, long bytesWritten, long totalSize){ + + }; + + public final void setTotalSize(long totalSize){ + this.totalSize = totalSize; + } +} diff --git a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/listeners/OnRPCNotificationListener.java b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/listeners/OnRPCNotificationListener.java new file mode 100644 index 000000000..e760618b1 --- /dev/null +++ b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/listeners/OnRPCNotificationListener.java @@ -0,0 +1,8 @@ +package com.smartdevicelink.proxy.rpc.listeners; + +import com.smartdevicelink.proxy.RPCNotification; + +public abstract class OnRPCNotificationListener { + + public abstract void onNotified(RPCNotification notification); +} diff --git a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/listeners/OnRPCResponseListener.java b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/listeners/OnRPCResponseListener.java new file mode 100644 index 000000000..4bc5ccd79 --- /dev/null +++ b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/listeners/OnRPCResponseListener.java @@ -0,0 +1,73 @@ +package com.smartdevicelink.proxy.rpc.listeners; + +import com.smartdevicelink.proxy.RPCResponse; +import com.smartdevicelink.proxy.rpc.enums.Result; + +public abstract class OnRPCResponseListener { + /** + * Generic listener type that will work for most RPCs + */ + public final static int UPDATE_LISTENER_TYPE_BASE_RPC = 0; + /** + * Listener type specific to putfile + */ + public final static int UPDATE_LISTENER_TYPE_PUT_FILE = 1; + + /** + * Stores what type of listener this instance is. This prevents of from having to use reflection + */ + int listenerType; + + /** + * This is the base listener for all RPCs. + */ + public OnRPCResponseListener(){ + setListenerType(UPDATE_LISTENER_TYPE_BASE_RPC); + } + + protected final void setListenerType(int type){ + this.listenerType = type; + } + /** + * This is used to see what type of listener this instance is. It is needed + * because some RPCs require additional callbacks. Types are constants located in this class + * @return the type of listener this is + */ + public int getListenerType(){ + return this.listenerType; + } + + /* ***************************************************************** + ************************* Event Callbacks ************************* + *******************************************************************/ + + /** + * This method will be called once the packet has been entered into the queue of messages to send + * @param correlationId + */ + public void onStart(int correlationId){ + + }; + + /** + * This is the only method that must be extended. Other methods that are able to be extended are + * onStart and onError. + * @param correlationId + * @param response This will be the response message received from the core side. It should be cast into a corresponding RPC Response type. ie, if setting this + * for a PutFile request, the message parameter should be cast to a PutFileResponse class. + */ + public abstract void onResponse(int correlationId, final RPCResponse response); + + /** + * Called when there was some sort of error during the original request. + * @param correlationId + * @param resultCode + * @param info + */ + public void onError(int correlationId, Result resultCode, String info){ + + }; + + + +} diff --git a/sdl_android_lib/src/com/smartdevicelink/streaming/StreamRPCPacketizer.java b/sdl_android_lib/src/com/smartdevicelink/streaming/StreamRPCPacketizer.java index a8a2398bd..68a7a02ca 100644 --- a/sdl_android_lib/src/com/smartdevicelink/streaming/StreamRPCPacketizer.java +++ b/sdl_android_lib/src/com/smartdevicelink/streaming/StreamRPCPacketizer.java @@ -19,6 +19,7 @@ import com.smartdevicelink.proxy.rpc.PutFile; import com.smartdevicelink.proxy.rpc.PutFileResponse;
import com.smartdevicelink.proxy.rpc.StreamRPCResponse;
import com.smartdevicelink.proxy.rpc.enums.Result;
+import com.smartdevicelink.proxy.rpc.listeners.OnPutFileUpdateListener;
public class StreamRPCPacketizer extends AbstractPacketizer implements IPutFileResponseListener, Runnable{
@@ -33,8 +34,10 @@ public class StreamRPCPacketizer extends AbstractPacketizer implements IPutFileR private Object mPauseLock;
private boolean mPaused;
-
- public StreamRPCPacketizer(SdlProxyBase<IProxyListenerBase> proxy, IStreamListener streamListener, InputStream is, RPCRequest request, SessionType sType, byte rpcSessionID, byte wiproVersion, long iLength) throws IOException {
+
+ private OnPutFileUpdateListener callBack;
+
+ public StreamRPCPacketizer(SdlProxyBase<IProxyListenerBase> proxy, IStreamListener streamListener, InputStream is, RPCRequest request, SessionType sType, byte rpcSessionID, byte wiproVersion, long iLength) throws IOException {
super(streamListener, is, request, sType, rpcSessionID, wiproVersion);
lFileSize = iLength;
iInitialCorrID = request.getCorrelationID();
@@ -45,6 +48,9 @@ public class StreamRPCPacketizer extends AbstractPacketizer implements IPutFileR _proxy = proxy;
_proxyListener = _proxy.getProxyListener();
_proxy.addPutFileResponseListener(this);
+ }
+ if(_request.getFunctionName().equalsIgnoreCase(FunctionID.PUT_FILE.toString())){
+ callBack = ((PutFile)_request).getOnPutFileUpdateListener();
} }
@@ -163,7 +169,9 @@ public class StreamRPCPacketizer extends AbstractPacketizer implements IPutFileR {
handleStreamException(null,null," Error, PutFile offset invalid for file: " + sFileName);
}
-
+ if(callBack!=null){
+ callBack.onStart(_request.getCorrelationID(), lFileSize);
+ }
while (!Thread.interrupted()) {
synchronized (mPauseLock)
@@ -226,22 +234,36 @@ public class StreamRPCPacketizer extends AbstractPacketizer implements IPutFileR @Override
public void onPutFileResponse(PutFileResponse response)
{
+
OnStreamRPC streamNote = notificationList.get(response.getCorrelationID());
if (streamNote == null) return;
-
+
if (response.getSuccess())
{
- if (_proxyListener != null)
+ if(callBack!=null){
+ callBack.onUpdate(response.getCorrelationID(), streamNote.getBytesComplete(), lFileSize);
+ }
+ if (_proxyListener != null){
_proxyListener.onOnStreamRPC(streamNote);
+ }
+
}
else
{
+ if(callBack!=null){
+ callBack.onError(response.getCorrelationID(), response.getResultCode(), response.getInfo());
+ }
handleStreamException(response, null, "");
+
}
if (response.getSuccess() && streamNote.getBytesComplete().equals(streamNote.getFileSize()) )
{
+ if(callBack!=null){
+ callBack.onResponse(iInitialCorrID, response, streamNote.getBytesComplete());
+ }
handleStreamSuccess(response, streamNote.getBytesComplete());
+
}
}
@@ -250,5 +272,6 @@ public class StreamRPCPacketizer extends AbstractPacketizer implements IPutFileR {
if (thread != null)
handleStreamException(null, e, info);
+
}
}
diff --git a/sdl_android_lib/src/com/smartdevicelink/util/CorrelationIdGenerator.java b/sdl_android_lib/src/com/smartdevicelink/util/CorrelationIdGenerator.java new file mode 100644 index 000000000..18ff93622 --- /dev/null +++ b/sdl_android_lib/src/com/smartdevicelink/util/CorrelationIdGenerator.java @@ -0,0 +1,25 @@ +package com.smartdevicelink.util; + +import java.util.concurrent.atomic.AtomicInteger; + +public class CorrelationIdGenerator { + + private static final int CORRELATION_ID_START = 0; + + private static final AtomicInteger sNextCorrelationId = new AtomicInteger(CORRELATION_ID_START); + + public static int generateId() { + for (;;) { + final int result = sNextCorrelationId.get(); + // aapt-generated IDs have the high byte nonzero; clamp to the range under that. + int newValue = result + 1; + + if (newValue > 0x00FFFFFF){ + newValue = CORRELATION_ID_START; // Roll over to 0. + } + if (sNextCorrelationId.compareAndSet(result, newValue)) { + return result; + } + } + } +} |