author | hash <hash> | 2002-10-09 19:37:20 (UTC) |
---|---|---|
committer | hash <hash> | 2002-10-09 19:37:20 (UTC) |
commit | 3689213cd06e8655b3f338ad170ad4e0fa040b80 (patch) (unidiff) | |
tree | 328d017486631efdf1df238262d804b263c51433 | |
parent | 381ad47090a7dcf79d1d4fd11fff87ff565fb36b (diff) | |
download | opie-3689213cd06e8655b3f338ad170ad4e0fa040b80.zip opie-3689213cd06e8655b3f338ad170ad4e0fa040b80.tar.gz opie-3689213cd06e8655b3f338ad170ad4e0fa040b80.tar.bz2 |
as far as i can tell, this should work, but then again, it isnt working...
i cant understand minicom's file transfer stuff in updown.c
anyone know what might be the problem?
-rw-r--r-- | noncore/apps/opie-console/sz_transfer.cpp | 35 | ||||
-rw-r--r-- | noncore/apps/opie-console/sz_transfer.h | 7 |
2 files changed, 29 insertions, 13 deletions
diff --git a/noncore/apps/opie-console/sz_transfer.cpp b/noncore/apps/opie-console/sz_transfer.cpp index 10f3f7a..a5af2be 100644 --- a/noncore/apps/opie-console/sz_transfer.cpp +++ b/noncore/apps/opie-console/sz_transfer.cpp | |||
@@ -2,6 +2,7 @@ | |||
2 | #include "sz_transfer.h" | 2 | #include "sz_transfer.h" |
3 | #include <qfile.h> | 3 | #include <qfile.h> |
4 | #include <opie/oprocess.h> | 4 | #include <opie/oprocess.h> |
5 | #include <stdio.h> | ||
5 | 6 | ||
6 | SzTransfer::SzTransfer(Type t, IOLayer *layer) : FileTransferLayer(layer), m_t(t) | 7 | SzTransfer::SzTransfer(Type t, IOLayer *layer) : FileTransferLayer(layer), m_t(t) |
7 | { | 8 | { |
@@ -19,20 +20,22 @@ void SzTransfer::sendFile(const QString& file) { | |||
19 | 20 | ||
20 | proc = new OProcess; | 21 | proc = new OProcess; |
21 | *proc << "sz"; | 22 | *proc << "sz"; |
22 | *proc << "-vv" << file; | 23 | *proc << "-v" << "-v" << "-v" << "-b" << file; |
23 | connect(proc, SIGNAL(processExited(OProcess *)), | 24 | connect(proc, SIGNAL(processExited(OProcess *)), |
24 | this, SLOT(sent())); | 25 | this, SLOT(sent())); |
25 | connect(proc, SIGNAL(processRecievedStdout(OProcess *, char *, int)), | 26 | connect(proc, SIGNAL(receivedStdout(OProcess *, char *, int)), |
26 | this, SLOT(SzRecievedStdout(OProcess *, char *, int))); | 27 | this, SLOT(SzReceivedStdout(OProcess *, char *, int))); |
27 | connect(proc, SIGNAL(processRecievedStderr(OProcess *, char *, int)), | 28 | connect(proc, SIGNAL(receivedStderr(OProcess *, char *, int)), |
28 | this, SLOT(SzRecievedStderr(OProcess *, char *, int))); | 29 | this, SLOT(SzReceivedStderr(OProcess *, char *, int))); |
29 | connect(layer(), SIGNAL(received(QByteArray &)), | 30 | connect(layer(), SIGNAL(received(const QByteArray &)), |
30 | this, SLOT(recievedStdin(QByteArray &))); | 31 | this, SLOT(receivedStdin(const QByteArray &))); |
31 | proc->start(OProcess::NotifyOnExit, OProcess::All); | 32 | proc->start(OProcess::NotifyOnExit, OProcess::All); |
32 | 33 | ||
33 | } | 34 | } |
34 | 35 | ||
35 | void SzTransfer::SzRecievedStdout(OProcess *, char *buffer, int buflen) { | 36 | void SzTransfer::SzReceivedStdout(OProcess *, char *buffer, int buflen) { |
37 | |||
38 | qWarning("recieved from sz %d bytes", buflen); | ||
36 | 39 | ||
37 | QByteArray data(buflen); | 40 | QByteArray data(buflen); |
38 | data.fill(*buffer, buflen); | 41 | data.fill(*buffer, buflen); |
@@ -41,14 +44,26 @@ void SzTransfer::SzRecievedStdout(OProcess *, char *buffer, int buflen) { | |||
41 | (layer())->send(data); | 44 | (layer())->send(data); |
42 | } | 45 | } |
43 | 46 | ||
44 | void SzTransfer::SzRecievedStderr(OProcess *, char *, int) { | 47 | void SzTransfer::SzReceivedStderr(OProcess *, char *buffer, int length) { |
45 | 48 | ||
46 | // parse and show data in a progress dialog/widget | 49 | // parse and show data in a progress dialog/widget |
50 | printf("\n"); | ||
51 | for (int i = 0; i < length; i++) | ||
52 | printf("%c", buffer[i]); | ||
47 | } | 53 | } |
48 | 54 | ||
49 | void SzTransfer::recievedStdin(QByteArray &data) { | 55 | void SzTransfer::receivedStdin(const QByteArray &data) { |
50 | 56 | ||
57 | qWarning("recieved from io_serial %d bytes", data.size()); | ||
51 | // recieved data from the io layer goes to sz | 58 | // recieved data from the io layer goes to sz |
52 | proc->writeStdin(data.data(), data.size()); | 59 | proc->writeStdin(data.data(), data.size()); |
53 | 60 | ||
54 | } | 61 | } |
62 | |||
63 | void SzTransfer::sent() { | ||
64 | |||
65 | qWarning("sent file"); | ||
66 | delete proc; | ||
67 | disconnect(layer(), SIGNAL(received(const QByteArray &)), | ||
68 | this, SLOT(receivedStdin(const QByteArray &))); | ||
69 | } | ||
diff --git a/noncore/apps/opie-console/sz_transfer.h b/noncore/apps/opie-console/sz_transfer.h index 825680d..d3e6621 100644 --- a/noncore/apps/opie-console/sz_transfer.h +++ b/noncore/apps/opie-console/sz_transfer.h | |||
@@ -24,11 +24,12 @@ public slots: | |||
24 | */ | 24 | */ |
25 | void sendFile( const QString& file ) ; | 25 | void sendFile( const QString& file ) ; |
26 | void sendFile( const QFile& ); | 26 | void sendFile( const QFile& ); |
27 | void sent(); | ||
27 | 28 | ||
28 | private slots: | 29 | private slots: |
29 | void SzRecievedStdout(OProcess *, char *, int); | 30 | void SzReceivedStdout(OProcess *, char *, int); |
30 | void SzRecievedStderr(OProcess *, char *, int); | 31 | void SzReceivedStderr(OProcess *, char *, int); |
31 | void recievedStdin(QByteArray &); | 32 | void receivedStdin(const QByteArray &); |
32 | 33 | ||
33 | private: | 34 | private: |
34 | OProcess *proc; | 35 | OProcess *proc; |