/**
         * Discovers and reports all remote XBee devices that match the supplied
         * identifiers.
         *
         * <p>This method blocks until the configured timeout in the device (NT)
         * expires.</p>
         *
         * @param ids List which contains the identifiers of the devices to be
         *            discovered.
         *
         * @return A list of the discovered remote XBee devices with the given
         *         identifiers.
         *
         * @throws InterfaceNotOpenException if the device is not open.
         * @throws XBeeException if there is an error discovering the devices.
         *
         * @see #discoverDevice(String)
         */
        public List <RemoteXBeeDevice> discoverDevices(IList <string> ids)      /*throws XBeeException */
        {
            // Check if the connection is open.
            if (!xbeeDevice.IsOpen)
            {
                throw new InterfaceNotOpenException();
            }

            logger.DebugFormat("{0}ND for all {1} devices.", xbeeDevice.ToString(), ids.ToString());

            running     = true;
            discovering = true;

            performNodeDiscovery(null, null);

            List <RemoteXBeeDevice> foundDevices = new List <RemoteXBeeDevice>(0);

            if (deviceList == null)
            {
                return(foundDevices);
            }

            XBeeNetwork network = xbeeDevice.GetNetwork();

            foreach (RemoteXBeeDevice d in deviceList)
            {
                string nID = d.NodeID;
                if (nID == null)
                {
                    continue;
                }
                foreach (string id in ids)
                {
                    if (nID.Equals(id))
                    {
                        RemoteXBeeDevice rDevice = network.addRemoteDevice(d);
                        if (rDevice != null && !foundDevices.Contains(rDevice))
                        {
                            foundDevices.Add(rDevice);
                        }
                    }
                }
            }

            return(foundDevices);
        }
        /**
         * Returns the network associated with this XBee device.
         *
         * @return The XBee network of the device.
         *
         * @throws InterfaceNotOpenException if this device connection is not open.
         *
         * @see XBeeNetwork
         */
        public virtual XBeeNetwork GetNetwork()
        {
            if (!IsOpen)
                throw new InterfaceNotOpenException();

            if (network == null)
                network = new XBeeNetwork(this);
            return network;
        }