Diffstat (limited to 'noncore/apps/opie-console/test/senderui.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/apps/opie-console/test/senderui.cpp | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/noncore/apps/opie-console/test/senderui.cpp b/noncore/apps/opie-console/test/senderui.cpp new file mode 100644 index 0000000..fc93c04 --- a/dev/null +++ b/noncore/apps/opie-console/test/senderui.cpp | |||
@@ -0,0 +1,47 @@ | |||
1 | #include <stdlib.h> | ||
2 | #include <stdio.h> | ||
3 | |||
4 | #include <qmultilineedit.h> | ||
5 | |||
6 | #include "../profile.h" | ||
7 | #include "../io_serial.h" | ||
8 | |||
9 | |||
10 | #include "senderui.h" | ||
11 | |||
12 | SenderUI::SenderUI() | ||
13 | : Sender() { | ||
14 | |||
15 | /* we do that manually */ | ||
16 | Profile prof; | ||
17 | QString str = "/dev/ttyS0"; | ||
18 | prof.writeEntry("Device",str ); | ||
19 | prof.writeEntry("Baud", 115200 ); | ||
20 | |||
21 | qWarning("prof " + prof.readEntry("Device") + " " + str); | ||
22 | ser = new IOSerial(prof); | ||
23 | connect(ser, SIGNAL(received(const QByteArray& ) ), | ||
24 | this, SLOT(got(const QByteArray&) ) ); | ||
25 | |||
26 | if ( ser->open() ) | ||
27 | qWarning("opened!!!"); | ||
28 | else | ||
29 | qWarning("could not open"); | ||
30 | |||
31 | |||
32 | |||
33 | } | ||
34 | SenderUI::~SenderUI() { | ||
35 | |||
36 | } | ||
37 | void SenderUI::slotSend() { | ||
38 | QCString str = MultiLineEdit1->text().utf8(); | ||
39 | qWarning("sending: %s", str.data() ); | ||
40 | ser->send( str ); | ||
41 | } | ||
42 | void SenderUI::got(const QByteArray& ar) { | ||
43 | for ( uint i = 0; i < ar.count(); i++ ) { | ||
44 | printf("%c", ar[i] ); | ||
45 | } | ||
46 | //printf("\n"); | ||
47 | } | ||