mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge
synced 2024-11-28 12:56:49 +01:00
Xiaomi: fix GB crashing when sending command to disconnected SPP-based device
This commit is contained in:
parent
28066b9b7d
commit
7fb0d19374
@ -277,11 +277,15 @@ public class XiaomiSppSupport extends XiaomiConnectionSupport {
|
||||
|
||||
@Override
|
||||
public void sendCommand(String taskName, XiaomiProto.Command command) {
|
||||
XiaomiSppPacket packet = XiaomiSppPacket.fromXiaomiCommand(command, frameCounter.getAndIncrement(), false);
|
||||
LOG.debug("sending packet: {}", packet);
|
||||
TransactionBuilder builder = this.commsSupport.createTransactionBuilder("send " + taskName);
|
||||
builder.write(packet.encode(mXiaomiSupport.getAuthService(), encryptionCounter));
|
||||
builder.queue(this.commsSupport.getQueue());
|
||||
try {
|
||||
XiaomiSppPacket packet = XiaomiSppPacket.fromXiaomiCommand(command, frameCounter.getAndIncrement(), false);
|
||||
LOG.debug("sending packet: {}", packet);
|
||||
TransactionBuilder builder = this.commsSupport.createTransactionBuilder("send " + taskName);
|
||||
builder.write(packet.encode(mXiaomiSupport.getAuthService(), encryptionCounter));
|
||||
builder.queue(this.commsSupport.getQueue());
|
||||
} catch (final Exception ex) {
|
||||
LOG.error("Caught unexpected exception while sending command, device may not have been informed!: {}", ex, ex);
|
||||
}
|
||||
}
|
||||
|
||||
public void sendCommand(final TransactionBuilder builder, final XiaomiProto.Command command) {
|
||||
|
Loading…
Reference in New Issue
Block a user