Diffstat (limited to 'noncore/apps/opie-console/test') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/apps/opie-console/test/console.pro | 6 | ||||
-rw-r--r-- | noncore/apps/opie-console/test/senderui.cpp | 18 | ||||
-rw-r--r-- | noncore/apps/opie-console/test/senderui.h | 10 |
3 files changed, 23 insertions, 11 deletions
diff --git a/noncore/apps/opie-console/test/console.pro b/noncore/apps/opie-console/test/console.pro index b10b651..f5761e2 100644 --- a/noncore/apps/opie-console/test/console.pro +++ b/noncore/apps/opie-console/test/console.pro | |||
@@ -1,15 +1,15 @@ | |||
1 | TEMPLATE = app | 1 | TEMPLATE = app |
2 | #CONFIG = qt warn_on release | 2 | #CONFIG = qt warn_on release |
3 | CONFIG = qt debug | 3 | CONFIG = qt debug |
4 | #DESTDIR = $(OPIEDIR)/bin | 4 | #DESTDIR = $(OPIEDIR)/bin |
5 | HEADERS = ../io_layer.h ../io_serial.h ../sz_transfer.h ../file_layer.h\ | 5 | HEADERS = ../io_layer.h ../io_serial.h ../sz_transfer.h ../file_layer.h\ |
6 | senderui.h ../profile.h | 6 | senderui.h ../profile.h ../filetransfer.h |
7 | SOURCES = ../io_layer.cpp ../io_serial.cpp \ | 7 | SOURCES = ../io_layer.cpp ../io_serial.cpp \ |
8 | ../profile.cpp ../sz_transfer.cpp ../file_layer.cpp\ | 8 | ../profile.cpp ../sz_transfer.cpp ../file_layer.cpp\ |
9 | main.cpp senderui.cpp | 9 | main.cpp senderui.cpp ../filetransfer.cpp |
10 | INTERFACES = sender.ui | 10 | INTERFACES = sender.ui |
11 | INCLUDEPATH += $(OPIEDIR)/include | 11 | INCLUDEPATH += $(OPIEDIR)/include |
12 | DEPENDPATH += $(OPIEDIR)/include | 12 | DEPENDPATH += $(OPIEDIR)/include |
13 | LIBS += -lqpe -lopie | 13 | LIBS += -lqpe -lopie |
14 | TARGET = test | 14 | TARGET = test |
15 | 15 | ||
diff --git a/noncore/apps/opie-console/test/senderui.cpp b/noncore/apps/opie-console/test/senderui.cpp index 24d3eb2..3d7c534 100644 --- a/noncore/apps/opie-console/test/senderui.cpp +++ b/noncore/apps/opie-console/test/senderui.cpp | |||
@@ -1,62 +1,68 @@ | |||
1 | #include <stdlib.h> | 1 | #include <stdlib.h> |
2 | #include <stdio.h> | 2 | #include <stdio.h> |
3 | #include <fcntl.h> | ||
4 | #include <sys/termios.h> | ||
3 | 5 | ||
4 | #include <qmultilineedit.h> | 6 | #include <qmultilineedit.h> |
7 | #include <qsocketnotifier.h> | ||
5 | 8 | ||
6 | #include "../profile.h" | 9 | #include "../profile.h" |
7 | #include "../io_serial.h" | 10 | #include "../io_serial.h" |
8 | #include "../sz_transfer.h" | 11 | #include "../filetransfer.h" |
9 | 12 | ||
13 | #include <opie/oprocess.h> | ||
10 | 14 | ||
11 | #include "senderui.h" | 15 | #include "senderui.h" |
12 | 16 | ||
13 | SenderUI::SenderUI() | 17 | SenderUI::SenderUI() |
14 | : Sender() { | 18 | : Sender() { |
15 | 19 | ||
16 | /* we do that manually */ | 20 | /* we do that manually */ |
17 | Profile prof; | 21 | Profile prof; |
18 | QString str = "/dev/ttyS1"; | 22 | QString str = "/dev/ttyS0"; |
19 | prof.writeEntry("Device",str ); | 23 | prof.writeEntry("Device",str ); |
20 | prof.writeEntry("Baud", 115200 ); | 24 | prof.writeEntry("Baud", 115200 ); |
21 | 25 | ||
22 | qWarning("prof " + prof.readEntry("Device") + " " + str); | 26 | qWarning("prof " + prof.readEntry("Device") + " " + str); |
23 | ser = new IOSerial(prof); | 27 | ser = new IOSerial(prof); |
24 | connect(ser, SIGNAL(received(const QByteArray& ) ), | 28 | connect(ser, SIGNAL(received(const QByteArray& ) ), |
25 | this, SLOT(got(const QByteArray&) ) ); | 29 | this, SLOT(got(const QByteArray&) ) ); |
26 | 30 | ||
27 | if ( ser->open() ) | 31 | if ( ser->open() ) |
28 | qWarning("opened!!!"); | 32 | qWarning("opened!!!"); |
29 | else | 33 | else |
30 | qWarning("could not open"); | 34 | qWarning("could not open"); |
31 | 35 | ||
32 | 36 | ||
33 | |||
34 | } | 37 | } |
35 | SenderUI::~SenderUI() { | 38 | SenderUI::~SenderUI() { |
36 | 39 | ||
37 | } | 40 | } |
38 | void SenderUI::slotSendFile() { | 41 | void SenderUI::slotSendFile() { |
39 | 42 | ||
40 | sz = new SzTransfer(SzTransfer::SZ, ser); | 43 | sz = new FileTransfer(FileTransfer::SZ, ser); |
41 | sz->sendFile("/home/jake/test"); | 44 | sz->sendFile("/home/ich/bootopie-v06-13.jffs2"); |
42 | 45 | ||
43 | connect (sz, SIGNAL(sent()), | 46 | connect (sz, SIGNAL(sent()), |
44 | this, SLOT(fileTransComplete())); | 47 | this, SLOT(fileTransComplete())); |
45 | } | 48 | } |
46 | 49 | ||
47 | void SenderUI::slotSend() { | 50 | void SenderUI::slotSend() { |
48 | QCString str = MultiLineEdit1->text().utf8(); | 51 | QCString str = MultiLineEdit1->text().utf8(); |
49 | qWarning("sending: %s", str.data() ); | 52 | qWarning("sending: %s", str.data() ); |
50 | ser->send( str ); | 53 | ser->send( str ); |
51 | } | 54 | } |
52 | void SenderUI::got(const QByteArray& ar) { | 55 | void SenderUI::got(const QByteArray& ar) { |
53 | for ( uint i = 0; i < ar.count(); i++ ) { | 56 | for ( uint i = 0; i < ar.count(); i++ ) { |
54 | printf("%c", ar[i] ); | 57 | printf("%c", ar[i] ); |
55 | } | 58 | } |
56 | //printf("\n"); | 59 | //printf("\n"); |
57 | } | 60 | } |
58 | 61 | ||
59 | void SenderUI::fileTransComplete() { | 62 | void SenderUI::fileTransComplete() { |
60 | 63 | ||
61 | qWarning("file transfer compete"); | 64 | qWarning("file transfer compete"); |
62 | } | 65 | } |
66 | void SenderUI::send() { | ||
67 | |||
68 | } | ||
diff --git a/noncore/apps/opie-console/test/senderui.h b/noncore/apps/opie-console/test/senderui.h index f6230cc..5e613cd 100644 --- a/noncore/apps/opie-console/test/senderui.h +++ b/noncore/apps/opie-console/test/senderui.h | |||
@@ -1,27 +1,33 @@ | |||
1 | #ifndef SENDER_UI_H | 1 | #ifndef SENDER_UI_H |
2 | #define SENDER_UI_H | 2 | #define SENDER_UI_H |
3 | 3 | ||
4 | #include <qcstring.h> | 4 | #include <qcstring.h> |
5 | 5 | ||
6 | #include "sender.h" | 6 | #include "sender.h" |
7 | 7 | ||
8 | class IOSerial; | 8 | class IOSerial; |
9 | class SzTransfer; | 9 | class FileTransfer; |
10 | class QSocketNotifier; | ||
11 | class OProcess; | ||
10 | class SenderUI : public Sender { | 12 | class SenderUI : public Sender { |
11 | Q_OBJECT | 13 | Q_OBJECT |
12 | public: | 14 | public: |
13 | SenderUI(); | 15 | SenderUI(); |
14 | ~SenderUI(); | 16 | ~SenderUI(); |
15 | 17 | ||
16 | public slots: | 18 | public slots: |
19 | void send(); | ||
17 | void slotSendFile(); | 20 | void slotSendFile(); |
18 | void slotSend(); | 21 | void slotSend(); |
19 | void got(const QByteArray& ); | 22 | void got(const QByteArray& ); |
20 | void fileTransComplete(); | 23 | void fileTransComplete(); |
21 | private: | 24 | private: |
22 | IOSerial* ser; | 25 | IOSerial* ser; |
23 | SzTransfer* sz; | 26 | FileTransfer* sz; |
27 | int m_fd; | ||
28 | QSocketNotifier* m_sock; | ||
29 | OProcess* m_proc; | ||
24 | }; | 30 | }; |
25 | 31 | ||
26 | 32 | ||
27 | #endif | 33 | #endif |