Skip to content

Commit

Permalink
Merge pull request #5 from ConnectSDK/fix_connection_failure_event
Browse files Browse the repository at this point in the history
Fix failure connection event
  • Loading branch information
Hyun Kook Khang committed Dec 15, 2014
2 parents e298e6d + ab864e5 commit f261f7d
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 f261f7d

Please sign in to comment.