Skip to content

Commit fe6eb08

Browse files
committed
update: profile: add a new network event reason for profile update
Signed-off-by: Tatiana Leon <Tatiana.Leon@digi.com>
1 parent a682475 commit fe6eb08

File tree

3 files changed

+12
-3
lines changed

3 files changed

+12
-3
lines changed

digi/xbee/devices.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11774,6 +11774,9 @@ def __init__(self, code, description):
1177411774
self.__code = code
1177511775
self.__description = description
1177611776

11777+
def __str__(self):
11778+
return "%s (%d)" % (self.__description, self.__code)
11779+
1177711780
@property
1177811781
def code(self):
1177911782
"""
@@ -11829,11 +11832,15 @@ class NetworkEventReason(Enum):
1182911832
ROUTE = (0x04, "Hop of a network route")
1183011833
READ_INFO = (0x05, "Read XBee information")
1183111834
FIRMWARE_UPDATE = (0x06, "The firmware of the device was updated")
11835+
PROFILE_UPDATE = (0x07, "New profile applied to the device")
1183211836

1183311837
def __init__(self, code, description):
1183411838
self.__code = code
1183511839
self.__description = description
1183611840

11841+
def __str__(self):
11842+
return "%s (%d)" % (self.__description, self.__code)
11843+
1183711844
@property
1183811845
def code(self):
1183911846
"""

digi/xbee/profile.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
from digi.xbee.firmware import UpdateConfigurer, EXTENSION_GBL, EXTENSION_XML, \
3131
EXTENSION_EBIN, EXTENSION_EHX2, EXTENSION_OTB, EXTENSION_OTA, \
3232
EXTENSION_EBL, update_local_firmware, update_remote_firmware
33-
from digi.xbee.devices import XBeeDevice, RemoteXBeeDevice
33+
from digi.xbee.devices import XBeeDevice, RemoteXBeeDevice, NetworkEventReason
3434
from digi.xbee.exception import XBeeException, FirmwareUpdateException, \
3535
InvalidOperatingModeException
3636
from digi.xbee.filesystem import LocalXBeeFileSystemManager, \
@@ -1408,11 +1408,11 @@ def restore_after_update(self, net_changed, protocol_changed_by_settings, port_s
14081408
if net_changed or protocol_changed_by_settings:
14091409
if not self._xbee.is_remote():
14101410
# Clear the full network as it is no longer valid.
1411-
self._xbee.get_network().clear()
1411+
self._xbee.get_network()._clear(NetworkEventReason.PROFILE_UPDATE)
14121412
else:
14131413
# Remove node from the network as it might be no longer part of it.
14141414
self._xbee.get_local_xbee_device().get_network(). \
1415-
remove_device(self._xbee)
1415+
_remove_device(self._xbee, NetworkEventReason.PROFILE_UPDATE)
14161416

14171417
self._configurer.progress_cb(self._configurer.TASK_RESTORE,
14181418
done=self._configurer.restore_total)

doc/user_doc/discovering_the_xbee_network.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -826,6 +826,8 @@ As well, ``NetworkEventReason`` enumerates the network modification causes:
826826
information.
827827
* ``NetworkEventReason.FIRMWARE_UPDATE``: The node was updated/removed, or the
828828
network cleared after a firmware update.
829+
* ``NetworkEventReason.PROFILE_UPDATE``: The node was updated/removed, or the
830+
network cleared after applying a profile.
829831
* ``NetworkEventReason.MANUAL``: The node was manually added/updated/removed, or
830832
the network cleared.
831833

0 commit comments

Comments
 (0)