Enable SMS Reply

(still dangerous, not enabled)
This commit is contained in:
Andreas Shimokawa 2022-04-04 17:27:55 +02:00
parent 8546254539
commit 1636aed465
6 changed files with 24 additions and 5 deletions

View File

@ -108,7 +108,7 @@ public class AmazfitBipUCoordinator extends HuamiCoordinator {
return new int[]{
R.xml.devicesettings_amazfitbipu,
R.xml.devicesettings_vibrationpatterns,
//R.xml.devicesettings_canned_dismisscall_16,
R.xml.devicesettings_canned_dismisscall_16,
R.xml.devicesettings_timeformat,
R.xml.devicesettings_world_clocks,
R.xml.devicesettings_wearlocation,

View File

@ -108,6 +108,7 @@ public class AmazfitBipUProCoordinator extends HuamiCoordinator {
return new int[]{
R.xml.devicesettings_amazfitbipupro,
R.xml.devicesettings_vibrationpatterns,
R.xml.devicesettings_canned_dismisscall_16,
R.xml.devicesettings_timeformat,
R.xml.devicesettings_world_clocks,
R.xml.devicesettings_wearlocation,

View File

@ -87,6 +87,7 @@ public class MiBand6Coordinator extends HuamiCoordinator {
R.xml.devicesettings_miband6,
R.xml.devicesettings_miband6_new_protocol,
R.xml.devicesettings_vibrationpatterns,
R.xml.devicesettings_canned_dismisscall_16,
R.xml.devicesettings_wearlocation,
R.xml.devicesettings_heartrate_sleep_alert_activity_stress,
R.xml.devicesettings_goal_notification,

View File

@ -99,7 +99,7 @@ public class HuamiChunked2021Decoder {
currentType = 0;
return ArrayUtils.remove(buf, 0);
}
if (currentType == HuamiService.CHUNKED2021_ENDPOINT_SMSREPLY && false) { // unsafe for now, disabled, also we shoud return somehing and then parse in HuamiSupport instead of firing stuff here
if (currentType == HuamiService.CHUNKED2021_ENDPOINT_SMSREPLY) {
LOG.debug("got command for SMS reply");
if (buf[0] == 0x0d) {
try {

View File

@ -1193,13 +1193,25 @@ public abstract class HuamiSupport extends AbstractBTLEDeviceSupport {
public void onSetCallStateNew(CallSpec callSpec) {
if (callSpec.command == CallSpec.CALL_INCOMING) {
int phoneNumberLength = 0;
if (callSpec.number != null && !callSpec.number.equals("")) {
phoneNumberLength = callSpec.number.getBytes().length;
}
byte[] message = NotificationUtils.getPreferredTextFor(callSpec).getBytes();
int length = 10 + message.length;
int length = 7 + message.length + phoneNumberLength;
if (phoneNumberLength > 0) {
length += 3;
}
ByteBuffer buf = ByteBuffer.allocate(length);
buf.order(ByteOrder.LITTLE_ENDIAN);
buf.put(new byte[]{3, 0, 0, 0, 0, 0});
buf.put(message);
buf.put(new byte[]{0, 0, 0, 2});
if (phoneNumberLength > 0) {
buf.put(new byte[]{0, 0, 0});
buf.put(callSpec.number.getBytes());
}
buf.put((byte) 0);
try {
TransactionBuilder builder = performInitialized("incoming call");
writeToChunked(builder, 0, buf.array());
@ -2278,7 +2290,7 @@ public abstract class HuamiSupport extends AbstractBTLEDeviceSupport {
byte[] reassemblyBuffer;
byte reassemblyType = 0x00;
private void handleConfigurationInfo(byte[] value) {
void handleConfigurationInfo(byte[] value) {
if (value == null || value.length < 4) {
return;
}

View File

@ -27,6 +27,7 @@ import java.io.IOException;
import nodomain.freeyourgadget.gadgetbridge.R;
import nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiFWHelper;
import nodomain.freeyourgadget.gadgetbridge.devices.huami.miband6.MiBand6FWHelper;
import nodomain.freeyourgadget.gadgetbridge.model.CallSpec;
import nodomain.freeyourgadget.gadgetbridge.service.btle.TransactionBuilder;
import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.miband5.MiBand5Support;
import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.operations.UpdateFirmwareOperation;
@ -57,6 +58,10 @@ public class MiBand6Support extends MiBand5Support {
return new MiBand6FWHelper(uri, context);
}
@Override
public void onSetCallState(CallSpec callSpec) {
onSetCallStateNew(callSpec);
}
@Override
public boolean supportsSunriseSunsetWindHumidity() {