mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge
synced 2024-11-28 21:06:50 +01:00
The notification, once enabled, can only be triggerd once per day, mind that when testing. Packet structure: ``` 00:c2:00:3a:01:00:00:00:01:88:13:00:00 00:c2:00: - chunked transfer type 2 3a: - command set goals/notificatrions 01: - 01 - set steps goal, 02 - set calories goal, 03 - both 00:00:00: - delimiter 01: - enable steps goal notification 88:13: - set steps goal (5000) 00:00 - delimiter ``` This is sent when goal notification switch is enabled in Zepp app: ``` 00:c2:00:3a:03:00:00:00:01:40:1f:00:00:01:2c:01:00:00 00:c2:00: - chunked transfer type 2 3a: - command set goals/notificatrions 03: - 01 - set steps goal, 02 - set calories goal, 03 - both 00:00:00: - delimiter 01: - enable steps goal notification 40:1f: - steps goal (8000) 00:00: - delimiter 01: - enable calories goal notification (seems to be not used in Neo) 2c:01: - set calories goal (300) 00:00 - delimiter ``` And when disabled: `00:c2:00:3a:03:00:00:00:00:40:1f:00:00:00:2c:01:00:00` Reviewed-on: https://codeberg.org/Freeyourgadget/Gadgetbridge/pulls/2780 Co-authored-by: NekoBox <nekobox@noreply.codeberg.org> Co-committed-by: NekoBox <nekobox@noreply.codeberg.org>
This commit is contained in:
parent
c6104f5332
commit
c2f5fd3215
@ -528,7 +528,7 @@ public abstract class HuamiSupport extends AbstractBTLEDeviceSupport {
|
||||
* @return
|
||||
*/
|
||||
|
||||
private HuamiSupport setFitnessGoal(TransactionBuilder transaction) {
|
||||
protected HuamiSupport setFitnessGoal(TransactionBuilder transaction) {
|
||||
LOG.info("Attempting to set Fitness Goal...");
|
||||
BluetoothGattCharacteristic characteristic = getCharacteristic(HuamiService.UUID_CHARACTERISTIC_8_USER_SETTINGS);
|
||||
if (characteristic != null) {
|
||||
@ -3161,7 +3161,7 @@ public abstract class HuamiSupport extends AbstractBTLEDeviceSupport {
|
||||
return this;
|
||||
}
|
||||
|
||||
private HuamiSupport setGoalNotification(TransactionBuilder builder) {
|
||||
protected HuamiSupport setGoalNotification(TransactionBuilder builder) {
|
||||
boolean enable = HuamiCoordinator.getGoalNotification(gbDevice.getAddress());
|
||||
LOG.info("Setting goal notification to " + enable);
|
||||
if (enable) {
|
||||
|
@ -48,6 +48,32 @@ public class AmazfitNeoSupport extends MiBand5Support {
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected AmazfitNeoSupport setFitnessGoal(TransactionBuilder builder) {
|
||||
LOG.info("Attempting to set Fitness Goal...");
|
||||
setNeoFitnessGoal(builder);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected AmazfitNeoSupport setGoalNotification(TransactionBuilder builder) {
|
||||
LOG.info("Attempting to set goal notification...");
|
||||
setNeoFitnessGoal(builder);
|
||||
return this;
|
||||
}
|
||||
|
||||
private void setNeoFitnessGoal(TransactionBuilder builder) {
|
||||
int fitnessGoal = GBApplication.getPrefs().getInt(ActivityUser.PREF_USER_STEPS_GOAL, ActivityUser.defaultUserStepsGoal);
|
||||
boolean fitnessGoalNotification = HuamiCoordinator.getGoalNotification(gbDevice.getAddress());
|
||||
LOG.info("Setting Amazfit Neo fitness goal to: " + fitnessGoal + ", notification: " + fitnessGoalNotification);
|
||||
byte[] bytes = ArrayUtils.addAll(
|
||||
new byte[] { 0x3a, 1, 0, 0, 0, (byte) (fitnessGoalNotification ? 1 : 0 ) },
|
||||
BLETypeConversions.fromUint16(fitnessGoal));
|
||||
bytes = ArrayUtils.addAll(bytes,
|
||||
HuamiService.COMMAND_SET_FITNESS_GOAL_END);
|
||||
writeToChunked(builder, 2, bytes);
|
||||
}
|
||||
|
||||
@Override
|
||||
public HuamiFWHelper createFWHelper(Uri uri, Context context) throws IOException {
|
||||
return new AmazfitNeoFWHelper(uri, context);
|
||||
|
Loading…
Reference in New Issue
Block a user