mirror of
https://github.com/oliexdev/openScale.git
synced 2025-08-13 20:24:14 +02:00
Add new Bluetooth string resources and use them
This commit is contained in:
@@ -540,7 +540,7 @@ public class BluetoothBeurerSanitas extends BluetoothCommunication {
|
||||
|
||||
if (!stableMeasurement) {
|
||||
LogManager.d(TAG, String.format("Active measurement, weight: %.2f", weight));
|
||||
//TODO sendMessage(R.string.info_measuring, weight);
|
||||
sendMessage(R.string.bluetooth_scale_info_measuring_weight, weight);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -636,7 +636,7 @@ public class BluetoothBeurerSanitas extends BluetoothCommunication {
|
||||
userReferWeightExists, userMeasurementExist, scaleVersion));
|
||||
|
||||
if (batteryLevel <= 10) {
|
||||
//TODO sendMessage(R.string.info_scale_low_battery, batteryLevel);
|
||||
sendMessage(R.string.bluetooth_scale_warning_low_battery, batteryLevel);
|
||||
}
|
||||
|
||||
byte requestedUnit = (byte) currentUnit;
|
||||
@@ -819,7 +819,7 @@ public class BluetoothBeurerSanitas extends BluetoothCommunication {
|
||||
// Try to start a measurement to make the scale learn the reference weight to recognize the user next time.
|
||||
// If we already have data, this will most likely run into time-out and the scale switches off before finishing.
|
||||
LogManager.d(TAG, "New user successfully added; time to step on scale");
|
||||
//TODO sendMessage(R.string.info_step_on_scale_for_reference, 0);
|
||||
sendMessage(R.string.bluetooth_scale_info_step_on_for_reference, 0);
|
||||
LogManager.d(TAG, "Sending command: CMD_DO_MEASUREMENT");
|
||||
sendCommand(CMD_DO_MEASUREMENT, encodeUserId(currentRemoteUser));
|
||||
// We send a new command, so make sure we wait
|
||||
@@ -828,7 +828,7 @@ public class BluetoothBeurerSanitas extends BluetoothCommunication {
|
||||
}
|
||||
|
||||
LogManager.d(TAG, String.format("Cannot create additional scale user (error 0x%02x)", data[3]));
|
||||
//TODO sendMessage(R.string.error_max_scale_users, 0);
|
||||
sendMessage(R.string.bluetooth_scale_error_max_users_reached, 0);
|
||||
// Force disconnect
|
||||
LogManager.d(TAG, "Terminating state machine.");
|
||||
jumpNextToStepNr( 9 );
|
||||
|
@@ -192,7 +192,7 @@ public abstract class BluetoothCommunication {
|
||||
* @param msg the string id to be send
|
||||
* @param value the value to be used
|
||||
*/
|
||||
protected void sendMessage(int msg, Object value) {
|
||||
protected void sendMessage(int msg, Object value) { // TODO implement in openScale 3.0
|
||||
if (callbackBtHandler != null) {
|
||||
callbackBtHandler.obtainMessage(
|
||||
BT_STATUS.SCALE_MESSAGE.ordinal(), msg, 0, value).sendToTarget();
|
||||
|
@@ -166,7 +166,7 @@ public class BluetoothHoffenBBS8107 extends BluetoothCommunication {
|
||||
private ScaleMeasurement parseFinalMeasurement(byte[] value) {
|
||||
float weight = Converters.fromUnsignedInt16Le(value, 3) / 10.0f;
|
||||
LogManager.d(TAG, String.format("Got final weight: %.1f %s", weight, user.getScaleUnit().toString()));
|
||||
// TODO sendMessage(R.string.info_measuring, weight);
|
||||
sendMessage(R.string.bluetooth_scale_info_measuring_weight, weight);
|
||||
|
||||
if (user.getScaleUnit() != WeightUnit.KG) {
|
||||
// For lb and st this scale will always return result in lb
|
||||
|
@@ -128,7 +128,7 @@ public class BluetoothInlife extends BluetoothCommunication {
|
||||
case (byte) 0xd8:
|
||||
float weight = Converters.fromUnsignedInt16Be(data, 2) / 10.0f;
|
||||
LogManager.d(TAG, String.format("Current weight %.2f kg", weight));
|
||||
//TODO sendMessage(R.string.info_measuring, weight);
|
||||
sendMessage(R.string.bluetooth_scale_info_measuring_weight, weight);
|
||||
break;
|
||||
case (byte) 0xdd:
|
||||
if (data[11] == (byte) 0x80 || data[11] == (byte) 0x81) {
|
||||
|
@@ -128,7 +128,7 @@ public class BluetoothSenssun extends BluetoothCommunication {
|
||||
|
||||
if (weightStabilized) {
|
||||
values |= 1;
|
||||
//TODO sendMessage(R.string.info_measuring, lastWeight / 10.0f);
|
||||
sendMessage(R.string.bluetooth_scale_info_measuring_weight, lastWeight / 10.0f);
|
||||
synchroniseUser();
|
||||
}
|
||||
break;
|
||||
|
@@ -152,7 +152,7 @@ public class BluetoothSoehnle extends BluetoothCommunication {
|
||||
|
||||
LogManager.d(TAG, "Soehnle scale battery level is " + batteryLevel);
|
||||
if (batteryLevel <= 10) {
|
||||
//TODO sendMessage(R.string.info_scale_low_battery, batteryLevel);
|
||||
sendMessage(R.string.bluetooth_scale_warning_low_battery, batteryLevel);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -170,7 +170,7 @@ public class BluetoothSoehnle extends BluetoothCommunication {
|
||||
LogManager.d(TAG, "User control point index is " + soehnleUserIndex + " for user id " + userId);
|
||||
|
||||
prefs.edit().putInt("userScaleIndex" + soehnleUserIndex, userId).apply();
|
||||
//TODO sendMessage(R.string.info_step_on_scale_for_reference, 0);
|
||||
sendMessage(R.string.bluetooth_scale_info_step_on_for_reference, 0);
|
||||
} else {
|
||||
LogManager.e(TAG, "Error creating new Sohnle user", null);
|
||||
}
|
||||
|
@@ -204,7 +204,7 @@ public abstract class BluetoothStandardWeightProfile extends BluetoothCommunicat
|
||||
if (registerNewUser) {
|
||||
requestMeasurement();
|
||||
stopMachineState();
|
||||
// TODO sendMessage(R.string.info_step_on_scale_for_reference, 0);
|
||||
sendMessage(R.string.bluetooth_scale_info_step_on_for_reference, 0);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
@@ -241,7 +241,7 @@ public abstract class BluetoothStandardWeightProfile extends BluetoothCommunicat
|
||||
int batteryLevel = parser.getIntValue(FORMAT_UINT8);
|
||||
LogManager.d(TAG, String.format("Received battery level %d%%", batteryLevel));
|
||||
if (batteryLevel <= 10) {
|
||||
// TODO sendMessage(R.string.info_scale_low_battery, batteryLevel);
|
||||
sendMessage(R.string.bluetooth_scale_warning_low_battery, batteryLevel);
|
||||
}
|
||||
}
|
||||
else if(characteristic.equals(BluetoothGattUuid.CHARACTERISTIC_MANUFACTURER_NAME_STRING)) {
|
||||
@@ -829,15 +829,15 @@ public abstract class BluetoothStandardWeightProfile extends BluetoothCommunicat
|
||||
for (int i = 0; i < userList.size(); ++i) {
|
||||
ScaleUser u = userList.get(i);
|
||||
String name = u.getUserName();
|
||||
/* TODO choiceStrings[i] = (name.length() > 0 ? name : String.format("P%02d", u.getId()))
|
||||
+ " " + context.getString(u.getGender().isMale() ? R.string.label_male : R.string.label_female).toLowerCase()
|
||||
+ " " + context.getString(R.string.label_height).toLowerCase() + ":" + u.getBodyHeight()
|
||||
+ " " + context.getString(R.string.label_birthday).toLowerCase() + ":" + dateFormat.format(u.getBirthday())
|
||||
+ " " + context.getString(R.string.label_activity_level).toLowerCase() + ":" + (u.getActivityLevel().toInt() + 1);*/
|
||||
choiceStrings[i] = (name.length() > 0 ? name : String.format("P%02d", u.getId()))
|
||||
+ " " + (u.getGender().isMale() ? "male" : "female").toLowerCase()
|
||||
+ " " + "height" + ":" + u.getBodyHeight()
|
||||
+ " " + "birthday" + ":" + dateFormat.format(u.getBirthday())
|
||||
+ " " + "activityLevel" + ":" + (u.getActivityLevel().toInt() + 1);
|
||||
indexArray[i] = u.getId();
|
||||
}
|
||||
if (userList.size() < getVendorSpecificMaxUserCount()) {
|
||||
// TODO choiceStrings[userList.size()] = context.getString(R.string.info_create_new_user_on_scale);
|
||||
choiceStrings[userList.size()] = context.getString(R.string.bluetooth_scale_info_create_user_instruction);
|
||||
indexArray[userList.size()] = -1;
|
||||
}
|
||||
Pair<CharSequence[], int[]> choices = new Pair(choiceStrings, indexArray);
|
||||
|
@@ -193,7 +193,7 @@ public class BluetoothTrisaBodyAnalyze extends BluetoothCommunication {
|
||||
saveDevicePassword(context, deviceId, password);
|
||||
}
|
||||
|
||||
// TODO sendMessage(R.string.trisa_scale_pairing_succeeded, null);
|
||||
sendMessage(R.string.bluetooth_scale_trisa_success_pairing, null);
|
||||
|
||||
// To complete the pairing process, we must set the scale's broadcast id, and then
|
||||
// disconnect. The writeCommand() call below will trigger the next state machine transition,
|
||||
@@ -209,7 +209,7 @@ public class BluetoothTrisaBodyAnalyze extends BluetoothCommunication {
|
||||
}
|
||||
if (password == null) {
|
||||
LogManager.w(TAG, "Received challenge, but password is unknown.", null);
|
||||
// TODO sendMessage(R.string.trisa_scale_not_paired, null);
|
||||
sendMessage(R.string.bluetooth_scale_trisa_message_not_paired_instruction, null);
|
||||
disconnect();
|
||||
return;
|
||||
}
|
||||
|
@@ -363,4 +363,13 @@
|
||||
<!-- Nachrichten zur Löschung der gesamten Datenbank -->
|
||||
<string name="delete_db_successful">Gesamte Datenbank wurde gelöscht.</string>
|
||||
<string name="delete_db_error">Fehler beim Löschen der gesamten Datenbank.</string>
|
||||
|
||||
<!-- Bluetooth Waagen Nachrichten -->
|
||||
<string name="bluetooth_scale_trisa_message_not_paired_instruction">Diese Waage wurde nicht gekoppelt!\n\nHalten Sie die Taste an der Unterseite der Waage gedrückt, um sie in den Kopplungsmodus zu versetzen, und verbinden Sie sich dann erneut, um das Gerätepasswort abzurufen.</string>
|
||||
<string name="bluetooth_scale_trisa_success_pairing">Kopplung erfolgreich!\n\nVerbinden Sie sich erneut, um Messdaten abzurufen.</string>
|
||||
<string name="bluetooth_scale_info_create_user_instruction">Neuen Benutzer auf der Waage erstellen.</string>
|
||||
<string name="bluetooth_scale_warning_low_battery">Niedriger Batteriestand (%d%%), bitte Batterien der Waage aufladen oder ersetzen.</string>
|
||||
<string name="bluetooth_scale_info_step_on_for_reference">Bitte stellen Sie sich barfuß auf die Waage für Referenzmessungen.</string>
|
||||
<string name="bluetooth_scale_info_measuring_weight">Gewichtsmessung: %.2f</string>
|
||||
<string name="bluetooth_scale_error_max_users_reached">Maximale Anzahl gleichzeitiger Waagenbenutzer erreicht.</string>
|
||||
</resources>
|
||||
|
@@ -364,4 +364,14 @@
|
||||
<!-- Entire Database Deletion Messages -->
|
||||
<string name="delete_db_successful">Entire database has been deleted.</string>
|
||||
<string name="delete_db_error">Error deleting entire database.</string>
|
||||
|
||||
<!-- Bluetooth Scales Messages -->
|
||||
<string name="bluetooth_scale_trisa_message_not_paired_instruction">This scale has not been paired!\n\nHold the button on the bottom of the scale to switch it to pairing mode, and then reconnect to retrieve the device password.</string>
|
||||
<string name="bluetooth_scale_trisa_success_pairing">Pairing succeeded!\n\nReconnect to retrieve measurement data.</string>
|
||||
<string name="bluetooth_scale_info_create_user_instruction">Create new user on scale.</string>
|
||||
<string name="bluetooth_scale_warning_low_battery">Low battery level (%d%%), please recharge or replace scale batteries</string>
|
||||
<string name="bluetooth_scale_info_step_on_for_reference">Please step barefoot on the scale for reference measurements</string>
|
||||
<string name="bluetooth_scale_info_measuring_weight">Measuring weight: %.2f</string>
|
||||
<string name="bluetooth_scale_error_max_users_reached">Max. number of concurrent scale users reached</string>
|
||||
|
||||
</resources>
|
||||
|
Reference in New Issue
Block a user