mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge
synced 2024-11-28 21:06:50 +01:00
Small cleanup
This commit is contained in:
parent
5ebfe9b39f
commit
1c2516186d
@ -36,6 +36,7 @@ public final class HuaweiConstants {
|
||||
|
||||
public static final int TAG_RESULT = 127;
|
||||
public static final byte[] RESULT_SUCCESS = new byte[]{0x00, 0x01, (byte)0x86, (byte)0xA0};
|
||||
public static final int RESULT_SUCCESS_INT = 0x186a0;
|
||||
|
||||
public static class CryptoTags {
|
||||
public static final int encryption = 124;
|
||||
|
@ -469,6 +469,20 @@ public class Weather {
|
||||
}
|
||||
}
|
||||
|
||||
public static class WeatherDeviceRequest extends HuaweiPacket {
|
||||
public static final byte id = 0x04;
|
||||
|
||||
public WeatherDeviceRequest(ParamsProvider paramsProvider, int responseValue) {
|
||||
super(paramsProvider);
|
||||
|
||||
this.serviceId = Weather.id;
|
||||
this.commandId = id;
|
||||
this.tlv = new HuaweiTLV().put(0x01, responseValue);
|
||||
this.isEncrypted = false;
|
||||
this.complete = true;
|
||||
}
|
||||
}
|
||||
|
||||
public static class WeatherUnitRequest extends HuaweiPacket {
|
||||
public static final byte id = 0x05;
|
||||
|
||||
|
@ -18,14 +18,12 @@ package nodomain.freeyourgadget.gadgetbridge.service.devices.huawei.requests;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import nodomain.freeyourgadget.gadgetbridge.devices.huawei.HuaweiConstants;
|
||||
import nodomain.freeyourgadget.gadgetbridge.devices.huawei.HuaweiPacket;
|
||||
import nodomain.freeyourgadget.gadgetbridge.devices.huawei.HuaweiTLV;
|
||||
import nodomain.freeyourgadget.gadgetbridge.devices.huawei.packets.Weather;
|
||||
import nodomain.freeyourgadget.gadgetbridge.model.WeatherSpec;
|
||||
import nodomain.freeyourgadget.gadgetbridge.service.devices.huawei.HuaweiSupportProvider;
|
||||
|
||||
public class SendWeatherDeviceRequest extends Request {
|
||||
WeatherSpec weatherSpec;
|
||||
|
||||
public SendWeatherDeviceRequest(HuaweiSupportProvider support) {
|
||||
super(support);
|
||||
@ -36,13 +34,7 @@ public class SendWeatherDeviceRequest extends Request {
|
||||
@Override
|
||||
protected List<byte[]> createRequest() throws RequestCreationException {
|
||||
try {
|
||||
// TODO: move this to the weather packet class
|
||||
HuaweiPacket response = new HuaweiPacket(supportProvider.getParamsProvider());
|
||||
response.serviceId = this.serviceId;
|
||||
response.commandId = this.commandId;
|
||||
response.setTlv(new HuaweiTLV().put(0x01, 0x186a0));
|
||||
response.setEncryption(false);
|
||||
return response.serialize();
|
||||
return new Weather.WeatherDeviceRequest(paramsProvider, HuaweiConstants.RESULT_SUCCESS_INT).serialize();
|
||||
} catch (HuaweiPacket.CryptoException e) {
|
||||
throw new RequestCreationException(e);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user