summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoey Grover <joeygrover@gmail.com>2016-05-06 14:41:10 -0400
committerJoey Grover <joeygrover@gmail.com>2016-05-06 14:41:10 -0400
commit15a6617b9bd7522fa9df80a38cfbecbf4d2a741f (patch)
treeea01378242353c8dde0acde95cfbec3986ce155d
parent388009b89308a1a5aadc0a9d9c7cee2d141695fc (diff)
downloadsdl_android-15a6617b9bd7522fa9df80a38cfbecbf4d2a741f.tar.gz
Cleaned up SdlConnection
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/SdlConnection/SdlConnection.java57
1 files changed, 28 insertions, 29 deletions
diff --git a/sdl_android_lib/src/com/smartdevicelink/SdlConnection/SdlConnection.java b/sdl_android_lib/src/com/smartdevicelink/SdlConnection/SdlConnection.java
index dc8c0e191..354ad6956 100644
--- a/sdl_android_lib/src/com/smartdevicelink/SdlConnection/SdlConnection.java
+++ b/sdl_android_lib/src/com/smartdevicelink/SdlConnection/SdlConnection.java
@@ -262,7 +262,7 @@ public class SdlConnection implements IProtocolListener, ITransportListener, ISt
@Override
public void onProtocolSessionStarted(SessionType sessionType,
- byte sessionID, byte version, String correlationID) {Log.d(TAG, "onProtocolSessionStarted");
+ byte sessionID, byte version, String correlationID) {
_connectionListener.onProtocolSessionStarted(sessionType, sessionID, version, correlationID);
}
@@ -543,28 +543,27 @@ public class SdlConnection implements IProtocolListener, ITransportListener, ISt
}
if(cachedMultiConfig!=null ){
if(cachedMultiConfig.getService()!=null){
- synchronized(TRANSPORT_REFERENCE_LOCK) {
- // Ensure transport is null
- if (_transport != null) {
- if (_transport.getIsConnected()) {
- _transport.disconnect();
+ synchronized(TRANSPORT_REFERENCE_LOCK) {
+ // Ensure transport is null
+ if (_transport != null) {
+ if (_transport.getIsConnected()) {
+ _transport.disconnect();
+ }
+ _transport = null;
}
- _transport = null;
+ _transport = new MultiplexTransport(cachedMultiConfig, SdlConnection.this);
+ try {
+ startTransport();
+ } catch (SdlException e) {
+ e.printStackTrace();
+ }
+ ((MultiplexTransport)_transport).forceHardwareConnectEvent(TransportType.BLUETOOTH);
}
- _transport = new MultiplexTransport(cachedMultiConfig, SdlConnection.this);
- try {
- startTransport();
- } catch (SdlException e) {
- e.printStackTrace();
+ }else{ //The service must be null or already consumed. Let's see if we can find the connection that consumed it
+ for (SdlSession session : listenerList) {
+ session.checkForOpenMultiplexConnection(SdlConnection.this);;
}
- ((MultiplexTransport)_transport).forceHardwareConnectEvent(TransportType.BLUETOOTH);
}
- }else{ //The service must be null or already consumed. Let's see if we can find the connection that consumed it
- for (SdlSession session : listenerList) {
- session.checkForOpenMultiplexConnection(SdlConnection.this);;
- }
-
- }
}
}
@@ -762,16 +761,16 @@ public class SdlConnection implements IProtocolListener, ITransportListener, ISt
}
}else if(_transport.getTransportType()==TransportType.BLUETOOTH
&& !_transport.getIsConnected()){
- if(cachedMultiConfig!=null){
- //We are in legacy mode, but just received a force connect. The router service should never be pointing us here if we are truely in legacy mode
- ComponentName tempCompName = SdlBroadcastReceiver.consumeQueuedRouterService();
- cachedMultiConfig.setService(tempCompName);
- //We are not connected yet so we should be able to close down
- _transport.disconnect(); //This will force us into the
- }else{
- Log.i(TAG, "No cached multiplexing config, transport error being called");
- _transport.disconnect();
- }
+ if(cachedMultiConfig!=null){
+ //We are in legacy mode, but just received a force connect. The router service should never be pointing us here if we are truely in legacy mode
+ ComponentName tempCompName = SdlBroadcastReceiver.consumeQueuedRouterService();
+ cachedMultiConfig.setService(tempCompName);
+ //We are not connected yet so we should be able to close down
+ _transport.disconnect(); //This will force us into the
+ }else{
+ Log.i(TAG, "No cached multiplexing config, transport error being called");
+ _transport.disconnect();
+ }
Log.w(TAG, "Using own transport, but not connected. Attempting to join multiplexing");
}else{
Log.w(TAG, "Currently in legacy mode connected to own transport service. Nothing will take place on trnasport cycle");