mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge
synced 2024-11-28 21:06:50 +01:00
ID115: wrist setting
This commit is contained in:
parent
e03d80b8e4
commit
65fbb4da5b
@ -7,6 +7,7 @@ import nodomain.freeyourgadget.gadgetbridge.model.NotificationType;
|
|||||||
import static nodomain.freeyourgadget.gadgetbridge.service.btle.AbstractBTLEDeviceSupport.BASE_UUID;
|
import static nodomain.freeyourgadget.gadgetbridge.service.btle.AbstractBTLEDeviceSupport.BASE_UUID;
|
||||||
|
|
||||||
public class ID115Constants {
|
public class ID115Constants {
|
||||||
|
public static final String PREF_WRIST = "id115_wrist";
|
||||||
public static final String PREF_SCREEN_ORIENTATION = "id115_screen_orientation";
|
public static final String PREF_SCREEN_ORIENTATION = "id115_screen_orientation";
|
||||||
|
|
||||||
public static final UUID UUID_SERVICE_ID115 = UUID.fromString(String.format(BASE_UUID, "0AF0"));
|
public static final UUID UUID_SERVICE_ID115 = UUID.fromString(String.format(BASE_UUID, "0AF0"));
|
||||||
@ -31,6 +32,9 @@ public class ID115Constants {
|
|||||||
// CMD_ID_SETTINGS
|
// CMD_ID_SETTINGS
|
||||||
public static final byte CMD_KEY_SET_TIME = 0x01;
|
public static final byte CMD_KEY_SET_TIME = 0x01;
|
||||||
public static final byte CMD_KEY_SET_GOAL = 0x03;
|
public static final byte CMD_KEY_SET_GOAL = 0x03;
|
||||||
|
public static final byte CMD_KEY_SET_HAND = 0x22;
|
||||||
|
public static final byte CMD_ARG_LEFT = 0x00;
|
||||||
|
public static final byte CMD_ARG_RIGHT = 0x01;
|
||||||
public static final byte CMD_KEY_SET_DISPLAY_MODE = 0x2B;
|
public static final byte CMD_KEY_SET_DISPLAY_MODE = 0x2B;
|
||||||
public static final byte CMD_ARG_HORIZONTAL = 0x00;
|
public static final byte CMD_ARG_HORIZONTAL = 0x00;
|
||||||
public static final byte CMD_ARG_VERTICAL = 0x02;
|
public static final byte CMD_ARG_VERTICAL = 0x02;
|
||||||
|
@ -64,6 +64,7 @@ public class ID115Support extends AbstractBTLEDeviceSupport {
|
|||||||
builder.notify(normalNotifyCharacteristic, true);
|
builder.notify(normalNotifyCharacteristic, true);
|
||||||
|
|
||||||
setTime(builder)
|
setTime(builder)
|
||||||
|
.setWrist(builder)
|
||||||
.setScreenOrientation(builder)
|
.setScreenOrientation(builder)
|
||||||
.setGoal(builder)
|
.setGoal(builder)
|
||||||
.setInitialized(builder);
|
.setInitialized(builder);
|
||||||
@ -305,6 +306,26 @@ public class ID115Support extends AbstractBTLEDeviceSupport {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ID115Support setWrist(TransactionBuilder builder) {
|
||||||
|
String value = GBApplication.getPrefs().getString(ID115Constants.PREF_WRIST,
|
||||||
|
"left");
|
||||||
|
LOG.warn("wrist value: '" + value + "'");
|
||||||
|
|
||||||
|
byte wrist;
|
||||||
|
if (value.equals("left")) {
|
||||||
|
wrist = ID115Constants.CMD_ARG_LEFT;
|
||||||
|
} else {
|
||||||
|
wrist = ID115Constants.CMD_ARG_RIGHT;
|
||||||
|
}
|
||||||
|
|
||||||
|
LOG.warn("Wrist: " + wrist);
|
||||||
|
builder.write(normalWriteCharacteristic, new byte[] {
|
||||||
|
ID115Constants.CMD_ID_SETTINGS, ID115Constants.CMD_KEY_SET_HAND,
|
||||||
|
wrist
|
||||||
|
});
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
ID115Support setScreenOrientation(TransactionBuilder builder) {
|
ID115Support setScreenOrientation(TransactionBuilder builder) {
|
||||||
String value = GBApplication.getPrefs().getString(ID115Constants.PREF_SCREEN_ORIENTATION,
|
String value = GBApplication.getPrefs().getString(ID115Constants.PREF_SCREEN_ORIENTATION,
|
||||||
"horizontal");
|
"horizontal");
|
||||||
|
@ -514,6 +514,15 @@
|
|||||||
<PreferenceCategory
|
<PreferenceCategory
|
||||||
android:key="pref_category_id115_general"
|
android:key="pref_category_id115_general"
|
||||||
android:title="@string/pref_header_general">
|
android:title="@string/pref_header_general">
|
||||||
|
|
||||||
|
<ListPreference
|
||||||
|
android:defaultValue="left"
|
||||||
|
android:entries="@array/wearside"
|
||||||
|
android:entryValues="@array/wearside_values"
|
||||||
|
android:key="id115_wrist"
|
||||||
|
android:title="@string/miband_prefs_wearside"
|
||||||
|
android:summary="%s" />
|
||||||
|
|
||||||
<ListPreference
|
<ListPreference
|
||||||
android:defaultValue="horizontal"
|
android:defaultValue="horizontal"
|
||||||
android:entries="@array/orientation"
|
android:entries="@array/orientation"
|
||||||
|
Loading…
Reference in New Issue
Block a user