Diffstat (limited to 'noncore/settings/networksettings/ppp/modem.h') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/settings/networksettings/ppp/modem.h | 98 |
1 files changed, 98 insertions, 0 deletions
diff --git a/noncore/settings/networksettings/ppp/modem.h b/noncore/settings/networksettings/ppp/modem.h new file mode 100644 index 0000000..c23524a --- a/dev/null +++ b/noncore/settings/networksettings/ppp/modem.h | |||
@@ -0,0 +1,98 @@ | |||
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., 675 Mass Ave, Cambridge, MA 02139, 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.h> | ||
39 | |||
40 | void alarm_handler(int); | ||
41 | const char *pppdPath(); | ||
42 | |||
43 | class Modem : public QObject { | ||
44 | Q_OBJECT | ||
45 | public: | ||
46 | Modem(); | ||
47 | ~Modem(); | ||
48 | |||
49 | const QString getDevice() {return device;}; | ||
50 | void setDevice(const QString dev) {device = dev;}; | ||
51 | |||
52 | bool opentty(); | ||
53 | bool closetty(); | ||
54 | bool hangup(); | ||
55 | bool writeChar(unsigned char); | ||
56 | bool writeLine(const char *); | ||
57 | bool dataMode() const { return data_mode; } | ||
58 | void setDataMode(bool set) { data_mode = set; } | ||
59 | const QString modemMessage(); | ||
60 | speed_t modemspeed(); | ||
61 | static QString parseModemSpeed(const QString &); | ||
62 | void notify(const QObject *, const char *); | ||
63 | void stop(); | ||
64 | void flush(); | ||
65 | |||
66 | int lockdevice(); | ||
67 | void unlockdevice(); | ||
68 | |||
69 | public: | ||
70 | static Modem *modem; | ||
71 | |||
72 | signals: | ||
73 | void charWaiting(unsigned char); | ||
74 | |||
75 | private slots: | ||
76 | void startNotifier(); | ||
77 | void stopNotifier(); | ||
78 | void readtty(int); | ||
79 | |||
80 | private: | ||
81 | void escape_to_command_mode(); | ||
82 | int openLockfile(QString,int); | ||
83 | |||
84 | private: | ||
85 | QString device; | ||
86 | QString lockfile; | ||
87 | int modemfd; | ||
88 | QSocketNotifier *sn; | ||
89 | bool data_mode; | ||
90 | QString errmsg; | ||
91 | struct termios initial_tty; | ||
92 | struct termios tty; | ||
93 | bool modem_is_locked; | ||
94 | }; | ||
95 | |||
96 | #endif | ||
97 | |||
98 | |||