mirror of
https://github.com/aljazceru/Android-nRF-Toolbox.git
synced 2025-12-22 08:54:21 +01:00
Locales added
This commit is contained in:
@@ -24,6 +24,7 @@ package no.nordicsemi.android.nrftoolbox.parser;
|
|||||||
import android.bluetooth.BluetoothGattCharacteristic;
|
import android.bluetooth.BluetoothGattCharacteristic;
|
||||||
|
|
||||||
import java.util.Calendar;
|
import java.util.Calendar;
|
||||||
|
import java.util.Locale;
|
||||||
|
|
||||||
public class BloodPressureMeasurementParser {
|
public class BloodPressureMeasurementParser {
|
||||||
public static String parse(final BluetoothGattCharacteristic characteristic) {
|
public static String parse(final BluetoothGattCharacteristic characteristic) {
|
||||||
@@ -59,7 +60,7 @@ public class BloodPressureMeasurementParser {
|
|||||||
calendar.set(Calendar.MINUTE, characteristic.getIntValue(BluetoothGattCharacteristic.FORMAT_UINT8, offset + 5));
|
calendar.set(Calendar.MINUTE, characteristic.getIntValue(BluetoothGattCharacteristic.FORMAT_UINT8, offset + 5));
|
||||||
calendar.set(Calendar.SECOND, characteristic.getIntValue(BluetoothGattCharacteristic.FORMAT_UINT8, offset + 6));
|
calendar.set(Calendar.SECOND, characteristic.getIntValue(BluetoothGattCharacteristic.FORMAT_UINT8, offset + 6));
|
||||||
offset += 7;
|
offset += 7;
|
||||||
builder.append(String.format("\nTimestamp: %1$tT %1$te.%1$tm.%1$tY", calendar));
|
builder.append(String.format(Locale.US, "\nTimestamp: %1$tT %1$te.%1$tm.%1$tY", calendar));
|
||||||
}
|
}
|
||||||
|
|
||||||
// parse pulse rate if present
|
// parse pulse rate if present
|
||||||
|
|||||||
@@ -23,6 +23,8 @@ package no.nordicsemi.android.nrftoolbox.parser;
|
|||||||
|
|
||||||
import android.bluetooth.BluetoothGattCharacteristic;
|
import android.bluetooth.BluetoothGattCharacteristic;
|
||||||
|
|
||||||
|
import java.util.Locale;
|
||||||
|
|
||||||
public class CSCMeasurementParser {
|
public class CSCMeasurementParser {
|
||||||
private static final byte WHEEL_REV_DATA_PRESENT = 0x01; // 1 bit
|
private static final byte WHEEL_REV_DATA_PRESENT = 0x01; // 1 bit
|
||||||
private static final byte CRANK_REV_DATA_PRESENT = 0x02; // 1 bit
|
private static final byte CRANK_REV_DATA_PRESENT = 0x02; // 1 bit
|
||||||
@@ -57,12 +59,12 @@ public class CSCMeasurementParser {
|
|||||||
|
|
||||||
final StringBuilder builder = new StringBuilder();
|
final StringBuilder builder = new StringBuilder();
|
||||||
if (wheelRevPresent) {
|
if (wheelRevPresent) {
|
||||||
builder.append(String.format("Wheel rev: %d,\n", wheelRevolutions));
|
builder.append(String.format(Locale.US, "Wheel rev: %d,\n", wheelRevolutions));
|
||||||
builder.append(String.format("Last wheel event time: %d ms,\n", lastWheelEventTime));
|
builder.append(String.format(Locale.US, "Last wheel event time: %d ms,\n", lastWheelEventTime));
|
||||||
}
|
}
|
||||||
if (crankRevPreset) {
|
if (crankRevPreset) {
|
||||||
builder.append(String.format("Crank rev: %d,\n", crankRevolutions));
|
builder.append(String.format(Locale.US, "Crank rev: %d,\n", crankRevolutions));
|
||||||
builder.append(String.format("Last crank event time: %d ms,\n", lastCrankEventTime));
|
builder.append(String.format(Locale.US, "Last crank event time: %d ms,\n", lastCrankEventTime));
|
||||||
}
|
}
|
||||||
builder.setLength(builder.length() - 2);
|
builder.setLength(builder.length() - 2);
|
||||||
return builder.toString();
|
return builder.toString();
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ import android.bluetooth.BluetoothGattCharacteristic;
|
|||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Locale;
|
||||||
|
|
||||||
public class HeartRateMeasurementParser {
|
public class HeartRateMeasurementParser {
|
||||||
private static final byte HEART_RATE_VALUE_FORMAT = 0x01; // 1 bit
|
private static final byte HEART_RATE_VALUE_FORMAT = 0x01; // 1 bit
|
||||||
@@ -101,7 +102,7 @@ public class HeartRateMeasurementParser {
|
|||||||
if (rrIntervalStatus) {
|
if (rrIntervalStatus) {
|
||||||
builder.append(",\nRR Interval: ");
|
builder.append(",\nRR Interval: ");
|
||||||
for (final Float interval : rrIntervals)
|
for (final Float interval : rrIntervals)
|
||||||
builder.append(String.format("%.02f ms, ", interval));
|
builder.append(String.format(Locale.US, "%.02f ms, ", interval));
|
||||||
builder.setLength(builder.length() - 2); // remove the ", " at the end
|
builder.setLength(builder.length() - 2); // remove the ", " at the end
|
||||||
}
|
}
|
||||||
return builder.toString();
|
return builder.toString();
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ package no.nordicsemi.android.nrftoolbox.parser;
|
|||||||
import android.bluetooth.BluetoothGattCharacteristic;
|
import android.bluetooth.BluetoothGattCharacteristic;
|
||||||
|
|
||||||
import java.util.Calendar;
|
import java.util.Calendar;
|
||||||
|
import java.util.Locale;
|
||||||
|
|
||||||
public class IntermediateCuffPressureParser {
|
public class IntermediateCuffPressureParser {
|
||||||
public static String parse(final BluetoothGattCharacteristic characteristic) {
|
public static String parse(final BluetoothGattCharacteristic characteristic) {
|
||||||
@@ -55,7 +56,7 @@ public class IntermediateCuffPressureParser {
|
|||||||
calendar.set(Calendar.MINUTE, characteristic.getIntValue(BluetoothGattCharacteristic.FORMAT_UINT8, offset + 5));
|
calendar.set(Calendar.MINUTE, characteristic.getIntValue(BluetoothGattCharacteristic.FORMAT_UINT8, offset + 5));
|
||||||
calendar.set(Calendar.SECOND, characteristic.getIntValue(BluetoothGattCharacteristic.FORMAT_UINT8, offset + 6));
|
calendar.set(Calendar.SECOND, characteristic.getIntValue(BluetoothGattCharacteristic.FORMAT_UINT8, offset + 6));
|
||||||
offset += 7;
|
offset += 7;
|
||||||
builder.append(String.format("\nTimestamp: %1$tT %1$te.%1$tm.%1$tY", calendar));
|
builder.append(String.format(Locale.US, "\nTimestamp: %1$tT %1$te.%1$tm.%1$tY", calendar));
|
||||||
}
|
}
|
||||||
|
|
||||||
// parse pulse rate if present
|
// parse pulse rate if present
|
||||||
|
|||||||
@@ -23,6 +23,8 @@ package no.nordicsemi.android.nrftoolbox.parser;
|
|||||||
|
|
||||||
import android.bluetooth.BluetoothGattCharacteristic;
|
import android.bluetooth.BluetoothGattCharacteristic;
|
||||||
|
|
||||||
|
import java.util.Locale;
|
||||||
|
|
||||||
public class RSCMeasurementParser {
|
public class RSCMeasurementParser {
|
||||||
private static final byte INSTANTANEOUS_STRIDE_LENGTH_PRESENT = 0x01; // 1 bit
|
private static final byte INSTANTANEOUS_STRIDE_LENGTH_PRESENT = 0x01; // 1 bit
|
||||||
private static final byte TOTAL_DISTANCE_PRESENT = 0x02; // 1 bit
|
private static final byte TOTAL_DISTANCE_PRESENT = 0x02; // 1 bit
|
||||||
@@ -57,11 +59,11 @@ public class RSCMeasurementParser {
|
|||||||
}
|
}
|
||||||
|
|
||||||
final StringBuilder builder = new StringBuilder();
|
final StringBuilder builder = new StringBuilder();
|
||||||
builder.append(String.format("Speed: %.2f m/s, Cadence: %d RPM,\n", instantaneousSpeed, instantaneousCadence));
|
builder.append(String.format(Locale.US, "Speed: %.2f m/s, Cadence: %d RPM,\n", instantaneousSpeed, instantaneousCadence));
|
||||||
if (islmPresent)
|
if (islmPresent)
|
||||||
builder.append(String.format("Instantaneous Stride Length: %.2f m,\n", instantaneousStrideLength));
|
builder.append(String.format(Locale.US, "Instantaneous Stride Length: %.2f m,\n", instantaneousStrideLength));
|
||||||
if (tdPreset)
|
if (tdPreset)
|
||||||
builder.append(String.format("Total Distance: %.1f m,\n", totalDistance));
|
builder.append(String.format(Locale.US, "Total Distance: %.1f m,\n", totalDistance));
|
||||||
if (walking)
|
if (walking)
|
||||||
builder.append("Status: WALKING");
|
builder.append("Status: WALKING");
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -23,6 +23,8 @@ package no.nordicsemi.android.nrftoolbox.parser;
|
|||||||
|
|
||||||
import android.bluetooth.BluetoothGattCharacteristic;
|
import android.bluetooth.BluetoothGattCharacteristic;
|
||||||
|
|
||||||
|
import java.util.Locale;
|
||||||
|
|
||||||
public class TemperatureMeasurementParser {
|
public class TemperatureMeasurementParser {
|
||||||
private static final byte TEMPERATURE_UNIT_FLAG = 0x01; // 1 bit
|
private static final byte TEMPERATURE_UNIT_FLAG = 0x01; // 1 bit
|
||||||
private static final byte TIMESTAMP_FLAG = 0x02; // 1 bits
|
private static final byte TIMESTAMP_FLAG = 0x02; // 1 bits
|
||||||
@@ -66,7 +68,7 @@ public class TemperatureMeasurementParser {
|
|||||||
}
|
}
|
||||||
|
|
||||||
final StringBuilder builder = new StringBuilder();
|
final StringBuilder builder = new StringBuilder();
|
||||||
builder.append(String.format("%.02f", tempValue));
|
builder.append(String.format(Locale.US, "%.02f", tempValue));
|
||||||
|
|
||||||
if (fahrenheit)
|
if (fahrenheit)
|
||||||
builder.append("°F");
|
builder.append("°F");
|
||||||
|
|||||||
Reference in New Issue
Block a user