Skip to content

Commit

Permalink
Fix failure connection event
Browse files Browse the repository at this point in the history
  • Loading branch information
oleksii-frolov committed Dec 12, 2014
1 parent e298e6d commit ab864e5
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/com/connectsdk/device/ConnectableDevice.java
Original file line number Diff line number Diff line change
Expand Up @@ -409,7 +409,7 @@ public boolean hasCapability(String capability) {
boolean hasCap = false;

for (DeviceService service: services.values()) {
if ( service.hasCapability(capability) ) {
if ( service.hasCapability(capability) && service.isConnected() ) {
hasCap = true;
break;
}
Expand Down Expand Up @@ -947,7 +947,11 @@ public void onCapabilitiesUpdated(DeviceService service, List<String> added, Lis
DiscoveryManager.getInstance().onCapabilityUpdated(this, added, removed);
}

@Override public void onConnectionFailure(DeviceService service, Error error) {

@Override
public void onConnectionFailure(DeviceService service, Error error) {
// disconnect device if all services are not connected
onDisconnect(service, error);
}

@Override public void onConnectionRequired(DeviceService service) {
Expand All @@ -956,7 +960,7 @@ public void onCapabilitiesUpdated(DeviceService service, List<String> added, Lis
@Override
public void onConnectionSuccess(DeviceService service) {
// TODO: iOS is passing to a function for when each service is ready on a device. This is not implemented on Android.

if (isConnected()) {
ConnectableDeviceStore deviceStore = DiscoveryManager.getInstance().getConnectableDeviceStore();
if (deviceStore != null) {
Expand Down

0 comments on commit ab864e5

Please sign in to comment.