mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge
synced 2024-12-25 10:05:49 +01:00
Send gps and time before forecast
This commit is contained in:
parent
14eaba858c
commit
287b720350
@ -0,0 +1,27 @@
|
||||
package nodomain.freeyourgadget.gadgetbridge.devices.huawei.packets;
|
||||
|
||||
import nodomain.freeyourgadget.gadgetbridge.devices.huawei.HuaweiPacket;
|
||||
import nodomain.freeyourgadget.gadgetbridge.devices.huawei.HuaweiTLV;
|
||||
|
||||
public class GpsAndTime {
|
||||
public static final byte id = 0x18;
|
||||
|
||||
public static class CurrentGPSRequest extends HuaweiPacket {
|
||||
public static final byte id = 0x07;
|
||||
public CurrentGPSRequest (
|
||||
ParamsProvider paramsProvider
|
||||
) {
|
||||
super(paramsProvider);
|
||||
|
||||
this.serviceId = GpsAndTime.id;
|
||||
this.commandId = id;
|
||||
this.tlv = new HuaweiTLV();
|
||||
this.tlv.put(0x01, (int) 0);
|
||||
this.tlv.put(0x02, (long) 0);
|
||||
this.tlv.put(0x03, (long) 0);
|
||||
this.isEncrypted = true;
|
||||
this.complete = true;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
@ -78,6 +78,7 @@ import nodomain.freeyourgadget.gadgetbridge.model.WeatherSpec;
|
||||
import nodomain.freeyourgadget.gadgetbridge.service.devices.huawei.requests.GetEventAlarmList;
|
||||
import nodomain.freeyourgadget.gadgetbridge.service.devices.huawei.requests.GetNotificationConstraintsRequest;
|
||||
import nodomain.freeyourgadget.gadgetbridge.service.devices.huawei.requests.GetSmartAlarmList;
|
||||
import nodomain.freeyourgadget.gadgetbridge.service.devices.huawei.requests.SendGpsAndTimeToDeviceRequest;
|
||||
import nodomain.freeyourgadget.gadgetbridge.service.devices.huawei.requests.SendWeatherCurrentRequest;
|
||||
import nodomain.freeyourgadget.gadgetbridge.service.devices.huawei.requests.SendNotifyHeartRateCapabilityRequest;
|
||||
import nodomain.freeyourgadget.gadgetbridge.service.devices.huawei.requests.SendNotifyRestHeartRateCapabilityRequest;
|
||||
@ -1658,12 +1659,19 @@ public class HuaweiSupportProvider {
|
||||
weatherSpec
|
||||
);
|
||||
|
||||
SendGpsAndTimeToDeviceRequest sendGpsAndTimeToDeviceRequest = new SendGpsAndTimeToDeviceRequest(
|
||||
this
|
||||
);
|
||||
|
||||
sendWeatherCurrentRequest.nextRequest(sendGpsAndTimeToDeviceRequest);
|
||||
|
||||
|
||||
if (getHuaweiCoordinator().supportsWeatherForecasts()) {
|
||||
SendWeatherForecastRequest sendWeatherForecastRequest = new SendWeatherForecastRequest(
|
||||
this,
|
||||
weatherSpec
|
||||
);
|
||||
sendWeatherCurrentRequest.nextRequest(sendWeatherForecastRequest);
|
||||
sendGpsAndTimeToDeviceRequest.nextRequest(sendWeatherForecastRequest);
|
||||
}
|
||||
|
||||
sendWeatherCurrentRequest.doPerform();
|
||||
|
@ -0,0 +1,32 @@
|
||||
package nodomain.freeyourgadget.gadgetbridge.service.devices.huawei.requests;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import nodomain.freeyourgadget.gadgetbridge.devices.huawei.HuaweiPacket;
|
||||
import nodomain.freeyourgadget.gadgetbridge.devices.huawei.packets.GpsAndTime;
|
||||
import nodomain.freeyourgadget.gadgetbridge.service.devices.huawei.HuaweiSupportProvider;
|
||||
|
||||
|
||||
public class SendGpsAndTimeToDeviceRequest extends Request {
|
||||
|
||||
|
||||
public SendGpsAndTimeToDeviceRequest(HuaweiSupportProvider support) {
|
||||
super(support);
|
||||
this.serviceId = GpsAndTime.id;
|
||||
this.commandId = GpsAndTime.CurrentGPSRequest.id;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected List<byte[]> createRequest() throws RequestCreationException {
|
||||
try {
|
||||
// TODO: support multiple units
|
||||
|
||||
return new GpsAndTime.CurrentGPSRequest(
|
||||
this.paramsProvider
|
||||
).serialize();
|
||||
} catch (HuaweiPacket.CryptoException e) {
|
||||
throw new RequestCreationException(e);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user