author | paule <paule> | 2007-01-28 04:04:14 (UTC) |
---|---|---|
committer | paule <paule> | 2007-01-28 04:04:14 (UTC) |
commit | ec2309cb69365847762db542c41951629cd06cbe (patch) (unidiff) | |
tree | 2f0101c1f0d6268207dbd15eb21f40c812a4fff5 /noncore/tools/remote/remote.cpp | |
parent | 3cd37427b5c5f26f62cff583fbde914467ddafe3 (diff) | |
download | opie-ec2309cb69365847762db542c41951629cd06cbe.zip opie-ec2309cb69365847762db542c41951629cd06cbe.tar.gz opie-ec2309cb69365847762db542c41951629cd06cbe.tar.bz2 |
Refactored out all communication with LIRC into new LircHandler class
Diffstat (limited to 'noncore/tools/remote/remote.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/tools/remote/remote.cpp | 61 |
1 files changed, 8 insertions, 53 deletions
diff --git a/noncore/tools/remote/remote.cpp b/noncore/tools/remote/remote.cpp index 35d06bc..67fc57d 100644 --- a/noncore/tools/remote/remote.cpp +++ b/noncore/tools/remote/remote.cpp | |||
@@ -34,72 +34,27 @@ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |||
34 | #include <sys/un.h> | 34 | #include <sys/un.h> |
35 | #include <unistd.h> | 35 | #include <unistd.h> |
36 | #include <stdio.h> | 36 | #include <stdio.h> |
37 | #include <signal.h> | 37 | #include <signal.h> |
38 | 38 | ||
39 | 39 | ||
40 | /*void reconnect(int &fd) | ||
41 | { | ||
42 | //struct sockaddr_un addr; | ||
43 | |||
44 | addr.sun_family=AF_UNIX; | ||
45 | strcpy(addr.sun_path,"/dev/lircd"); | ||
46 | fd = socket(AF_UNIX, SOCK_STREAM, 0); | ||
47 | |||
48 | if(connect(fd,(struct sockaddr *) &addr, sizeof(addr) ) == -1) | ||
49 | { | ||
50 | QMessageBox *mb = new QMessageBox("error", | ||
51 | "couldnt connect to socket", | ||
52 | QMessageBox::NoIcon, | ||
53 | QMessageBox::Ok, | ||
54 | QMessageBox::NoButton, | ||
55 | QMessageBox::NoButton); | ||
56 | mb->exec(); | ||
57 | } | ||
58 | } | ||
59 | */ | ||
60 | |||
61 | int main( int argc, char **argv ) | 40 | int main( int argc, char **argv ) |
62 | { | 41 | { |
63 | QPEApplication a( argc, argv ); | 42 | QPEApplication a( argc, argv ); |
64 | MainView w; | 43 | MainView w; |
44 | a.setMainWidget( &w ); | ||
45 | QPEApplication::showWidget( &w ); | ||
65 | 46 | ||
66 | int fd; | 47 | LircHandler lh; |
67 | //struct sockaddr_un addr; | 48 | if(!lh.isLircdRunning()) { |
68 | //char read_buffer[BUFFERSIZE+1]; | 49 | QMessageBox mb("Error!", |
69 | //char write_buffer[] = "LIST\n"; | 50 | "Lircd is not running", |
70 | |||
71 | //addr.sun_family=AF_UNIX; | ||
72 | //strcpy(addr.sun_path,"/dev/lircd"); | ||
73 | //fd = socket(AF_UNIX, SOCK_STREAM, 0); | ||
74 | |||
75 | //printf("fd1: %d\n", fd); | ||
76 | /* | ||
77 | if(connect(fd,(struct sockaddr *) &addr, sizeof(addr) ) == -1) | ||
78 | { | ||
79 | QMessageBox *mb = new QMessageBox("error", | ||
80 | "couldnt connect to socket", | ||
81 | QMessageBox::NoIcon, | 51 | QMessageBox::NoIcon, |
82 | QMessageBox::Ok, | 52 | QMessageBox::Ok, |
83 | QMessageBox::NoButton, | 53 | QMessageBox::NoButton, |
84 | QMessageBox::NoButton); | 54 | QMessageBox::NoButton); |
85 | mb->exec(); | 55 | mb.exec(); |
86 | } | ||
87 | */ | ||
88 | |||
89 | //printf("%d\n", write(fd, write_buffer, sizeof(write_buffer) ) ); | ||
90 | |||
91 | //printf("%d\n", read(fd, read_buffer, BUFFERSIZE ) ); | ||
92 | 56 | ||
93 | //QMessageBox *mbtest = new QMessageBox("lirc test", | 57 | } |
94 | // *new QString((const char *) read_buffer), | ||
95 | // QMessageBox::NoIcon, | ||
96 | // QMessageBox::Ok, | ||
97 | // QMessageBox::NoButton, | ||
98 | // QMessageBox::NoButton); | ||
99 | //mbtest->exec(); | ||
100 | 58 | ||
101 | a.setMainWidget( &w ); | ||
102 | w.setIRSocket(fd); | ||
103 | QPEApplication::showWidget( &w ); | ||
104 | return a.exec(); | 59 | return a.exec(); |
105 | } | 60 | } |