summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/opie-console/atconfigdialog.cpp16
-rw-r--r--noncore/apps/opie-console/atconfigdialog.h19
-rw-r--r--noncore/apps/opie-console/dialer.cpp37
-rw-r--r--noncore/apps/opie-console/dialer.h1
-rw-r--r--noncore/apps/opie-console/io_modem.h18
5 files changed, 47 insertions, 44 deletions
diff --git a/noncore/apps/opie-console/atconfigdialog.cpp b/noncore/apps/opie-console/atconfigdialog.cpp
index 87a08f6..5c02692 100644
--- a/noncore/apps/opie-console/atconfigdialog.cpp
+++ b/noncore/apps/opie-console/atconfigdialog.cpp
@@ -1,199 +1,215 @@
1 1
2#include <qlineedit.h> 2#include <qlineedit.h>
3#include <qspinbox.h> 3#include <qspinbox.h>
4#include <qlayout.h> 4#include <qlayout.h>
5#include <qcombobox.h> 5#include <qcombobox.h>
6#include <qtabwidget.h> 6#include <qtabwidget.h>
7#include <qlabel.h> 7#include <qlabel.h>
8#include <qcombobox.h> 8#include <qcombobox.h>
9#include <qscrollview.h> 9#include <qscrollview.h>
10 10
11#include "atconfigdialog.h" 11#include "atconfigdialog.h"
12#include "io_modem.h"
12 13
13 14
14ATConfigDialog::ATConfigDialog( QWidget* parent, const char* name, bool modal, WFlags fl ) 15ATConfigDialog::ATConfigDialog( QWidget* parent, const char* name, bool modal, WFlags fl )
15 : QDialog( parent, name, modal, fl ) { 16 : QDialog( parent, name, modal, fl ) {
16 17
17 18
18 setCaption( tr( "Dialing parameter setup" ) ); 19 setCaption( tr( "Dialing parameter setup" ) );
19 20
20 QVBoxLayout *layout = new QVBoxLayout( this ); 21 QVBoxLayout *layout = new QVBoxLayout( this );
21 QTabWidget *tabWidget = new QTabWidget( this ); 22 QTabWidget *tabWidget = new QTabWidget( this );
22 23
23 tabWidget->addTab( tab0( this ), tr("Settings1") ); 24 tabWidget->addTab( tab0( this ), tr("Settings1") );
24 tabWidget->addTab( tab1( this ), tr("Settings2") ); 25 tabWidget->addTab( tab1( this ), tr("Settings2") );
25 26
26 layout->addWidget( tabWidget ); 27 layout->addWidget( tabWidget );
27 28
28} 29}
29 30
30QWidget* ATConfigDialog::tab0( QWidget* parent) { 31QWidget* ATConfigDialog::tab0( QWidget* parent) {
31 32
32 33
33 QScrollView* sv = new QScrollView( parent ); 34 QScrollView* sv = new QScrollView( parent );
34 35
35 QWidget *returnWidget = new QWidget( sv->viewport() ); 36 QWidget *returnWidget = new QWidget( sv->viewport() );
36 sv->setResizePolicy( QScrollView::AutoOneFit ); 37 sv->setResizePolicy( QScrollView::AutoOneFit );
37// sv->setHScrollBarMode( QScrollView::AlwaysOff ); 38// sv->setHScrollBarMode( QScrollView::AlwaysOff );
38// sv->setFrameShape( QFrame::NoFrame ); 39// sv->setFrameShape( QFrame::NoFrame );
39 40
40 41
41 42
42 43
43 QGridLayout *layout = new QGridLayout( returnWidget, 10, 2 ); 44 QGridLayout *layout = new QGridLayout( returnWidget, 10, 2 );
44 45
45 QLabel *initStringLabel = new QLabel( tr("Init string "), returnWidget ); 46 QLabel *initStringLabel = new QLabel( tr("Init string "), returnWidget );
46 initStringLine = new QLineEdit( returnWidget ); 47 initStringLine = new QLineEdit( returnWidget );
47 layout->addWidget( initStringLabel, 0, 0 ); 48 layout->addWidget( initStringLabel, 0, 0 );
48 layout->addWidget( initStringLine, 0, 1 ); 49 layout->addWidget( initStringLine, 0, 1 );
49 50
50 QLabel *resetStringLabel = new QLabel( tr("Reset string "), returnWidget ); 51 QLabel *resetStringLabel = new QLabel( tr("Reset string "), returnWidget );
51 resetStringLine = new QLineEdit( returnWidget ); 52 resetStringLine = new QLineEdit( returnWidget );
52 layout->addWidget( resetStringLabel, 1, 0 ); 53 layout->addWidget( resetStringLabel, 1, 0 );
53 layout->addWidget( resetStringLine, 1, 1 ); 54 layout->addWidget( resetStringLine, 1, 1 );
54 55
55 QLabel *dialPref1Label = new QLabel( tr("Dialing prefix #1 " ), returnWidget ); 56 QLabel *dialPref1Label = new QLabel( tr("Dialing prefix #1 " ), returnWidget );
56 dialPref1Line = new QLineEdit( returnWidget ); 57 dialPref1Line = new QLineEdit( returnWidget );
57 layout->addWidget( dialPref1Label, 2, 0 ); 58 layout->addWidget( dialPref1Label, 2, 0 );
58 layout->addWidget( dialPref1Line, 2, 1 ); 59 layout->addWidget( dialPref1Line, 2, 1 );
59 60
60 QLabel *dialSuf1Label = new QLabel( tr("Dialing suffix #1 " ), returnWidget ); 61 QLabel *dialSuf1Label = new QLabel( tr("Dialing suffix #1 " ), returnWidget );
61 dialSuf1Line = new QLineEdit( returnWidget ); 62 dialSuf1Line = new QLineEdit( returnWidget );
62 layout->addWidget( dialSuf1Label, 3, 0 ); 63 layout->addWidget( dialSuf1Label, 3, 0 );
63 layout->addWidget( dialSuf1Line, 3, 1 ); 64 layout->addWidget( dialSuf1Line, 3, 1 );
64 65
65 QLabel *dialPref2Label = new QLabel( tr("Dialing prefix #2 " ), returnWidget ); 66 QLabel *dialPref2Label = new QLabel( tr("Dialing prefix #2 " ), returnWidget );
66 dialPref2Line = new QLineEdit( returnWidget ); 67 dialPref2Line = new QLineEdit( returnWidget );
67 layout->addWidget( dialPref2Label, 4, 0 ); 68 layout->addWidget( dialPref2Label, 4, 0 );
68 layout->addWidget( dialPref2Line, 4, 1 ); 69 layout->addWidget( dialPref2Line, 4, 1 );
69 70
70 QLabel *dialSuf2Label = new QLabel( tr("Dialing suffix #2 " ), returnWidget ); 71 QLabel *dialSuf2Label = new QLabel( tr("Dialing suffix #2 " ), returnWidget );
71 dialSuf2Line = new QLineEdit( returnWidget ); 72 dialSuf2Line = new QLineEdit( returnWidget );
72 layout->addWidget( dialSuf2Label, 5, 0 ); 73 layout->addWidget( dialSuf2Label, 5, 0 );
73 layout->addWidget( dialSuf2Line, 5, 1 ); 74 layout->addWidget( dialSuf2Line, 5, 1 );
74 75
75 QLabel *dialPref3Label = new QLabel( tr("Dialing prefix #3 " ), returnWidget ); 76 QLabel *dialPref3Label = new QLabel( tr("Dialing prefix #3 " ), returnWidget );
76 dialPref3Line = new QLineEdit( returnWidget ); 77 dialPref3Line = new QLineEdit( returnWidget );
77 layout->addWidget( dialPref3Label, 6, 0 ); 78 layout->addWidget( dialPref3Label, 6, 0 );
78 layout->addWidget( dialPref3Line, 6, 1 ); 79 layout->addWidget( dialPref3Line, 6, 1 );
79 80
80 QLabel *dialSuf3Label = new QLabel( tr("Dialing suffix #3 " ), returnWidget ); 81 QLabel *dialSuf3Label = new QLabel( tr("Dialing suffix #3 " ), returnWidget );
81 dialSuf3Line = new QLineEdit( returnWidget ); 82 dialSuf3Line = new QLineEdit( returnWidget );
82 layout->addWidget( dialSuf3Label, 7, 0 ); 83 layout->addWidget( dialSuf3Label, 7, 0 );
83 layout->addWidget( dialSuf3Line, 7, 1 ); 84 layout->addWidget( dialSuf3Line, 7, 1 );
84 85
85 QLabel *connectLabel = new QLabel( tr("Connect string " ), returnWidget ); 86 QLabel *connectLabel = new QLabel( tr("Connect string " ), returnWidget );
86 connectLine = new QLineEdit( returnWidget ); 87 connectLine = new QLineEdit( returnWidget );
87 layout->addWidget( connectLabel, 8, 0 ); 88 layout->addWidget( connectLabel, 8, 0 );
88 layout->addWidget( connectLine, 8, 1 ); 89 layout->addWidget( connectLine, 8, 1 );
89 90
90 QLabel *hangupLabel = new QLabel( tr("Hang-up string " ), returnWidget ); 91 QLabel *hangupLabel = new QLabel( tr("Hang-up string " ), returnWidget );
91 hangupLine = new QLineEdit( returnWidget ); 92 hangupLine = new QLineEdit( returnWidget );
92 layout->addWidget( hangupLabel, 9, 0 ); 93 layout->addWidget( hangupLabel, 9, 0 );
93 layout->addWidget( hangupLine, 9, 1 ); 94 layout->addWidget( hangupLine, 9, 1 );
94 95
95 sv->addChild( returnWidget ); 96 sv->addChild( returnWidget );
96 97
97 return sv; 98 return sv;
98 99
99} 100}
100 101
101QWidget* ATConfigDialog::tab1( QWidget* parent ) { 102QWidget* ATConfigDialog::tab1( QWidget* parent ) {
102 103
103 104
104 QWidget *returnWidget = new QWidget( parent ); 105 QWidget *returnWidget = new QWidget( parent );
105 106
106 QGridLayout *layout = new QGridLayout( returnWidget, 8, 2 ); 107 QGridLayout *layout = new QGridLayout( returnWidget, 8, 2 );
107 108
108 QLabel *dialTimeLabel = new QLabel( tr("Dial time " ), returnWidget ); 109 QLabel *dialTimeLabel = new QLabel( tr("Dial time " ), returnWidget );
109 dialTimeSpin = new QSpinBox( returnWidget ); 110 dialTimeSpin = new QSpinBox( returnWidget );
110 layout->addWidget( dialTimeLabel, 0, 0 ); 111 layout->addWidget( dialTimeLabel, 0, 0 );
111 layout->addWidget( dialTimeSpin, 0, 1 ); 112 layout->addWidget( dialTimeSpin, 0, 1 );
112 113
113 QLabel *delayRedialLabel = new QLabel( tr("Delay before redial " ), returnWidget ); 114 QLabel *delayRedialLabel = new QLabel( tr("Delay before redial " ), returnWidget );
114 delayRedialSpin = new QSpinBox( returnWidget ); 115 delayRedialSpin = new QSpinBox( returnWidget );
115 layout->addWidget( delayRedialLabel, 1, 0 ); 116 layout->addWidget( delayRedialLabel, 1, 0 );
116 layout->addWidget( delayRedialSpin, 1, 1 ); 117 layout->addWidget( delayRedialSpin, 1, 1 );
117 118
118 QLabel *numberTriesLabel = new QLabel( tr("Number of tries " ), returnWidget ); 119 QLabel *numberTriesLabel = new QLabel( tr("Number of tries " ), returnWidget );
119 numberTriesSpin = new QSpinBox( returnWidget ); 120 numberTriesSpin = new QSpinBox( returnWidget );
120 layout->addWidget( numberTriesLabel, 2, 0 ); 121 layout->addWidget( numberTriesLabel, 2, 0 );
121 layout->addWidget( numberTriesSpin, 2, 1 ); 122 layout->addWidget( numberTriesSpin, 2, 1 );
122 123
123 QLabel *dtrDropTimeLabel = new QLabel( tr("DTR drop time (0=no) " ), returnWidget ); 124 QLabel *dtrDropTimeLabel = new QLabel( tr("DTR drop time (0=no) " ), returnWidget );
124 dtrDropTimeSpin = new QSpinBox( returnWidget ); 125 dtrDropTimeSpin = new QSpinBox( returnWidget );
125 layout->addWidget( dtrDropTimeLabel, 3, 0 ); 126 layout->addWidget( dtrDropTimeLabel, 3, 0 );
126 layout->addWidget( dtrDropTimeSpin, 3, 1 ); 127 layout->addWidget( dtrDropTimeSpin, 3, 1 );
127 128
128 QLabel *bpsDetectLabel = new QLabel( tr("Auto bps detect " ), returnWidget ); 129 QLabel *bpsDetectLabel = new QLabel( tr("Auto bps detect " ), returnWidget );
129 bpsDetectBox = new QComboBox( returnWidget ); 130 bpsDetectBox = new QComboBox( returnWidget );
130 layout->addWidget( bpsDetectLabel, 4, 0 ); 131 layout->addWidget( bpsDetectLabel, 4, 0 );
131 layout->addWidget( bpsDetectBox, 4, 1 ); 132 layout->addWidget( bpsDetectBox, 4, 1 );
132 bpsDetectBox->insertItem( tr("No") ); 133 bpsDetectBox->insertItem( tr("No") );
133 bpsDetectBox->insertItem( tr("Yes") ); 134 bpsDetectBox->insertItem( tr("Yes") );
134 135
135 QLabel *dcdLinesLabel = new QLabel( tr("Modem has DCD line " ), returnWidget ); 136 QLabel *dcdLinesLabel = new QLabel( tr("Modem has DCD line " ), returnWidget );
136 dcdLinesBox = new QComboBox( returnWidget ); 137 dcdLinesBox = new QComboBox( returnWidget );
137 layout->addWidget( dcdLinesLabel, 5, 0 ); 138 layout->addWidget( dcdLinesLabel, 5, 0 );
138 layout->addWidget( dcdLinesBox, 5, 1 ); 139 layout->addWidget( dcdLinesBox, 5, 1 );
139 dcdLinesBox->insertItem( tr("No") ); 140 dcdLinesBox->insertItem( tr("No") );
140 dcdLinesBox->insertItem( tr("Yes") ); 141 dcdLinesBox->insertItem( tr("Yes") );
141 142
142 QLabel *multiLineUntagLabel = new QLabel( tr("Multi-line untag " ), returnWidget ); 143 QLabel *multiLineUntagLabel = new QLabel( tr("Multi-line untag " ), returnWidget );
143 multiLineUntagBox = new QComboBox( returnWidget ); 144 multiLineUntagBox = new QComboBox( returnWidget );
144 layout->addWidget( multiLineUntagLabel, 6, 0 ); 145 layout->addWidget( multiLineUntagLabel, 6, 0 );
145 layout->addWidget( multiLineUntagBox, 6, 1 ); 146 layout->addWidget( multiLineUntagBox, 6, 1 );
146 multiLineUntagBox->insertItem( tr("No") ); 147 multiLineUntagBox->insertItem( tr("No") );
147 multiLineUntagBox->insertItem( tr("Yes") ); 148 multiLineUntagBox->insertItem( tr("Yes") );
148 149
149 return returnWidget; 150 return returnWidget;
150 151
151} 152}
152 153
153 154
154void ATConfigDialog::readConfig( const Profile& config ) { 155void ATConfigDialog::readConfig( const Profile& config ) {
155 156
156 initStringLine->setText( config.readEntry("InitString", MODEM_DEFAULT_INIT_STRING ) ); 157 initStringLine->setText( config.readEntry("InitString", MODEM_DEFAULT_INIT_STRING ) );
157 resetStringLine->setText( config.readEntry("ResetString", MODEM_DEFAULT_RESET_STRING ) ); 158 resetStringLine->setText( config.readEntry("ResetString", MODEM_DEFAULT_RESET_STRING ) );
158 dialPref1Line->setText( config.readEntry("DialPrefix1", MODEM_DEFAULT_DIAL_PREFIX1 ) ); 159 dialPref1Line->setText( config.readEntry("DialPrefix1", MODEM_DEFAULT_DIAL_PREFIX1 ) );
159 dialSuf1Line->setText( config.readEntry("DialSuffix1", MODEM_DEFAULT_DIAL_SUFFIX1 ) ); 160 dialSuf1Line->setText( config.readEntry("DialSuffix1", MODEM_DEFAULT_DIAL_SUFFIX1 ) );
160 dialPref2Line->setText( config.readEntry("DialPrefix2", MODEM_DEFAULT_DIAL_PREFIX1 ) ); 161 dialPref2Line->setText( config.readEntry("DialPrefix2", MODEM_DEFAULT_DIAL_PREFIX1 ) );
161 dialSuf2Line->setText( config.readEntry("DialSuffix2", MODEM_DEFAULT_DIAL_SUFFIX1 ) ); 162 dialSuf2Line->setText( config.readEntry("DialSuffix2", MODEM_DEFAULT_DIAL_SUFFIX1 ) );
162 dialPref3Line->setText( config.readEntry("DialPrefix3", MODEM_DEFAULT_DIAL_PREFIX1 ) ); 163 dialPref3Line->setText( config.readEntry("DialPrefix3", MODEM_DEFAULT_DIAL_PREFIX1 ) );
163 dialSuf3Line->setText( config.readEntry("DialSuffix3", MODEM_DEFAULT_DIAL_SUFFIX1 ) ); 164 dialSuf3Line->setText( config.readEntry("DialSuffix3", MODEM_DEFAULT_DIAL_SUFFIX1 ) );
164 connectLine->setText( config.readEntry("DefaultConnect", MODEM_DEFAULT_CONNECT_STRING ) ); 165 connectLine->setText( config.readEntry("DefaultConnect", MODEM_DEFAULT_CONNECT_STRING ) );
165 hangupLine->setText( config.readEntry("HangupString", MODEM_DEFAULT_HANGUP_STRING ) ); 166 hangupLine->setText( config.readEntry("HangupString", MODEM_DEFAULT_HANGUP_STRING ) );
166 dialTimeSpin->setValue( config.readNumEntry("DialTime", MODEM_DEFAULT_DIAL_TIME ) ); 167 dialTimeSpin->setValue( config.readNumEntry("DialTime", MODEM_DEFAULT_DIAL_TIME ) );
167 delayRedialSpin->setValue( config.readNumEntry("DelayRedial", MODEM_DEFAULT_DELAY_REDIAL ) ); 168 delayRedialSpin->setValue( config.readNumEntry("DelayRedial", MODEM_DEFAULT_DELAY_REDIAL ) );
168 numberTriesSpin->setValue( config.readNumEntry("NumberTries", MODEM_DEFAULT_NUMBER_TRIES ) ); 169 numberTriesSpin->setValue( config.readNumEntry("NumberTries", MODEM_DEFAULT_NUMBER_TRIES ) );
169 dtrDropTimeSpin->setValue( config.readNumEntry("DTRDRopTime", MODEM_DEFAULT_DTR_DROP_TIME ) ); 170 dtrDropTimeSpin->setValue( config.readNumEntry("DTRDRopTime", MODEM_DEFAULT_DTR_DROP_TIME ) );
170 bpsDetectBox->setCurrentItem( config.readBoolEntry("BPSDetect", MODEM_DEFAULT_BPS_DETECT ) ); 171 bpsDetectBox->setCurrentItem( config.readBoolEntry("BPSDetect", MODEM_DEFAULT_BPS_DETECT ) );
171 dcdLinesBox->setCurrentItem( config.readBoolEntry("DCDLines", MODEM_DEFAULT_DCD_LINES ) ); 172 dcdLinesBox->setCurrentItem( config.readBoolEntry("DCDLines", MODEM_DEFAULT_DCD_LINES ) );
172 multiLineUntagBox->setCurrentItem( config.readBoolEntry("MultiLineUntag", MODEM_DEFAULT_MULTI_LINE_UNTAG ) ); 173 multiLineUntagBox->setCurrentItem( config.readBoolEntry("MultiLineUntag", MODEM_DEFAULT_MULTI_LINE_UNTAG ) );
174
175 // Not implemented yet
176 resetStringLine->setEnabled(false);
177 dialSuf1Line->setEnabled(false);
178 dialPref2Line->setEnabled(false);
179 dialSuf2Line->setEnabled(false);
180 dialPref3Line->setEnabled(false);
181 dialSuf3Line->setEnabled(false);
182 dialTimeSpin->setEnabled(false);
183 delayRedialSpin->setEnabled(false);
184 numberTriesSpin->setEnabled(false);
185 dtrDropTimeSpin->setEnabled(false);
186 bpsDetectBox->setEnabled(false);
187 dcdLinesBox->setEnabled(false);
188 multiLineUntagBox->setEnabled(false);
173} 189}
174 190
175void ATConfigDialog::writeConfig( Profile& config ) { 191void ATConfigDialog::writeConfig( Profile& config ) {
176 192
177 config.writeEntry( "InitString", initStringLine->text() ); 193 config.writeEntry( "InitString", initStringLine->text() );
178 config.writeEntry( "ResetString", resetStringLine->text() ); 194 config.writeEntry( "ResetString", resetStringLine->text() );
179 config.writeEntry( "DialPrefix1", dialPref1Line->text() ); 195 config.writeEntry( "DialPrefix1", dialPref1Line->text() );
180 config.writeEntry( "DialSuffix1", dialSuf1Line->text() ); 196 config.writeEntry( "DialSuffix1", dialSuf1Line->text() );
181 config.writeEntry( "DialPrefix2", dialPref2Line->text() ); 197 config.writeEntry( "DialPrefix2", dialPref2Line->text() );
182 config.writeEntry( "DialSuffix2", dialSuf2Line->text() ); 198 config.writeEntry( "DialSuffix2", dialSuf2Line->text() );
183 config.writeEntry( "DialPrefix3", dialPref3Line->text() ); 199 config.writeEntry( "DialPrefix3", dialPref3Line->text() );
184 config.writeEntry( "DialSuffix3", dialSuf3Line->text() ); 200 config.writeEntry( "DialSuffix3", dialSuf3Line->text() );
185 config.writeEntry( "DefaultConnect", connectLine->text() ); 201 config.writeEntry( "DefaultConnect", connectLine->text() );
186 config.writeEntry( "HangupString", hangupLine->text() ); 202 config.writeEntry( "HangupString", hangupLine->text() );
187 config.writeEntry( "DialTime", dialTimeSpin->value() ); 203 config.writeEntry( "DialTime", dialTimeSpin->value() );
188 config.writeEntry( "DelayRedial", delayRedialSpin->value() ); 204 config.writeEntry( "DelayRedial", delayRedialSpin->value() );
189 config.writeEntry( "NumberTries", numberTriesSpin->value() ); 205 config.writeEntry( "NumberTries", numberTriesSpin->value() );
190 config.writeEntry( "DTRDRopTime", dtrDropTimeSpin->value() ); 206 config.writeEntry( "DTRDRopTime", dtrDropTimeSpin->value() );
191 config.writeEntry( "BPSDetect", bpsDetectBox->currentItem() ); 207 config.writeEntry( "BPSDetect", bpsDetectBox->currentItem() );
192 config.writeEntry( "DCDLines", dcdLinesBox->currentItem() ); 208 config.writeEntry( "DCDLines", dcdLinesBox->currentItem() );
193 config.writeEntry( "MultiLineUntag", multiLineUntagBox->currentItem() ); 209 config.writeEntry( "MultiLineUntag", multiLineUntagBox->currentItem() );
194 210
195} 211}
196 212
197 213
198ATConfigDialog::~ATConfigDialog() { 214ATConfigDialog::~ATConfigDialog() {
199} 215}
diff --git a/noncore/apps/opie-console/atconfigdialog.h b/noncore/apps/opie-console/atconfigdialog.h
index 4dd033b..8cb044e 100644
--- a/noncore/apps/opie-console/atconfigdialog.h
+++ b/noncore/apps/opie-console/atconfigdialog.h
@@ -1,69 +1,50 @@
1 1
2#ifndef ATCONFIGDIALOG_H 2#ifndef ATCONFIGDIALOG_H
3#define ATCONFIGDIALOG_H 3#define ATCONFIGDIALOG_H
4 4
5#include <qdialog.h> 5#include <qdialog.h>
6#include "profile.h" 6#include "profile.h"
7 7
8#define MODEM_DEFAULT_INIT_STRING "~^M~ATZ^M~"
9#define MODEM_DEFAULT_RESET_STRING "~^M~ATZ^M~"
10#define MODEM_DEFAULT_DIAL_PREFIX1 "ATDT"
11#define MODEM_DEFAULT_DIAL_SUFFIX1 "^M"
12#define MODEM_DEFAULT_DIAL_PREFIX2 "ATDP"
13#define MODEM_DEFAULT_DIAL_SUFFIX2 "^M"
14#define MODEM_DEFAULT_DIAL_PREFIX3 "ATX1DT"
15#define MODEM_DEFAULT_DIAL_SUFFIX3 ";X4D^M"
16#define MODEM_DEFAULT_CONNECT_STRING "CONNECT"
17#define MODEM_DEFAULT_HANGUP_STRING "~~+++~~ATH^M"
18#define MODEM_DEFAULT_CANCEL_STRING "^M"
19#define MODEM_DEFAULT_DIAL_TIME 45
20#define MODEM_DEFAULT_DELAY_REDIAL 2
21#define MODEM_DEFAULT_NUMBER_TRIES 10
22#define MODEM_DEFAULT_DTR_DROP_TIME 1
23#define MODEM_DEFAULT_BPS_DETECT 0 // bool
24#define MODEM_DEFAULT_DCD_LINES 1 //bool
25#define MODEM_DEFAULT_MULTI_LINE_UNTAG 0 // bool
26
27class QLineEdit; 8class QLineEdit;
28class QSpinBox; 9class QSpinBox;
29class QComboBox; 10class QComboBox;
30 11
31class ATConfigDialog : public QDialog { 12class ATConfigDialog : public QDialog {
32 13
33 Q_OBJECT 14 Q_OBJECT
34 15
35public: 16public:
36 ATConfigDialog( QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 ); 17 ATConfigDialog( QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 );
37 18
38 ~ATConfigDialog(); 19 ~ATConfigDialog();
39 20
40 void readConfig( const Profile& ); 21 void readConfig( const Profile& );
41 void writeConfig( Profile& ); 22 void writeConfig( Profile& );
42 23
43private: 24private:
44 QWidget *tab0( QWidget* parent); 25 QWidget *tab0( QWidget* parent);
45 QWidget *tab1( QWidget* parent); 26 QWidget *tab1( QWidget* parent);
46 27
47private: 28private:
48 QLineEdit *initStringLine; 29 QLineEdit *initStringLine;
49 QLineEdit *resetStringLine; 30 QLineEdit *resetStringLine;
50 QLineEdit *dialPref1Line; 31 QLineEdit *dialPref1Line;
51 QLineEdit *dialSuf1Line; 32 QLineEdit *dialSuf1Line;
52 QLineEdit *dialPref2Line; 33 QLineEdit *dialPref2Line;
53 QLineEdit *dialSuf2Line; 34 QLineEdit *dialSuf2Line;
54 QLineEdit *dialPref3Line; 35 QLineEdit *dialPref3Line;
55 QLineEdit *dialSuf3Line; 36 QLineEdit *dialSuf3Line;
56 QLineEdit *connectLine; 37 QLineEdit *connectLine;
57 QLineEdit *hangupLine; 38 QLineEdit *hangupLine;
58 QSpinBox *dialTimeSpin; 39 QSpinBox *dialTimeSpin;
59 QSpinBox *delayRedialSpin; 40 QSpinBox *delayRedialSpin;
60 QSpinBox *numberTriesSpin; 41 QSpinBox *numberTriesSpin;
61 QSpinBox *dtrDropTimeSpin; 42 QSpinBox *dtrDropTimeSpin;
62 QComboBox *bpsDetectBox; 43 QComboBox *bpsDetectBox;
63 QComboBox *dcdLinesBox; 44 QComboBox *dcdLinesBox;
64 QComboBox *multiLineUntagBox; 45 QComboBox *multiLineUntagBox;
65 46
66}; 47};
67 48
68 49
69#endif 50#endif
diff --git a/noncore/apps/opie-console/dialer.cpp b/noncore/apps/opie-console/dialer.cpp
index 51d4093..d37e406 100644
--- a/noncore/apps/opie-console/dialer.cpp
+++ b/noncore/apps/opie-console/dialer.cpp
@@ -1,296 +1,301 @@
1#include "dialer.h" 1#include "dialer.h"
2 2
3#include <qlayout.h> 3#include <qlayout.h>
4#include <qprogressbar.h> 4#include <qprogressbar.h>
5#include <qlabel.h> 5#include <qlabel.h>
6#include <qpushbutton.h> 6#include <qpushbutton.h>
7#include <qapp.h> 7#include <qapp.h>
8#include <qtimer.h> 8#include <qtimer.h>
9#include <qmessagebox.h> 9#include <qmessagebox.h>
10 10
11#include <unistd.h> 11#include <unistd.h>
12#include <string.h> 12#include <string.h>
13#include <fcntl.h> 13#include <fcntl.h>
14#include <errno.h> 14#include <errno.h>
15 15
16// State machine: | When an error occurs, we don't have to 16// State machine: | When an error occurs, we don't have to
17// | reset everything. 17// | reset everything.
18// (init) <------+ | But if the user wants to reset, 18// (init) <------+ | But if the user wants to reset,
19// | | | we stop dialing immediately. 19// | | | we stop dialing immediately.
20// v | | 20// v | |
21// (options) ----+ | Following the state machine is necessary 21// (options) ----+ | Following the state machine is necessary
22// | \ | to get determinable results. 22// | \ | to get determinable results.
23// v ^ | 23// v ^ |
24// (dial) ----+ | 24// (dial) ----+ |
25// | ^ | 25// | ^ |
26// v | | 26// v | |
27// (online) --+ | 27// (online) --+ |
28// | | 28// | |
29// v | 29// v |
30 30
31 31
32// from atconfigdialog 32// from atconfigdialog
33//initStringLine->setText( config.readEntry("InitString", MODEM_DEFAULT_INIT_STRING ) ); 33//initStringLine->setText( config.readEntry("InitString", MODEM_DEFAULT_INIT_STRING ) );
34//resetStringLine->setText( config.readEntry("ResetString", MODEM_DEFAULT_RESET_STRING ) ); 34//resetStringLine->setText( config.readEntry("ResetString", MODEM_DEFAULT_RESET_STRING ) );
35//dialPref1Line->setText( config.readEntry("DialPrefix1", MODEM_DEFAULT_DIAL_PREFIX1 ) ); 35//dialPref1Line->setText( config.readEntry("DialPrefix1", MODEM_DEFAULT_DIAL_PREFIX1 ) );
36//dialSuf1Line->setText( config.readEntry("DialSuffix1", MODEM_DEFAULT_DIAL_SUFFIX1 ) ); 36//dialSuf1Line->setText( config.readEntry("DialSuffix1", MODEM_DEFAULT_DIAL_SUFFIX1 ) );
37//dialPref2Line->setText( config.readEntry("DialPrefix2", MODEM_DEFAULT_DIAL_PREFIX1 ) ); 37//dialPref2Line->setText( config.readEntry("DialPrefix2", MODEM_DEFAULT_DIAL_PREFIX1 ) );
38//dialSuf2Line->setText( config.readEntry("DialSuffix2", MODEM_DEFAULT_DIAL_SUFFIX1 ) ); 38//dialSuf2Line->setText( config.readEntry("DialSuffix2", MODEM_DEFAULT_DIAL_SUFFIX1 ) );
39//dialPref3Line->setText( config.readEntry("DialPrefix3", MODEM_DEFAULT_DIAL_PREFIX1 ) ); 39//dialPref3Line->setText( config.readEntry("DialPrefix3", MODEM_DEFAULT_DIAL_PREFIX1 ) );
40//dialSuf3Line->setText( config.readEntry("DialSuffix3", MODEM_DEFAULT_DIAL_SUFFIX1 ) ); 40//dialSuf3Line->setText( config.readEntry("DialSuffix3", MODEM_DEFAULT_DIAL_SUFFIX1 ) );
41//connectLine->setText( config.readEntry("DefaultConnect" MODEM_DEFAULT_CONNECT_STRING ) ); 41//connectLine->setText( config.readEntry("DefaultConnect" MODEM_DEFAULT_CONNECT_STRING ) );
42//hangupLine->setText( config.readEntry("HangupString", MODEM_DEFAULT_HANGUP_STRING ) ); 42//hangupLine->setText( config.readEntry("HangupString", MODEM_DEFAULT_HANGUP_STRING ) );
43 43
44// from modemconfigwidget 44// from modemconfigwidget
45//int rad_flow = prof.readNumEntry("Flow"); 45//int rad_flow = prof.readNumEntry("Flow");
46//int rad_parity = prof.readNumEntry("Parity"); 46//int rad_parity = prof.readNumEntry("Parity");
47//int speed = prof.readNumEntry("Speed"); 47//int speed = prof.readNumEntry("Speed");
48//QString number = prof.readEntry("Number"); 48//QString number = prof.readEntry("Number");
49 49
50Dialer::Dialer(const Profile& profile, int fd, QWidget *parent, const char *name) 50Dialer::Dialer(const Profile& profile, int fd, QWidget *parent, const char *name)
51: QDialog(parent, name, true), m_fd(fd), m_profile(profile) 51: QDialog(parent, name, true), m_fd(fd), m_profile(profile)
52{ 52{
53 QVBoxLayout *vbox; 53 QVBoxLayout *vbox;
54 QLabel *desc; 54 QLabel *desc;
55 55
56 //m_profile.writeEntry("InitString", "ATZ"); 56 //m_profile.writeEntry("InitString", "ATZ");
57 //m_profile.writeEntry("DialPrefix1", "ATDT"); 57 //m_profile.writeEntry("DialPrefix1", "ATDT");
58 //m_profile.writeEntry("Termination", "\n"); 58 //m_profile.writeEntry("Termination", "\n");
59 59
60 usercancel = 0; 60 usercancel = 0;
61 cleanshutdown = 0;
61 62
62 fcntl(m_fd, F_SETFL, O_NONBLOCK); 63 fcntl(m_fd, F_SETFL, O_NONBLOCK);
63 64
64 desc = new QLabel(QObject::tr("Dialing number: %1").arg(m_profile.readEntry("Number")), this); 65 desc = new QLabel(QObject::tr("Dialing number: %1").arg(m_profile.readEntry("Number")), this);
65 progress = new QProgressBar(this); 66 progress = new QProgressBar(this);
66 status = new QLabel("", this); 67 status = new QLabel("", this);
67 status->setFrameStyle(QFrame::Panel | QFrame::Sunken); 68 status->setFrameStyle(QFrame::Panel | QFrame::Sunken);
68 cancel = new QPushButton(QObject::tr("Cancel"), this); 69 cancel = new QPushButton(QObject::tr("Cancel"), this);
69 70
70 vbox = new QVBoxLayout(this, 2); 71 vbox = new QVBoxLayout(this, 2);
71 vbox->add(desc); 72 vbox->add(desc);
72 vbox->add(progress); 73 vbox->add(progress);
73 vbox->add(status); 74 vbox->add(status);
74 vbox->add(cancel); 75 vbox->add(cancel);
75 76
76 connect(cancel, SIGNAL(clicked()), SLOT(slotCancel())); 77 connect(cancel, SIGNAL(clicked()), SLOT(slotCancel()));
77 78
78 show(); 79 show();
79 80
80 QTimer::singleShot(500, this, SLOT(slotAutostart())); 81 QTimer::singleShot(500, this, SLOT(slotAutostart()));
81} 82}
82 83
83Dialer::~Dialer() 84Dialer::~Dialer()
84{ 85{
85} 86}
86 87
87void Dialer::setHangupOnly() 88void Dialer::setHangupOnly()
88{ 89{
89 state = state_cancel; 90 state = state_cancel;
90 usercancel = 1; 91 usercancel = 1;
91} 92}
92 93
93void Dialer::slotCancel() 94void Dialer::slotCancel()
94{ 95{
95 if(state != state_online) 96 if(state != state_online)
96 { 97 {
97 usercancel = 1; 98 usercancel = 1;
98 reset(); 99 reset();
99 } 100 }
100 else accept(); 101 else accept();
101} 102}
102 103
103void Dialer::reset() 104void Dialer::reset()
104{ 105{
105 switchState(state_cancel); 106 switchState(state_cancel);
106} 107}
107 108
108void Dialer::slotAutostart() 109void Dialer::slotAutostart()
109{ 110{
110 //state = state_preinit; 111 //state = state_preinit;
111 dial(m_profile.readEntry("Number")); 112 dial(m_profile.readEntry("Number"));
112} 113}
113 114
114void Dialer::dial(const QString& number) 115void Dialer::dial(const QString& number)
115{ 116{
116 while(state != state_online) 117 while(state != state_online)
117 { 118 {
118 if(!usercancel) 119 if(!usercancel)
119 { 120 {
120 state = state_preinit; 121 state = state_preinit;
121 trydial(number); 122 trydial(number);
122 } 123 }
123 else break; 124 else break;
124 } 125 }
125 126
126 if(usercancel) 127 if(usercancel)
127 { 128 {
128 // modem hangup 129 // modem hangup
129 trydial(QString::null); 130 trydial(QString::null);
130 reject(); 131 reject();
131 } 132 }
132} 133}
133 134
134void Dialer::trydial(const QString& number) 135void Dialer::trydial(const QString& number)
135{ 136{
136 //if(state != state_cancel) 137 if(state != state_cancel) switchState(state_preinit);
137 //{ 138 if(cleanshutdown)
138 if(state != state_cancel) switchState(state_preinit); 139 {
139 send("+++ATH"); 140 send(m_profile.readEntry("HangupString"));
141 //send("+++ATH");
140 send(""); 142 send("");
141 //QString response = receive(); 143 }
142 //}
143 144
144 if(state != state_cancel) 145 if(state != state_cancel)
145 { 146 {
146 switchState(state_init); 147 switchState(state_init);
147 send("ATZ"); 148 //send("ATZ");
148 //send(m_profile.readEntry("InitString")); 149 send(m_profile.readEntry("InitString"));
149 QString response2 = receive(); 150 QString response2 = receive();
150 if(!response2.contains("\nOK\r")) 151 if(!response2.contains("\nOK\r"))
151 reset(); 152 reset();
152 } 153 }
153 154
154 if(state != state_cancel) 155 if(state != state_cancel)
155 { 156 {
156 switchState(state_options); 157 switchState(state_options);
157 158
158 send("ATM3L3"); 159 send("ATM3L3");
159 QString response3 = receive(); 160 QString response3 = receive();
160 if(!response3.contains("\nOK\r")) 161 if(!response3.contains("\nOK\r"))
161 reset(); 162 reset();
162 } 163 }
163 164
164 if(state != state_cancel) 165 if(state != state_cancel)
165 { 166 {
166 switchState(state_dialtone); 167 switchState(state_dialtone);
167 168
168 send("ATX1"); 169 send("ATX1");
169 QString response4 = receive(); 170 QString response4 = receive();
170 if(!response4.contains("\nOK\r")) 171 if(!response4.contains("\nOK\r"))
171 reset(); 172 reset();
172 } 173 }
173 174
174 if(state != state_cancel) 175 if(state != state_cancel)
175 { 176 {
176 switchState(state_dialing); 177 switchState(state_dialing);
177 178
178 send(QString("ATDT %1").arg(number)); 179 //send(QString("ATDT %1").arg(number));
179 //send(QString("%1 %2").arg(m_profile.readEntry("DialPrefix1")).arg(number)); 180 send(QString("%1 %2").arg(m_profile.readEntry("DialPrefix1")).arg(number));
180 QString response5 = receive(); 181 QString response5 = receive();
181 if(!response5.contains("\nCONNECT")) 182 if(!response5.contains("\n" + m_profile.readEntry("DefaultConnect")))
182 { 183 {
183 if(response5.contains("BUSY")) 184 if(response5.contains("BUSY"))
184 switchState(state_dialing); 185 switchState(state_dialing);
185 else 186 else
186 { 187 {
187 QMessageBox::warning(this, 188 QMessageBox::warning(this,
188 QObject::tr("Failure"), 189 QObject::tr("Failure"),
189 QObject::tr("Dialing the number failed.")); 190 QObject::tr("Dialing the number failed."));
190 slotCancel(); 191 slotCancel();
191 } 192 }
192 } 193 }
193 } 194 }
194 195
195 if(state != state_cancel) 196 if(state != state_cancel)
196 { 197 {
197 switchState(state_online); 198 switchState(state_online);
198 } 199 }
199} 200}
200 201
201void Dialer::send(const QString& msg) 202void Dialer::send(const QString& msg)
202{ 203{
203 QString m = msg; 204 QString m = msg;
204 int bytes; 205 int bytes;
205 QString termination; 206 QString termination;
206 207
207qWarning("Sending: '%s'", m.latin1()); 208 //qWarning("Sending: '%s'", m.latin1());
208 209
209 termination = "\r"; 210 termination = "\r";
210 //termination = m_profile.readEntry("Termination"); 211 //termination = m_profile.readEntry("Termination");
211 if(termination == "\n") m = m + "\n"; 212 if(termination == "\n") m = m + "\n";
212 else if(termination == "\r") m = m + "\r"; 213 else if(termination == "\r") m = m + "\r";
213 else m = m + "\r\n"; 214 else m = m + "\r\n";
214 215
215 bytes = ::write(m_fd, m.local8Bit(), strlen(m.local8Bit())); 216 bytes = ::write(m_fd, m.local8Bit(), strlen(m.local8Bit()));
216 if(bytes < 0) 217 if(bytes < 0)
217 { 218 {
218 reset(); 219 reset();
219 } 220 }
220} 221}
221 222
222QString Dialer::receive() 223QString Dialer::receive()
223{ 224{
224 QString buf; 225 QString buf;
225 char buffer[1024]; 226 char buffer[1024];
226 int ret; 227 int ret;
227 int counter; 228 int counter;
228 229
229 while(1) 230 while(1)
230 { 231 {
231 ret = ::read(m_fd, buffer, sizeof(buffer)); 232 ret = ::read(m_fd, buffer, sizeof(buffer));
232 233
233 if(ret > 0) 234 if(ret > 0)
234 { 235 {
235 for(int i = 0; i < ret; i++) 236 for(int i = 0; i < ret; i++)
236 buffer[i] = buffer[i] & 0x7F; 237 buffer[i] = buffer[i] & 0x7F;
237 buffer[ret] = 0; 238 buffer[ret] = 0;
238qWarning("Got: '%s'", buffer); 239 //qWarning("Got: '%s'", buffer);
239 buf.append(QString(buffer)); 240 buf.append(QString(buffer));
240 if(buf.contains("OK") || buf.contains("ERROR") || buf.contains("CONNECT") || (buf.contains("BUSY"))) 241 if(buf.contains("OK") || buf.contains("ERROR") || buf.contains("CONNECT") || (buf.contains("BUSY")))
241{ 242 {
242qWarning("Receiving: '%s'", buf.latin1()); 243 //qWarning("Receiving: '%s'", buf.latin1());
244 cleanshutdown = 1;
243 return buf; 245 return buf;
244} 246 }
245 } 247 }
246 else if(ret < 0) 248 else if(ret < 0)
247 { 249 {
248 if(errno != EAGAIN) reset(); 250 if(errno != EAGAIN) reset();
249 else if(!(counter++ % 100)) qApp->processEvents(); 251 else if(!(counter++ % 100)) qApp->processEvents();
250 } 252 }
251 else if(!(counter++ % 100)) qApp->processEvents(); 253 else if(!(counter++ % 100)) qApp->processEvents();
254
255 if(usercancel) return QString::null;
252 } 256 }
253 257
258 cleanshutdown = 1;
254 return QString::null; 259 return QString::null;
255} 260}
256 261
257void Dialer::switchState(int newstate) 262void Dialer::switchState(int newstate)
258{ 263{
259 int oldstate = state; 264 int oldstate = state;
260 state = newstate; 265 state = newstate;
261 266
262 switch(state) 267 switch(state)
263 { 268 {
264 case state_cancel: 269 case state_cancel:
265 status->setText(QObject::tr("Cancelling...")); 270 status->setText(QObject::tr("Cancelling..."));
266 progress->setProgress(0); 271 progress->setProgress(0);
267 break; 272 break;
268 case state_preinit: 273 case state_preinit:
269 status->setText(QObject::tr("Searching modem")); 274 status->setText(QObject::tr("Searching modem"));
270 progress->setProgress(10); 275 progress->setProgress(10);
271 break; 276 break;
272 case state_init: 277 case state_init:
273 status->setText(QObject::tr("Initializing...")); 278 status->setText(QObject::tr("Initializing..."));
274 progress->setProgress(20); 279 progress->setProgress(20);
275 break; 280 break;
276 case state_options: 281 case state_options:
277 status->setText(QObject::tr("Reset speakers")); 282 status->setText(QObject::tr("Reset speakers"));
278 progress->setProgress(30); 283 progress->setProgress(30);
279 break; 284 break;
280 case state_dialtone: 285 case state_dialtone:
281 status->setText(QObject::tr("Turning off dialtone")); 286 status->setText(QObject::tr("Turning off dialtone"));
282 progress->setProgress(40); 287 progress->setProgress(40);
283 break; 288 break;
284 case state_dialing: 289 case state_dialing:
285 if(oldstate != state_dialing) status->setText(QObject::tr("Dial number")); 290 if(oldstate != state_dialing) status->setText(QObject::tr("Dial number"));
286 else status->setText(QObject::tr("Line busy, redialing number")); 291 else status->setText(QObject::tr("Line busy, redialing number"));
287 progress->setProgress(50); 292 progress->setProgress(50);
288 break; 293 break;
289 case state_online: 294 case state_online:
290 status->setText(QObject::tr("Connection established")); 295 status->setText(QObject::tr("Connection established"));
291 progress->setProgress(100); 296 progress->setProgress(100);
292 cancel->setText(QObject::tr("Dismiss")); 297 cancel->setText(QObject::tr("Dismiss"));
293 break; 298 break;
294 } 299 }
295} 300}
296 301
diff --git a/noncore/apps/opie-console/dialer.h b/noncore/apps/opie-console/dialer.h
index 84444b9..28303f3 100644
--- a/noncore/apps/opie-console/dialer.h
+++ b/noncore/apps/opie-console/dialer.h
@@ -1,53 +1,54 @@
1#ifndef DIALER_H 1#ifndef DIALER_H
2#define DIALER_H 2#define DIALER_H
3 3
4#include <qdialog.h> 4#include <qdialog.h>
5 5
6#include "profile.h" 6#include "profile.h"
7 7
8class QLabel; 8class QLabel;
9class QProgressBar; 9class QProgressBar;
10 10
11class Dialer : public QDialog 11class Dialer : public QDialog
12{ 12{
13 Q_OBJECT 13 Q_OBJECT
14 public: 14 public:
15 Dialer(const Profile& profile, int fd, QWidget *parent = NULL, const char *name = NULL); 15 Dialer(const Profile& profile, int fd, QWidget *parent = NULL, const char *name = NULL);
16 ~Dialer(); 16 ~Dialer();
17 void setHangupOnly(); 17 void setHangupOnly();
18 18
19 public slots: 19 public slots:
20 void slotCancel(); 20 void slotCancel();
21 void slotAutostart(); 21 void slotAutostart();
22 22
23 private: 23 private:
24 void switchState(int newstate); 24 void switchState(int newstate);
25 void reset(); 25 void reset();
26 void dial(const QString& number); 26 void dial(const QString& number);
27 void trydial(const QString& number); 27 void trydial(const QString& number);
28 28
29 void send(const QString& msg); 29 void send(const QString& msg);
30 QString receive(); 30 QString receive();
31 31
32 enum States 32 enum States
33 { 33 {
34 state_cancel, 34 state_cancel,
35 state_preinit, 35 state_preinit,
36 state_init, 36 state_init,
37 state_options, 37 state_options,
38 state_dialtone, 38 state_dialtone,
39 state_dialing, 39 state_dialing,
40 state_online 40 state_online
41 }; 41 };
42 42
43 QLabel *status; 43 QLabel *status;
44 QProgressBar *progress; 44 QProgressBar *progress;
45 QPushButton *cancel; 45 QPushButton *cancel;
46 int state; 46 int state;
47 int usercancel; 47 int usercancel;
48 const Profile& m_profile; 48 const Profile& m_profile;
49 int m_fd; 49 int m_fd;
50 int cleanshutdown;
50}; 51};
51 52
52#endif 53#endif
53 54
diff --git a/noncore/apps/opie-console/io_modem.h b/noncore/apps/opie-console/io_modem.h
index 8453b95..1328706 100644
--- a/noncore/apps/opie-console/io_modem.h
+++ b/noncore/apps/opie-console/io_modem.h
@@ -1,71 +1,71 @@
1#ifndef OPIE_IO_MODEM 1#ifndef OPIE_IO_MODEM
2#define OPIE_IO_MODEM 2#define OPIE_IO_MODEM
3 3
4#include <opie/oprocess.h> 4#include <opie/oprocess.h>
5#include "io_serial.h" 5#include "io_serial.h"
6#include "profile.h" 6#include "profile.h"
7 7
8/* Default values to be used if the profile information is incomplete */ 8/* Default values to be used if the profile information is incomplete */
9#define MODEM_DEFAULT_DEVICE "/dev/ttyS0" 9#define MODEM_DEFAULT_DEVICE "/dev/ttyS0"
10#define MODEM_DEFAULT_BAUD 9600 10#define MODEM_DEFAULT_BAUD 9600
11#define MODEM_DEFAULT_PARITY 0 11#define MODEM_DEFAULT_PARITY 0
12#define MODEM_DEFAULT_DBITS 8 12#define MODEM_DEFAULT_DBITS 8
13#define MODEM_DEFAULT_SBITS 1 13#define MODEM_DEFAULT_SBITS 1
14#define MODEM_DEFAULT_FLOW 0 14#define MODEM_DEFAULT_FLOW 0
15 15
16#define MODEM_DEFAULT_INIT_STRING "~^M~ATZ^M~" 16#define MODEM_DEFAULT_INIT_STRING "ATZ"
17#define MODEM_DEFAULT_RESET_STRING "~^M~ATZ^M~" 17#define MODEM_DEFAULT_RESET_STRING "ATZ~"
18#define MODEM_DEFAULT_DIAL_PREFIX1 "ATDT" 18#define MODEM_DEFAULT_DIAL_PREFIX1 "ATDT"
19#define MODEM_DEFAULT_DIAL_SUFFIX1 "^M" 19#define MODEM_DEFAULT_DIAL_SUFFIX1 ""
20#define MODEM_DEFAULT_DIAL_PREFIX2 "ATDP" 20#define MODEM_DEFAULT_DIAL_PREFIX2 ""
21#define MODEM_DEFAULT_DIAL_SUFFIX2 "^M" 21#define MODEM_DEFAULT_DIAL_SUFFIX2 ""
22#define MODEM_DEFAULT_DIAL_PREFIX3 "ATX1DT" 22#define MODEM_DEFAULT_DIAL_PREFIX3 ""
23#define MODEM_DEFAULT_DIAL_SUFFIX3 ";X4D^M" 23#define MODEM_DEFAULT_DIAL_SUFFIX3 ""
24#define MODEM_DEFAULT_CONNECT_STRING "CONNECT" 24#define MODEM_DEFAULT_CONNECT_STRING "CONNECT"
25#define MODEM_DEFAULT_HANGUP_STRING "~~+++~~ATH^M" 25#define MODEM_DEFAULT_HANGUP_STRING "+++ATH"
26#define MODEM_DEFAULT_CANCEL_STRING "^M" 26#define MODEM_DEFAULT_CANCEL_STRING ""
27#define MODEM_DEFAULT_DIAL_TIME 45 27#define MODEM_DEFAULT_DIAL_TIME 45
28#define MODEM_DEFAULT_DELAY_REDIAL 2 28#define MODEM_DEFAULT_DELAY_REDIAL 2
29#define MODEM_DEFAULT_NUMBER_TRIES 10 29#define MODEM_DEFAULT_NUMBER_TRIES 10
30#define MODEM_DEFAULT_DTR_DROP_TIME 1 30#define MODEM_DEFAULT_DTR_DROP_TIME 1
31#define MODEM_DEFAULT_BPS_DETECT 0 // bool 31#define MODEM_DEFAULT_BPS_DETECT 0 // bool
32#define MODEM_DEFAULT_DCD_LINES 1 //bool 32#define MODEM_DEFAULT_DCD_LINES 1 //bool
33#define MODEM_DEFAULT_MULTI_LINE_UNTAG 0 // bool 33#define MODEM_DEFAULT_MULTI_LINE_UNTAG 0 // bool
34 34
35/* IOSerial implements a RS232 IO Layer */ 35/* IOSerial implements a RS232 IO Layer */
36 36
37class IOModem : public IOSerial { 37class IOModem : public IOSerial {
38 38
39 Q_OBJECT 39 Q_OBJECT
40 40
41public: 41public:
42 42
43 IOModem(const Profile &); 43 IOModem(const Profile &);
44 ~IOModem(); 44 ~IOModem();
45 45
46 QString identifier() const; 46 QString identifier() const;
47 QString name() const; 47 QString name() const;
48 48
49signals: 49signals:
50 void received(const QByteArray &); 50 void received(const QByteArray &);
51 void error(int, const QString &); 51 void error(int, const QString &);
52 52
53public slots: 53public slots:
54 bool open(); 54 bool open();
55 void close(); 55 void close();
56 void reload(const Profile &); 56 void reload(const Profile &);
57 57
58private: 58private:
59 59
60 QString m_initString, m_resetString, m_dialPref1, m_dialSuf1, m_dialPref2, 60 QString m_initString, m_resetString, m_dialPref1, m_dialSuf1, m_dialPref2,
61 m_dialSuf2, m_dialPref3, m_dialSuf3, m_connect, m_hangup, m_cancel; 61 m_dialSuf2, m_dialPref3, m_dialSuf3, m_connect, m_hangup, m_cancel;
62 int m_dialTime, m_delayRedial, m_numberTries, m_dtrDropTime, 62 int m_dialTime, m_delayRedial, m_numberTries, m_dtrDropTime,
63 m_bpsDetect, m_dcdLines, m_multiLineUntag; 63 m_bpsDetect, m_dcdLines, m_multiLineUntag;
64 Profile m_profile; 64 Profile m_profile;
65 65
66private slots: 66private slots:
67 void slotExited(OProcess* proc); 67 void slotExited(OProcess* proc);
68 68
69}; 69};
70 70
71#endif 71#endif