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.models;
013
014/**
015 * Enumerates the different working modes of the XBee device. The operating 
016 * mode establishes the way a user communicates with an XBee device through 
017 * its serial interface.
018 */
019public enum OperatingMode {
020
021        // Enumeration types
022        AT(0, "AT mode"),
023        API(1, "API mode"),
024        API_ESCAPE(2, "API mode with escaped characters"),
025        UNKNOWN(3, "Unknown");
026        
027        // Variables
028        private final int id;
029        
030        private final String name;
031        
032        /**
033         * Class constructor. Instantiates a new {@code OperatingMode} enumeration 
034         * entry with the given parameters.
035         * 
036         * @param id Operating mode ID.
037         * @param name Operating mode name.
038         */
039        private OperatingMode(int id, String name) {
040                this.id = id;
041                this.name = name;
042        }
043        
044        /**
045         * Returns the operating mode ID.
046         * 
047         * @return Operating mode ID.
048         */
049        public int getID() {
050                return id;
051        }
052        
053        /**
054         * Returns the operating mode name.
055         * 
056         * @return Operating mode name.
057         */
058        public String getName() {
059                return name;
060        }
061        
062        /*
063         * (non-Javadoc)
064         * @see java.lang.Enum#toString()
065         */
066        @Override
067        public String toString() {
068                return name;
069        }
070}