Diffstat (limited to 'noncore/apps/opie-console/test/senderui.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/apps/opie-console/test/senderui.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/noncore/apps/opie-console/test/senderui.cpp b/noncore/apps/opie-console/test/senderui.cpp index 8bc1676..2ce3f6d 100644 --- a/noncore/apps/opie-console/test/senderui.cpp +++ b/noncore/apps/opie-console/test/senderui.cpp | |||
@@ -1,68 +1,75 @@ | |||
1 | #include <stdlib.h> | 1 | #include <stdlib.h> |
2 | #include <stdio.h> | 2 | #include <stdio.h> |
3 | #include <fcntl.h> | 3 | #include <fcntl.h> |
4 | #include <sys/termios.h> | 4 | #include <sys/termios.h> |
5 | 5 | ||
6 | #include <qmultilineedit.h> | 6 | #include <qmultilineedit.h> |
7 | #include <qsocketnotifier.h> | 7 | #include <qsocketnotifier.h> |
8 | 8 | ||
9 | #include "../profile.h" | 9 | #include "../profile.h" |
10 | #include "../io_serial.h" | 10 | #include "../io_serial.h" |
11 | #include "../filetransfer.h" | 11 | #include "../filetransfer.h" |
12 | #include "../filereceive.h" | ||
12 | 13 | ||
13 | #include <opie/oprocess.h> | 14 | #include <opie/oprocess.h> |
14 | 15 | ||
15 | #include "senderui.h" | 16 | #include "senderui.h" |
16 | 17 | ||
17 | SenderUI::SenderUI() | 18 | SenderUI::SenderUI() |
18 | : Sender() { | 19 | : Sender() { |
19 | 20 | ||
20 | /* we do that manually */ | 21 | /* we do that manually */ |
21 | Profile prof; | 22 | Profile prof; |
22 | QString str = "/dev/ttyS0"; | 23 | QString str = "/dev/ttyS0"; |
23 | prof.writeEntry("Device",str ); | 24 | prof.writeEntry("Device",str ); |
24 | prof.writeEntry("Baud", 115200 ); | 25 | prof.writeEntry("Baud", 115200 ); |
25 | 26 | ||
26 | qWarning("prof " + prof.readEntry("Device") + " " + str); | 27 | qWarning("prof " + prof.readEntry("Device") + " " + str); |
27 | ser = new IOSerial(prof); | 28 | ser = new IOSerial(prof); |
28 | connect(ser, SIGNAL(received(const QByteArray& ) ), | 29 | connect(ser, SIGNAL(received(const QByteArray& ) ), |
29 | this, SLOT(got(const QByteArray&) ) ); | 30 | this, SLOT(got(const QByteArray&) ) ); |
30 | 31 | ||
31 | if ( ser->open() ) | 32 | if ( ser->open() ) |
32 | qWarning("opened!!!"); | 33 | qWarning("opened!!!"); |
33 | else | 34 | else |
34 | qWarning("could not open"); | 35 | qWarning("could not open"); |
35 | 36 | ||
36 | 37 | ||
37 | } | 38 | } |
38 | SenderUI::~SenderUI() { | 39 | SenderUI::~SenderUI() { |
39 | 40 | ||
40 | } | 41 | } |
41 | void SenderUI::slotSendFile() { | 42 | void SenderUI::slotSendFile() { |
42 | 43 | ||
43 | sz = new FileTransfer(FileTransfer::SY, ser); | 44 | sz = new FileTransfer(FileTransfer::SY, ser); |
44 | sz->sendFile("/home/ich/bootopie-v06-13.jffs2"); | 45 | sz->sendFile("/home/ich/bootopie-v06-13.jffs2"); |
45 | 46 | ||
46 | connect (sz, SIGNAL(sent()), | 47 | connect (sz, SIGNAL(sent()), |
47 | this, SLOT(fileTransComplete())); | 48 | this, SLOT(fileTransComplete())); |
48 | } | 49 | } |
49 | 50 | ||
50 | void SenderUI::slotSend() { | 51 | void SenderUI::slotSend() { |
51 | QCString str = MultiLineEdit1->text().utf8(); | 52 | QCString str = MultiLineEdit1->text().utf8(); |
52 | qWarning("sending: %s", str.data() ); | 53 | qWarning("sending: %s", str.data() ); |
53 | ser->send( str ); | 54 | ser->send( str ); |
54 | } | 55 | } |
55 | void SenderUI::got(const QByteArray& ar) { | 56 | void SenderUI::got(const QByteArray& ar) { |
56 | for ( uint i = 0; i < ar.count(); i++ ) { | 57 | for ( uint i = 0; i < ar.count(); i++ ) { |
57 | printf("%c", ar[i] ); | 58 | printf("%c", ar[i] ); |
58 | } | 59 | } |
59 | //printf("\n"); | 60 | //printf("\n"); |
60 | } | 61 | } |
61 | 62 | ||
62 | void SenderUI::fileTransComplete() { | 63 | void SenderUI::fileTransComplete() { |
63 | 64 | ||
64 | qWarning("file transfer complete"); | 65 | qWarning("file transfer complete"); |
65 | } | 66 | } |
66 | void SenderUI::send() { | 67 | void SenderUI::send() { |
67 | 68 | ||
68 | } | 69 | } |
70 | void SenderUI::slotRev(){ | ||
71 | qWarning("Going to receive!"); | ||
72 | FileReceive *rev = new FileReceive( FileReceive::SZ, ser ); | ||
73 | rev->receive(); | ||
74 | |||
75 | } \ No newline at end of file | ||