NO.1 F1: Display settings.
Set time format and distance units.
This commit is contained in:
parent
6f358ff722
commit
7b78003ba1
|
@ -19,6 +19,7 @@ package nodomain.freeyourgadget.gadgetbridge.service.devices.no1f1;
|
|||
import android.bluetooth.BluetoothGatt;
|
||||
import android.bluetooth.BluetoothGattCharacteristic;
|
||||
import android.net.Uri;
|
||||
import android.text.format.DateFormat;
|
||||
import android.widget.Toast;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
|
@ -388,11 +389,23 @@ public class No1F1Support extends AbstractBTLEDeviceSupport {
|
|||
});
|
||||
|
||||
// display settings
|
||||
builder.write(ctrlCharacteristic, new byte[]{
|
||||
byte[] displayBytes = new byte[]{
|
||||
No1F1Constants.CMD_DISPLAY_SETTINGS,
|
||||
0x01, // 1 - display distance in kilometers, 2 - in miles
|
||||
0x01 // 1 - display 24-hour clock, 2 - for 12-hour with AM/PM
|
||||
});
|
||||
0x00, // 1 - display distance in kilometers, 2 - in miles
|
||||
0x00 // 1 - display 24-hour clock, 2 - for 12-hour with AM/PM
|
||||
};
|
||||
String units = GBApplication.getPrefs().getString("measurement_system", getContext().getString(R.string.p_unit_metric));
|
||||
if (units.equals(getContext().getString(R.string.p_unit_metric))) {
|
||||
displayBytes[1] = 1;
|
||||
} else {
|
||||
displayBytes[1] = 2;
|
||||
}
|
||||
if (DateFormat.is24HourFormat(getContext())) {
|
||||
displayBytes[2] = 1;
|
||||
} else {
|
||||
displayBytes[2] = 2;
|
||||
}
|
||||
builder.write(ctrlCharacteristic, displayBytes);
|
||||
|
||||
// heart rate measurement mode
|
||||
builder.write(ctrlCharacteristic, new byte[]{
|
||||
|
@ -643,8 +656,7 @@ public class No1F1Support extends AbstractBTLEDeviceSupport {
|
|||
}
|
||||
|
||||
private void handleRealtimeHeartRateData(byte[] data) {
|
||||
if (data.length==2)
|
||||
{
|
||||
if (data.length == 2) {
|
||||
if (data[1] == (byte) 0x11)
|
||||
LOG.info("Heart rate measurement started.");
|
||||
else
|
||||
|
|
Loading…
Reference in New Issue