Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

remote.cpp

Go to the documentation of this file.
00001 /*
00002 Opie-Remote.  emulates remote controlls on an iPaq (and maybe a Zaurus) in Opie.
00003 Copyright (C) 2002 Thomas Stephens
00004  
00005 This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public
00006 License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later
00007 version.
00008  
00009 This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the
00010 implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
00011 Public License for more details.
00012  
00013 You should have received a copy of the GNU General Public License along with this program; if not, write to the Free
00014 Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
00015 */
00016 
00017 #include "mainview.h"
00018 
00019 /* OPIE */
00020 #include <qpe/qpeapplication.h>
00021 #include <qpe/config.h>
00022 
00023 /* QT */
00024 #include <qpushbutton.h>
00025 #include <qtabwidget.h>
00026 #include <qlayout.h>
00027 #include <qmessagebox.h>
00028 #include <qpaintdevice.h>
00029 #include <qobject.h>
00030 
00031 /* STD */
00032 #include <sys/socket.h>
00033 #include <sys/types.h>
00034 #include <sys/un.h>
00035 #include <unistd.h>
00036 #include <stdio.h>
00037 #include <signal.h>
00038 
00039 
00040 /*void reconnect(int &fd)
00041 {
00042 //      struct sockaddr_un addr;
00043  
00044         addr.sun_family=AF_UNIX;
00045         strcpy(addr.sun_path,"/dev/lircd");
00046         fd = socket(AF_UNIX, SOCK_STREAM, 0);
00047  
00048         if(connect(fd,(struct sockaddr *) &addr, sizeof(addr) ) == -1)
00049         {
00050                 QMessageBox *mb = new QMessageBox("error",
00051                                                                                         "couldnt connect to socket",
00052                                                                                         QMessageBox::NoIcon,
00053                                                                                         QMessageBox::Ok,
00054                                                                                         QMessageBox::NoButton,
00055                                                                                         QMessageBox::NoButton);
00056                 mb->exec();
00057         }
00058 }
00059 */
00060 
00061 int main( int argc, char **argv )
00062 {
00063     QPEApplication a( argc, argv );
00064     MainView w;
00065 
00066     int fd;
00067     //  struct sockaddr_un addr;
00068     //  char read_buffer[BUFFERSIZE+1];
00069     //  char write_buffer[] = "LIST\n";
00070 
00071     //  addr.sun_family=AF_UNIX;
00072     //  strcpy(addr.sun_path,"/dev/lircd");
00073     //  fd = socket(AF_UNIX, SOCK_STREAM, 0);
00074 
00075     //  printf("fd1: %d\n", fd);
00076     /*
00077         if(connect(fd,(struct sockaddr *) &addr, sizeof(addr) ) == -1)
00078         {
00079                 QMessageBox *mb = new QMessageBox("error",
00080                                                                                         "couldnt connect to socket",
00081                                                                                         QMessageBox::NoIcon,
00082                                                                                         QMessageBox::Ok,
00083                                                                                         QMessageBox::NoButton,
00084                                                                                         QMessageBox::NoButton);
00085                 mb->exec();
00086         }
00087     */
00088 
00089     //  printf("%d\n", write(fd, write_buffer, sizeof(write_buffer) ) );
00090 
00091     //  printf("%d\n", read(fd, read_buffer, BUFFERSIZE ) );
00092 
00093     //  QMessageBox *mbtest = new QMessageBox("lirc test",
00094     //                                                                                  *new QString((const char *) read_buffer),
00095     //                                                                                  QMessageBox::NoIcon,
00096     //                                                                                  QMessageBox::Ok,
00097     //                                                                                  QMessageBox::NoButton,
00098     //                                                                                  QMessageBox::NoButton);
00099     //  mbtest->exec();
00100 
00101     a.setMainWidget( &w );
00102     w.setIRSocket(fd);
00103     QPEApplication::showWidget( &w );
00104     return a.exec();
00105 }

Generated on Sat Nov 5 16:18:03 2005 for OPIE by  doxygen 1.4.2