mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge
synced 2025-02-03 21:47:32 +01:00
Zepp OS: Fix Alexa initial connection
This commit is contained in:
parent
43d02b9661
commit
7359186cee
@ -19,6 +19,7 @@ package nodomain.freeyourgadget.gadgetbridge.service.devices.huami.zeppos.servic
|
|||||||
import static nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSettingsPreferenceConst.PREF_VOICE_SERVICE_LANGUAGE;
|
import static nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSettingsPreferenceConst.PREF_VOICE_SERVICE_LANGUAGE;
|
||||||
import static nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSettingsPreferenceConst.PREF_WATCHFACE;
|
import static nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSettingsPreferenceConst.PREF_WATCHFACE;
|
||||||
|
|
||||||
|
import android.os.Handler;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
@ -75,6 +76,8 @@ public class ZeppOsAlexaService extends AbstractZeppOsService {
|
|||||||
|
|
||||||
public static final String PREF_VERSION = "zepp_os_alexa_version";
|
public static final String PREF_VERSION = "zepp_os_alexa_version";
|
||||||
|
|
||||||
|
private final Handler handler = new Handler();
|
||||||
|
|
||||||
final ByteArrayOutputStream voiceBuffer = new ByteArrayOutputStream();
|
final ByteArrayOutputStream voiceBuffer = new ByteArrayOutputStream();
|
||||||
|
|
||||||
public ZeppOsAlexaService(final Huami2021Support support) {
|
public ZeppOsAlexaService(final Huami2021Support support) {
|
||||||
@ -348,7 +351,10 @@ public class ZeppOsAlexaService extends AbstractZeppOsService {
|
|||||||
|
|
||||||
LOG.info("Alexa starting: var1={}, var2={}, var3={}, var4={}, params={}", var1, var2, var3, var4, params);
|
LOG.info("Alexa starting: var1={}, var2={}, var3={}, var4={}, params={}", var1, var2, var3, var4, params);
|
||||||
|
|
||||||
sendStartAck();
|
// Send the start ack with a slight delay, to give enough time for the connection to switch to fast mode
|
||||||
|
// I can't seem to get the callback for onConnectionUpdated working, and if we reply too soon the watch
|
||||||
|
// will just stay stuck "Connecting...". It seems like it takes ~350ms to switch to fast connection.
|
||||||
|
handler.postDelayed(this::sendStartAck, 700);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void handleEnd(final byte[] payload) {
|
private void handleEnd(final byte[] payload) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user