001/**
002 * Copyright (c) 2014-2015 Digi International Inc.,
003 * All rights not expressly granted are reserved.
004 *
005 * This Source Code Form is subject to the terms of the Mozilla Public
006 * License, v. 2.0. If a copy of the MPL was not distributed with this file,
007 * You can obtain one at http://mozilla.org/MPL/2.0/.
008 *
009 * Digi International Inc. 11001 Bren Road East, Minnetonka, MN 55343
010 * =======================================================================
011 */
012package com.digi.xbee.api;
013
014import com.digi.xbee.api.models.XBee64BitAddress;
015import com.digi.xbee.api.models.XBeeProtocol;
016
017/**
018 * This class represents a remote DigiPoint device.
019 * 
020 * @see RemoteXBeeDevice
021 * @see RemoteDigiMeshDevice
022 * @see RemoteRaw802Device
023 * @see RemoteZigBeeDevice
024 */
025public class RemoteDigiPointDevice extends RemoteXBeeDevice {
026
027        /**
028         * Class constructor. Instantiates a new {@code RemoteDigiPointDevice} object 
029         * with the given local {@code DigiPointDevice} which contains the connection 
030         * interface to be used.
031         * 
032         * @param localXBeeDevice The local point-to-multipoint device that will behave as 
033         *                        connection interface to communicate with this 
034         *                        remote point-to-multipoint device.
035         * @param addr64 The 64-bit address to identify this remote point-to-multipoint 
036         *               device.
037         * 
038         * @throws IllegalArgumentException if {@code localXBeeDevice.isRemote() == true}.
039         * @throws NullPointerException if {@code localXBeeDevice == null} or
040         *                              if {@code addr64 == null}.
041         * 
042         * @see com.digi.xbee.api.models.XBee64BitAddress
043         */
044        public RemoteDigiPointDevice(DigiPointDevice localXBeeDevice, XBee64BitAddress addr64) {
045                super(localXBeeDevice, addr64);
046        }
047        
048        /**
049         * Class constructor. Instantiates a new {@code RemoteDigiPointDevice} object 
050         * with the given local {@code XBeeDevice} which contains the connection 
051         * interface to be used.
052         * 
053         * @param localXBeeDevice The local XBee device that will behave as 
054         *                        connection interface to communicate with this 
055         *                        remote point-to-multipoint device.
056         * @param addr64 The 64-bit address to identify this remote point-to-multipoint 
057         *               device.
058         * 
059         * @throws IllegalArgumentException if {@code localXBeeDevice.isRemote() == true} or 
060         *                                  if {@code localXBeeDevice.getXBeeProtocol() != XBeeProtocol.DIGI_POINT}.
061         * @throws NullPointerException if {@code localXBeeDevice == null} or
062         *                              if {@code addr64 == null}.
063         * 
064         * @see com.digi.xbee.api.models.XBee64BitAddress
065         */
066        public RemoteDigiPointDevice(XBeeDevice localXBeeDevice, XBee64BitAddress addr64) {
067                super(localXBeeDevice, addr64);
068                
069                // Verify the local device has point-to-multipoint protocol.
070                if (localXBeeDevice.getXBeeProtocol() != XBeeProtocol.DIGI_POINT)
071                        throw new IllegalArgumentException("The protocol of the local XBee device is not " + XBeeProtocol.DIGI_POINT.getDescription() + ".");
072        }
073        
074        /**
075         * Class constructor. Instantiates a new {@code RemoteDigiPointDevice} object 
076         * with the given local {@code XBeeDevice} which contains the connection 
077         * interface to be used.
078         * 
079         * @param localXBeeDevice The local XBee device that will behave as 
080         *                        connection interface to communicate with this 
081         *                        remote point-to-multipoint device.
082         * @param addr64 The 64-bit address to identify this remote point-to-multipoint 
083         *               device.
084         * @param id The node identifier of this remote point-to-multipoint device. 
085         *           It might be {@code null}.
086         * 
087         * @throws IllegalArgumentException if {@code localXBeeDevice.isRemote() == true} or 
088         *                                  if {@code localXBeeDevice.getXBeeProtocol() != XBeeProtocol.DIGI_POINT}.
089         * @throws NullPointerException if {@code localXBeeDevice == null} or
090         *                              if {@code addr64 == null}.
091         * 
092         * @see com.digi.xbee.api.models.XBee64BitAddress
093         */
094        public RemoteDigiPointDevice(XBeeDevice localXBeeDevice, XBee64BitAddress addr64, String id) {
095                super(localXBeeDevice, addr64, null, id);
096                
097                // Verify the local device has point-to-multipoint protocol.
098                if (localXBeeDevice.getXBeeProtocol() != XBeeProtocol.DIGI_POINT)
099                        throw new IllegalArgumentException("The protocol of the local XBee device is not " + XBeeProtocol.DIGI_POINT.getDescription() + ".");
100        }
101        
102        /*
103         * (non-Javadoc)
104         * @see com.digi.xbee.api.AbstractXBeeDevice#getXBeeProtocol()
105         */
106        @Override
107        public XBeeProtocol getXBeeProtocol() {
108                return XBeeProtocol.DIGI_POINT;
109        }
110}