Skip to content

Commit 5a1029a

Browse files
committed
command mode: XBee devices can enter command mode always
Command mode methods threw an 'InvalidOperatingModeException' if current operation mode is not Transparent. XBee devices can enter in command mode always using '+++' (default sequence), independently of the current operating mode. Signed-off-by: Tatiana Leon <Tatiana.Leon@digi.com>
1 parent 24b6ae6 commit 5a1029a

File tree

1 file changed

+0
-9
lines changed

1 file changed

+0
-9
lines changed

digi/xbee/devices.py

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4128,14 +4128,10 @@ def _enter_at_command_mode(self):
41284128
Raises:
41294129
SerialTimeoutException: If there is any error trying to write to
41304130
the serial port.
4131-
InvalidOperatingModeException: If the XBee is in API mode.
41324131
"""
41334132
if not self._serial_port:
41344133
raise XBeeException(
41354134
"Command mode is only supported for local XBee devices using a serial connection")
4136-
if self._operating_mode in (OperatingMode.API_MODE, OperatingMode.ESCAPED_API_MODE):
4137-
raise InvalidOperatingModeException(
4138-
message="Invalid mode. Command mode can be only accessed while in AT mode")
41394135

41404136
from digi.xbee.recovery import enter_at_command_mode
41414137
return enter_at_command_mode(self._serial_port)
@@ -4147,16 +4143,11 @@ def _exit_at_command_mode(self):
41474143
Raises:
41484144
SerialTimeoutException: If there is any error trying to write to
41494145
the serial port.
4150-
InvalidOperatingModeException: If the XBee is in API mode.
41514146
"""
41524147
if not self._serial_port:
41534148
raise XBeeException(
41544149
"Command mode is only supported for local XBee devices using a serial connection")
41554150

4156-
if self._operating_mode in (OperatingMode.API_MODE, OperatingMode.ESCAPED_API_MODE):
4157-
raise InvalidOperatingModeException(
4158-
message="Invalid mode. Command mode can be only be exited while in AT mode")
4159-
41604151
self._serial_port.write("ATCN\r".encode("utf8"))
41614152
time.sleep(self.__DEFAULT_GUARD_TIME)
41624153

0 commit comments

Comments
 (0)