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 | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/noncore/apps/opie-console/test/senderui.cpp b/noncore/apps/opie-console/test/senderui.cpp index fc93c04..24d3eb2 100644 --- a/noncore/apps/opie-console/test/senderui.cpp +++ b/noncore/apps/opie-console/test/senderui.cpp | |||
@@ -1,47 +1,62 @@ | |||
1 | #include <stdlib.h> | 1 | #include <stdlib.h> |
2 | #include <stdio.h> | 2 | #include <stdio.h> |
3 | 3 | ||
4 | #include <qmultilineedit.h> | 4 | #include <qmultilineedit.h> |
5 | 5 | ||
6 | #include "../profile.h" | 6 | #include "../profile.h" |
7 | #include "../io_serial.h" | 7 | #include "../io_serial.h" |
8 | #include "../sz_transfer.h" | ||
8 | 9 | ||
9 | 10 | ||
10 | #include "senderui.h" | 11 | #include "senderui.h" |
11 | 12 | ||
12 | SenderUI::SenderUI() | 13 | SenderUI::SenderUI() |
13 | : Sender() { | 14 | : Sender() { |
14 | 15 | ||
15 | /* we do that manually */ | 16 | /* we do that manually */ |
16 | Profile prof; | 17 | Profile prof; |
17 | QString str = "/dev/ttyS0"; | 18 | QString str = "/dev/ttyS1"; |
18 | prof.writeEntry("Device",str ); | 19 | prof.writeEntry("Device",str ); |
19 | prof.writeEntry("Baud", 115200 ); | 20 | prof.writeEntry("Baud", 115200 ); |
20 | 21 | ||
21 | qWarning("prof " + prof.readEntry("Device") + " " + str); | 22 | qWarning("prof " + prof.readEntry("Device") + " " + str); |
22 | ser = new IOSerial(prof); | 23 | ser = new IOSerial(prof); |
23 | connect(ser, SIGNAL(received(const QByteArray& ) ), | 24 | connect(ser, SIGNAL(received(const QByteArray& ) ), |
24 | this, SLOT(got(const QByteArray&) ) ); | 25 | this, SLOT(got(const QByteArray&) ) ); |
25 | 26 | ||
26 | if ( ser->open() ) | 27 | if ( ser->open() ) |
27 | qWarning("opened!!!"); | 28 | qWarning("opened!!!"); |
28 | else | 29 | else |
29 | qWarning("could not open"); | 30 | qWarning("could not open"); |
30 | 31 | ||
31 | 32 | ||
32 | 33 | ||
33 | } | 34 | } |
34 | SenderUI::~SenderUI() { | 35 | SenderUI::~SenderUI() { |
35 | 36 | ||
36 | } | 37 | } |
38 | void SenderUI::slotSendFile() { | ||
39 | |||
40 | sz = new SzTransfer(SzTransfer::SZ, ser); | ||
41 | sz->sendFile("/home/jake/test"); | ||
42 | |||
43 | connect (sz, SIGNAL(sent()), | ||
44 | this, SLOT(fileTransComplete())); | ||
45 | } | ||
46 | |||
37 | void SenderUI::slotSend() { | 47 | void SenderUI::slotSend() { |
38 | QCString str = MultiLineEdit1->text().utf8(); | 48 | QCString str = MultiLineEdit1->text().utf8(); |
39 | qWarning("sending: %s", str.data() ); | 49 | qWarning("sending: %s", str.data() ); |
40 | ser->send( str ); | 50 | ser->send( str ); |
41 | } | 51 | } |
42 | void SenderUI::got(const QByteArray& ar) { | 52 | void SenderUI::got(const QByteArray& ar) { |
43 | for ( uint i = 0; i < ar.count(); i++ ) { | 53 | for ( uint i = 0; i < ar.count(); i++ ) { |
44 | printf("%c", ar[i] ); | 54 | printf("%c", ar[i] ); |
45 | } | 55 | } |
46 | //printf("\n"); | 56 | //printf("\n"); |
47 | } | 57 | } |
58 | |||
59 | void SenderUI::fileTransComplete() { | ||
60 | |||
61 | qWarning("file transfer compete"); | ||
62 | } | ||