mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge
synced 2024-11-28 21:06:50 +01:00
ID115: set steps goal
This commit is contained in:
parent
d66e9e6a8b
commit
02b3f23329
@ -28,6 +28,7 @@ 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_DISPLAY_MODE = 0x2B;
|
public static final byte CMD_KEY_SET_DISPLAY_MODE = 0x2B;
|
||||||
|
|
||||||
// CMD_ID_NOTIFY
|
// CMD_ID_NOTIFY
|
||||||
|
@ -17,6 +17,7 @@ import java.util.UUID;
|
|||||||
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.devices.id115.ID115Constants;
|
import nodomain.freeyourgadget.gadgetbridge.devices.id115.ID115Constants;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
|
import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
|
||||||
|
import nodomain.freeyourgadget.gadgetbridge.model.ActivityUser;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.model.Alarm;
|
import nodomain.freeyourgadget.gadgetbridge.model.Alarm;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.model.CalendarEventSpec;
|
import nodomain.freeyourgadget.gadgetbridge.model.CalendarEventSpec;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.model.CallSpec;
|
import nodomain.freeyourgadget.gadgetbridge.model.CallSpec;
|
||||||
@ -63,6 +64,7 @@ public class ID115Support extends AbstractBTLEDeviceSupport {
|
|||||||
|
|
||||||
setTime(builder)
|
setTime(builder)
|
||||||
.setDisplayMode(builder, false)
|
.setDisplayMode(builder, false)
|
||||||
|
.setGoal(builder)
|
||||||
.setInitialized(builder);
|
.setInitialized(builder);
|
||||||
|
|
||||||
return builder;
|
return builder;
|
||||||
@ -310,6 +312,23 @@ public class ID115Support extends AbstractBTLEDeviceSupport {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private ID115Support setGoal(TransactionBuilder transaction) {
|
||||||
|
ActivityUser activityUser = new ActivityUser();
|
||||||
|
int value = activityUser.getStepsGoal();
|
||||||
|
|
||||||
|
transaction.write(normalWriteCharacteristic, new byte[]{
|
||||||
|
ID115Constants.CMD_ID_SETTINGS,
|
||||||
|
ID115Constants.CMD_KEY_SET_GOAL,
|
||||||
|
0,
|
||||||
|
(byte) (value & 0xff),
|
||||||
|
(byte) ((value >> 8) & 0xff),
|
||||||
|
(byte) ((value >> 16) & 0xff),
|
||||||
|
(byte) ((value >> 24) & 0xff),
|
||||||
|
0, 0
|
||||||
|
});
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
void sendCallNotification(CallSpec callSpec) {
|
void sendCallNotification(CallSpec callSpec) {
|
||||||
String number = "";
|
String number = "";
|
||||||
if (callSpec.number != null) {
|
if (callSpec.number != null) {
|
||||||
|
Loading…
Reference in New Issue
Block a user