Skip to content

Commit

Permalink
Refactor SimpleDeviceInterface -> SimpleBluetoothDeviceInterface
Browse files Browse the repository at this point in the history
  • Loading branch information
harryjph committed Jun 21, 2018
1 parent 647ff6e commit 8f8a7f6
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ public void closeDevice(BluetoothSerialDevice device) {
* @param deviceInterface The interface accessing the device
* you are trying to close the connection to
*/
public void closeDevice(SimpleDeviceInterface deviceInterface) {
public void closeDevice(SimpleBluetoothDeviceInterface deviceInterface) {
closeDevice(deviceInterface.getDevice().getMac());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public class BluetoothSerialDevice {
private final InputStream inputStream;

@Nullable
private SimpleDeviceInterface owner;
private SimpleBluetoothDeviceInterface owner;

private BluetoothSerialDevice(String mac, BluetoothSocket socket, OutputStream outputStream, InputStream inputStream) {
this.mac = mac;
Expand Down Expand Up @@ -93,17 +93,17 @@ void close() throws IOException {
}

/**
* Wrap using a SimpleDeviceInterface.
* Wrap using a SimpleBluetoothDeviceInterface.
* This makes things a lot simpler within the class accessing this device
*
* @return a SimpleDeviceInterface that will access this device object
* @return a SimpleBluetoothDeviceInterface that will access this device object
*/
public SimpleDeviceInterface toSimpleDeviceInterface() {
public SimpleBluetoothDeviceInterface toSimpleDeviceInterface() {
requireNotClosed();
if (owner != null) {
return owner;
} else {
return owner = new SimpleDeviceInterface(this);
return owner = new SimpleBluetoothDeviceInterface(this);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import io.reactivex.disposables.CompositeDisposable;
import io.reactivex.schedulers.Schedulers;

public class SimpleDeviceInterface {
public class SimpleBluetoothDeviceInterface {

private final BluetoothSerialDevice device;

Expand All @@ -19,7 +19,7 @@ public class SimpleDeviceInterface {
@Nullable
private OnErrorListener errorListener;

SimpleDeviceInterface(BluetoothSerialDevice device) {
SimpleBluetoothDeviceInterface(BluetoothSerialDevice device) {
this.device = device;

compositeDisposable.add(device.openMessageStream()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
import android.widget.Toast;

import com.harrysoft.androidbluetoothserial.BluetoothManager;
import com.harrysoft.androidbluetoothserial.SimpleDeviceInterface;
import com.harrysoft.androidbluetoothserial.SimpleBluetoothDeviceInterface;

import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.disposables.CompositeDisposable;
Expand All @@ -27,7 +27,7 @@ public class CommunicateViewModel extends AndroidViewModel {

// Our Bluetooth Device! When disconnected it is null, so make sure we know that we need to deal with it potentially being null
@Nullable
private SimpleDeviceInterface deviceInterface;
private SimpleBluetoothDeviceInterface deviceInterface;

// The messages feed that the activity sees
private MutableLiveData<String> messagesData = new MutableLiveData<>();
Expand Down Expand Up @@ -119,7 +119,7 @@ public void disconnect() {
}

// Called once the library connects a bluetooth device
private void onConnected(SimpleDeviceInterface deviceInterface) {
private void onConnected(SimpleBluetoothDeviceInterface deviceInterface) {
this.deviceInterface = deviceInterface;
if (this.deviceInterface != null) {
// We have a device! Tell the activity we are connected.
Expand Down

0 comments on commit 8f8a7f6

Please sign in to comment.