1
0
mirror of https://codeberg.org/Freeyourgadget/Gadgetbridge synced 2024-12-25 10:05:49 +01:00

Updated according to review

Thank you José Rebelo!
This commit is contained in:
Martin.JM 2024-02-18 20:29:55 +01:00 committed by José Rebelo
parent c66051f580
commit 9a388ca386
3 changed files with 8 additions and 7 deletions

View File

@ -345,7 +345,7 @@ public class HuaweiCoordinator {
}
public boolean supportsWeatherExtended() {
return supportsCommandForService(0x0f, 0x05);
return supportsCommandForService(0x0f, 0x06);
}
public boolean supportsWeatherForecasts() {

View File

@ -17,14 +17,15 @@
package nodomain.freeyourgadget.gadgetbridge.service.devices.huawei.requests;
import android.location.Location;
import java.util.Calendar;
import java.util.List;
import nodomain.freeyourgadget.gadgetbridge.GBApplication;
import nodomain.freeyourgadget.gadgetbridge.devices.huawei.HuaweiPacket;
import nodomain.freeyourgadget.gadgetbridge.devices.huawei.packets.GpsAndTime;
import nodomain.freeyourgadget.gadgetbridge.service.devices.huawei.HuaweiSupportProvider;
import nodomain.freeyourgadget.gadgetbridge.util.Prefs;
import nodomain.freeyourgadget.gadgetbridge.service.devices.pebble.webview.CurrentPosition;
public class SendGpsAndTimeToDeviceRequest extends Request {
@ -37,12 +38,12 @@ public class SendGpsAndTimeToDeviceRequest extends Request {
@Override
protected List<byte[]> createRequest() throws RequestCreationException {
try {
Prefs prefs = GBApplication.getPrefs();
Location location = new CurrentPosition().getLastKnownLocation();
return new GpsAndTime.CurrentGPSRequest(
this.paramsProvider,
(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)
location.getLatitude(),
location.getLongitude()
).serialize();
} catch (HuaweiPacket.CryptoException e) {
throw new RequestCreationException(e);

View File

@ -55,7 +55,7 @@ public class SendWeatherForecastRequest extends Request {
// Add today as well
WeatherForecastData.DayData today = new WeatherForecastData.DayData();
today.timestamp = weatherSpec.sunRise;
today.timestamp = weatherSpec.timestamp;
today.icon = supportProvider.openWeatherMapConditionCodeToHuaweiIcon(weatherSpec.currentConditionCode);
today.highTemperature = (byte) (weatherSpec.todayMaxTemp - 273);
today.lowTemperature = (byte) (weatherSpec.todayMinTemp - 273);