summaryrefslogtreecommitdiff
path: root/noncore
authorhash <hash>2002-10-09 19:37:20 (UTC)
committer hash <hash>2002-10-09 19:37:20 (UTC)
commit3689213cd06e8655b3f338ad170ad4e0fa040b80 (patch) (side-by-side diff)
tree328d017486631efdf1df238262d804b263c51433 /noncore
parent381ad47090a7dcf79d1d4fd11fff87ff565fb36b (diff)
downloadopie-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?
Diffstat (limited to 'noncore') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/opie-console/sz_transfer.cpp35
-rw-r--r--noncore/apps/opie-console/sz_transfer.h7
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 @@
#include "sz_transfer.h"
#include <qfile.h>
#include <opie/oprocess.h>
+#include <stdio.h>
SzTransfer::SzTransfer(Type t, IOLayer *layer) : FileTransferLayer(layer), m_t(t)
{
@@ -19,20 +20,22 @@ void SzTransfer::sendFile(const QString& file) {
proc = new OProcess;
*proc << "sz";
- *proc << "-vv" << file;
+ *proc << "-v" << "-v" << "-v" << "-b" << file;
connect(proc, SIGNAL(processExited(OProcess *)),
this, SLOT(sent()));
- connect(proc, SIGNAL(processRecievedStdout(OProcess *, char *, int)),
- this, SLOT(SzRecievedStdout(OProcess *, char *, int)));
- connect(proc, SIGNAL(processRecievedStderr(OProcess *, char *, int)),
- this, SLOT(SzRecievedStderr(OProcess *, char *, int)));
- connect(layer(), SIGNAL(received(QByteArray &)),
- this, SLOT(recievedStdin(QByteArray &)));
+ connect(proc, SIGNAL(receivedStdout(OProcess *, char *, int)),
+ this, SLOT(SzReceivedStdout(OProcess *, char *, int)));
+ connect(proc, SIGNAL(receivedStderr(OProcess *, char *, int)),
+ this, SLOT(SzReceivedStderr(OProcess *, char *, int)));
+ connect(layer(), SIGNAL(received(const QByteArray &)),
+ this, SLOT(receivedStdin(const QByteArray &)));
proc->start(OProcess::NotifyOnExit, OProcess::All);
}
-void SzTransfer::SzRecievedStdout(OProcess *, char *buffer, int buflen) {
+void SzTransfer::SzReceivedStdout(OProcess *, char *buffer, int buflen) {
+
+ qWarning("recieved from sz %d bytes", buflen);
QByteArray data(buflen);
data.fill(*buffer, buflen);
@@ -41,14 +44,26 @@ void SzTransfer::SzRecievedStdout(OProcess *, char *buffer, int buflen) {
(layer())->send(data);
}
-void SzTransfer::SzRecievedStderr(OProcess *, char *, int) {
+void SzTransfer::SzReceivedStderr(OProcess *, char *buffer, int length) {
// parse and show data in a progress dialog/widget
+ printf("\n");
+ for (int i = 0; i < length; i++)
+ printf("%c", buffer[i]);
}
-void SzTransfer::recievedStdin(QByteArray &data) {
+void SzTransfer::receivedStdin(const QByteArray &data) {
+ qWarning("recieved from io_serial %d bytes", data.size());
// recieved data from the io layer goes to sz
proc->writeStdin(data.data(), data.size());
}
+
+void SzTransfer::sent() {
+
+ qWarning("sent file");
+ delete proc;
+ disconnect(layer(), SIGNAL(received(const QByteArray &)),
+ this, SLOT(receivedStdin(const QByteArray &)));
+}
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:
*/
void sendFile( const QString& file ) ;
void sendFile( const QFile& );
+ void sent();
private slots:
- void SzRecievedStdout(OProcess *, char *, int);
- void SzRecievedStderr(OProcess *, char *, int);
- void recievedStdin(QByteArray &);
+ void SzReceivedStdout(OProcess *, char *, int);
+ void SzReceivedStderr(OProcess *, char *, int);
+ void receivedStdin(const QByteArray &);
private:
OProcess *proc;