mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge.git
synced 2025-01-10 17:11:56 +01:00
Updated according to review
Thank you José Rebelo!
This commit is contained in:
parent
c66051f580
commit
9a388ca386
@ -345,7 +345,7 @@ public class HuaweiCoordinator {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean supportsWeatherExtended() {
|
public boolean supportsWeatherExtended() {
|
||||||
return supportsCommandForService(0x0f, 0x05);
|
return supportsCommandForService(0x0f, 0x06);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean supportsWeatherForecasts() {
|
public boolean supportsWeatherForecasts() {
|
||||||
|
@ -17,14 +17,15 @@
|
|||||||
|
|
||||||
package nodomain.freeyourgadget.gadgetbridge.service.devices.huawei.requests;
|
package nodomain.freeyourgadget.gadgetbridge.service.devices.huawei.requests;
|
||||||
|
|
||||||
|
import android.location.Location;
|
||||||
|
|
||||||
import java.util.Calendar;
|
import java.util.Calendar;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.GBApplication;
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.devices.huawei.HuaweiPacket;
|
import nodomain.freeyourgadget.gadgetbridge.devices.huawei.HuaweiPacket;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.devices.huawei.packets.GpsAndTime;
|
import nodomain.freeyourgadget.gadgetbridge.devices.huawei.packets.GpsAndTime;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.service.devices.huawei.HuaweiSupportProvider;
|
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 {
|
public class SendGpsAndTimeToDeviceRequest extends Request {
|
||||||
|
|
||||||
@ -37,12 +38,12 @@ public class SendGpsAndTimeToDeviceRequest extends Request {
|
|||||||
@Override
|
@Override
|
||||||
protected List<byte[]> createRequest() throws RequestCreationException {
|
protected List<byte[]> createRequest() throws RequestCreationException {
|
||||||
try {
|
try {
|
||||||
Prefs prefs = GBApplication.getPrefs();
|
Location location = new CurrentPosition().getLastKnownLocation();
|
||||||
return new GpsAndTime.CurrentGPSRequest(
|
return new GpsAndTime.CurrentGPSRequest(
|
||||||
this.paramsProvider,
|
this.paramsProvider,
|
||||||
(int) (Calendar.getInstance().getTime().getTime() / 1000L) - 60, // Backdating a bit seems to work better
|
(int) (Calendar.getInstance().getTime().getTime() / 1000L) - 60, // Backdating a bit seems to work better
|
||||||
prefs.getFloat("location_latitude", 0.0F),
|
location.getLatitude(),
|
||||||
prefs.getFloat("location_longitude", 0.0F)
|
location.getLongitude()
|
||||||
).serialize();
|
).serialize();
|
||||||
} catch (HuaweiPacket.CryptoException e) {
|
} catch (HuaweiPacket.CryptoException e) {
|
||||||
throw new RequestCreationException(e);
|
throw new RequestCreationException(e);
|
||||||
|
@ -55,7 +55,7 @@ public class SendWeatherForecastRequest extends Request {
|
|||||||
|
|
||||||
// Add today as well
|
// Add today as well
|
||||||
WeatherForecastData.DayData today = new WeatherForecastData.DayData();
|
WeatherForecastData.DayData today = new WeatherForecastData.DayData();
|
||||||
today.timestamp = weatherSpec.sunRise;
|
today.timestamp = weatherSpec.timestamp;
|
||||||
today.icon = supportProvider.openWeatherMapConditionCodeToHuaweiIcon(weatherSpec.currentConditionCode);
|
today.icon = supportProvider.openWeatherMapConditionCodeToHuaweiIcon(weatherSpec.currentConditionCode);
|
||||||
today.highTemperature = (byte) (weatherSpec.todayMaxTemp - 273);
|
today.highTemperature = (byte) (weatherSpec.todayMaxTemp - 273);
|
||||||
today.lowTemperature = (byte) (weatherSpec.todayMinTemp - 273);
|
today.lowTemperature = (byte) (weatherSpec.todayMinTemp - 273);
|
||||||
|
Loading…
Reference in New Issue
Block a user