Skip to content

Commit

Permalink
Revert "Support for nameless OKOK scales (Myria MY4836) (#1081)"
Browse files Browse the repository at this point in the history
This reverts commit 29dd632.
  • Loading branch information
oliexdev committed Nov 17, 2024
1 parent 29dd632 commit f8f8669
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 208 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ public static BluetoothCommunication createDeviceDriver(Context context, String
if (name.equals("Health Scale".toLowerCase(Locale.US))) {
return new BluetoothOneByone(context);
}
if(name.equals("1byone scale".toLowerCase(Locale.US))) {
if(name.equals("1byone scale".toLowerCase(Locale.US))){
return new BluetoothOneByoneNew(context);
}

Expand Down Expand Up @@ -114,13 +114,10 @@ public static BluetoothCommunication createDeviceDriver(Context context, String
}
if (deviceName.equals("Hoffen BS-8107")) {
return new BluetoothHoffenBBS8107(context);
}
}
if (deviceName.equals("ADV") || deviceName.equals("Chipsea-BLE")) {
return new BluetoothOKOK(context);
}
if (deviceName.isEmpty()) {
return new BluetoothOKOK2(context);
}
if (deviceName.equals("BF105") || deviceName.equals("BF720")) {
return new BluetoothBeurerBF105(context);
}
Expand All @@ -133,10 +130,10 @@ public static BluetoothCommunication createDeviceDriver(Context context, String
if (deviceName.equals("SBF72") || deviceName.equals("BF915") || deviceName.equals("SBF73")) {
return new BluetoothSanitasSBF72(context, deviceName);
}
if (deviceName.equals("Weight Scale")) {
if (deviceName.equals("Weight Scale")){
return new BluetoothSinocare(context);
}
if (deviceName.equals("CH100")) {
if (deviceName.equals("CH100")){
return new BluetoothHuaweiAH100(context);
}
if (deviceName.equals("ES-26BB-B")){
Expand All @@ -145,7 +142,7 @@ public static BluetoothCommunication createDeviceDriver(Context context, String
if (deviceName.equals("Yoda1")){
return new BluetoothYoda1Scale(context);
}
if (deviceName.equals("AAA002") || deviceName.equals("AAA007")) {
if (deviceName.equals("AAA002") || deviceName.equals("AAA007")){
return new BluetoothBroadcastScale(context);
}
return null;
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@

import android.content.SharedPreferences;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuInflater;
Expand All @@ -42,9 +41,6 @@ public class BluetoothPreferences extends PreferenceFragmentCompat {
private Preference btScanner;

private static final String formatDeviceName(String name, String address) {
if (TextUtils.isEmpty(name) && !address.isEmpty()) {
return String.format("[%s]", address);
}
if (name.isEmpty() || address.isEmpty()) {
return "-";
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@
import android.provider.Settings;
import android.text.SpannableStringBuilder;
import android.text.Spanned;
import android.text.TextUtils;
import android.text.style.ForegroundColorSpan;
import android.text.style.RelativeSizeSpan;
import android.view.Gravity;
Expand Down Expand Up @@ -229,9 +228,6 @@ public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
}

private static final String formatDeviceName(String name, String address) {
if (TextUtils.isEmpty(name) && !address.isEmpty()) {
return String.format("[%s]", address);
}
if (name.isEmpty() || address.isEmpty()) {
return "-";
}
Expand Down Expand Up @@ -318,15 +314,14 @@ private void onDeviceFound(final ScanResult bleScanResult) {
BluetoothDevice device = bleScanResult.getDevice();
Context context = getContext();

if (foundDevices.containsKey(device.getAddress()) || context == null) {
if (device.getName() == null || foundDevices.containsKey(device.getAddress()) || context == null) {
return;
}

BluetoothDeviceView deviceView = new BluetoothDeviceView(context);
deviceView.setDeviceName(formatDeviceName(bleScanResult.getDevice()));

String name = device.getName() != null ? device.getName() : "";
BluetoothCommunication btDevice = BluetoothFactory.createDeviceDriver(context, name);
BluetoothCommunication btDevice = BluetoothFactory.createDeviceDriver(context, device.getName());
if (btDevice != null) {
Timber.d("Found supported device %s (driver: %s)",
formatDeviceName(device), btDevice.driverName());
Expand Down

0 comments on commit f8f8669

Please sign in to comment.