Skip to content
This repository has been archived by the owner on Dec 23, 2024. It is now read-only.

added ability to connect to the current DeviceSupport #1172

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
import android.content.SharedPreferences;
import android.content.pm.PackageManager;
import android.net.Uri;
import android.os.Binder;
import android.os.Handler;
import android.os.IBinder;
import android.support.annotation.Nullable;
Expand Down Expand Up @@ -751,9 +752,16 @@ public void onDestroy() {
}
}

public class CommunicationServiceBinder extends Binder{
public DeviceSupport getDeviceSupport(){
if(mDeviceSupport == null) return null;
return ((ServiceDeviceSupport)DeviceCommunicationService.this.mDeviceSupport).getDelegate();
}
}

@Override
public IBinder onBind(Intent intent) {
return null;
return new CommunicationServiceBinder();
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,10 @@ public ServiceDeviceSupport(DeviceSupport delegate, EnumSet<Flags> flags) {
this.flags = flags;
}

public DeviceSupport getDelegate() {
return delegate;
}

@Override
public void setContext(GBDevice gbDevice, BluetoothAdapter btAdapter, Context context) {
delegate.setContext(gbDevice, btAdapter, context);
Expand Down