huawei: watchface: GetWatchfaceParams (27 01)
* request to get supported watchface versions and screen size
This commit is contained in:
parent
71389c3fce
commit
cd6bc10239
|
@ -380,6 +380,8 @@ public class HuaweiCoordinator {
|
|||
return supportsCommandForService(0x0c, 0x01);
|
||||
}
|
||||
|
||||
public boolean supportsWatchfaceParams(){ return supportsCommandForService(0x27, 0x01);}
|
||||
|
||||
public boolean supportsWeather() {
|
||||
return supportsCommandForService(0x0f, 0x01);
|
||||
}
|
||||
|
|
|
@ -0,0 +1,42 @@
|
|||
package nodomain.freeyourgadget.gadgetbridge.devices.huawei.packets;
|
||||
|
||||
import nodomain.freeyourgadget.gadgetbridge.devices.huawei.HuaweiPacket;
|
||||
import nodomain.freeyourgadget.gadgetbridge.devices.huawei.HuaweiTLV;
|
||||
|
||||
public class Watchface {
|
||||
public static final byte id = 0x27;
|
||||
|
||||
public static class WatchfaceParams {
|
||||
public static final byte id = 0x01;
|
||||
public static class Request extends HuaweiPacket {
|
||||
|
||||
public Request(ParamsProvider paramsProvider) {
|
||||
super(paramsProvider);
|
||||
this.serviceId = Watchface.id;
|
||||
this.commandId = id;
|
||||
|
||||
|
||||
this.tlv = new HuaweiTLV()
|
||||
.put(0x01)
|
||||
.put(0x02)
|
||||
.put(0x03)
|
||||
.put(0x04)
|
||||
.put(0x05)
|
||||
.put(0x0e)
|
||||
.put(0x0f);
|
||||
|
||||
this.complete = true;
|
||||
|
||||
}
|
||||
|
||||
public static class Response extends HuaweiPacket {
|
||||
public Response (ParamsProvider paramsProvider) {
|
||||
super(paramsProvider);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -85,6 +85,7 @@ import nodomain.freeyourgadget.gadgetbridge.service.devices.huawei.requests.GetE
|
|||
import nodomain.freeyourgadget.gadgetbridge.service.devices.huawei.requests.GetGpsParameterRequest;
|
||||
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.GetWatchfaceParams;
|
||||
import nodomain.freeyourgadget.gadgetbridge.service.devices.huawei.requests.SendExtendedAccountRequest;
|
||||
import nodomain.freeyourgadget.gadgetbridge.service.devices.huawei.requests.SendGpsAndTimeToDeviceRequest;
|
||||
import nodomain.freeyourgadget.gadgetbridge.service.devices.huawei.requests.SendGpsDataRequest;
|
||||
|
@ -728,6 +729,11 @@ public class HuaweiSupportProvider {
|
|||
GetNotificationConstraintsRequest getNotificationConstraintsReq = new GetNotificationConstraintsRequest(this);
|
||||
getNotificationConstraintsReq.doPerform();
|
||||
}
|
||||
|
||||
if (getHuaweiCoordinator().supportsWatchfaceParams()) {
|
||||
GetWatchfaceParams getWatchfaceParams = new GetWatchfaceParams(this);
|
||||
getWatchfaceParams.doPerform();
|
||||
}
|
||||
} catch (IOException e) {
|
||||
GB.toast(getContext(), "Initialize dynamic services of Huawei device failed", Toast.LENGTH_SHORT, GB.ERROR,
|
||||
e);
|
||||
|
|
|
@ -0,0 +1,31 @@
|
|||
package nodomain.freeyourgadget.gadgetbridge.service.devices.huawei.requests;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import nodomain.freeyourgadget.gadgetbridge.devices.huawei.HuaweiPacket;
|
||||
import nodomain.freeyourgadget.gadgetbridge.devices.huawei.packets.Watchface;
|
||||
import nodomain.freeyourgadget.gadgetbridge.service.devices.huawei.HuaweiSupportProvider;
|
||||
|
||||
public class GetWatchfaceParams extends Request{
|
||||
|
||||
private static final Logger LOG = LoggerFactory.getLogger(GetWatchfaceParams.class);
|
||||
|
||||
public GetWatchfaceParams(HuaweiSupportProvider support) {
|
||||
super(support);
|
||||
this.serviceId = Watchface.id;
|
||||
this.commandId = Watchface.WatchfaceParams.id;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected List<byte[]> createRequest() throws RequestCreationException {
|
||||
try {
|
||||
return new Watchface.WatchfaceParams.Request(paramsProvider).serialize();
|
||||
} catch (HuaweiPacket.CryptoException e) {
|
||||
throw new RequestCreationException(e);
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue