Cleanup of Huawei weather implementation

This commit is contained in:
Martin.JM 2024-02-18 19:46:50 +01:00 committed by José Rebelo
parent 1c2516186d
commit c66051f580
4 changed files with 37 additions and 6 deletions

View File

@ -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.

View File

@ -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 <https://www.gnu.org/licenses/>. */
package nodomain.freeyourgadget.gadgetbridge.devices.huawei.packets;
import nodomain.freeyourgadget.gadgetbridge.devices.huawei.HuaweiPacket;

View File

@ -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.

View File

@ -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 <https://www.gnu.org/licenses/>. */
package nodomain.freeyourgadget.gadgetbridge.service.devices.huawei.requests;
import java.util.Calendar;
@ -20,13 +37,10 @@ public class SendGpsAndTimeToDeviceRequest extends Request {
@Override
protected List<byte[]> 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();