diff --git a/app/src/main/assets/ic_device_unknown.svg b/app/src/main/assets/ic_device_unknown.svg
new file mode 100644
index 000000000..303eabe88
--- /dev/null
+++ b/app/src/main/assets/ic_device_unknown.svg
@@ -0,0 +1,144 @@
+
+
+
+
diff --git a/app/src/main/assets/ic_device_unknown_disabled.svg b/app/src/main/assets/ic_device_unknown_disabled.svg
new file mode 100644
index 000000000..8c15510b5
--- /dev/null
+++ b/app/src/main/assets/ic_device_unknown_disabled.svg
@@ -0,0 +1,197 @@
+
+
+
+
diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/DiscoveryActivity.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/DiscoveryActivity.java
index 755698866..1d9bfb9d3 100644
--- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/DiscoveryActivity.java
+++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/DiscoveryActivity.java
@@ -32,6 +32,8 @@ import android.bluetooth.le.ScanRecord;
import android.bluetooth.le.ScanResult;
import android.bluetooth.le.ScanSettings;
import android.content.BroadcastReceiver;
+import android.content.ClipData;
+import android.content.ClipboardManager;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
@@ -45,6 +47,7 @@ import android.os.Message;
import android.os.ParcelUuid;
import android.os.Parcelable;
import android.provider.Settings;
+import android.text.TextUtils;
import android.view.View;
import android.widget.AdapterView;
import android.widget.Button;
@@ -94,6 +97,7 @@ public class DiscoveryActivity extends AbstractGBActivity implements AdapterView
* If already bonded devices are to be ignored when scanning
*/
private boolean ignoreBonded = true;
+ private boolean discoverUnsupported = false;
private ProgressBar bluetoothProgress;
private ProgressBar bluetoothLEProgress;
private DeviceCandidateAdapter deviceCandidateAdapter;
@@ -248,6 +252,7 @@ public class DiscoveryActivity extends AbstractGBActivity implements AdapterView
Prefs prefs = GBApplication.getPrefs();
ignoreBonded = prefs.getBoolean("ignore_bonded_devices", true);
+ discoverUnsupported = prefs.getBoolean("discover_unsupported_devices", false);
oldBleScanning = prefs.getBoolean("disable_new_ble_scanning", false);
if (oldBleScanning) {
@@ -392,9 +397,9 @@ public class DiscoveryActivity extends AbstractGBActivity implements AdapterView
GBDeviceCandidate candidate = new GBDeviceCandidate(device, rssi, uuids);
DeviceType deviceType = DeviceHelper.getInstance().getSupportedType(candidate);
- if (deviceType.isSupported()) {
+ if (deviceType.isSupported() || discoverUnsupported) {
candidate.setDeviceType(deviceType);
- LOG.info("Recognized supported device: " + candidate);
+ LOG.info("Recognized device: " + candidate);
int index = deviceCandidates.indexOf(candidate);
if (index >= 0) {
deviceCandidates.set(index, candidate); // replace
@@ -713,6 +718,25 @@ public class DiscoveryActivity extends AbstractGBActivity implements AdapterView
LOG.error("Device candidate clicked, but item not found");
return;
}
+ if (!deviceCandidate.getDeviceType().isSupported()){
+ LOG.error("Unsupported device candidate");
+ ArrayList deviceDetails = new ArrayList<>();
+ deviceDetails.add(deviceCandidate.getName());
+ deviceDetails.add(deviceCandidate.getMacAddress());
+ try {
+ for (ParcelUuid uuid : deviceCandidate.getServiceUuids()) {
+ deviceDetails.add(uuid.getUuid().toString());
+ }
+ } catch (Exception e) {
+ LOG.error("Error collecting device uuids: " + e);
+ }
+ String clipboardData = TextUtils.join(", ", deviceDetails);
+ ClipboardManager clipboard = (ClipboardManager) getSystemService(Context.CLIPBOARD_SERVICE);
+ ClipData clip = ClipData.newPlainText(deviceCandidate.getName(), clipboardData);
+ clipboard.setPrimaryClip(clip);
+ toast(this, "Device details copied to clipboard", Toast.LENGTH_SHORT, GB.INFO);
+ return;
+ }
stopDiscovery();
DeviceCoordinator coordinator = DeviceHelper.getInstance().getCoordinator(deviceCandidate);
@@ -760,6 +784,14 @@ public class DiscoveryActivity extends AbstractGBActivity implements AdapterView
LOG.error("Device candidate clicked, but item not found");
return true;
}
+ if (!deviceCandidate.getDeviceType().isSupported()) {
+ LOG.error("Unsupported device candidate");
+ ClipboardManager clipboard = (ClipboardManager) getSystemService(Context.CLIPBOARD_SERVICE);
+ ClipData clip = ClipData.newPlainText(deviceCandidate.getName(), deviceCandidate.getMacAddress());
+ clipboard.setPrimaryClip(clip);
+ toast(this, "Bluetooth address copied to clipboard", Toast.LENGTH_SHORT, GB.INFO);
+ return true;
+ }
DeviceCoordinator coordinator = DeviceHelper.getInstance().getCoordinator(deviceCandidate);
GBDevice device = DeviceHelper.getInstance().toSupportedDevice(deviceCandidate);
diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/adapter/DeviceCandidateAdapter.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/adapter/DeviceCandidateAdapter.java
index e1a9534dc..9f3fd5c19 100644
--- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/adapter/DeviceCandidateAdapter.java
+++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/adapter/DeviceCandidateAdapter.java
@@ -73,6 +73,10 @@ public class DeviceCandidateAdapter extends ArrayAdapter {
}
}
+ if (!device.getDeviceType().isSupported()) {
+ status += " UNSUPPORTED";
+ }
+
DeviceCoordinator coordinator = DeviceHelper.getInstance().getCoordinator(device);
if (coordinator.getBondingStyle() == DeviceCoordinator.BONDING_STYLE_REQUIRE_KEY) {
if (device.getDevice().getBondState() == BluetoothDevice.BOND_BONDED) {
diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/model/DeviceType.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/model/DeviceType.java
index 82d4889fc..259b9bc1f 100644
--- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/model/DeviceType.java
+++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/model/DeviceType.java
@@ -32,7 +32,7 @@ import nodomain.freeyourgadget.gadgetbridge.R;
* and may not be changed.
*/
public enum DeviceType {
- UNKNOWN(-1, R.drawable.ic_device_default, R.drawable.ic_device_default_disabled, R.string.devicetype_unknown),
+ UNKNOWN(-1, R.drawable.ic_device_unknown, R.drawable.ic_device_unknown_disabled, R.string.devicetype_unknown),
PEBBLE(1, R.drawable.ic_device_pebble, R.drawable.ic_device_pebble_disabled, R.string.devicetype_pebble),
MIBAND(10, R.drawable.ic_device_miband, R.drawable.ic_device_miband_disabled, R.string.devicetype_miband),
MIBAND2(11, R.drawable.ic_device_miband2, R.drawable.ic_device_miband2_disabled, R.string.devicetype_miband2),
diff --git a/app/src/main/res/drawable/ic_device_unknown.xml b/app/src/main/res/drawable/ic_device_unknown.xml
new file mode 100644
index 000000000..1178c6a97
--- /dev/null
+++ b/app/src/main/res/drawable/ic_device_unknown.xml
@@ -0,0 +1,22 @@
+
+
+
+
+
+
diff --git a/app/src/main/res/drawable/ic_device_unknown_disabled.xml b/app/src/main/res/drawable/ic_device_unknown_disabled.xml
new file mode 100644
index 000000000..330f03e51
--- /dev/null
+++ b/app/src/main/res/drawable/ic_device_unknown_disabled.xml
@@ -0,0 +1,27 @@
+
+
+
+
+
+
+
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index 54574ac5c..b28fbdafb 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -1100,6 +1100,8 @@
Error retrieving devices from database
Ignore bonded devices
Enabling this option will ignore devices that have been bonded/paired already when scanning
+ Discover unsupported devices
+ Enabling this option will display all discovered bluetooth devices when scanning. They cannot be used in Gadgetbridge.
Location must be turned on to scan for devices
Sony SWR12 Settings
Low vibration enabled
diff --git a/app/src/main/res/xml/preferences.xml b/app/src/main/res/xml/preferences.xml
index 239945e70..33a9ec8a7 100644
--- a/app/src/main/res/xml/preferences.xml
+++ b/app/src/main/res/xml/preferences.xml
@@ -394,6 +394,11 @@
android:layout="@layout/preference_checkbox"
android:summary="@string/companiondevice_pairing_details"
android:title="@string/companiondevice_pairing" />
-
+