mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge
synced 2024-08-24 00:00:47 +02:00
Bangle.js: Fix #2996 - force a reconnect when rx/tx characteristics can't be found
This commit is contained in:
parent
ec843b5447
commit
140c62ac55
@ -131,6 +131,7 @@ import nodomain.freeyourgadget.gadgetbridge.service.btle.AbstractBTLEDeviceSuppo
|
|||||||
import nodomain.freeyourgadget.gadgetbridge.service.btle.BLETypeConversions;
|
import nodomain.freeyourgadget.gadgetbridge.service.btle.BLETypeConversions;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.service.btle.BtLEQueue;
|
import nodomain.freeyourgadget.gadgetbridge.service.btle.BtLEQueue;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.service.btle.TransactionBuilder;
|
import nodomain.freeyourgadget.gadgetbridge.service.btle.TransactionBuilder;
|
||||||
|
import nodomain.freeyourgadget.gadgetbridge.service.btle.actions.SetDeviceStateAction;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.util.EmojiConverter;
|
import nodomain.freeyourgadget.gadgetbridge.util.EmojiConverter;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.util.FileUtils;
|
import nodomain.freeyourgadget.gadgetbridge.util.FileUtils;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.util.GB;
|
import nodomain.freeyourgadget.gadgetbridge.util.GB;
|
||||||
@ -318,6 +319,12 @@ public class BangleJSDeviceSupport extends AbstractBTLEDeviceSupport {
|
|||||||
|
|
||||||
rxCharacteristic = getCharacteristic(BangleJSConstants.UUID_CHARACTERISTIC_NORDIC_UART_RX);
|
rxCharacteristic = getCharacteristic(BangleJSConstants.UUID_CHARACTERISTIC_NORDIC_UART_RX);
|
||||||
txCharacteristic = getCharacteristic(BangleJSConstants.UUID_CHARACTERISTIC_NORDIC_UART_TX);
|
txCharacteristic = getCharacteristic(BangleJSConstants.UUID_CHARACTERISTIC_NORDIC_UART_TX);
|
||||||
|
if (rxCharacteristic==null || txCharacteristic==null) {
|
||||||
|
// https://codeberg.org/Freeyourgadget/Gadgetbridge/issues/2996 - sometimes we get
|
||||||
|
// initializeDevice called but no characteristics have been fetched - try and reconnect in that case
|
||||||
|
LOG.warn("RX/TX characteristics are null, will attempt to reconnect");
|
||||||
|
builder.add(new SetDeviceStateAction(getDevice(), GBDevice.State.WAITING_FOR_RECONNECT, getContext()));
|
||||||
|
}
|
||||||
builder.setCallback(this);
|
builder.setCallback(this);
|
||||||
builder.notify(rxCharacteristic, true);
|
builder.notify(rxCharacteristic, true);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user