com.digi.xbee.api

## Class AbstractXBeeDevice

- java.lang.Object
- - com.digi.xbee.api.AbstractXBeeDevice

- Direct Known Subclasses:
    RemoteXBeeDevice, XBeeDevice

      public abstract class AbstractXBeeDevice
      extends Object

  This class provides common functionality for all XBee devices.
  See Also:
    `XBeeDevice`, `RemoteXBeeDevice`

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `AbstractXBeeDevice(IConnectionInterface connectionInterface)` Class constructor.
    `AbstractXBeeDevice(String port, int baudRate)` Class constructor.
    `AbstractXBeeDevice(String port, int baudRate, int dataBits, int stopBits, int parity, int flowControl)` Class constructor.
    `AbstractXBeeDevice(String port, SerialPortParameters serialPortParameters)` Class constructor.
    `AbstractXBeeDevice(XBeeDevice localXBeeDevice, XBee64BitAddress addr64)` Class constructor.
    `AbstractXBeeDevice(XBeeDevice localXBeeDevice, XBee64BitAddress addr64, XBee16BitAddress addr16, String id)` Class constructor.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `applyChanges()` Applies changes to all command registers causing queued command register values to be applied.
    `void` | `enableApplyConfigurationChanges(boolean enabled)` Enables or disables the 'apply configuration changes' option for this device.
    `void` | `executeParameter(String parameter)` Executes the given command in this XBee device.
    `XBee16BitAddress` | `get16BitAddress()` Returns the 16-bit address of this XBee device.
    `XBee64BitAddress` | `get64BitAddress()` Returns the 64-bit address of this XBee device.
    `int` | `getADCValue(IOLine ioLine)` Returns the analog value of the provided IO line of this XBee device.
    `IConnectionInterface` | `getConnectionInterface()` Returns the connection interface associated to this XBee device.
    `XBee64BitAddress` | `getDestinationAddress()` Returns the 64-bit destination extended address of this XBee device.
    `Set<IOLine>` | `getDIOChangeDetection()` Returns the set of IO lines of this device that are monitored for change detection.
    `IOValue` | `getDIOValue(IOLine ioLine)` Returns the digital value of the provided IO line of this XBee device.
    `String` | `getFirmwareVersion()` Returns the firmware version (hexadecimal string value) of this XBee device.
    `HardwareVersion` | `getHardwareVersion()` Returns the hardware version of this XBee device.
    `IOMode` | `getIOConfiguration(IOLine ioLine)` Returns the configuration mode of the provided IO line of this XBee device.
    `int` | `getIOSamplingRate()` Returns the IO sampling rate of this XBee device.
    `String` | `getNodeID()` Returns the node identifier of this XBee device.
    `byte[]` | `getPANID()` Returns the operating PAN ID (Personal Area Network Identifier) of this XBee device.
    `byte[]` | `getParameter(String parameter)` Gets the value of the given parameter from this XBee device.
    `PowerLevel` | `getPowerLevel()` Returns the output power level at which this XBee device transmits conducted power.
    `double` | `getPWMDutyCycle(IOLine ioLine)` Gets the PWM duty cycle (in %) corresponding to the provided IO line of this XBee device.
    `XBeeProtocol` | `getXBeeProtocol()` Returns the XBee Protocol of this XBee device.
    `boolean` | `isApplyConfigurationChangesEnabled()` Returns whether the 'apply configuration changes' option is enabled in this device.
    `abstract boolean` | `isRemote()` Returns whether this XBee device is a remote device.
    `void` | `readDeviceInfo()` Reads some parameters from this device and obtains its protocol.
    `IOSample` | `readIOSample()` Returns an IO sample from this XBee device containing the value of all enabled digital IO and analog input channels.
    `abstract void` | `reset()` Performs a software reset on this XBee device and blocks until the process is completed.
    `void` | `setDestinationAddress(XBee64BitAddress xbee64BitAddress)` Sets the 64-bit destination extended address of this XBee device.
    `void` | `setDIOChangeDetection(Set<IOLine> lines)` Sets the digital IO lines of this XBee device to be monitored and sampled whenever their status changes.
    `void` | `setDIOValue(IOLine ioLine, IOValue ioValue)` Sets the digital value (high or low) to the provided IO line of this XBee device.
    `void` | `setIOConfiguration(IOLine ioLine, IOMode ioMode)` Sets the configuration of the given IO line of this XBee device.
    `void` | `setIOSamplingRate(int rate)` Sets the IO sampling rate to enable periodic sampling in this XBee device.
    `void` | `setNodeID(String nodeID)` Sets the node identifier of this XBee device.
    `void` | `setPANID(byte[] panID)` Sets the PAN ID (Personal Area Network Identifier) of this XBee device.
    `void` | `setParameter(String parameter, byte[] parameterValue)` Sets the given parameter with the provided value in this XBee device.
    `void` | `setPowerLevel(PowerLevel powerLevel)` Sets the output power level at which this XBee device transmits conducted power.
    `void` | `setPWMDutyCycle(IOLine ioLine, double dutyCycle)` Sets the duty cycle (in %) of the provided IO line of this XBee device.
    `String` | `toString()`
    `void` | `updateDeviceDataFrom(AbstractXBeeDevice device)` Updates the current device reference with the data provided for the given device.
    `void` | `writeChanges()` Writes configurable parameter values to the non-volatile memory of this XBee device so that parameter modifications persist through subsequent resets.

    - ### Methods inherited from class java.lang.Object

      `equals, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Constructor Detail

    - #### AbstractXBeeDevice

          public AbstractXBeeDevice(IConnectionInterface connectionInterface)

      Class constructor. Instantiates a new `XBeeDevice` object with the given connection interface.
      Parameters:
        `connectionInterface` - The connection interface with the physical XBee device.
      Throws:
        `NullPointerException` - if `connectionInterface == null`.
      See Also:
        `AbstractXBeeDevice(String, int)`, `AbstractXBeeDevice(String, SerialPortParameters)`, `AbstractXBeeDevice(XBeeDevice, XBee64BitAddress)`, `AbstractXBeeDevice(XBeeDevice, XBee64BitAddress, XBee16BitAddress, String)`, `AbstractXBeeDevice(String, int, int, int, int, int)`, `IConnectionInterface`

    - #### AbstractXBeeDevice

          public AbstractXBeeDevice(String port,
                            int baudRate)

      Class constructor. Instantiates a new `XBeeDevice` object in the given port name and baud rate.
      Parameters:
        `port` - Serial port name where XBee device is attached to.
        `baudRate` - Serial port baud rate to communicate with the device. Other connection parameters will be set as default (8 data bits, 1 stop bit, no parity, no flow control).
      Throws:
        `IllegalArgumentException` - if `baudRate < 0`.
        `NullPointerException` - if `port == null`.
      See Also:
        `AbstractXBeeDevice(IConnectionInterface)`, `AbstractXBeeDevice(String, SerialPortParameters)`, `AbstractXBeeDevice(XBeeDevice, XBee64BitAddress)`, `AbstractXBeeDevice(XBeeDevice, XBee64BitAddress, XBee16BitAddress, String)`, `AbstractXBeeDevice(String, int, int, int, int, int)`

    - #### AbstractXBeeDevice

          public AbstractXBeeDevice(String port,
                            int baudRate,
                            int dataBits,
                            int stopBits,
                            int parity,
                            int flowControl)

      Class constructor. Instantiates a new `XBeeDevice` object in the given serial port name and settings.
      Parameters:
        `port` - Serial port name where XBee device is attached to.
        `baudRate` - Serial port baud rate to communicate with the device.
        `dataBits` - Serial port data bits.
        `stopBits` - Serial port data bits.
        `parity` - Serial port data bits.
        `flowControl` - Serial port data bits.
      Throws:
        `IllegalArgumentException` - if `baudRate < 0` or if `dataBits < 0` or if `stopBits < 0` or if `parity < 0` or if `flowControl < 0`.
        `NullPointerException` - if `port == null`.
      See Also:
        `AbstractXBeeDevice(IConnectionInterface)`, `AbstractXBeeDevice(String, int)`, `AbstractXBeeDevice(String, SerialPortParameters)`, `AbstractXBeeDevice(XBeeDevice, XBee64BitAddress)`, `AbstractXBeeDevice(XBeeDevice, XBee64BitAddress, XBee16BitAddress, String)`

    - #### AbstractXBeeDevice

          public AbstractXBeeDevice(String port,
                            SerialPortParameters serialPortParameters)

      Class constructor. Instantiates a new `XBeeDevice` object in the given serial port name and parameters.
      Parameters:
        `port` - Serial port name where XBee device is attached to.
        `serialPortParameters` - Object containing the serial port parameters.
      Throws:
        `NullPointerException` - if `port == null` or if `serialPortParameters == null`.
      See Also:
        `AbstractXBeeDevice(IConnectionInterface)`, `AbstractXBeeDevice(String, int)`, `AbstractXBeeDevice(XBeeDevice, XBee64BitAddress)`, `AbstractXBeeDevice(XBeeDevice, XBee64BitAddress, XBee16BitAddress, String)`, `AbstractXBeeDevice(String, int, int, int, int, int)`, `SerialPortParameters`

    - #### AbstractXBeeDevice

          public AbstractXBeeDevice(XBeeDevice localXBeeDevice,
                            XBee64BitAddress addr64)

      Class constructor. Instantiates a new `RemoteXBeeDevice` object with the given local `XBeeDevice` which contains the connection interface to be used.
      Parameters:
        `localXBeeDevice` - The local XBee device that will behave as connection interface to communicate with this remote XBee device.
        `addr64` - The 64-bit address to identify this XBee device.
      Throws:
        `IllegalArgumentException` - If `localXBeeDevice.isRemote() == true`.
        `NullPointerException` - if `localXBeeDevice == null` or if `addr64 == null`.
      See Also:
        `AbstractXBeeDevice(IConnectionInterface)`, `AbstractXBeeDevice(String, int)`, `AbstractXBeeDevice(String, SerialPortParameters)`, `AbstractXBeeDevice(XBeeDevice, XBee64BitAddress, XBee16BitAddress, String)`, `AbstractXBeeDevice(String, int, int, int, int, int)`, `XBee16BitAddress`

    - #### AbstractXBeeDevice

          public AbstractXBeeDevice(XBeeDevice localXBeeDevice,
                            XBee64BitAddress addr64,
                            XBee16BitAddress addr16,
                            String id)

      Class constructor. Instantiates a new `RemoteXBeeDevice` object with the given local `XBeeDevice` which contains the connection interface to be used.
      Parameters:
        `localXBeeDevice` - The local XBee device that will behave as connection interface to communicate with this remote XBee device.
        `addr64` - The 64-bit address to identify this XBee device.
        `addr16` - The 16-bit address to identify this XBee device. It might be `null`.
        `id` - The node identifier of this XBee device. It might be `null`.
      Throws:
        `IllegalArgumentException` - If `localXBeeDevice.isRemote() == true`.
        `NullPointerException` - If `localXBeeDevice == null` or if `addr64 == null`.
      See Also:
        `AbstractXBeeDevice(IConnectionInterface)`, `AbstractXBeeDevice(String, int)`, `AbstractXBeeDevice(String, SerialPortParameters)`, `AbstractXBeeDevice(XBeeDevice, XBee64BitAddress)`, `AbstractXBeeDevice(String, int, int, int, int, int)`, `XBee16BitAddress`, `XBee64BitAddress`

  - ### Method Detail

    - #### applyChanges

          public void applyChanges()
                            throws TimeoutException,
                                   XBeeException

      Applies changes to all command registers causing queued command register values to be applied.

      This method must be invoked if the 'apply configuration changes' option is disabled and the changes to this XBee device parameters must be applied.

      To know if the 'apply configuration changes' option is enabled, use the `isApplyConfigurationChangesEnabled()` method. And to enable/disable this feature, the method `enableApplyConfigurationChanges(boolean)`.

      Applying changes does not imply the modifications will persist through subsequent resets. To do so, use the `writeChanges()` method.

      Throws:
        `InterfaceNotOpenException` - if this device connection is not open.
        `TimeoutException` - if there is a timeout sending the get Apply Changes command.
        `XBeeException` - if there is any other XBee related exception.
      See Also:
        `enableApplyConfigurationChanges(boolean)`, `isApplyConfigurationChangesEnabled()`, `setParameter(String, byte[])`, `writeChanges()`

    - #### enableApplyConfigurationChanges

          public void enableApplyConfigurationChanges(boolean enabled)

      Enables or disables the 'apply configuration changes' option for this device.

      Enabling this option means that when any parameter of this XBee device is set, it will be also applied.

      If this option is disabled, the method `applyChanges()` must be used in order to apply the changes in all the parameters that were previously set.

      Parameters:
        `enabled` - `true` to apply configuration changes when an XBee parameter is set, `false` otherwise.
      See Also:
        `applyChanges()`, `isApplyConfigurationChangesEnabled()`

    - #### executeParameter

          public void executeParameter(String parameter)
                                throws TimeoutException,
                                       XBeeException

      Executes the given command in this XBee device.

      This method is intended to be used for those AT parameters that cannot be read or written, they just execute some action in the XBee module.

      Parameters:
        `parameter` - The AT command to be executed.
      Throws:
        `IllegalArgumentException` - if `parameter.length() != 2`.
        `NullPointerException` - if `parameter == null`.
        `TimeoutException` - if there is a timeout executing the parameter.
        `XBeeException` - if there is any other XBee related exception.
      See Also:
        `getParameter(String)`, `setParameter(String, byte[])`

    - #### get16BitAddress

          public XBee16BitAddress get16BitAddress()

      Returns the 16-bit address of this XBee device.

      To refresh this value use the `readDeviceInfo()` method.

      Returns:
        The 16-bit address of this XBee device.
      See Also:
        `XBee16BitAddress`

    - #### get64BitAddress

          public XBee64BitAddress get64BitAddress()

      Returns the 64-bit address of this XBee device.

      If this value is `null` or `XBee64BitAddress.UNKNOWN_ADDRESS`, use the `readDeviceInfo()` method to get its value.

      Returns:
        The 64-bit address of this XBee device.
      See Also:
        `XBee64BitAddress`

    - #### getADCValue

          public int getADCValue(IOLine ioLine)
                          throws TimeoutException,
                                 XBeeException

      Returns the analog value of the provided IO line of this XBee device.

      The provided IO line must be previously configured as ADC. To do so, use `setIOConfiguration` and `IOMode.ADC`.

      Parameters:
        `ioLine` - The IO line to get its analog value.
      Returns:
        The analog value corresponding to the provided IO line.
      Throws:
        `InterfaceNotOpenException` - if this device connection is not open.
        `NullPointerException` - if `ioLine == null`.
        `TimeoutException` - if there is a timeout sending the get IO values command.
        `XBeeException` - if there is any other XBee related exception.
      See Also:
        `getIOConfiguration(IOLine)`, `setIOConfiguration(IOLine, IOMode)`, `IOLine`, `IOMode.ADC`

    - #### getConnectionInterface

          public IConnectionInterface getConnectionInterface()

      Returns the connection interface associated to this XBee device.
      Returns:
        XBee device's connection interface.
      See Also:
        `IConnectionInterface`

    - #### getDestinationAddress

          public XBee64BitAddress getDestinationAddress()
                                                 throws TimeoutException,
                                                        XBeeException

      Returns the 64-bit destination extended address of this XBee device.

      `XBee64BitAddress.BROADCAST_ADDRESS` is the broadcast address for the PAN. `XBee64BitAddress.COORDINATOR_ADDRESS` can be used to address the Pan Coordinator.

      Returns:
        64-bit destination address.
      Throws:
        `InterfaceNotOpenException` - if this device connection is not open.
        `TimeoutException` - if there is a timeout sending the get destination address command.
        `XBeeException` - if there is any other XBee related exception.
      See Also:
        `setDestinationAddress(XBee64BitAddress)`, `XBee64BitAddress`

    - #### getDIOChangeDetection

          public Set<IOLine> getDIOChangeDetection()
                                            throws TimeoutException,
                                                   XBeeException

      Returns the set of IO lines of this device that are monitored for change detection.

      A `null` set means the DIO change detection feature is disabled.

      Modules can be configured to transmit to the configured destination address a data sample immediately whenever a monitored digital IO line changes state.

      Returns:
        Set of digital IO lines that are monitored for change detection, `null` if there are no monitored lines.
      Throws:
        `InterfaceNotOpenException` - if this device connection is not open.
        `TimeoutException` - if there is a timeout sending the get DIO change detection command.
        `XBeeException` - if there is any other XBee related exception.
      See Also:
        `getDestinationAddress()`, `setDestinationAddress(XBee64BitAddress)`, `setDIOChangeDetection(Set)`

    - #### getDIOValue

          public IOValue getDIOValue(IOLine ioLine)
                              throws TimeoutException,
                                     XBeeException

      Returns the digital value of the provided IO line of this XBee device.

      The provided IO line must be previously configured as digital I/O . To do so, use `setIOConfiguration` and the following `IOMode`:

      - `IOMode.DIGITAL_IN` to configure as digital input.
      - `IOMode.DIGITAL_OUT_HIGH` to configure as digital output, high.
      - `IOMode.DIGITAL_OUT_LOW` to configure as digital output, low.
      Parameters:
        `ioLine` - The IO line to get its digital value.
      Returns:
        The digital value corresponding to the provided IO line.
      Throws:
        `InterfaceNotOpenException` - if this device connection is not open.
        `NullPointerException` - if `ioLine == null`.
        `TimeoutException` - if there is a timeout sending the get IO values command.
        `XBeeException` - if there is any other XBee related exception.
      See Also:
        `getIOConfiguration(IOLine)`, `setIOConfiguration(IOLine, IOMode)`, `IOLine`, `IOValue`, `IOMode.DIGITAL_IN`, `IOMode.DIGITAL_OUT_HIGH`, `IOMode.DIGITAL_OUT_LOW`

    - #### getFirmwareVersion

          public String getFirmwareVersion()

      Returns the firmware version (hexadecimal string value) of this XBee device.

      To refresh this value use the `readDeviceInfo()` method.

      Returns:
        The firmware version of the XBee device.

    - #### getHardwareVersion

          public HardwareVersion getHardwareVersion()

      Returns the hardware version of this XBee device.

      If this value is `null`, use the `readDeviceInfo()` method to get its value.

      Returns:
        The hardware version of the XBee device.
      See Also:
        `HardwareVersion`, `HardwareVersionEnum`

    - #### getIOConfiguration

          public IOMode getIOConfiguration(IOLine ioLine)
                                    throws TimeoutException,
                                           XBeeException

      Returns the configuration mode of the provided IO line of this XBee device.
      Parameters:
        `ioLine` - The IO line to get its configuration.
      Returns:
        The IO mode (configuration) of the provided IO line.
      Throws:
        `InterfaceNotOpenException` - if this device connection is not open.
        `NullPointerException` - if `ioLine == null`.
        `TimeoutException` - if there is a timeout sending the get configuration command.
        `XBeeException` - if there is any other XBee related exception.
      See Also:
        `setIOConfiguration(IOLine, IOMode)`, `IOLine`, `IOMode`

    - #### getIOSamplingRate

          public int getIOSamplingRate()
                                throws TimeoutException,
                                       XBeeException

      Returns the IO sampling rate of this XBee device.

      A sample rate of `0` means the IO sampling feature is disabled.

      Periodic sampling allows this XBee module to take an IO sample and transmit it to a remote device (configured in the destination address) at the configured periodic rate (ms).

      Returns:
        IO sampling rate in milliseconds.
      Throws:
        `InterfaceNotOpenException` - if this device connection is not open.
        `TimeoutException` - if there is a timeout sending the get IO sampling rate command.
        `XBeeException` - if there is any other XBee related exception.
      See Also:
        `getDestinationAddress()`, `setDestinationAddress(XBee64BitAddress)`, `setIOSamplingRate(int)`

    - #### getNodeID

          public String getNodeID()

      Returns the node identifier of this XBee device.

      To refresh this value use the `readDeviceInfo()` method.

      Returns:
        The node identifier of this device.
      See Also:
        `setNodeID(String)`

    - #### getPANID

          public byte[] getPANID()
                          throws TimeoutException,
                                 XBeeException

      Returns the operating PAN ID (Personal Area Network Identifier) of this XBee device.

      For modules to communicate they must be configured with the same identifier. Only modules with matching IDs can communicate with each other.This parameter allows multiple networks to co-exist on the same physical channel.

      Returns:
        The operating PAN ID of this XBee device.
      Throws:
        `InterfaceNotOpenException` - if this device connection is not open.
        `TimeoutException` - if there is a timeout getting the PAN ID.
        `XBeeException` - if there is any other XBee related exception.
      See Also:
        `setPANID(byte[])`

    - #### getParameter

          public byte[] getParameter(String parameter)
                              throws TimeoutException,
                                     XBeeException

      Gets the value of the given parameter from this XBee device.
      Parameters:
        `parameter` - The name of the parameter to retrieve its value.
      Returns:
        A byte array containing the value of the parameter.
      Throws:
        `IllegalArgumentException` - if `parameter.length() != 2`.
        `NullPointerException` - if `parameter == null`.
        `TimeoutException` - if there is a timeout getting the parameter value.
        `XBeeException` - if there is any other XBee related exception.
      See Also:
        `executeParameter(String)`, `setParameter(String, byte[])`

    - #### getPowerLevel

          public PowerLevel getPowerLevel()
                                   throws TimeoutException,
                                          XBeeException

      Returns the output power level at which this XBee device transmits conducted power.
      Returns:
        The output power level of this XBee device.
      Throws:
        `InterfaceNotOpenException` - if this device connection is not open.
        `TimeoutException` - if there is a timeout getting the power level.
        `XBeeException` - if there is any other XBee related exception.
      See Also:
        `setPowerLevel(PowerLevel)`, `PowerLevel`

    - #### getPWMDutyCycle

          public double getPWMDutyCycle(IOLine ioLine)
                                 throws TimeoutException,
                                        XBeeException

      Gets the PWM duty cycle (in %) corresponding to the provided IO line of this XBee device.

      The provided IO line must be:

      - PWM capable (`IOLine.hasPWMCapability()`).
      - Previously configured as PWM Output (use `setIOConfiguration` and `IOMode.PWM`).
      Parameters:
        `ioLine` - The IO line to get its PWM duty cycle.
      Returns:
        The PWM duty cycle value corresponding to the provided IO line (0% - 100%).
      Throws:
        `IllegalArgumentException` - if `ioLine.hasPWMCapability() == false`.
        `InterfaceNotOpenException` - if this device connection is not open.
        `NullPointerException` - if `ioLine == null`.
        `TimeoutException` - if there is a timeout sending the get PWM duty cycle command.
        `XBeeException` - if there is any other XBee related exception.
      See Also:
        `getIOConfiguration(IOLine)`, `setIOConfiguration(IOLine, IOMode)`, `setPWMDutyCycle(IOLine, double)`, `IOLine`, `IOMode.PWM`

    - #### getXBeeProtocol

          public XBeeProtocol getXBeeProtocol()

      Returns the XBee Protocol of this XBee device.

      To refresh this value use the `readDeviceInfo()` method.

      Returns:
        The XBee device protocol.
      See Also:
        `XBeeProtocol`

    - #### isApplyConfigurationChangesEnabled

          public boolean isApplyConfigurationChangesEnabled()

      Returns whether the 'apply configuration changes' option is enabled in this device.

      If this option is enabled, when any parameter of this XBee device is set, it will be also applied.

      If this option is disabled, the method `applyChanges()` must be used in order to apply the changes in all the parameters that were previously set.

      Returns:
        `true` if the option is enabled, `false` otherwise.
      See Also:
        `applyChanges()`, `enableApplyConfigurationChanges(boolean)`

    - #### isRemote

          public abstract boolean isRemote()

      Returns whether this XBee device is a remote device.
      Returns:
        `true` if this XBee device is a remote device, `false` otherwise.

    - #### readDeviceInfo

          public void readDeviceInfo()
                              throws TimeoutException,
                                     XBeeException

      Reads some parameters from this device and obtains its protocol.

      This method refresh the values of:

      - 64-bit address only if it is not initialized.
      - Node Identifier.
      - Hardware version if it is not initialized.
      - Firmware version.
      - XBee device protocol.
      - 16-bit address (not for DigiMesh modules).
      Throws:
        `InterfaceNotOpenException` - if this device connection is not open.
        `TimeoutException` - if there is a timeout reading the parameters.
        `XBeeException` - if there is any other XBee related exception.
      See Also:
        `get16BitAddress()`, `get64BitAddress()`, `getHardwareVersion()`, `getNodeID()`, `getFirmwareVersion()`, `getXBeeProtocol()`, `setNodeID(String)`

    - #### readIOSample

          public IOSample readIOSample()
                                throws TimeoutException,
                                       XBeeException

      Returns an IO sample from this XBee device containing the value of all enabled digital IO and analog input channels.
      Returns:
        An IO sample containing the value of all enabled digital IO and analog input channels.
      Throws:
        `InterfaceNotOpenException` - if this device connection is not open.
        `TimeoutException` - if there is a timeout getting the IO sample.
        `XBeeException` - if there is any other XBee related exception.
      See Also:
        `IOSample`

    - #### reset

          public abstract void reset()
                              throws TimeoutException,
                                     XBeeException

      Performs a software reset on this XBee device and blocks until the process is completed.
      Throws:
        `TimeoutException` - if the configured time expires while waiting for the command reply.
        `XBeeException` - if there is any other XBee related exception.

    - #### setDestinationAddress

          public void setDestinationAddress(XBee64BitAddress xbee64BitAddress)
                                     throws TimeoutException,
                                            XBeeException

      Sets the 64-bit destination extended address of this XBee device.

      `XBee64BitAddress.BROADCAST_ADDRESS` is the broadcast address for the PAN. `XBee64BitAddress.COORDINATOR_ADDRESS` can be used to address the Pan Coordinator.

      Parameters:
        `xbee64BitAddress` - 64-bit destination address to be configured.
      Throws:
        `InterfaceNotOpenException` - if this device connection is not open.
        `NullPointerException` - if `xbee64BitAddress == null`.
        `TimeoutException` - if there is a timeout sending the set destination address command.
        `XBeeException` - if there is any other XBee related exception.
      See Also:
        `getDestinationAddress()`, `XBee64BitAddress`

    - #### setDIOChangeDetection

          public void setDIOChangeDetection(Set<IOLine> lines)
                                     throws TimeoutException,
                                            XBeeException

      Sets the digital IO lines of this XBee device to be monitored and sampled whenever their status changes.

      A `null` set of lines disables this feature.

      If a change is detected on an enabled digital IO pin, a digital IO sample is immediately transmitted to the configured destination address.

      The destination address can be configured using the `setDestinationAddress(XBee64BitAddress)` method and retrieved by `getDestinationAddress()`.

      Parameters:
        `lines` - Set of IO lines to be monitored, `null` to disable this feature.
      Throws:
        `InterfaceNotOpenException` - if this device connection is not open.
        `TimeoutException` - if there is a timeout sending the set DIO change detection command.
        `XBeeException` - if there is any other XBee related exception.
      See Also:
        `getDestinationAddress()`, `getDIOChangeDetection()`, `setDestinationAddress(XBee64BitAddress)`

    - #### setDIOValue

          public void setDIOValue(IOLine ioLine,
                         IOValue ioValue)
                           throws TimeoutException,
                                  XBeeException

      Sets the digital value (high or low) to the provided IO line of this XBee device.
      Parameters:
        `ioLine` - The IO line to set its value.
        `ioValue` - The IOValue to set to the IO line (`HIGH` or `LOW`).
      Throws:
        `InterfaceNotOpenException` - if this device connection is not open.
        `NullPointerException` - if `ioLine == null` or if `ioValue == null`.
        `TimeoutException` - if there is a timeout sending the set DIO command.
        `XBeeException` - if there is any other XBee related exception.
      See Also:
        `getIOConfiguration(IOLine)`, `setIOConfiguration(IOLine, IOMode)`, `IOLine`, `IOValue`, `IOMode.DIGITAL_OUT_HIGH`, `IOMode.DIGITAL_OUT_LOW`

    - #### setIOConfiguration

          public void setIOConfiguration(IOLine ioLine,
                                IOMode ioMode)
                                  throws TimeoutException,
                                         XBeeException

      Sets the configuration of the given IO line of this XBee device.
      Parameters:
        `ioLine` - The IO line to configure.
        `ioMode` - The IO mode to set to the IO line.
      Throws:
        `InterfaceNotOpenException` - if this device connection is not open.
        `NullPointerException` - if `ioLine == null` or if `ioMode == null`.
        `TimeoutException` - if there is a timeout sending the set configuration command.
        `XBeeException` - if there is any other XBee related exception.
      See Also:
        `getIOConfiguration(IOLine)`, `IOLine`, `IOMode`

    - #### setIOSamplingRate

          public void setIOSamplingRate(int rate)
                                 throws TimeoutException,
                                        XBeeException

      Sets the IO sampling rate to enable periodic sampling in this XBee device.

      A sample rate of `0` ms. disables this feature.

      All enabled digital IO and analog inputs will be sampled and transmitted every `rate` milliseconds to the configured destination address.

      The destination address can be configured using the `setDestinationAddress(XBee64BitAddress)` method and retrieved by `getDestinationAddress()`.

      Parameters:
        `rate` - IO sampling rate in milliseconds.
      Throws:
        `IllegalArgumentException` - if `rate < 0` or `rate > 0xFFFF`.
        `InterfaceNotOpenException` - if this device connection is not open.
        `TimeoutException` - if there is a timeout sending the set IO sampling rate command.
        `XBeeException` - if there is any other XBee related exception.
      See Also:
        `getDestinationAddress()`, `setDestinationAddress(XBee64BitAddress)`, `getIOSamplingRate()`

    - #### setNodeID

          public void setNodeID(String nodeID)
                         throws TimeoutException,
                                XBeeException

      Sets the node identifier of this XBee device.
      Parameters:
        `nodeID` - The new node id of the device.
      Throws:
        `IllegalArgumentException` - if `nodeID.length > 20`.
        `InterfaceNotOpenException` - if this device connection is not open.
        `NullPointerException` - if `nodeID == null`.
        `TimeoutException` - if there is a timeout setting the node ID value.
        `XBeeException` - if there is any other XBee related exception.
      See Also:
        `getNodeID()`

    - #### setPANID

          public void setPANID(byte[] panID)
                        throws TimeoutException,
                               XBeeException

      Sets the PAN ID (Personal Area Network Identifier) of this XBee device.

      For modules to communicate they must be configured with the same identifier. Only modules with matching IDs can communicate with each other.This parameter allows multiple networks to co-exist on the same physical channel.

      Parameters:
        `panID` - The new PAN ID of this XBee device.
      Throws:
        `IllegalArgumentException` - if `panID.length == 0` or if `panID.length > 8`.
        `InterfaceNotOpenException` - if this device connection is not open.
        `NullPointerException` - if `panID == null`.
        `TimeoutException` - if there is a timeout setting the PAN ID.
        `XBeeException` - if there is any other XBee related exception.
      See Also:
        `getPANID()`

    - #### setParameter

          public void setParameter(String parameter,
                          byte[] parameterValue)
                            throws TimeoutException,
                                   XBeeException

      Sets the given parameter with the provided value in this XBee device.

      If the 'apply configuration changes' option is enabled in this device, the configured value for the given parameter will be immediately applied, if not the method `applyChanges()` must be invoked to apply it.

      Use:

      - Method `isApplyConfigurationChangesEnabled()` to know if the 'apply configuration changes' option is enabled.
      - Method `enableApplyConfigurationChanges(boolean)` to enable or disable this option.

      To make parameter modifications persist through subsequent resets use the `writeChanges()` method.

      Parameters:
        `parameter` - The name of the parameter to be set.
        `parameterValue` - The value of the parameter to set.
      Throws:
        `IllegalArgumentException` - if `parameter.length() != 2`.
        `NullPointerException` - if `parameter == null` or if `parameterValue == null`.
        `TimeoutException` - if there is a timeout setting the parameter.
        `XBeeException` - if there is any other XBee related exception.
      See Also:
        `applyChanges()`, `enableApplyConfigurationChanges(boolean)`, `executeParameter(String)`, `getParameter(String)`, `isApplyConfigurationChangesEnabled()`, `writeChanges()`

    - #### setPowerLevel

          public void setPowerLevel(PowerLevel powerLevel)
                             throws TimeoutException,
                                    XBeeException

      Sets the output power level at which this XBee device transmits conducted power.
      Parameters:
        `powerLevel` - The new output power level to be set in this XBee device.
      Throws:
        `InterfaceNotOpenException` - if this device connection is not open.
        `NullPointerException` - if `powerLevel == null`.
        `TimeoutException` - if there is a timeout setting the power level.
        `XBeeException` - if there is any other XBee related exception.
      See Also:
        `getPowerLevel()`, `PowerLevel`

    - #### setPWMDutyCycle

          public void setPWMDutyCycle(IOLine ioLine,
                             double dutyCycle)
                               throws TimeoutException,
                                      XBeeException

      Sets the duty cycle (in %) of the provided IO line of this XBee device.

      The provided IO line must be:

      - PWM capable (`IOLine.hasPWMCapability()`).
      - Previously configured as PWM Output (use `setIOConfiguration` and `IOMode.PWM`).
      Parameters:
        `ioLine` - The IO line to set its duty cycle value.
        `dutyCycle` - The duty cycle of the PWM.
      Throws:
        `IllegalArgumentException` - if `ioLine.hasPWMCapability() == false` or if `value < 0` or if `value > 1023`.
        `InterfaceNotOpenException` - if this device connection is not open.
        `NullPointerException` - if `ioLine == null`.
        `TimeoutException` - if there is a timeout sending the set PWM duty cycle command.
        `XBeeException` - if there is any other XBee related exception.
      See Also:
        `getIOConfiguration(IOLine)`, `getIOConfiguration(IOLine)`, `setIOConfiguration(IOLine, IOMode)`, `getPWMDutyCycle(IOLine)`, `IOLine`, `IOMode.PWM`

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Object`

    - #### updateDeviceDataFrom

          public void updateDeviceDataFrom(AbstractXBeeDevice device)

      Updates the current device reference with the data provided for the given device.

      This is only for internal use.

      Parameters:
        `device` - The XBee Device to get the data from.

    - #### writeChanges

          public void writeChanges()
                            throws TimeoutException,
                                   XBeeException

      Writes configurable parameter values to the non-volatile memory of this XBee device so that parameter modifications persist through subsequent resets.

      Parameters values remain in this device's memory until overwritten by subsequent use of this method.

      If changes are made without writing them to non-volatile memory, the module reverts back to previously saved parameters the next time the module is powered-on.

      Writing the parameter modifications does not mean those values are immediately applied, this depends on the status of the 'apply configuration changes' option. Use method `isApplyConfigurationChangesEnabled()` to get its status and `enableApplyConfigurationChanges(boolean)` to enable/disable the option. If it is disable method `applyChanges()` can be used in order to manually apply the changes.

      Throws:
        `InterfaceNotOpenException` - if this device connection is not open.
        `TimeoutException` - if there is a timeout executing the write changes command.
        `XBeeException` - if there is any other XBee related exception.
      See Also:
        `applyChanges()`, `enableApplyConfigurationChanges(boolean)`, `isApplyConfigurationChangesEnabled()`, `setParameter(String, byte[])`

© Copyright 2014–2014 Digi International Inc. All rights reserved.