diff --git a/app/src/main/java/inc/osips/bleproject/presenter/RemoteControllerPresenter.java b/app/src/main/java/inc/osips/bleproject/presenter/RemoteControllerPresenter.java index 165e7a4..8788e2a 100644 --- a/app/src/main/java/inc/osips/bleproject/presenter/RemoteControllerPresenter.java +++ b/app/src/main/java/inc/osips/bleproject/presenter/RemoteControllerPresenter.java @@ -19,7 +19,6 @@ import java.util.HashMap; import java.util.List; import java.util.Map; -import java.util.Objects; import inc.osips.bleproject.interfaces.ControllerViewInterface; import inc.osips.iot_wireless_communication.wireless_comms_module.interfaces.WirelessDeviceConnector; @@ -276,7 +275,7 @@ private IntentFilter commsUpdateIntentFilter() { } private void sendInstructionsToDevice(String instruct) { - deviceConnector.sendInstructionsToRemoteDevice(deviceAddr, instruct); + deviceConnector.sendStringInstructionsToRemoteDevice(deviceAddr, instruct); } public void setDeviceAddressAndSendInstructions(String uuidAddr, String instructions) { diff --git a/iot_wireless_communication/src/main/java/inc/osips/iot_wireless_communication/wireless_comms_module/interfaces/WirelessDeviceConnector.java b/iot_wireless_communication/src/main/java/inc/osips/iot_wireless_communication/wireless_comms_module/interfaces/WirelessDeviceConnector.java index 951863b..0239ae3 100644 --- a/iot_wireless_communication/src/main/java/inc/osips/iot_wireless_communication/wireless_comms_module/interfaces/WirelessDeviceConnector.java +++ b/iot_wireless_communication/src/main/java/inc/osips/iot_wireless_communication/wireless_comms_module/interfaces/WirelessDeviceConnector.java @@ -26,10 +26,10 @@ public interface WirelessDeviceConnector { void connectAnotherDeviceSimultaneously(@NonNull Parcelable device, @Nullable String serviceUUID) throws Exception; void selectServiceUsingUUID (@Nullable String deviceAddress, @NonNull String UUID); void connectToDeviceWithDeviceInfoFrom(@NonNull Intent intent); - void sendInstructionsToRemoteDevice(@Nullable String deviceAddress, @NonNull String instructions); - void sendInstructionsToRemoteDevice(@Nullable String deviceAddress, - @Nullable UUID charxUuid, @NonNull String instructions); - void sendInstructionsToConnectedDevice(String deviceAddr, - @Nullable UUID charxUuid, byte[] data); - void sendInstructionsToConnectedDevice(String deviceAddr, byte[] data); + void sendStringInstructionsToRemoteDevice(@Nullable String deviceAddress, @NonNull String instructions); + void sendStringInstructionsToRemoteDevice(@Nullable String deviceAddress, + @Nullable UUID charxUuid, @NonNull String instructions); + void sendBytesInstructionsToRemoteDevice(String deviceAddr, + @Nullable UUID charxUuid, byte[] data); + void sendBytesInstructionsToRemoteDevice(String deviceAddr, byte[] data); } diff --git a/iot_wireless_communication/src/main/java/inc/osips/iot_wireless_communication/wireless_comms_module/remote_comms/ble_comms/BleConnection.java b/iot_wireless_communication/src/main/java/inc/osips/iot_wireless_communication/wireless_comms_module/remote_comms/ble_comms/BleConnection.java index fd85a9e..0a016bb 100644 --- a/iot_wireless_communication/src/main/java/inc/osips/iot_wireless_communication/wireless_comms_module/remote_comms/ble_comms/BleConnection.java +++ b/iot_wireless_communication/src/main/java/inc/osips/iot_wireless_communication/wireless_comms_module/remote_comms/ble_comms/BleConnection.java @@ -1,9 +1,6 @@ package inc.osips.iot_wireless_communication.wireless_comms_module.remote_comms.ble_comms; -import android.app.Activity; -import android.app.Service; import android.bluetooth.BluetoothDevice; -import android.bluetooth.BluetoothGattCharacteristic; import android.content.ComponentName; import android.content.Context; import android.content.Intent; @@ -123,25 +120,25 @@ public void selectServiceUsingUUID(@Nullable String deviceAddress, @NonNull Stri } @Override - public void sendInstructionsToRemoteDevice(@Nullable String deviceAddress, @NonNull String instructions) { - sendInstructionsToRemoteDevice(deviceAddress, null, instructions); + public void sendStringInstructionsToRemoteDevice(@Nullable String deviceAddress, @NonNull String instructions) { + sendStringInstructionsToRemoteDevice(deviceAddress, null, instructions); } @Override - public void sendInstructionsToRemoteDevice(@Nullable String deviceAddress, - @Nullable UUID charxUuid, @NonNull String instructions) { - gattService.sendInstructionsToConnectedDevice(deviceAddress, charxUuid, instructions); + public void sendStringInstructionsToRemoteDevice(@Nullable String deviceAddress, + @Nullable UUID charxUuid, @NonNull String instructions) { + gattService.sendStringInstructionsToConnectedDevice(deviceAddress, charxUuid, instructions); } @Override - public void sendInstructionsToConnectedDevice(String deviceAddr, @Nullable UUID charxUuid, - byte[] data) { - gattService.sendInstructionsToConnectedDevice(deviceAddr, charxUuid, data); + public void sendBytesInstructionsToRemoteDevice(String deviceAddr, @Nullable UUID charxUuid, + byte[] data) { + gattService.sendBytesInstructionsToConnectedDevice(deviceAddr, charxUuid, data); } @Override - public void sendInstructionsToConnectedDevice(String deviceAddr, byte[] data) { - gattService.sendInstructionsToConnectedDevice(deviceAddr, null, data); + public void sendBytesInstructionsToRemoteDevice(String deviceAddr, byte[] data) { + sendBytesInstructionsToRemoteDevice(deviceAddr, null, data); } private final ServiceConnection mConnection = diff --git a/iot_wireless_communication/src/main/java/inc/osips/iot_wireless_communication/wireless_comms_module/remote_comms/ble_comms/services/BleGattService.java b/iot_wireless_communication/src/main/java/inc/osips/iot_wireless_communication/wireless_comms_module/remote_comms/ble_comms/services/BleGattService.java index 0a516d9..486c0be 100755 --- a/iot_wireless_communication/src/main/java/inc/osips/iot_wireless_communication/wireless_comms_module/remote_comms/ble_comms/services/BleGattService.java +++ b/iot_wireless_communication/src/main/java/inc/osips/iot_wireless_communication/wireless_comms_module/remote_comms/ble_comms/services/BleGattService.java @@ -636,7 +636,8 @@ private void close(BluetoothGatt bleGatt) { bleGatt.close(); } - public void sendInstructionsToConnectedDevice(String deviceAddr, @Nullable UUID charxUuid, byte[] data){ + public void sendBytesInstructionsToConnectedDevice(String deviceAddr, @Nullable UUID charxUuid, + byte[] data){ BluetoothGatt bleGatt = multiBleGatt.get(deviceAddr); try { if (bleGatt != null) { @@ -669,8 +670,8 @@ public void sendInstructionsToConnectedDevice(String deviceAddr, @Nullable UUID } } - public void sendInstructionsToConnectedDevice(String deviceAddr, @Nullable UUID charxUuid, - String instructions) { + public void sendStringInstructionsToConnectedDevice(String deviceAddr, @Nullable UUID charxUuid, + String instructions) { BluetoothGatt bleGatt = multiBleGatt.get(deviceAddr); Log.d(TAG, "sendInstructionsToConnectedDevice: -> device address: " + deviceAddr ); try { diff --git a/iot_wireless_communication/src/main/java/inc/osips/iot_wireless_communication/wireless_comms_module/remote_comms/p2p_comms/P2pConnection.java b/iot_wireless_communication/src/main/java/inc/osips/iot_wireless_communication/wireless_comms_module/remote_comms/p2p_comms/P2pConnection.java index cc9c748..ddaff87 100644 --- a/iot_wireless_communication/src/main/java/inc/osips/iot_wireless_communication/wireless_comms_module/remote_comms/p2p_comms/P2pConnection.java +++ b/iot_wireless_communication/src/main/java/inc/osips/iot_wireless_communication/wireless_comms_module/remote_comms/p2p_comms/P2pConnection.java @@ -99,23 +99,23 @@ public void selectServiceUsingUUID(@Nullable String deviceAddress, @NonNull Stri } @Override - public void sendInstructionsToRemoteDevice(@Nullable String deviceAddr, @NonNull String instructions) { + public void sendStringInstructionsToRemoteDevice(@Nullable String deviceAddr, @NonNull String instructions) { p2pService.writeInstructions(instructions); } @Override - public void sendInstructionsToRemoteDevice(@Nullable String deviceAddress, - @Nullable UUID charxUuid, @NonNull String instructions) { + public void sendStringInstructionsToRemoteDevice(@Nullable String deviceAddress, + @Nullable UUID charxUuid, @NonNull String instructions) { p2pService.writeInstructions(instructions); } @Override - public void sendInstructionsToConnectedDevice(String deviceAddr, @Nullable UUID charxUuid, byte[] data) { + public void sendBytesInstructionsToRemoteDevice(String deviceAddr, @Nullable UUID charxUuid, byte[] data) { p2pService.writeInstructions(data); } @Override - public void sendInstructionsToConnectedDevice(String deviceAddr, byte[] data) { + public void sendBytesInstructionsToRemoteDevice(String deviceAddr, byte[] data) { p2pService.writeInstructions(data); }