libpsynth 0.2.1
/home/raskolnikov/dev/psynth/trunk/src/psynth/net/osc_server_logger.hpp
Go to the documentation of this file.
00001 /***************************************************************************
00002  *                                                                         *
00003  *   PSYCHOSYNTH                                                           *
00004  *   ===========                                                           *
00005  *                                                                         *
00006  *   Copyright (C) 2007 Juan Pedro Bolivar Puente                          *
00007  *                                                                         *
00008  *   This program is free software: you can redistribute it and/or modify  *
00009  *   it under the terms of the GNU General Public License as published by  *
00010  *   the Free Software Foundation, either version 3 of the License, or     *
00011  *   (at your option) any later version.                                   *
00012  *                                                                         *
00013  *   This program is distributed in the hope that it will be useful,       *
00014  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
00015  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
00016  *   GNU General Public License for more details.                          *
00017  *                                                                         *
00018  *   You should have received a copy of the GNU General Public License     *
00019  *   along with this program.  If not, see <http://www.gnu.org/licenses/>. *
00020  *                                                                         *
00021  ***************************************************************************/
00022 
00023 #ifndef PSYNTH_OSCSERVERLOGGER_H
00024 #define PSYNTH_OSCSERVERLOGGER_H
00025 
00026 #include <psynth/net/osc_server.hpp>
00027 
00028 namespace psynth
00029 {
00030 
00031 class osc_server_logger : public osc_server_listener
00032 {
00033 public:
00034     virtual bool handle_server_start_listening (osc_server* server)
00035     {
00036         base::logger::self () ("oscserver", base::log::info, "Server listening.");
00037         return false;
00038     }
00039     
00040     virtual bool handle_server_stop_listening (osc_server* server,
00041                                                osc_server_error err)
00042     {
00043         switch(err) {
00044         case SE_NONE:
00045             base::logger::self () ("oscserver", base::log::info, "Server no longer listening.");
00046             break;
00047             
00048         case SE_PORT_BINDING:
00049             base::logger::self () ("oscserver", base::log::info, "Could not bind port.");
00050             break;
00051 
00052         default:
00053             break;
00054         }
00055 
00056         return false;
00057     }
00058     
00059     virtual bool handle_server_client_connect(osc_server* server, int client_id)
00060     {
00061         base::logger::self () ("oscserver", base::log::info, "Client connected.");
00062         return false;
00063     }
00064     
00065     virtual bool handle_server_client_disconnect(osc_server* server,
00066                                                  int client_id,
00067                                                  osc_server_client_error cause)
00068     {
00069         switch(cause) {
00070         case SCE_NONE:
00071             base::logger::self () ("oscserver", base::log::info, "Client disconnected.");
00072             break;
00073 
00074         case SCE_CLIENT_TIMEOUT:
00075             base::logger::self () ("oscserver", base::log::info, "Client timeout.");
00076             break;
00077             
00078         default:
00079             break;
00080         }
00081         
00082         return false;
00083     }
00084 };
00085 
00086 } /* namespace psynth */
00087 
00088 #endif /* PSYNTH_OSCSERVERLOGGER_H */