Contact cannot be a null ptr, and it is accessed before anyway. Disscussed with kedge.
[kdenetwork.git] / kppp / modem.h
blob53e255b9482c2d2a7e967f7206f67d450d3e7c50
1 /*
2 * kPPP: A pppd Front End for the KDE project
4 * $Id$
6 * Copyright (C) 1997 Bernd Johannes Wuebben
7 * wuebben@math.cornell.edu
9 * This file was added by Harri Porten <porten@tu-harburg.de>
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU Library General Public
14 * License as published by the Free Software Foundation; either
15 * version 2 of the License, or (at your option) any later version.
17 * This program is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20 * Library General Public License for more details.
22 * You should have received a copy of the GNU Library General Public
23 * License along with this program; if not, write to the Free
24 * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
27 #ifndef _MODEM_H_
28 #define _MODEM_H_
30 #include <qdir.h>
32 #include <sys/types.h>
33 #include <termios.h>
34 #include <unistd.h>
36 #include <qsocketnotifier.h>
38 #include <config-kppp.h>
40 class KCmdLineArgs;
42 void alarm_handler(int);
44 class Modem : public QObject {
45 Q_OBJECT
46 public:
47 Modem();
48 ~Modem();
50 bool opentty();
51 bool closetty();
52 bool hangup();
53 bool writeChar(unsigned char);
54 bool writeLine(const char *);
55 bool dataMode() const { return data_mode; }
56 void setDataMode(bool set) { data_mode = set; }
57 const QString modemMessage();
58 speed_t modemspeed();
59 static QString parseModemSpeed(const QString &);
60 void notify(const QObject *, const char *);
61 void stop();
62 void flush();
64 int lockdevice();
65 void unlockdevice();
67 public:
68 static Modem *modem;
70 signals:
71 void charWaiting(unsigned char);
73 private slots:
74 void startNotifier();
75 void stopNotifier();
76 void readtty(int);
78 private:
79 void escape_to_command_mode();
80 KCmdLineArgs *args;
82 private:
83 int modemfd;
84 QSocketNotifier *sn;
85 bool data_mode;
86 QString errmsg;
87 struct termios initial_tty;
88 struct termios tty;
89 bool modem_is_locked;
92 #endif