author | mickeyl <mickeyl> | 2003-01-21 00:37:32 (UTC) |
---|---|---|
committer | mickeyl <mickeyl> | 2003-01-21 00:37:32 (UTC) |
commit | 2f708339e301f28aadc622f4d58a2d22e0b598fb (patch) (side-by-side diff) | |
tree | 58cc0564a3e888acdcf5868ca48d21ef8f82ccec | |
parent | c5c75d4622f9c7d6aa1a8fd2ce3aed415032d932 (diff) | |
download | opie-2f708339e301f28aadc622f4d58a2d22e0b598fb.zip opie-2f708339e301f28aadc622f4d58a2d22e0b598fb.tar.gz opie-2f708339e301f28aadc622f4d58a2d22e0b598fb.tar.bz2 |
fixed a lot of errors and sloppyness to make it compile again...
-rw-r--r-- | noncore/apps/opie-console/MyPty.cpp | 4 | ||||
-rw-r--r-- | noncore/apps/opie-console/io_bt.cpp | 12 | ||||
-rw-r--r-- | noncore/apps/opie-console/io_bt.h | 13 | ||||
-rw-r--r-- | noncore/apps/opie-console/io_irda.cpp | 12 | ||||
-rw-r--r-- | noncore/apps/opie-console/io_irda.h | 13 | ||||
-rw-r--r-- | noncore/apps/opie-console/io_layer.cpp | 1 | ||||
-rw-r--r-- | noncore/apps/opie-console/io_layer.h | 0 | ||||
-rw-r--r-- | noncore/apps/opie-console/io_modem.cpp | 11 | ||||
-rw-r--r-- | noncore/apps/opie-console/io_modem.h | 13 | ||||
-rw-r--r-- | noncore/apps/opie-console/io_serial.h | 17 | ||||
-rw-r--r-- | noncore/apps/opie-console/opie-console.pro | 8 |
11 files changed, 75 insertions, 29 deletions
diff --git a/noncore/apps/opie-console/MyPty.cpp b/noncore/apps/opie-console/MyPty.cpp index 23d4966..b2f6a74 100644 --- a/noncore/apps/opie-console/MyPty.cpp +++ b/noncore/apps/opie-console/MyPty.cpp @@ -1,368 +1,368 @@ /* -------------------------------------------------------------------------- */ /* */ /* [MyPty.C] Pseudo Terminal Device */ /* */ /* -------------------------------------------------------------------------- */ /* */ /* Copyright (c) 1997,1998 by Lars Doelle <lars.doelle@on-line.de> */ /* */ /* This file is part of Konsole - an X terminal for KDE */ /* -------------------------------------------------------------------------- */ /* */ /* Ported Konsole to Qt/Embedded */ /* */ /* Copyright (C) 2000 by John Ryland <jryland@trolltech.com> */ /* */ /* -------------------------------------------------------------------------- */ /* If you're compiling konsole on non-Linux platforms and find problems that you can track down to this file, please have a look into ../README.ports, too. */ /*! \file */ /*! \class TEPty \brief Ptys provide a pseudo terminal connection to a program. Although closely related to pipes, these pseudo terminal connections have some ability, that makes it nessesary to uses them. Most importent, they know about changing screen sizes and UNIX job control. Within the terminal emulation framework, this class represents the host side of the terminal together with the connecting serial line. One can create many instances of this class within a program. As a side effect of using this class, a signal(2) handler is installed on SIGCHLD. \par FIXME [NOTE: much of the technical stuff below will be replaced by forkpty.] publish the SIGCHLD signal if not related to an instance. clearify TEPty::done vs. TEPty::~TEPty semantics. check if pty is restartable via run after done. \par Pseudo terminals Pseudo terminals are a unique feature of UNIX, and always come in form of pairs of devices (/dev/ptyXX and /dev/ttyXX), which are connected to each other by the operating system. One may think of them as two serial devices linked by a null-modem cable. Being based on devices the number of simultanous instances of this class is (globally) limited by the number of those device pairs, which is 256. Another technic are UNIX 98 PTY's. These are supported also, and prefered over the (obsolete) predecessor. There's a sinister ioctl(2), signal(2) and job control stuff nessesary to make everything work as it should. */ #include <qapplication.h> #include <qsocketnotifier.h> #include <qstring.h> #include <qfile.h> #include <stdlib.h> #include <stdio.h> #include <signal.h> #include <fcntl.h> #include <unistd.h> #include <termios.h> #include <sys/types.h> #include <sys/ioctl.h> #include <sys/wait.h> #ifdef HAVE_OPENPTY #include <pty.h> #endif #include "procctl.h" #include "MyPty.h" #undef VERBOSE_DEBUG /* -------------------------------------------------------------------------- */ /*! Informs the client program about the actual size of the window. */ void MyPty::setSize(int lines, int columns) { qWarning("setting size"); struct winsize wsize; wsize.ws_row = (unsigned short)lines; wsize.ws_col = (unsigned short)columns; if(m_fd < 0) return; ioctl(m_fd,TIOCSWINSZ,(char *)&wsize); } void MyPty::donePty() { // This is code from the Qt DumbTerminal example ::close(m_fd); if (m_cpid) { kill(m_cpid, SIGHUP); //waitpid(m_cpid, &status, 0); delete m_sn_e; delete m_sn_r; m_sn_e = 0l; m_sn_r = 0l; } m_cpid = 0; m_fd = -1; // emit done(status); } const char* MyPty::deviceName() { return m_ttynam; } void MyPty::error() { // This is code from the Qt DumbTerminal example donePty(); } void MyPty::start() { QStrList lis; int r =run(m_cmd.latin1(), lis, 0, 0); r = r; } /*! start the client program. */ int MyPty::run(const char* cmd, QStrList &, const char*, int) { // This is code from the Qt DumbTerminal example m_cpid = fork(); if ( !m_cpid ) { // child - exec shell on tty for (int sig = 1; sig < NSIG; sig++) signal(sig,SIG_DFL); int ttyfd = ::open(m_ttynam, O_RDWR); dup2(ttyfd, STDIN_FILENO); dup2(ttyfd, STDOUT_FILENO); dup2(ttyfd, STDERR_FILENO); // should be done with tty, so close it ::close(ttyfd); static struct termios ttmode; if ( setsid() < 0 ) perror( "failed to set process group" ); #if defined (TIOCSCTTY) // grabbed from APUE by Stevens ioctl(STDIN_FILENO, TIOCSCTTY, 0); #endif tcgetattr( STDIN_FILENO, &ttmode ); ttmode.c_cc[VINTR] = 3; ttmode.c_cc[VERASE] = 8; tcsetattr( STDIN_FILENO, TCSANOW, &ttmode ); setenv("TERM",m_term,1); setenv("COLORTERM","0",1); EnvironmentMap::Iterator it; for (it = m_env.begin(); it != m_env.end(); it++) { setenv(it.key().latin1(), it.data().latin1(), 1); } if (getuid() == 0) { char msg[] = "WARNING: You are running this shell as root!\n"; write(ttyfd, msg, sizeof(msg)); } execl(cmd, cmd, 0); donePty(); exit(-1); } // parent - continue as a widget delete m_sn_r; m_sn_r = new QSocketNotifier(m_fd,QSocketNotifier::Read,this); delete m_sn_e; m_sn_e = new QSocketNotifier(m_fd,QSocketNotifier::Exception,this); connect(m_sn_r,SIGNAL(activated(int)),this,SLOT(readPty())); connect(m_sn_e,SIGNAL(activated(int)),this,SLOT(error())); return 0; } int MyPty::openPty() { // This is code from the Qt DumbTerminal example int ptyfd = -1; #ifdef HAVE_OPENPTY int ttyfd; - if ( openpty(&ptyfd,&ttyfd,ttynam,0,0) ) + if ( openpty(&ptyfd,&ttyfd,m_ttynam,0,0) ) ptyfd = -1; else - close(ttyfd); // we open the ttynam ourselves. + ::close(ttyfd); // we open the ttynam ourselves. #else for (const char* c0 = "pqrstuvwxyzabcde"; ptyfd < 0 && *c0 != 0; c0++) { for (const char* c1 = "0123456789abcdef"; ptyfd < 0 && *c1 != 0; c1++) { sprintf(m_ptynam,"/dev/pty%c%c",*c0,*c1); sprintf(m_ttynam,"/dev/tty%c%c",*c0,*c1); if ((ptyfd = ::open(m_ptynam,O_RDWR)) >= 0) { if (geteuid() != 0 && !access(m_ttynam,R_OK|W_OK) == 0) { ::close(ptyfd); ptyfd = -1; } } } } #endif if ( ptyfd < 0 ) { // qApp->exit(1); return -1; } return ptyfd; } /*! Create an instance. */ MyPty::MyPty(const Profile& prof) : m_cpid(0) { int term = prof.readNumEntry("Terminal", Profile::VT100 ); switch( term ) { default: case Profile::VT100: case Profile::VT102: m_term = "vt100"; break; case Profile::Linux: m_term = "linux"; break; case Profile::XTerm: m_term = "xterm"; break; } m_sn_e = 0l; m_sn_r = 0l; m_fd = openPty(); ProcCtl* ctl = ProcCtl::self(); Q_UNUSED(ctl); reload(prof); } /*! Destructor. Note that the related client program is not killed (yet) when a instance is deleted. */ MyPty::~MyPty() { donePty(); } QString MyPty::identifier()const { return QString::fromLatin1("term"); } QString MyPty::name()const{ return identifier(); } bool MyPty::open() { if (m_fd < 0) m_fd = openPty(); start(); return true; } void MyPty::close() { donePty(); m_fd = openPty(); } void MyPty::reload( const Profile& prof) { m_env.clear(); m_cmd = prof.readEntry("Command", "/bin/sh"); /* * Lets check if m_cmd actually * exists.... * we try to use bin/bash and if * this fails we * will fallback to /bin/sh * which should be there 100% */ if ( m_cmd.stripWhiteSpace() == "/bin/bash" && !QFile::exists(QFile::encodeName(m_cmd) ) ) m_cmd = "/bin/sh"; int envcount = prof.readNumEntry("EnvVars", 0); for (int i=0; i<envcount; i++) { QString name = prof.readEntry("Env_Name_" + QString::number(i), ""); QString value = prof.readEntry("Env_Value_" + QString::number(i), ""); if (!(name.isEmpty() || value.isEmpty())) { m_env.insert(name, value); } } } /*! sends len bytes through the line */ void MyPty::send(const QByteArray& ar) { #ifdef VERBOSE_DEBUG // verbose debug printf("sending bytes:\n"); for (uint i = 0; i < ar.count(); i++) printf("%c", ar[i]); printf("\n"); #endif ::write(m_fd, ar.data(), ar.count()); } /*! indicates that a block of data is received */ void MyPty::readPty() { QByteArray buf(4096); int len = ::read( m_fd, buf.data(), 4096 ); if (len == -1 || len == 0) { donePty(); return; } if (len < 0) return; buf.resize(len); emit received(buf); #ifdef VERBOSE_DEBUG // verbose debug printf("read bytes:\n"); for (uint i = 0; i < buf.count(); i++) printf("%c", buf[i]); printf("\n"); #endif } QBitArray MyPty::supports()const { QBitArray ar(3); //autoconnect ar[0] = 1; // ar[1] = 0; ar[2] = 0; return ar; } diff --git a/noncore/apps/opie-console/io_bt.cpp b/noncore/apps/opie-console/io_bt.cpp index 8dd8151..37bf797 100644 --- a/noncore/apps/opie-console/io_bt.cpp +++ b/noncore/apps/opie-console/io_bt.cpp @@ -1,80 +1,92 @@ #include "io_bt.h" IOBt::IOBt( const Profile &config ) : IOSerial( config ) { m_attach = 0; } IOBt::~IOBt() { if ( m_attach ) { delete m_attach; } } void IOBt::close() { IOSerial::close(); // still need error handling if ( m_attach ) { delete m_attach; m_attach = 0; } } bool IOBt::open() { bool ret = false; // only set up bt stuff if mac address was set, otherwise use the device set if ( !m_mac.isEmpty() ) { // now it should also be checked, if there is a connection to the device with that mac allready // hciattach here m_attach = new OProcess(); *m_attach << "hciattach /dev/ttyS2 any 57600"; // then start hcid, then rcfomm handling (m_mac) connect( m_attach, SIGNAL( processExited( OProcess* ) ), this, SLOT( slotExited( OProcess* ) ) ); if ( m_attach->start() ) { ret = IOSerial::open(); } else { qWarning("could not attach to device"); delete m_attach; m_attach = 0; } } else { // directly to the normal serial // TODO: look first if the connection really exists. ( is set up ) ret =IOSerial::open(); } return ret; } void IOBt::reload( const Profile &config ) { m_device = config.readEntry("Device", BT_DEFAULT_DEVICE); m_mac = config.readEntry("Mac", BT_DEFAULT_MAC); m_baud = config.readNumEntry("Baud", BT_DEFAULT_BAUD); m_parity = config.readNumEntry("Parity", BT_DEFAULT_PARITY); m_dbits = config.readNumEntry("DataBits", BT_DEFAULT_DBITS); m_sbits = config.readNumEntry("StopBits", BT_DEFAULT_SBITS); m_flow = config.readNumEntry("Flow", BT_DEFAULT_FLOW); } QString IOBt::identifier() const { return "bluetooth"; } QString IOBt::name() const { return "BLuetooth IO Layer"; } void IOBt::slotExited( OProcess* proc ){ close(); delete proc; } + +QBitArray IOBt::supports() const { + return QBitArray( 3 ); +} + +bool IOBt::isConnected() { + return false; +} + +void IOBt::send(const QByteArray &data) { + qDebug( "Please overload me..." ); +} diff --git a/noncore/apps/opie-console/io_bt.h b/noncore/apps/opie-console/io_bt.h index 5e9988c..239eefb 100644 --- a/noncore/apps/opie-console/io_bt.h +++ b/noncore/apps/opie-console/io_bt.h @@ -1,48 +1,51 @@ #ifndef OPIE_IO_BT #define OPIE_IO_BT #include <opie/oprocess.h> #include "io_serial.h" /* Default values to be used if the profile information is incomplete */ #define BT_DEFAULT_DEVICE "/dev/ttyU0" #define BT_DEFAULT_BAUD 9600 #define BT_DEFAULT_PARITY 0 #define BT_DEFAULT_DBITS 8 #define BT_DEFAULT_SBITS 1 #define BT_DEFAULT_FLOW 0 #define BT_DEFAULT_MAC 0 /* IOSerial implements a RS232 IO Layer */ class IOBt : public IOSerial { Q_OBJECT public: IOBt(const Profile &); ~IOBt(); - QString identifier() const; - QString name() const; + virtual QString identifier() const; + virtual QString name() const; + virtual QBitArray supports() const; + virtual bool isConnected(); signals: void received(const QByteArray &); void error(int, const QString &); public slots: - bool open(); - void close(); - void reload(const Profile &); + virtual void send( const QByteArray& ); + virtual bool open(); + virtual void close(); + virtual void reload(const Profile &); private: OProcess *m_attach; QString m_mac; private slots: void slotExited(OProcess* proc); }; #endif /* OPIE_IO_IRDA */ diff --git a/noncore/apps/opie-console/io_irda.cpp b/noncore/apps/opie-console/io_irda.cpp index b3b693f..e360fb4 100644 --- a/noncore/apps/opie-console/io_irda.cpp +++ b/noncore/apps/opie-console/io_irda.cpp @@ -1,65 +1,77 @@ #include "io_irda.h" IOIrda::IOIrda( const Profile &config ) : IOSerial( config ) { m_attach = 0; } IOIrda::~IOIrda() { if ( m_attach ) { delete m_attach; } } void IOIrda::close() { IOSerial::close(); // still need error handling delete m_attach; } bool IOIrda::open() { bool ret; // irdaattach here m_attach = new OProcess(); *m_attach << "irattach /dev/ttyS2 -s"; connect( m_attach, SIGNAL( processExited( OProcess* ) ), this, SLOT( slotExited( OProcess* ) ) ); if ( m_attach->start() ) { ret= IOSerial::open(); } else { // emit error!!! qWarning("could not attach to device"); delete m_attach; m_attach = 0l; } return ret; } void IOIrda::reload( const Profile &config ) { m_device = config.readEntry("Device", IRDA_DEFAULT_DEVICE); m_baud = config.readNumEntry("Baud", IRDA_DEFAULT_BAUD); m_parity = config.readNumEntry("Parity", IRDA_DEFAULT_PARITY); m_dbits = config.readNumEntry("DataBits", IRDA_DEFAULT_DBITS); m_sbits = config.readNumEntry("StopBits", IRDA_DEFAULT_SBITS); m_flow = config.readNumEntry("Flow", IRDA_DEFAULT_FLOW); } QString IOIrda::identifier() const { return "irda"; } QString IOIrda::name() const { return "Irda IO Layer"; } void IOIrda::slotExited(OProcess* proc ){ close(); delete proc; } + +QBitArray IOIrda::supports()const { + return QBitArray( 3 ); +} + +bool IOIrda::isConnected() { + return false; +} + +void IOIrda::send(const QByteArray &data) { + qDebug( "Please overload me..." ); +} diff --git a/noncore/apps/opie-console/io_irda.h b/noncore/apps/opie-console/io_irda.h index 3aee951..14b1ae3 100644 --- a/noncore/apps/opie-console/io_irda.h +++ b/noncore/apps/opie-console/io_irda.h @@ -1,46 +1,49 @@ #ifndef OPIE_IO_IRDA #define OPIE_IO_IRDA #include <opie/oprocess.h> #include "io_serial.h" /* Default values to be used if the profile information is incomplete */ #define IRDA_DEFAULT_DEVICE "/dev/ircomm0" #define IRDA_DEFAULT_BAUD 9600 #define IRDA_DEFAULT_PARITY 0 #define IRDA_DEFAULT_DBITS 8 #define IRDA_DEFAULT_SBITS 1 #define IRDA_DEFAULT_FLOW 0 /* IOSerial implements a RS232 IO Layer */ class IOIrda : public IOSerial { Q_OBJECT public: IOIrda(const Profile &); ~IOIrda(); - QString identifier() const; - QString name() const; + virtual QString identifier() const; + virtual QString name() const; + virtual QBitArray supports() const; + virtual bool isConnected(); signals: void received(const QByteArray &); void error(int, const QString &); public slots: - bool open(); - void close(); - void reload(const Profile &); + virtual void send( const QByteArray& ); + virtual bool open(); + virtual void close(); + virtual void reload(const Profile &); private: OProcess *m_attach; private slots: void slotExited(OProcess* proc); }; #endif /* OPIE_IO_IRDA */ diff --git a/noncore/apps/opie-console/io_layer.cpp b/noncore/apps/opie-console/io_layer.cpp index 975ee60..52ec828 100644 --- a/noncore/apps/opie-console/io_layer.cpp +++ b/noncore/apps/opie-console/io_layer.cpp @@ -1,22 +1,23 @@ #include "io_layer.h" IOLayer::IOLayer() : QObject() { } IOLayer::IOLayer(const Profile &) : QObject() { } IOLayer::~IOLayer() { } int IOLayer::rawIO()const{ return -1; } void IOLayer::closeRawIO(int) { } void IOLayer::setSize(int, int ) { } + diff --git a/noncore/apps/opie-console/io_layer.h b/noncore/apps/opie-console/io_layer.h index ed4478b..4f9bbe4 100644 --- a/noncore/apps/opie-console/io_layer.h +++ b/noncore/apps/opie-console/io_layer.h diff --git a/noncore/apps/opie-console/io_modem.cpp b/noncore/apps/opie-console/io_modem.cpp index 896c24f..1ce680a 100644 --- a/noncore/apps/opie-console/io_modem.cpp +++ b/noncore/apps/opie-console/io_modem.cpp @@ -1,95 +1,106 @@ #include "io_modem.h" #include "dialer.h" IOModem::IOModem( const Profile &profile ) : IOSerial( profile ) { m_profile = profile; } IOModem::~IOModem() { } void IOModem::close() { // Hangup, discarding result // int fd = rawIO(); internDetach(); Dialer d(m_profile, m_fd); d.setHangupOnly(); //d.exec(); internAttach(); // closeRawIO(fd); IOSerial::close(); } bool IOModem::open() { bool ret = IOSerial::open(); if(!ret) return false; // int fd = rawIO(); internDetach(); Dialer d(m_profile, m_fd); int result = d.exec(); internAttach(); // closeRawIO(fd); if(result == QDialog::Accepted) { return true; } else { close(); return false; } } void IOModem::reload( const Profile &config ) { m_device = config.readEntry("Device", MODEM_DEFAULT_DEVICE); m_baud = config.readNumEntry("Baud", MODEM_DEFAULT_BAUD); m_parity = config.readNumEntry("Parity", MODEM_DEFAULT_PARITY); m_dbits = config.readNumEntry("DataBits", MODEM_DEFAULT_DBITS); m_sbits = config.readNumEntry("StopBits", MODEM_DEFAULT_SBITS); m_flow = config.readNumEntry("Flow", MODEM_DEFAULT_FLOW); m_initString = config.readEntry("InitString", MODEM_DEFAULT_INIT_STRING ); m_resetString = config.readEntry("ResetString", MODEM_DEFAULT_RESET_STRING ); m_dialPref1 = config.readEntry("DialPrefix1", MODEM_DEFAULT_DIAL_PREFIX1 ); m_dialSuf1 = config.readEntry("DialSuffix1", MODEM_DEFAULT_DIAL_SUFFIX1 ); m_dialPref2 = config.readEntry("DialPrefix2", MODEM_DEFAULT_DIAL_PREFIX1 ); m_dialSuf2 = config.readEntry("DialSuffix2", MODEM_DEFAULT_DIAL_SUFFIX1 ); m_dialPref3 = config.readEntry("DialPrefix3", MODEM_DEFAULT_DIAL_PREFIX1 ); m_dialSuf3 = config.readEntry("DialSuffix3", MODEM_DEFAULT_DIAL_SUFFIX1 ); m_connect = config.readEntry("DefaultConnect" MODEM_DEFAULT_CONNECT_STRING ); m_hangup = config.readEntry("HangupString", MODEM_DEFAULT_HANGUP_STRING ); m_cancel = config.readEntry("CancelString", MODEM_DEFAULT_CANCEL_STRING ); m_dialTime = config.readNumEntry("DialTime", MODEM_DEFAULT_DIAL_TIME ); m_delayRedial = config.readNumEntry("DelayRedial", MODEM_DEFAULT_DELAY_REDIAL ); m_numberTries = config.readNumEntry("NumberTries", MODEM_DEFAULT_NUMBER_TRIES ); m_dtrDropTime = config.readNumEntry("DTRDRopTime", MODEM_DEFAULT_DTR_DROP_TIME ); m_bpsDetect = config.readBoolEntry("BPSDetect", MODEM_DEFAULT_BPS_DETECT ); m_dcdLines = config.readBoolEntry("DCDLines", MODEM_DEFAULT_DCD_LINES ); m_multiLineUntag = config.readBoolEntry("MultiLineUntag", MODEM_DEFAULT_MULTI_LINE_UNTAG ); } QString IOModem::identifier() const { return "modem"; } QString IOModem::name() const { return "Modem IO Layer"; } void IOModem::slotExited(OProcess* proc ){ close(); /* delete it afterwards */ delete proc; } +QBitArray IOModem::supports()const { + return QBitArray( 3 ); +} + +bool IOModem::isConnected() { + return false; +} + +void IOModem::send(const QByteArray &data) { + qDebug( "Please overload me..." ); +} diff --git a/noncore/apps/opie-console/io_modem.h b/noncore/apps/opie-console/io_modem.h index 17228bd..2a926df 100644 --- a/noncore/apps/opie-console/io_modem.h +++ b/noncore/apps/opie-console/io_modem.h @@ -1,71 +1,74 @@ #ifndef OPIE_IO_MODEM #define OPIE_IO_MODEM #include <opie/oprocess.h> #include "io_serial.h" #include "profile.h" /* Default values to be used if the profile information is incomplete */ #define MODEM_DEFAULT_DEVICE "/dev/ttyS0" #define MODEM_DEFAULT_BAUD 9600 #define MODEM_DEFAULT_PARITY 0 #define MODEM_DEFAULT_DBITS 8 #define MODEM_DEFAULT_SBITS 1 #define MODEM_DEFAULT_FLOW 0 #define MODEM_DEFAULT_INIT_STRING "AT" #define MODEM_DEFAULT_RESET_STRING "ATZ~" #define MODEM_DEFAULT_DIAL_PREFIX1 "ATDT" #define MODEM_DEFAULT_DIAL_SUFFIX1 "" #define MODEM_DEFAULT_DIAL_PREFIX2 "" #define MODEM_DEFAULT_DIAL_SUFFIX2 "" #define MODEM_DEFAULT_DIAL_PREFIX3 "" #define MODEM_DEFAULT_DIAL_SUFFIX3 "" #define MODEM_DEFAULT_CONNECT_STRING "CONNECT" #define MODEM_DEFAULT_HANGUP_STRING "+++ATH" #define MODEM_DEFAULT_CANCEL_STRING "" #define MODEM_DEFAULT_DIAL_TIME 45 #define MODEM_DEFAULT_DELAY_REDIAL 2 #define MODEM_DEFAULT_NUMBER_TRIES 10 #define MODEM_DEFAULT_DTR_DROP_TIME 1 #define MODEM_DEFAULT_BPS_DETECT 0 // bool #define MODEM_DEFAULT_DCD_LINES 1 //bool #define MODEM_DEFAULT_MULTI_LINE_UNTAG 0 // bool /* IOSerial implements a RS232 IO Layer */ class IOModem : public IOSerial { Q_OBJECT public: IOModem(const Profile &); ~IOModem(); - QString identifier() const; - QString name() const; + virtual QString identifier() const; + virtual QString name() const; + virtual QBitArray supports() const; + virtual bool isConnected(); signals: void received(const QByteArray &); void error(int, const QString &); public slots: - bool open(); - void close(); - void reload(const Profile &); + virtual void send( const QByteArray& ); + virtual bool open(); + virtual void close(); + virtual void reload(const Profile &); private: QString m_initString, m_resetString, m_dialPref1, m_dialSuf1, m_dialPref2, m_dialSuf2, m_dialPref3, m_dialSuf3, m_connect, m_hangup, m_cancel; int m_dialTime, m_delayRedial, m_numberTries, m_dtrDropTime, m_bpsDetect, m_dcdLines, m_multiLineUntag; Profile m_profile; private slots: void slotExited(OProcess* proc); }; #endif diff --git a/noncore/apps/opie-console/io_serial.h b/noncore/apps/opie-console/io_serial.h index edceac6..20c1ae1 100644 --- a/noncore/apps/opie-console/io_serial.h +++ b/noncore/apps/opie-console/io_serial.h @@ -1,72 +1,73 @@ #ifndef OPIE_IO_SERIAL #define OPIE_IO_SERIAL #include <qsocketnotifier.h> #include "io_layer.h" /* Default values to be used if the profile information is incomplete */ #define SERIAL_DEFAULT_DEVICE "/dev/ttyS0" #define SERIAL_DEFAULT_BAUD 9600 #define SERIAL_DEFAULT_PARITY 0 #define SERIAL_DEFAULT_DBITS 8 #define SERIAL_DEFAULT_SBITS 1 #define SERIAL_DEFAULT_FLOW 0 /* IOSerial implements a RS232 IO Layer */ class IOSerial : public IOLayer { Q_OBJECT public: enum Parity { ParityNone = 0, ParityEven, ParityOdd, ParitySpace, ParityMark }; enum Flow { FlowHW = 0x01, FlowSW = 0x02 }; IOSerial(const Profile &); ~IOSerial(); - QString identifier() const; - QString name() const; + virtual QString identifier() const; + virtual QString name() const; int rawIO()const; void closeRawIO(int fd ); - QBitArray supports()const; - bool isConnected(); + virtual QBitArray supports() const; + virtual bool isConnected(); + /*signals: void received(const QByteArray &); void error(int, const QString &); */ public slots: - void send(const QByteArray &); - bool open(); - void close(); - void reload(const Profile &); + virtual void send(const QByteArray &); + virtual bool open(); + virtual void close(); + virtual void reload(const Profile &); protected: int baud(int baud) const; void internDetach(); void internAttach(); protected slots: void dataArrived(); void errorOccured(); protected: QSocketNotifier *m_read; QSocketNotifier *m_error; QString m_device; int m_baud; int m_parity; int m_dbits; int m_sbits; int m_flow; int m_fd; bool m_connected; }; #endif /* OPIE_IO_SERIAL */ diff --git a/noncore/apps/opie-console/opie-console.pro b/noncore/apps/opie-console/opie-console.pro index 1bb9f35..5ffa46f 100644 --- a/noncore/apps/opie-console/opie-console.pro +++ b/noncore/apps/opie-console/opie-console.pro @@ -1,77 +1,77 @@ TEMPLATE = app -TMAKE_CXXFLAGS =-DHAVE_OPENPTY -CONFIG = qt warn_on release +TMAKE_CXXFLAGS += -DHAVE_OPENPTY +CONFIG += qt warn_on release #CONFIG = qt debug DESTDIR = $(OPIEDIR)/bin HEADERS = io_layer.h io_serial.h io_irda.h io_bt.h io_modem.h \ file_layer.h filetransfer.h \ metafactory.h \ session.h \ mainwindow.h \ profile.h \ profileconfig.h \ profilemanager.h \ configwidget.h \ tabwidget.h \ configdialog.h \ keytrans.h \ transferdialog.h \ profiledialogwidget.h \ profileeditordialog.h \ default.h \ iolayerbase.h \ serialconfigwidget.h irdaconfigwidget.h \ btconfigwidget.h modemconfigwidget.h \ atconfigdialog.h dialdialog.h \ procctl.h \ function_keyboard.h \ receive_layer.h filereceive.h \ script.h \ dialer.h \ terminalwidget.h \ emulation_handler.h TECommon.h \ - TEHistroy.h TEScreen.h TEWidget.h \ + TEHistory.h TEScreen.h TEWidget.h \ TEmuVt102.h TEmulation.h MyPty.h \ consoleconfigwidget.h SOURCES = io_layer.cpp io_serial.cpp io_irda.cpp io_bt.cpp io_modem.cpp \ file_layer.cpp filetransfer.cpp \ main.cpp \ metafactory.cpp \ session.cpp \ mainwindow.cpp \ profile.cpp \ profileconfig.cpp \ profilemanager.cpp \ tabwidget.cpp \ configdialog.cpp \ keytrans.cpp \ transferdialog.cpp \ profiledialogwidget.cpp \ profileeditordialog.cpp \ iolayerbase.cpp \ serialconfigwidget.cpp irdaconfigwidget.cpp \ btconfigwidget.cpp modemconfigwidget.cpp \ atconfigdialog.cpp dialdialog.cpp \ default.cpp procctl.cpp \ function_keyboard.cpp \ receive_layer.cpp filereceive.cpp \ script.cpp \ dialer.cpp \ terminalwidget.cpp \ emulation_handler.cpp TEHistory.cpp \ TEScreen.cpp TEWidget.cpp \ TEmuVt102.cpp TEmulation.cpp MyPty.cpp \ consoleconfigwidget.cpp INTERFACES = configurebase.ui editbase.ui INCLUDEPATH += $(OPIEDIR)/include DEPENDPATH += $(OPIEDIR)/include -LIBS += -lqpe -lopie +LIBS += -lqpe -lopie -lutil TARGET = opie-console include ( ../../../include.pro ) |