mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge.git
synced 2025-01-25 08:05:55 +01:00
Enable SMS Reply
(still dangerous, not enabled)
This commit is contained in:
parent
8546254539
commit
1636aed465
@ -108,7 +108,7 @@ public class AmazfitBipUCoordinator extends HuamiCoordinator {
|
|||||||
return new int[]{
|
return new int[]{
|
||||||
R.xml.devicesettings_amazfitbipu,
|
R.xml.devicesettings_amazfitbipu,
|
||||||
R.xml.devicesettings_vibrationpatterns,
|
R.xml.devicesettings_vibrationpatterns,
|
||||||
//R.xml.devicesettings_canned_dismisscall_16,
|
R.xml.devicesettings_canned_dismisscall_16,
|
||||||
R.xml.devicesettings_timeformat,
|
R.xml.devicesettings_timeformat,
|
||||||
R.xml.devicesettings_world_clocks,
|
R.xml.devicesettings_world_clocks,
|
||||||
R.xml.devicesettings_wearlocation,
|
R.xml.devicesettings_wearlocation,
|
||||||
|
@ -108,6 +108,7 @@ public class AmazfitBipUProCoordinator extends HuamiCoordinator {
|
|||||||
return new int[]{
|
return new int[]{
|
||||||
R.xml.devicesettings_amazfitbipupro,
|
R.xml.devicesettings_amazfitbipupro,
|
||||||
R.xml.devicesettings_vibrationpatterns,
|
R.xml.devicesettings_vibrationpatterns,
|
||||||
|
R.xml.devicesettings_canned_dismisscall_16,
|
||||||
R.xml.devicesettings_timeformat,
|
R.xml.devicesettings_timeformat,
|
||||||
R.xml.devicesettings_world_clocks,
|
R.xml.devicesettings_world_clocks,
|
||||||
R.xml.devicesettings_wearlocation,
|
R.xml.devicesettings_wearlocation,
|
||||||
|
@ -87,6 +87,7 @@ public class MiBand6Coordinator extends HuamiCoordinator {
|
|||||||
R.xml.devicesettings_miband6,
|
R.xml.devicesettings_miband6,
|
||||||
R.xml.devicesettings_miband6_new_protocol,
|
R.xml.devicesettings_miband6_new_protocol,
|
||||||
R.xml.devicesettings_vibrationpatterns,
|
R.xml.devicesettings_vibrationpatterns,
|
||||||
|
R.xml.devicesettings_canned_dismisscall_16,
|
||||||
R.xml.devicesettings_wearlocation,
|
R.xml.devicesettings_wearlocation,
|
||||||
R.xml.devicesettings_heartrate_sleep_alert_activity_stress,
|
R.xml.devicesettings_heartrate_sleep_alert_activity_stress,
|
||||||
R.xml.devicesettings_goal_notification,
|
R.xml.devicesettings_goal_notification,
|
||||||
|
@ -99,7 +99,7 @@ public class HuamiChunked2021Decoder {
|
|||||||
currentType = 0;
|
currentType = 0;
|
||||||
return ArrayUtils.remove(buf, 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");
|
LOG.debug("got command for SMS reply");
|
||||||
if (buf[0] == 0x0d) {
|
if (buf[0] == 0x0d) {
|
||||||
try {
|
try {
|
||||||
|
@ -1193,13 +1193,25 @@ public abstract class HuamiSupport extends AbstractBTLEDeviceSupport {
|
|||||||
|
|
||||||
public void onSetCallStateNew(CallSpec callSpec) {
|
public void onSetCallStateNew(CallSpec callSpec) {
|
||||||
if (callSpec.command == CallSpec.CALL_INCOMING) {
|
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();
|
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);
|
ByteBuffer buf = ByteBuffer.allocate(length);
|
||||||
buf.order(ByteOrder.LITTLE_ENDIAN);
|
buf.order(ByteOrder.LITTLE_ENDIAN);
|
||||||
buf.put(new byte[]{3, 0, 0, 0, 0, 0});
|
buf.put(new byte[]{3, 0, 0, 0, 0, 0});
|
||||||
buf.put(message);
|
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 {
|
try {
|
||||||
TransactionBuilder builder = performInitialized("incoming call");
|
TransactionBuilder builder = performInitialized("incoming call");
|
||||||
writeToChunked(builder, 0, buf.array());
|
writeToChunked(builder, 0, buf.array());
|
||||||
@ -2278,7 +2290,7 @@ public abstract class HuamiSupport extends AbstractBTLEDeviceSupport {
|
|||||||
byte[] reassemblyBuffer;
|
byte[] reassemblyBuffer;
|
||||||
byte reassemblyType = 0x00;
|
byte reassemblyType = 0x00;
|
||||||
|
|
||||||
private void handleConfigurationInfo(byte[] value) {
|
void handleConfigurationInfo(byte[] value) {
|
||||||
if (value == null || value.length < 4) {
|
if (value == null || value.length < 4) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -27,6 +27,7 @@ import java.io.IOException;
|
|||||||
import nodomain.freeyourgadget.gadgetbridge.R;
|
import nodomain.freeyourgadget.gadgetbridge.R;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiFWHelper;
|
import nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiFWHelper;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.devices.huami.miband6.MiBand6FWHelper;
|
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.btle.TransactionBuilder;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.miband5.MiBand5Support;
|
import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.miband5.MiBand5Support;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.operations.UpdateFirmwareOperation;
|
import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.operations.UpdateFirmwareOperation;
|
||||||
@ -57,6 +58,10 @@ public class MiBand6Support extends MiBand5Support {
|
|||||||
return new MiBand6FWHelper(uri, context);
|
return new MiBand6FWHelper(uri, context);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onSetCallState(CallSpec callSpec) {
|
||||||
|
onSetCallStateNew(callSpec);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean supportsSunriseSunsetWindHumidity() {
|
public boolean supportsSunriseSunsetWindHumidity() {
|
||||||
|
Loading…
Reference in New Issue
Block a user