1/*
2 * kPPP: A pppd Front End for the KDE project
3 *
4 * $Id$
5 *
6 * Copyright (C) 1997 Bernd Johannes Wuebben
7 * wuebben@math.cornell.edu
8 *
9 * This file was added by Harri Porten <porten@tu-harburg.de>
10 *
11 *
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.
16 *
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.
21 *
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.
25 */
26
27#ifndef _MODEM_H_
28#define _MODEM_H_
29
30#include <qdir.h>
31
32#include <sys/types.h>
33#include <termios.h>
34#include <unistd.h>
35
36#include <qsocketnotifier.h>
37
38#include <config-kppp.h>
39
40class KCmdLineArgs;
41
42void alarm_handler(int);
43
44class Modem : public QObject {
45 Q_OBJECT
46public:
47 Modem();
48 ~Modem();
49
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();
63
64 int lockdevice();
65 void unlockdevice();
66
67public:
68 static Modem *modem;
69
70signals:
71 void charWaiting(unsigned char);
72
73private slots:
74 void startNotifier();
75 void stopNotifier();
76 void readtty(int);
77
78private:
79 void escape_to_command_mode();
80 KCmdLineArgs *args;
81
82private:
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;
90};
91
92#endif
93
94
95