001/** 002 * Copyright (c) 2014 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 DigiMesh device. 019 * 020 * @see RemoteXBeeDevice 021 * @see RemoteDigiPointDevice 022 * @see RemoteRaw802Device 023 * @see RemoteZigBeeDevice 024 */ 025public class RemoteDigiMeshDevice extends RemoteXBeeDevice { 026 027 /** 028 * Class constructor. Instantiates a new {@code RemoteDigiMeshDevice} object 029 * with the given local {@code DigiMeshDevice} which contains the connection 030 * interface to be used. 031 * 032 * @param localXBeeDevice The local DigiMesh device that will behave as 033 * connection interface to communicate with this 034 * remote DigiMesh device. 035 * @param addr64 The 64-bit address to identify this remote DigiMesh device. 036 * 037 * @throws IllegalArgumentException if {@code localXBeeDevice.isRemote() == true}. 038 * @throws NullPointerException if {@code localXBeeDevice == null} or 039 * if {@code addr64 == null}. 040 * 041 * @see com.digi.xbee.api.models.XBee64BitAddress 042 */ 043 public RemoteDigiMeshDevice(DigiMeshDevice localXBeeDevice, XBee64BitAddress addr64) { 044 super(localXBeeDevice, addr64); 045 } 046 047 /** 048 * Class constructor. Instantiates a new {@code RemoteDigiMeshDevice} object 049 * with the given local {@code XBeeDevice} which contains the connection 050 * interface to be used. 051 * 052 * @param localXBeeDevice The local XBee device that will behave as 053 * connection interface to communicate with this 054 * remote DigiMesh device. 055 * @param addr64 The 64-bit address to identify this remote DigiMesh device. 056 * 057 * @throws IllegalArgumentException if {@code localXBeeDevice.isRemote() == true} or 058 * if {@code localXBeeDevice.getXBeeProtocol() != XBeeProtocol.DIGI_MESH}. 059 * @throws NullPointerException if {@code localXBeeDevice == null} or 060 * if {@code addr64 == null}. 061 * 062 * @see com.digi.xbee.api.models.XBee64BitAddress 063 */ 064 public RemoteDigiMeshDevice(XBeeDevice localXBeeDevice, XBee64BitAddress addr64) { 065 super(localXBeeDevice, addr64); 066 067 // Verify the local device has DigiMesh protocol. 068 if (localXBeeDevice.getXBeeProtocol() != XBeeProtocol.DIGI_MESH) 069 throw new IllegalArgumentException("The protocol of the local XBee device is not " + XBeeProtocol.DIGI_MESH.getDescription() + "."); 070 } 071 072 /** 073 * Class constructor. Instantiates a new {@code RemoteDigiMeshDevice} object 074 * with the given local {@code XBeeDevice} which contains the connection 075 * interface to be used. 076 * 077 * @param localXBeeDevice The local XBee device that will behave as 078 * connection interface to communicate with this 079 * remote DigiMesh device. 080 * @param addr64 The 64-bit address to identify this remote DigiMesh device. 081 * @param id The node identifier of this remote DigiMesh device. It might 082 * be {@code null}. 083 * 084 * @throws IllegalArgumentException if {@code localXBeeDevice.isRemote() == true} or 085 * if {@code localXBeeDevice.getXBeeProtocol() != XBeeProtocol.DIGI_MESH}. 086 * @throws NullPointerException if {@code localXBeeDevice == null} or 087 * if {@code addr64 == null}. 088 * 089 * @see com.digi.xbee.api.models.XBee64BitAddress 090 */ 091 public RemoteDigiMeshDevice(XBeeDevice localXBeeDevice, XBee64BitAddress addr64, String id) { 092 super(localXBeeDevice, addr64, null, id); 093 094 // Verify the local device has DigiMesh protocol. 095 if (localXBeeDevice.getXBeeProtocol() != XBeeProtocol.DIGI_MESH) 096 throw new IllegalArgumentException("The protocol of the local XBee device is not " + XBeeProtocol.DIGI_MESH.getDescription() + "."); 097 } 098 099 /* 100 * (non-Javadoc) 101 * @see com.digi.xbee.api.AbstractXBeeDevice#getXBeeProtocol() 102 */ 103 @Override 104 public XBeeProtocol getXBeeProtocol() { 105 return XBeeProtocol.DIGI_MESH; 106 } 107}