mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge.git
synced 2025-01-25 16:15:55 +01:00
parent
cc16906d20
commit
27f61138bc
@ -87,6 +87,17 @@ public class HuaweiCoordinator {
|
|||||||
|
|
||||||
public HuaweiCoordinator(HuaweiCoordinatorSupplier parent) {
|
public HuaweiCoordinator(HuaweiCoordinatorSupplier parent) {
|
||||||
this.parent = parent;
|
this.parent = parent;
|
||||||
|
|
||||||
|
// Set non-numeric capabilities
|
||||||
|
this.expandCapabilities = GB.hexStringToByteArray(getCapabilitiesSharedPreferences().getString("expandCapabilities", "00"));
|
||||||
|
this.notificationCapabilities = (byte)getCapabilitiesSharedPreferences().getInt("notificationCapabilities", -0x01);
|
||||||
|
this.notificationConstraints = ByteBuffer.wrap(GB.hexStringToByteArray(
|
||||||
|
getCapabilitiesSharedPreferences().getString(
|
||||||
|
"notificationConstraints",
|
||||||
|
GB.hexdump(Notifications.defaultConstraints)
|
||||||
|
)));
|
||||||
|
this.maxContactsCount = getCapabilitiesSharedPreferences().getInt("maxContactsCount", 0);
|
||||||
|
|
||||||
for (String key : getCapabilitiesSharedPreferences().getAll().keySet()) {
|
for (String key : getCapabilitiesSharedPreferences().getAll().keySet()) {
|
||||||
int service;
|
int service;
|
||||||
try {
|
try {
|
||||||
@ -94,18 +105,7 @@ public class HuaweiCoordinator {
|
|||||||
byte[] commands = GB.hexStringToByteArray(getCapabilitiesSharedPreferences().getString(key, "00"));
|
byte[] commands = GB.hexStringToByteArray(getCapabilitiesSharedPreferences().getString(key, "00"));
|
||||||
this.commandsPerService.put(service, commands);
|
this.commandsPerService.put(service, commands);
|
||||||
} catch (NumberFormatException e) {
|
} catch (NumberFormatException e) {
|
||||||
if (key.equals("expandCapabilities"))
|
// These are the non-numeric capabilities, which have been set already
|
||||||
this.expandCapabilities = GB.hexStringToByteArray(getCapabilitiesSharedPreferences().getString(key, "00"));
|
|
||||||
if (key.equals("notificationCapabilities"))
|
|
||||||
this.notificationCapabilities = (byte)getCapabilitiesSharedPreferences().getInt(key, -0x01);
|
|
||||||
if (key.equals("notificationConstraints"))
|
|
||||||
this.notificationConstraints = ByteBuffer.wrap(GB.hexStringToByteArray(
|
|
||||||
getCapabilitiesSharedPreferences().getString(
|
|
||||||
key,
|
|
||||||
GB.hexdump(Notifications.defaultConstraints)
|
|
||||||
)));
|
|
||||||
if (key.equals("maxContactsCount"))
|
|
||||||
this.maxContactsCount = getCapabilitiesSharedPreferences().getInt(key, 0);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -24,10 +24,10 @@ import nodomain.freeyourgadget.gadgetbridge.devices.huawei.HuaweiTLV;
|
|||||||
public class Notifications {
|
public class Notifications {
|
||||||
public static final byte id = 0x02;
|
public static final byte id = 0x02;
|
||||||
public static final byte[] defaultConstraints = new byte[]{
|
public static final byte[] defaultConstraints = new byte[]{
|
||||||
(short)0x02, (short)0x0F,
|
0x00, 0x02, 0x00, 0x0F,
|
||||||
(short)0x00, (short)0x02, (short)0x1E,
|
0x00, 0x00, 0x00, 0x02, 0x00, 0x1E,
|
||||||
(short)0x00, (short)0x02, (short)0x1E,
|
0x00, 0x00, 0x00, 0x02, 0x00, 0x1E,
|
||||||
(short)0x00, (short)0x02, (short)0x1E
|
0x00, 0x00, 0x00, 0x02, 0x00, 0x1E
|
||||||
};
|
};
|
||||||
|
|
||||||
public static class NotificationActionRequest extends HuaweiPacket {
|
public static class NotificationActionRequest extends HuaweiPacket {
|
||||||
|
@ -24,6 +24,7 @@ import java.util.List;
|
|||||||
import nodomain.freeyourgadget.gadgetbridge.devices.huawei.HuaweiPacket;
|
import nodomain.freeyourgadget.gadgetbridge.devices.huawei.HuaweiPacket;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.devices.huawei.packets.Notifications;
|
import nodomain.freeyourgadget.gadgetbridge.devices.huawei.packets.Notifications;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.devices.huawei.packets.Notifications.NotificationConstraints;
|
import nodomain.freeyourgadget.gadgetbridge.devices.huawei.packets.Notifications.NotificationConstraints;
|
||||||
|
import nodomain.freeyourgadget.gadgetbridge.model.DeviceType;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.service.devices.huawei.HuaweiSupportProvider;
|
import nodomain.freeyourgadget.gadgetbridge.service.devices.huawei.HuaweiSupportProvider;
|
||||||
|
|
||||||
public class GetNotificationConstraintsRequest extends Request {
|
public class GetNotificationConstraintsRequest extends Request {
|
||||||
@ -37,7 +38,8 @@ public class GetNotificationConstraintsRequest extends Request {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected boolean requestSupported() {
|
protected boolean requestSupported() {
|
||||||
return supportProvider.getHuaweiCoordinator().supportsNotificationAlert() && supportProvider.getProtocolVersion() == 2;
|
return supportProvider.getHuaweiCoordinator().supportsNotificationAlert() && supportProvider.getProtocolVersion() == 2
|
||||||
|
&& supportProvider.getCoordinator().getDeviceType() != DeviceType.HUAWEIBANDAW70; // Bit of a workaround, there is probably some capabilities this actually depends on
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
Loading…
Reference in New Issue
Block a user