/* * This file is part of the Remote Sensor Actuator Interface (ReSAI). * * Copyright(c) Andreas Kipp, Frederic Siepmann * http://opensource.cit-ec.de/projects/resai * * This file may be licensed under the terms of of the * GNU Lesser General Public License Version 3 (the ``LGPL''), * or (at your option) any later version. * * Software distributed under the License is distributed * on an ``AS IS'' basis, WITHOUT WARRANTY OF ANY KIND, either * express or implied. See the LGPL for the specific language * governing rights and limitations. * * You should have received a copy of the LGPL along with this * program. If not, go to http://www.gnu.org/licenses/lgpl.html * or write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * * The development of this software was supported by the * Excellence Cluster EXC 277 Cognitive Interaction Technology. * The Excellence Cluster EXC 277 is a grant of the Deutsche * Forschungsgemeinschaft (DFG) in the context of the German * Excellence Initiative. * */ /** * Interface for Communicator to define communication elements. * * @author akipp */ package de.unibi.airobots.resaidroid.communication; import java.util.HashMap; public interface CommunicatorInterface { /** * Function to check if a connection is established. * @return true if connected */ public abstract boolean isConnected(); /** * Function to check if the user is logged in. * @return true if logged in */ public abstract boolean isAuthenticated(); /** * Login to communication server with given username and password. * @param _user name to login with * @param _pass password to login with */ public abstract void login(String _user, String _pass); /** * Execute connect to the communication server with given properties. * @param _server server ip * @param _port port for communication */ public abstract void connect(String _server, int _port); /** * Disconnect from communication server. */ public abstract void disconnect(); /** * Forward a message with properties to a given recipient. * @param recipient recipient of the data * @param properties data to be send */ public abstract void sendMessage(String recipient, HashMap properties); /** * Forward a message with properties to a given recipient with a * body text added to the message. * @param recipient recipient of the data * @param properties data to be send * @param body body to be added to message */ public abstract void sendMessage(String recipient, HashMap properties, String body); /** * Forward an error object to a given recipient. * @param recipient recipient to send to * @param e error object to send */ public abstract void sendError(String recipient, Exception e); }