-rw-r--r-- | noncore/apps/opie-console/test/console.pro | 6 | ||||
-rw-r--r-- | noncore/apps/opie-console/test/sender.ui | 18 | ||||
-rw-r--r-- | noncore/apps/opie-console/test/senderui.cpp | 17 | ||||
-rw-r--r-- | noncore/apps/opie-console/test/senderui.h | 4 |
4 files changed, 41 insertions, 4 deletions
diff --git a/noncore/apps/opie-console/test/console.pro b/noncore/apps/opie-console/test/console.pro index 721b820..b10b651 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 \ | 5 | HEADERS = ../io_layer.h ../io_serial.h ../sz_transfer.h ../file_layer.h\ |
6 | senderui.h ../profile.h | 6 | senderui.h ../profile.h |
7 | SOURCES = ../io_layer.cpp ../io_serial.cpp \ | 7 | SOURCES = ../io_layer.cpp ../io_serial.cpp \ |
8 | ../profile.cpp \ | 8 | ../profile.cpp ../sz_transfer.cpp ../file_layer.cpp\ |
9 | main.cpp senderui.cpp | 9 | main.cpp senderui.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/sender.ui b/noncore/apps/opie-console/test/sender.ui index 092f6e3..b946b81 100644 --- a/noncore/apps/opie-console/test/sender.ui +++ b/noncore/apps/opie-console/test/sender.ui | |||
@@ -25,36 +25,54 @@ | |||
25 | <number>11</number> | 25 | <number>11</number> |
26 | </property> | 26 | </property> |
27 | <property stdset="1"> | 27 | <property stdset="1"> |
28 | <name>spacing</name> | 28 | <name>spacing</name> |
29 | <number>6</number> | 29 | <number>6</number> |
30 | </property> | 30 | </property> |
31 | <widget> | 31 | <widget> |
32 | <class>QMultiLineEdit</class> | 32 | <class>QMultiLineEdit</class> |
33 | <property stdset="1"> | 33 | <property stdset="1"> |
34 | <name>name</name> | 34 | <name>name</name> |
35 | <cstring>MultiLineEdit1</cstring> | 35 | <cstring>MultiLineEdit1</cstring> |
36 | </property> | 36 | </property> |
37 | </widget> | 37 | </widget> |
38 | <widget> | 38 | <widget> |
39 | <class>QPushButton</class> | 39 | <class>QPushButton</class> |
40 | <property stdset="1"> | 40 | <property stdset="1"> |
41 | <name>name</name> | 41 | <name>name</name> |
42 | <cstring>PushButton1</cstring> | 42 | <cstring>PushButton1</cstring> |
43 | </property> | 43 | </property> |
44 | <property stdset="1"> | 44 | <property stdset="1"> |
45 | <name>text</name> | 45 | <name>text</name> |
46 | <string>&Send</string> | 46 | <string>&Send</string> |
47 | </property> | 47 | </property> |
48 | </widget> | 48 | </widget> |
49 | <widget> | ||
50 | <class>QPushButton</class> | ||
51 | <property stdset="1"> | ||
52 | <name>name</name> | ||
53 | <cstring>PushButton2</cstring> | ||
54 | </property> | ||
55 | <property stdset="1"> | ||
56 | <name>text</name> | ||
57 | <string>Send &File</string> | ||
58 | </property> | ||
59 | </widget> | ||
49 | </vbox> | 60 | </vbox> |
50 | </widget> | 61 | </widget> |
51 | <connections> | 62 | <connections> |
52 | <connection> | 63 | <connection> |
53 | <sender>PushButton1</sender> | 64 | <sender>PushButton1</sender> |
54 | <signal>clicked()</signal> | 65 | <signal>clicked()</signal> |
55 | <receiver>Form1</receiver> | 66 | <receiver>Form1</receiver> |
56 | <slot>slotSend()</slot> | 67 | <slot>slotSend()</slot> |
57 | </connection> | 68 | </connection> |
58 | <slot access="public">slotSend()</slot> | 69 | <slot access="public">slotSend()</slot> |
70 | <connection> | ||
71 | <sender>PushButton2</sender> | ||
72 | <signal>clicked()</signal> | ||
73 | <receiver>Form1</receiver> | ||
74 | <slot>slotSendFile()</slot> | ||
75 | </connection> | ||
76 | <slot access="public">slotSendFile()</slot> | ||
59 | </connections> | 77 | </connections> |
60 | </UI> | 78 | </UI> |
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 | } | ||
diff --git a/noncore/apps/opie-console/test/senderui.h b/noncore/apps/opie-console/test/senderui.h index bc69f5d..f6230cc 100644 --- a/noncore/apps/opie-console/test/senderui.h +++ b/noncore/apps/opie-console/test/senderui.h | |||
@@ -1,23 +1,27 @@ | |||
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 SenderUI : public Sender { | 10 | class SenderUI : public Sender { |
10 | Q_OBJECT | 11 | Q_OBJECT |
11 | public: | 12 | public: |
12 | SenderUI(); | 13 | SenderUI(); |
13 | ~SenderUI(); | 14 | ~SenderUI(); |
14 | 15 | ||
15 | public slots: | 16 | public slots: |
17 | void slotSendFile(); | ||
16 | void slotSend(); | 18 | void slotSend(); |
17 | void got(const QByteArray& ); | 19 | void got(const QByteArray& ); |
20 | void fileTransComplete(); | ||
18 | private: | 21 | private: |
19 | IOSerial* ser; | 22 | IOSerial* ser; |
23 | SzTransfer* sz; | ||
20 | }; | 24 | }; |
21 | 25 | ||
22 | 26 | ||
23 | #endif | 27 | #endif |