Skip to content

Commit 8f8a7f6

Browse files
committed
Refactor SimpleDeviceInterface -> SimpleBluetoothDeviceInterface
1 parent 647ff6e commit 8f8a7f6

File tree

4 files changed

+11
-11
lines changed

4 files changed

+11
-11
lines changed

androidBluetoothSerial/src/main/java/com/harrysoft/androidbluetoothserial/BluetoothManager.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ public void closeDevice(BluetoothSerialDevice device) {
108108
* @param deviceInterface The interface accessing the device
109109
* you are trying to close the connection to
110110
*/
111-
public void closeDevice(SimpleDeviceInterface deviceInterface) {
111+
public void closeDevice(SimpleBluetoothDeviceInterface deviceInterface) {
112112
closeDevice(deviceInterface.getDevice().getMac());
113113
}
114114

androidBluetoothSerial/src/main/java/com/harrysoft/androidbluetoothserial/BluetoothSerialDevice.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ public class BluetoothSerialDevice {
2424
private final InputStream inputStream;
2525

2626
@Nullable
27-
private SimpleDeviceInterface owner;
27+
private SimpleBluetoothDeviceInterface owner;
2828

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

9595
/**
96-
* Wrap using a SimpleDeviceInterface.
96+
* Wrap using a SimpleBluetoothDeviceInterface.
9797
* This makes things a lot simpler within the class accessing this device
9898
*
99-
* @return a SimpleDeviceInterface that will access this device object
99+
* @return a SimpleBluetoothDeviceInterface that will access this device object
100100
*/
101-
public SimpleDeviceInterface toSimpleDeviceInterface() {
101+
public SimpleBluetoothDeviceInterface toSimpleDeviceInterface() {
102102
requireNotClosed();
103103
if (owner != null) {
104104
return owner;
105105
} else {
106-
return owner = new SimpleDeviceInterface(this);
106+
return owner = new SimpleBluetoothDeviceInterface(this);
107107
}
108108
}
109109

androidBluetoothSerial/src/main/java/com/harrysoft/androidbluetoothserial/SimpleDeviceInterface.java renamed to androidBluetoothSerial/src/main/java/com/harrysoft/androidbluetoothserial/SimpleBluetoothDeviceInterface.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
import io.reactivex.disposables.CompositeDisposable;
77
import io.reactivex.schedulers.Schedulers;
88

9-
public class SimpleDeviceInterface {
9+
public class SimpleBluetoothDeviceInterface {
1010

1111
private final BluetoothSerialDevice device;
1212

@@ -19,7 +19,7 @@ public class SimpleDeviceInterface {
1919
@Nullable
2020
private OnErrorListener errorListener;
2121

22-
SimpleDeviceInterface(BluetoothSerialDevice device) {
22+
SimpleBluetoothDeviceInterface(BluetoothSerialDevice device) {
2323
this.device = device;
2424

2525
compositeDisposable.add(device.openMessageStream()

demoApplication/src/main/java/com/harrysoft/androidbluetoothserial/demoapp/CommunicateViewModel.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
import android.widget.Toast;
1212

1313
import com.harrysoft.androidbluetoothserial.BluetoothManager;
14-
import com.harrysoft.androidbluetoothserial.SimpleDeviceInterface;
14+
import com.harrysoft.androidbluetoothserial.SimpleBluetoothDeviceInterface;
1515

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

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

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

121121
// Called once the library connects a bluetooth device
122-
private void onConnected(SimpleDeviceInterface deviceInterface) {
122+
private void onConnected(SimpleBluetoothDeviceInterface deviceInterface) {
123123
this.deviceInterface = deviceInterface;
124124
if (this.deviceInterface != null) {
125125
// We have a device! Tell the activity we are connected.

0 commit comments

Comments
 (0)