By default, when you perform any configuration on an XBee device, the changes are automatically applied. However, there may be scenarios when you want to configure different settings or parameters of a device and apply the changes at the end once everything is configured. For that purpose, all XBee device classes provide properties and methods that allow you to specify when to apply configuration changes.
| Method/Property | Description |
|---|---|
ApplyConfigurationChangesEnabled |
Enabling this property means that when any parameter of this XBee device is set, it will be also applied. If this property is disabled, the method ApplyChanges() must be used in order to apply the changes in all the parameters that were previously set. |
ApplyChanges() |
Applies changes to all command registers, causing queued command register values to be applied. |
The ApplyChanges() method may fail for the following reasons:
-
The device is not connected, throwing an InterfaceNotOpenException.
-
There is a timeout setting the apply 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();