If you want configuration changes performed in an XBee device to persist through subsequent resets, you must write those changes in the device. Writing changes means that the parameter values configured in the device are written to the non-volatile memory of the XBee device. The module loads the parameter values from non-volatile memory every time it is started.
The XBee device classes provide a method to write (save) the parameter modifications in the XBee device memory so they persist through subsequent resets:
| Method | Description |
|---|---|
WriteChanges() |
Writes configurable parameter values to the non-volatile memory of this XBee device so that parameter modifications persist through subsequent resets. |
The WriteChanges() method may fail for the following reasons:
-
The device is not connected, throwing an InterfaceNotOpenException.
-
There is a timeout sending the write changes command, throwing a TimeoutException.
-
Other errors are caught as XBeeException.
// Instantiate an XBee device object.
XBeeBLEDevice myXBeeBLEDevice = new XBeeBLEDevice("00:00:00:00:00:00", "password");
// Connect the device.
myXBeeBLEDevice.Connect();
// Configure the device not to apply parameter changes automatically.
if (ApplyConfigurationChangesEnabled)
ApplyConfigurationChangesEnabled = false;
// Set the PAN ID of the XBee device to BABE.
myXBeeBLEDevice.SetPANID(new byte[]{(byte)0xBA, (byte)0xBE});
// Perform other configurations.
[...]
// Apply changes.
myXBeeBLEDevice.ApplyChanges();
// Write changes.
myXBeeBLEDevice.WriteChanges();