|
libpsynth 0.2.1
|
00001 00011 /* 00012 * Copyright (C) 2007, 2010 Juan Pedro Bolivar Puente 00013 * 00014 * This file is part of Psychosynth. 00015 * 00016 * Psychosynth is free software: you can redistribute it and/or modify 00017 * it under the terms of the GNU General Public License as published by 00018 * the Free Software Foundation, either version 3 of the License, or 00019 * (at your option) any later version. 00020 * 00021 * Psychosynth is distributed in the hope that it will be useful, 00022 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00023 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00024 * GNU General Public License for more details. 00025 * 00026 * You should have received a copy of the GNU General Public License 00027 * along with this program. If not, see <http://www.gnu.org/licenses/>. 00028 * 00029 */ 00030 00031 #ifndef PSYNTH_OSCCLIENTLOGGER_H 00032 #define PSYNTH_OSCCLIENTLOGGER_H 00033 00034 #include <psynth/base/logger.hpp> 00035 #include <psynth/net/osc_client.hpp> 00036 00037 namespace psynth 00038 { 00039 00040 class osc_client_logger : public osc_client_listener 00041 { 00042 public: 00043 virtual bool handle_client_connect (osc_client* client) { 00044 base::logger::self () ("oscclient", 00045 base::log::info, "Connecting..."); 00046 return false; 00047 } 00048 00049 virtual bool handle_client_disconnect(osc_client* client, osc_client_error err) { 00050 switch(err) { 00051 case CE_NONE: 00052 base::logger::self () ("oscclient", base::log::info, "Disconnected."); 00053 break; 00054 00055 case CE_PORT_BINDING: 00056 base::logger::self () ("oscclient", base::log::error, "Could not bind port."); 00057 break; 00058 00059 case CE_SERVER_DROP: 00060 base::logger::self () ("oscclient", base::log::error, "Connection dropped by server."); 00061 break; 00062 00063 case CE_SERVER_TIMEOUT: 00064 base::logger::self () ("oscclient", base::log::error, "Connection timeout"); 00065 break; 00066 00067 default: 00068 break; 00069 } 00070 return false; 00071 } 00072 00073 virtual bool handle_client_accept (osc_client* client) { 00074 base::logger::self () ("oscclient", base::log::info, "Accepted."); 00075 return false; 00076 } 00077 }; 00078 00079 } /* namespace psynth */ 00080 00081 #endif /* PSYNTH_OSCCLIENTLOGGER_H */
1.7.4