mirror of
https://github.com/oliexdev/openScale.git
synced 2025-08-07 01:06:57 +02:00
Settings: Add Sanitas SBF-70
Signed-off-by: Jerome Flesch <jflesch@kwain.net>
This commit is contained in:
@@ -27,6 +27,7 @@ import com.health.openscale.core.alarm.AlarmHandler;
|
||||
import com.health.openscale.core.bluetooth.BluetoothCommunication;
|
||||
import com.health.openscale.core.bluetooth.BluetoothCustomOpenScale;
|
||||
import com.health.openscale.core.bluetooth.BluetoothMiScale;
|
||||
import com.health.openscale.core.bluetooth.BluetoothSanitasSbf70;
|
||||
import com.health.openscale.core.database.ScaleDatabase;
|
||||
import com.health.openscale.core.database.ScaleUserDatabase;
|
||||
import com.health.openscale.core.datatypes.ScaleData;
|
||||
@@ -48,6 +49,7 @@ import java.util.TreeMap;
|
||||
|
||||
import static com.health.openscale.core.bluetooth.BluetoothCommunication.BT_MI_SCALE;
|
||||
import static com.health.openscale.core.bluetooth.BluetoothCommunication.BT_OPEN_SCALE;
|
||||
import static com.health.openscale.core.bluetooth.BluetoothCommunication.BT_SANITAS_SBF70;
|
||||
|
||||
public class OpenScale {
|
||||
|
||||
@@ -299,7 +301,6 @@ public class OpenScale {
|
||||
csvWriter.append("\n");
|
||||
}
|
||||
|
||||
|
||||
csvWriter.close();
|
||||
outputStream.close();
|
||||
}
|
||||
@@ -341,6 +342,9 @@ public class OpenScale {
|
||||
case BT_OPEN_SCALE:
|
||||
btCom = new BluetoothCustomOpenScale();
|
||||
break;
|
||||
case BT_SANITAS_SBF70:
|
||||
btCom = new BluetoothSanitasSbf70(context);
|
||||
break;
|
||||
default:
|
||||
Log.e("OpenScale", "No valid scale type selected");
|
||||
return;
|
||||
|
@@ -22,6 +22,7 @@ import android.os.Handler;
|
||||
public abstract class BluetoothCommunication {
|
||||
public static final int BT_MI_SCALE = 0;
|
||||
public static final int BT_OPEN_SCALE = 1;
|
||||
public static final int BT_SANITAS_SBF70 = 2;
|
||||
|
||||
public static final int BT_RETRIEVE_SCALE_DATA = 0;
|
||||
public static final int BT_INIT_PROCESS = 1;
|
||||
|
@@ -0,0 +1,24 @@
|
||||
package com.health.openscale.core.bluetooth;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
/**
|
||||
* Created by jflesch on 30/04/17.
|
||||
*/
|
||||
|
||||
public class BluetoothSanitasSbf70 extends BluetoothCommunication {
|
||||
|
||||
public BluetoothSanitasSbf70(Context con) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void startSearching(String deviceName) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void stopSearching() {
|
||||
|
||||
}
|
||||
}
|
@@ -187,7 +187,8 @@ public class MainActivity extends ActionBarActivity implements
|
||||
String deviceType = prefs.getString("btDeviceTypes", "0");
|
||||
|
||||
// Check if Bluetooth 4.x is available
|
||||
if (Integer.parseInt(deviceType) == BluetoothCommunication.BT_MI_SCALE) {
|
||||
if (Integer.parseInt(deviceType) == BluetoothCommunication.BT_MI_SCALE
|
||||
|| Integer.parseInt(deviceType) == BluetoothCommunication.BT_SANITAS_SBF70) {
|
||||
if (!getPackageManager().hasSystemFeature(PackageManager.FEATURE_BLUETOOTH_LE)) {
|
||||
setBluetoothStatusIcon(R.drawable.bluetooth_disabled);
|
||||
Toast.makeText(getApplicationContext(), "Bluetooth 4.x " + getResources().getString(R.string.info_is_not_available), Toast.LENGTH_SHORT).show();
|
||||
|
@@ -3,10 +3,12 @@
|
||||
<string-array name="bt_device_entries">
|
||||
<item>Xiaomi Mi Scale v1</item>
|
||||
<item>openScale Custom Scale</item>
|
||||
<item>Sanitas SBF-70</item>
|
||||
</string-array>
|
||||
|
||||
<string-array name="bt_device_values">
|
||||
<item>0</item>
|
||||
<item>1</item>
|
||||
<item>2</item>
|
||||
</string-array>
|
||||
</resources>
|
Reference in New Issue
Block a user