Skip to content

Commit a357ced

Browse files
committed
device: use the real communication mode of the device when writing a packet
If the device is remote and its mode is not known, the packet was always being written as in API mode, but it must be written using the mode of the local device. Signed-off-by: Ruben Moral <ruben.moral@digi.com>
1 parent 50bf4d3 commit a357ced

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

library/src/main/java/com/digi/xbee/api/AbstractXBeeDevice.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2017-2019, Digi International Inc.
2+
* Copyright 2017-2022, Digi International Inc.
33
*
44
* This Source Code Form is subject to the terms of the Mozilla Public
55
* License, v. 2.0. If a copy of the MPL was not distributed with this
@@ -1618,7 +1618,7 @@ public void packetReceived(XBeePacket receivedPacket) {
16181618
private void writePacket(XBeePacket packet) throws IOException {
16191619
logger.debug(toString() + "Sending XBee packet: \n{}", packet.toPrettyString());
16201620
// Write bytes with the required escaping mode.
1621-
switch (operatingMode) {
1621+
switch (getOperatingMode()) {
16221622
case API:
16231623
default:
16241624
connectionInterface.writeData(packet.generateByteArray());

0 commit comments

Comments
 (0)