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.exceptions; 013 014import com.digi.xbee.api.models.OperatingMode; 015 016/** 017 * This exception will be thrown when performing any action with the XBee 018 * device and its operating mode is different than {@link OperatingMode#API} 019 * and {@link OperatingMode#API_ESCAPE}. 020 * 021 * @see XBeeDeviceException 022 * @see com.digi.xbee.api.models.OperatingMode 023 */ 024public class InvalidOperatingModeException extends XBeeDeviceException { 025 026 // Constants 027 private static final long serialVersionUID = 1L; 028 private static final String DEFAULT_MESSAGE = "The operating mode of the XBee device is not supported by the library."; 029 030 /** 031 * Creates an {@code InvalidOperatingModeException} with 032 * {@value #DEFAULT_MESSAGE} as its error detail message. 033 */ 034 public InvalidOperatingModeException() { 035 super(DEFAULT_MESSAGE); 036 } 037 038 /** 039 * Creates an {@code InvalidOperatingModeException} with the specified 040 * operating mode. 041 * 042 * @param mode The unsupported operating mode. 043 * 044 * @see com.digi.xbee.api.models.OperatingMode 045 */ 046 public InvalidOperatingModeException(OperatingMode mode) { 047 super("Unsupported operating mode: " + mode); 048 } 049 050 /** 051 * Creates an {@code InvalidOperatingModeException} with the specified 052 * message. 053 * 054 * @param message The associated message. 055 */ 056 public InvalidOperatingModeException(String message) { 057 super(message); 058 } 059 060 /** 061 * Creates an {@code InvalidOperatingModeException} with the specified 062 * message and cause. 063 * 064 * @param message The associated message. 065 * @param cause The cause of this exception. 066 * 067 * @see Throwable 068 */ 069 public InvalidOperatingModeException(String message, Throwable cause) { 070 super(message, cause); 071 } 072}