From 099291cc4cc648c1938a7245d9abccbc6738a46d Mon Sep 17 00:00:00 2001 From: deva Date: Tue, 3 May 2005 17:13:25 +0000 Subject: Fixed some missong Info object references. --- src/dv1394.cc | 6 ++++++ src/dv1394.h | 6 ++++++ src/info_gui.cc | 4 ++++ src/info_gui.h | 5 ++++- src/miav.cc | 6 +++++- src/socket.cc | 17 +++++++++++------ src/socket.h | 7 +++++-- 7 files changed, 41 insertions(+), 10 deletions(-) diff --git a/src/dv1394.cc b/src/dv1394.cc index d6d86cb..ed7b038 100644 --- a/src/dv1394.cc +++ b/src/dv1394.cc @@ -31,6 +31,9 @@ /* * $Log$ + * Revision 1.8 2005/05/03 17:13:25 deva + * Fixed some missong Info object references. + * * Revision 1.7 2005/05/03 08:31:59 deva * Removed the error object, and replaced it with a more generic info object. * @@ -41,6 +44,8 @@ #include #include "dv1394.h" +#ifdef USE_GUI + #include "dv.h" @@ -177,3 +182,4 @@ unsigned char *dv1394::readFrame() return ptr; } +#endif/*USE_GUI*/ diff --git a/src/dv1394.h b/src/dv1394.h index 7c24699..2131dc9 100644 --- a/src/dv1394.h +++ b/src/dv1394.h @@ -31,6 +31,9 @@ /* * $Log$ + * Revision 1.5 2005/05/03 17:13:25 deva + * Fixed some missong Info object references. + * * Revision 1.4 2005/05/03 08:31:59 deva * Removed the error object, and replaced it with a more generic info object. * @@ -42,6 +45,8 @@ #ifndef __MIAV_DV1394_H__ #define __MIAV_DV1394_H__ +#ifdef USE_GUI + #include #include "info.h" @@ -59,3 +64,4 @@ private: }; #endif/*__MIAV_DV1394_H__*/ +#endif/*USE_GUI*/ diff --git a/src/info_gui.cc b/src/info_gui.cc index 376a19f..4536ed3 100644 --- a/src/info_gui.cc +++ b/src/info_gui.cc @@ -34,6 +34,8 @@ */ #include +#ifdef USE_GUI + #include "info_gui.h" #include @@ -129,3 +131,5 @@ void InfoGui::info(char *fmt, ...) // End of safezone pthread_mutex_unlock(&mutex); } + +#endif/*USE_GUI*/ diff --git a/src/info_gui.h b/src/info_gui.h index 269f827..6a5c97b 100644 --- a/src/info_gui.h +++ b/src/info_gui.h @@ -37,11 +37,12 @@ #ifndef __MIAV_INFO_GUI_H__ #define __MIAV_INFO_GUI_H__ +#ifdef USE_GUI + #define TXT_ERROR_TITLE "Der er opstået en fejl!" #define TXT_WARNING_TITLE "Advarsel" #define TXT_INFO_TITLE "Information" - #include "info.h" #include @@ -66,3 +67,5 @@ private: }; #endif/*__MIAV_INFO_GUI_H__*/ + +#endif/*USE_GUI*/ diff --git a/src/miav.cc b/src/miav.cc index 1518795..ba30a17 100644 --- a/src/miav.cc +++ b/src/miav.cc @@ -31,6 +31,9 @@ /* * $Log$ + * Revision 1.9 2005/05/03 17:13:25 deva + * Fixed some missong Info object references. + * * Revision 1.8 2005/05/03 09:22:12 deva * Implemented the gui part of the info object. * @@ -93,6 +96,7 @@ int grab(int argc, char *argv[]) { * This function starts the MIaV server. */ int server(int argc, char *argv[]) { + InfoConsole info; int port = config->readInt("server_port"); pid_t childpid; // variable to store the child's pid @@ -100,7 +104,7 @@ int server(int argc, char *argv[]) { // (ellers kommer der kernel-brok) printf("Listening on port %d\n", port); - Socket *socket = new Socket(port); + Socket *socket = new Socket(port, &info); while(1) { Socket *csocket = new Socket(socket->slisten()); diff --git a/src/socket.cc b/src/socket.cc index 4b282b4..c01e31d 100644 --- a/src/socket.cc +++ b/src/socket.cc @@ -31,6 +31,9 @@ /* * $Log$ + * Revision 1.5 2005/05/03 17:13:25 deva + * Fixed some missong Info object references. + * * Revision 1.4 2005/05/03 08:31:59 deva * Removed the error object, and replaced it with a more generic info object. * @@ -42,6 +45,8 @@ #include "socket.h" +#include + Socket::Socket(Info *ginfo) { info = ginfo; @@ -83,10 +88,10 @@ Socket::~Socket() Socket Socket::slisten() { - Socket s = Socket(); + Socket s = Socket(info); if(err) { - info->error("Socket: No socket present!"); + //info->error("Socket: No socket present!"); return s; } if(!connected) { @@ -94,7 +99,7 @@ Socket Socket::slisten() err = bind(ssocket, (struct sockaddr*)&socketaddr, sizeof(socketaddr)); if (err) { - info->error("Socket: bind() failed!"); + info->error("Socket: bind() failed! %s", strerror(errno)); return s; } @@ -102,7 +107,7 @@ Socket Socket::slisten() // requests (max 5 in queue) err = listen(ssocket, 5); if(err) { - info->error("Socket: listen() failed!"); + info->error("Socket: listen() failed! %s", strerror(errno)); return s; } } @@ -116,7 +121,7 @@ Socket Socket::slisten() if (s.ssocket < 0) { err = 1; - info->error("Socket: accept() failed!"); + info->error("Socket: accept() failed! %s", strerror(errno)); return s; } @@ -139,7 +144,7 @@ int Socket::sconnect(char *ip) err = connect(ssocket, (struct sockaddr*)&socketaddr, sizeof(socketaddr)); if (err) { - info->error("Socket: connect() failed!"); + info->error("Socket: connect() failed! %s", strerror(errno)); return err; } // fprintf(stderr, "Socket connected\n"); diff --git a/src/socket.h b/src/socket.h index d81aea2..3f95e69 100644 --- a/src/socket.h +++ b/src/socket.h @@ -31,6 +31,9 @@ /* * $Log$ + * Revision 1.5 2005/05/03 17:13:25 deva + * Fixed some missong Info object references. + * * Revision 1.4 2005/05/03 08:31:59 deva * Removed the error object, and replaced it with a more generic info object. * @@ -56,8 +59,8 @@ class Socket { public: - Socket(Info *ginfo = NULL); - Socket(u_short port, Info *ginfo = NULL); + Socket(Info *ginfo); + Socket(u_short port, Info *ginfo); ~Socket(); Socket slisten(); int sconnect(char *ip); -- cgit v1.2.3