Skip to content

Commit c00b213

Browse files
committed
Fix if high bandwidth is needed during d/c
1 parent 9377865 commit c00b213

1 file changed

Lines changed: 32 additions & 4 deletions

File tree

base/src/main/java/com/smartdevicelink/protocol/SdlProtocolBase.java

Lines changed: 32 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1184,16 +1184,44 @@ public void onTransportDisconnected(String info, TransportRecord disconnectedTra
11841184
}
11851185

11861186
if((getTransportForSession(SessionType.RPC) != null && disconnectedTransport.equals(getTransportForSession(SessionType.RPC))) || disconnectedTransport.equals(connectedPrimaryTransport)){
1187+
//Primary transport has been disconnected. Let's check if we can recover.
11871188
//transportTypes.remove(type);
11881189
boolean primaryTransportAvailable = false;
11891190
if(requestedPrimaryTransports != null && requestedPrimaryTransports.size() > 1){
1190-
for (TransportType transportType: requestedPrimaryTransports){ Log.d(TAG, "Checking " + transportType.name());
1191+
for (TransportType transportType: requestedPrimaryTransports){
1192+
DebugTool.logInfo( "Checking " + transportType.name());
1193+
11911194
if(!disconnectedTransport.getType().equals(transportType)
11921195
&& transportManager != null
11931196
&& transportManager.isConnected(transportType,null)){
1194-
primaryTransportAvailable = true;
1195-
transportManager.updateTransportConfig(transportConfig);
1196-
break;
1197+
1198+
//There is currently a supported primary transport
1199+
1200+
//See if any high bandwidth transport is available currently
1201+
boolean highBandwidthAvailable = transportManager.isHighBandwidthAvailable();
1202+
1203+
if (requiresHighBandwidth) {
1204+
if (!highBandwidthAvailable) {
1205+
if (TransportType.BLUETOOTH.equals(transportType)
1206+
&& requestedSecondaryTransports != null
1207+
&& supportedSecondaryTransports != null) {
1208+
for (TransportType secondaryTransport : requestedSecondaryTransports) {
1209+
DebugTool.logInfo("Checking secondary " + secondaryTransport.name());
1210+
if (supportedSecondaryTransports.contains(secondaryTransport)) {
1211+
//Should only be USB or TCP
1212+
highBandwidthAvailable = true;
1213+
break;
1214+
}
1215+
}
1216+
}
1217+
} // High bandwidth already available
1218+
}
1219+
1220+
if(!requiresHighBandwidth || (requiresHighBandwidth && highBandwidthAvailable )) {
1221+
primaryTransportAvailable = true;
1222+
transportManager.updateTransportConfig(transportConfig);
1223+
break;
1224+
}
11971225
}
11981226
}
11991227
}

0 commit comments

Comments
 (0)