ConnectSDK / Connect-SDK-Android-Core

Core source code for the Android Connect SDK project
Apache License 2.0
114 stars 79 forks source link

Add getCapability method to ConnectableDevice #13

Closed oleksii-frolov closed 9 years ago

oleksii-frolov commented 9 years ago

These changes add a new getCapability method for solving that issue https://github.com/ConnectSDK/Connect-SDK-Android/issues/201

oleksii-frolov commented 9 years ago

@iheart2code Could you please explain how it should be? I didn't get about gradle plugin here.

khk624 commented 9 years ago

Maybe we can rename the getApiController to getCapability, in that case he can add new capabilities without modifying the method

Adding this will help for this case, getApiController() in ConnectableDevice.java

        T controller = service.getAPI(controllerClass);

        // new code
        if (priorityMethod == null)
            return controller;
        // ends 

        if (foundController == null) {
            foundController = controller;
        }

even though, it does not cover adding multiple new capabilities. Maybe we need to change getApiController to public and change the method name to getCapability() in that case.

Let me know your opinion.

iheart2code commented 9 years ago

Sounds like a great idea, @khk624