From c66051f5802ba2e0cdf1e8c9d5217f38d3ebef67 Mon Sep 17 00:00:00 2001 From: "Martin.JM" Date: Sun, 18 Feb 2024 19:46:50 +0100 Subject: [PATCH] Cleanup of Huawei weather implementation --- .../devices/huawei/HuaweiTLV.java | 2 +- .../devices/huawei/packets/GpsAndTime.java | 17 ++++++++++++++ .../devices/huawei/HuaweiSupportProvider.java | 2 +- .../SendGpsAndTimeToDeviceRequest.java | 22 +++++++++++++++---- 4 files changed, 37 insertions(+), 6 deletions(-) diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huawei/HuaweiTLV.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huawei/HuaweiTLV.java index c0e4527a0..53c9c1899 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huawei/HuaweiTLV.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huawei/HuaweiTLV.java @@ -1,4 +1,4 @@ -/* Copyright (C) 2024 Damien Gaignon, Martin.JM +/* Copyright (C) 2024 Damien Gaignon, Martin.JM, Vitalii Tomin This file is part of Gadgetbridge. diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huawei/packets/GpsAndTime.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huawei/packets/GpsAndTime.java index 327ac37c6..4363b64a9 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huawei/packets/GpsAndTime.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huawei/packets/GpsAndTime.java @@ -1,3 +1,20 @@ +/* Copyright (C) 2024 Vitalii Tomin, Martin.JM + + This file is part of Gadgetbridge. + + Gadgetbridge is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as published + by the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + Gadgetbridge is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see . */ + package nodomain.freeyourgadget.gadgetbridge.devices.huawei.packets; import nodomain.freeyourgadget.gadgetbridge.devices.huawei.HuaweiPacket; diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/huawei/HuaweiSupportProvider.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/huawei/HuaweiSupportProvider.java index 614b7dd06..8579a011e 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/huawei/HuaweiSupportProvider.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/huawei/HuaweiSupportProvider.java @@ -1,4 +1,4 @@ -/* Copyright (C) 2024 Damien Gaignon, Martin.JM +/* Copyright (C) 2024 Damien Gaignon, Martin.JM, Vitalii Tomin This file is part of Gadgetbridge. diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/huawei/requests/SendGpsAndTimeToDeviceRequest.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/huawei/requests/SendGpsAndTimeToDeviceRequest.java index a3525d02a..5dc3a0430 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/huawei/requests/SendGpsAndTimeToDeviceRequest.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/huawei/requests/SendGpsAndTimeToDeviceRequest.java @@ -1,3 +1,20 @@ +/* Copyright (C) 2024 Vitalii Tomin, Martin.JM + + This file is part of Gadgetbridge. + + Gadgetbridge is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as published + by the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + Gadgetbridge is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see . */ + package nodomain.freeyourgadget.gadgetbridge.service.devices.huawei.requests; import java.util.Calendar; @@ -20,13 +37,10 @@ public class SendGpsAndTimeToDeviceRequest extends Request { @Override protected List createRequest() throws RequestCreationException { try { - // TODO: support multiple units - Prefs prefs = GBApplication.getPrefs(); - // Backdating a bit seems to work better return new GpsAndTime.CurrentGPSRequest( this.paramsProvider, - (int) (Calendar.getInstance().getTime().getTime() / 1000L) - 60, + (int) (Calendar.getInstance().getTime().getTime() / 1000L) - 60, // Backdating a bit seems to work better prefs.getFloat("location_latitude", 0.0F), prefs.getFloat("location_longitude", 0.0F) ).serialize();