mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge
synced 2024-12-18 06:37:47 +01:00
ZeTime: Basic support for rejecting incoming calls
This commit is contained in:
parent
94358e79b0
commit
ad1e519723
@ -80,6 +80,7 @@ public class ZeTimeConstants {
|
||||
public static final byte CMD_REMINDERS = (byte) 0x97;
|
||||
public static final byte CMD_PUSH_CALENDAR_DAY = (byte) 0x99;
|
||||
public static final byte CMD_MUSIC_CONTROL = (byte) 0xD0;
|
||||
public static final byte CMD_CALL_CONTROL = (byte) 0xDC;
|
||||
public static final byte CMD_TEST_SIGNALING = (byte) 0xFA;
|
||||
// here are the action commands
|
||||
public static final byte CMD_REQUEST = (byte) 0x70;
|
||||
|
@ -43,6 +43,7 @@ import nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSett
|
||||
import nodomain.freeyourgadget.gadgetbridge.database.DBHandler;
|
||||
import nodomain.freeyourgadget.gadgetbridge.database.DBHelper;
|
||||
import nodomain.freeyourgadget.gadgetbridge.deviceevents.GBDeviceEventBatteryInfo;
|
||||
import nodomain.freeyourgadget.gadgetbridge.deviceevents.GBDeviceEventCallControl;
|
||||
import nodomain.freeyourgadget.gadgetbridge.deviceevents.GBDeviceEventMusicControl;
|
||||
import nodomain.freeyourgadget.gadgetbridge.deviceevents.GBDeviceEventVersionInfo;
|
||||
import nodomain.freeyourgadget.gadgetbridge.devices.zetime.ZeTimeConstants;
|
||||
@ -79,6 +80,7 @@ public class ZeTimeDeviceSupport extends AbstractBTLEDeviceSupport {
|
||||
private final GBDeviceEventBatteryInfo batteryCmd = new GBDeviceEventBatteryInfo();
|
||||
private final GBDeviceEventVersionInfo versionCmd = new GBDeviceEventVersionInfo();
|
||||
private final GBDeviceEventMusicControl musicCmd = new GBDeviceEventMusicControl();
|
||||
private final GBDeviceEventCallControl callCmd = new GBDeviceEventCallControl();
|
||||
private final int eightHourOffset = 28800;
|
||||
private byte[] lastMsg;
|
||||
private byte msgPart;
|
||||
@ -895,6 +897,9 @@ public class ZeTimeDeviceSupport extends AbstractBTLEDeviceSupport {
|
||||
case ZeTimeConstants.CMD_MUSIC_CONTROL:
|
||||
handleMusicControl(data);
|
||||
break;
|
||||
case ZeTimeConstants.CMD_CALL_CONTROL:
|
||||
handleCallControl(data);
|
||||
break;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@ -1376,6 +1381,17 @@ public class ZeTimeDeviceSupport extends AbstractBTLEDeviceSupport {
|
||||
}
|
||||
}
|
||||
|
||||
private void handleCallControl(byte[] callControlMsg) {
|
||||
if (callControlMsg.length == 7
|
||||
&& callControlMsg[2] == ZeTimeConstants.CMD_SEND
|
||||
&& callControlMsg[3] == 0x01
|
||||
&& callControlMsg[4] == 0x00
|
||||
&& callControlMsg[5] == 0x01) {
|
||||
callCmd.event = GBDeviceEventCallControl.Event.REJECT;
|
||||
evaluateGBDeviceEvent(callCmd);
|
||||
}
|
||||
}
|
||||
|
||||
private void replyMsgToWatch(TransactionBuilder builder, byte[] msg) {
|
||||
if (msg.length > maxMsgLength) {
|
||||
int msgpartlength = 0;
|
||||
|
Loading…
Reference in New Issue
Block a user