author | harlekin <harlekin> | 2002-10-25 18:48:25 (UTC) |
---|---|---|
committer | harlekin <harlekin> | 2002-10-25 18:48:25 (UTC) |
commit | 4151cc12a6c37cbec4bb6883204703eec2fb8648 (patch) (unidiff) | |
tree | f7e81dc7de747628225ae4627c7cf3028183441a | |
parent | e8c4383915db7ed6f47899945404247b1fd5c3c4 (diff) | |
download | opie-4151cc12a6c37cbec4bb6883204703eec2fb8648.zip opie-4151cc12a6c37cbec4bb6883204703eec2fb8648.tar.gz opie-4151cc12a6c37cbec4bb6883204703eec2fb8648.tar.bz2 |
added data bits and stop bits
-rw-r--r-- | noncore/apps/opie-console/iolayerbase.cpp | 102 | ||||
-rw-r--r-- | noncore/apps/opie-console/iolayerbase.h | 11 | ||||
-rw-r--r-- | noncore/apps/opie-console/modemconfigwidget.cpp | 62 | ||||
-rw-r--r-- | noncore/apps/opie-console/serialconfigwidget.cpp | 53 |
4 files changed, 204 insertions, 24 deletions
diff --git a/noncore/apps/opie-console/iolayerbase.cpp b/noncore/apps/opie-console/iolayerbase.cpp index 47f9e76..ba7c86e 100644 --- a/noncore/apps/opie-console/iolayerbase.cpp +++ b/noncore/apps/opie-console/iolayerbase.cpp | |||
@@ -1,169 +1,239 @@ | |||
1 | #include <qlabel.h> | 1 | #include <qlabel.h> |
2 | #include <qlayout.h> | 2 | #include <qlayout.h> |
3 | #include <qcombobox.h> | 3 | #include <qcombobox.h> |
4 | #include <qbuttongroup.h> | 4 | #include <qbuttongroup.h> |
5 | #include <qhbuttongroup.h> | 5 | #include <qhbuttongroup.h> |
6 | #include <qradiobutton.h> | 6 | #include <qradiobutton.h> |
7 | #include <qhbox.h> | ||
7 | 8 | ||
8 | #include "iolayerbase.h" | 9 | #include "iolayerbase.h" |
9 | 10 | ||
10 | namespace { | 11 | namespace { |
11 | enum ParityIds { | 12 | enum ParityIds { |
12 | id_parity_none, | 13 | id_parity_none, |
13 | id_parity_odd, | 14 | id_parity_odd, |
14 | id_parity_even | 15 | id_parity_even |
15 | }; | 16 | }; |
16 | 17 | ||
17 | enum FlowIds { | 18 | enum FlowIds { |
18 | id_flow_hw, | 19 | id_flow_hw, |
19 | id_flow_sw, | 20 | id_flow_sw, |
20 | id_flow_none, | 21 | id_flow_none, |
21 | }; | 22 | }; |
22 | 23 | ||
23 | enum SpeedIds { | 24 | enum SpeedIds { |
24 | id_baud_115200, | 25 | id_baud_115200, |
25 | id_baud_57600, | 26 | id_baud_57600, |
26 | id_baud_38400, | 27 | id_baud_38400, |
27 | id_baud_19200, | 28 | id_baud_19200, |
28 | id_baud_9600 | 29 | id_baud_9600 |
29 | }; | 30 | }; |
30 | 31 | ||
32 | enum DataIds { | ||
33 | id_data_5, | ||
34 | id_data_6, | ||
35 | id_data_7, | ||
36 | id_data_8 | ||
37 | }; | ||
38 | |||
39 | enum StopIds { | ||
40 | id_stop_1, | ||
41 | id_stop_1_5, | ||
42 | id_stop_2 | ||
43 | }; | ||
44 | |||
31 | } | 45 | } |
32 | 46 | ||
33 | 47 | ||
34 | IOLayerBase::IOLayerBase( QWidget* par, const char* name ) | 48 | IOLayerBase::IOLayerBase( QWidget* par, const char* name ) |
35 | : QWidget( par, name ) | 49 | : QWidget( par, name ) |
36 | { | 50 | { |
37 | m_speedLabel = new QLabel(tr("Speed"), this ); | 51 | m_speedLabel = new QLabel(tr("Speed"), this ); |
38 | m_speedBox = new QComboBox(this ); | 52 | m_speedBox = new QComboBox(this ); |
39 | 53 | ||
40 | m_groupFlow = new QButtonGroup(tr("Flow control"),this ); | 54 | m_groupFlow = new QHButtonGroup(tr("Flow control"),this ); |
41 | m_flowHw = new QRadioButton(tr("Hardware"), m_groupFlow ); | 55 | m_flowHw = new QRadioButton(tr("Hardware"), m_groupFlow ); |
42 | m_flowSw = new QRadioButton(tr("Software"), m_groupFlow ); | 56 | m_flowSw = new QRadioButton(tr("Software"), m_groupFlow ); |
43 | m_flowNone = new QRadioButton( tr("None"), m_groupFlow ); | 57 | m_flowNone = new QRadioButton( tr("None"), m_groupFlow ); |
44 | 58 | ||
45 | m_groupParity = new QButtonGroup(tr("Parity"), this ); | 59 | m_groupParity = new QHButtonGroup(tr("Parity"), this ); |
46 | m_parityNone = new QRadioButton(tr("None"), m_groupParity ); | 60 | m_parityNone = new QRadioButton(tr("None"), m_groupParity ); |
47 | m_parityOdd = new QRadioButton(tr("Odd"), m_groupParity ); | 61 | m_parityOdd = new QRadioButton(tr("Odd"), m_groupParity ); |
48 | m_parityEven = new QRadioButton(tr("Even"), m_groupParity ); | 62 | m_parityEven = new QRadioButton(tr("Even"), m_groupParity ); |
49 | 63 | ||
64 | m_groupData = new QHButtonGroup(tr("Data Bits"), this); | ||
65 | m_data5 = new QRadioButton(tr("5"), m_groupData ); | ||
66 | m_data6 = new QRadioButton(tr("6"), m_groupData ); | ||
67 | m_data7 = new QRadioButton(tr("7"), m_groupData ); | ||
68 | m_data8 = new QRadioButton(tr("8"), m_groupData ); | ||
69 | |||
70 | m_groupStop = new QHButtonGroup(tr("Stop Bits"), this ); | ||
71 | m_stop1 = new QRadioButton(tr("1"), m_groupStop ); | ||
72 | m_stop15 = new QRadioButton(tr("1.5"), m_groupStop ); | ||
73 | m_stop2 = new QRadioButton(tr("2"), m_groupStop ); | ||
74 | |||
75 | |||
50 | m_lroot = new QVBoxLayout( this ); | 76 | m_lroot = new QVBoxLayout( this ); |
51 | m_lroot->add(m_speedLabel ); | 77 | m_lroot->add(m_speedLabel ); |
52 | m_lroot->add(m_speedBox ); | 78 | m_lroot->add(m_speedBox ); |
53 | m_lroot->setStretchFactor(m_speedLabel, 1); | ||
54 | m_lroot->setStretchFactor(m_speedBox, 1 ); | ||
55 | |||
56 | m_hbox = new QHBoxLayout(m_groupFlow, 2 ); | ||
57 | m_hbox->add(m_flowHw ); | ||
58 | m_hbox->add(m_flowSw ); | ||
59 | m_hbox->add(m_flowNone ); | ||
60 | m_lroot->add(m_groupFlow ); | 79 | m_lroot->add(m_groupFlow ); |
61 | m_lroot->setStretchFactor(m_groupFlow, 2 ); | ||
62 | |||
63 | m_hboxPar = new QHBoxLayout( m_groupParity, 2 ); | ||
64 | m_hboxPar->add(m_parityOdd ); | ||
65 | m_hboxPar->add(m_parityEven ); | ||
66 | m_hboxPar->add(m_parityNone ); | ||
67 | m_lroot->add(m_groupParity ); | 80 | m_lroot->add(m_groupParity ); |
68 | m_lroot->setStretchFactor(m_groupParity, 2 ); | 81 | m_lroot->add( m_groupData ); |
82 | m_lroot->add( m_groupStop ); | ||
69 | m_lroot->addStretch(2); | 83 | m_lroot->addStretch(2); |
70 | 84 | ||
71 | // profiles | 85 | // profiles |
72 | m_speedBox->insertItem(tr("115200 baud"), id_baud_115200 ); | 86 | m_speedBox->insertItem(tr("115200 baud"), id_baud_115200 ); |
73 | m_speedBox->insertItem(tr("57600 baud"), id_baud_57600 ); | 87 | m_speedBox->insertItem(tr("57600 baud"), id_baud_57600 ); |
74 | m_speedBox->insertItem(tr("38400 baud"), id_baud_38400 ); | 88 | m_speedBox->insertItem(tr("38400 baud"), id_baud_38400 ); |
75 | m_speedBox->insertItem(tr("19200 baud"), id_baud_19200 ); | 89 | m_speedBox->insertItem(tr("19200 baud"), id_baud_19200 ); |
76 | m_speedBox->insertItem(tr("9600 baud"), id_baud_9600 ); | 90 | m_speedBox->insertItem(tr("9600 baud"), id_baud_9600 ); |
77 | 91 | ||
78 | }; | 92 | }; |
79 | IOLayerBase::~IOLayerBase() { | 93 | IOLayerBase::~IOLayerBase() { |
80 | 94 | ||
81 | } | 95 | } |
82 | void IOLayerBase::setFlow( Flow flo ) { | 96 | void IOLayerBase::setFlow( Flow flo ) { |
83 | switch ( flo ) { | 97 | switch ( flo ) { |
84 | case Software: | 98 | case Software: |
85 | m_flowSw->setChecked( true ); | 99 | m_flowSw->setChecked( true ); |
86 | break; | 100 | break; |
87 | case Hardware: | 101 | case Hardware: |
88 | m_flowHw->setChecked( true ); | 102 | m_flowHw->setChecked( true ); |
89 | break; | 103 | break; |
90 | case None: | 104 | case None: |
91 | m_flowNone->setChecked( true ); | 105 | m_flowNone->setChecked( true ); |
92 | break; | 106 | break; |
93 | } | 107 | } |
94 | } | 108 | } |
95 | 109 | ||
96 | void IOLayerBase::setParity( Parity par ) { | 110 | void IOLayerBase::setParity( Parity par ) { |
97 | switch( par ) { | 111 | switch( par ) { |
98 | case NonePar: | 112 | case NonePar: |
99 | m_parityNone->setChecked( true ); | 113 | m_parityNone->setChecked( true ); |
100 | break; | 114 | break; |
101 | case Odd: | 115 | case Odd: |
102 | m_parityOdd->setChecked( true ); | 116 | m_parityOdd->setChecked( true ); |
103 | break; | 117 | break; |
104 | case Even: | 118 | case Even: |
105 | m_parityEven->setChecked( true ); | 119 | m_parityEven->setChecked( true ); |
106 | break; | 120 | break; |
107 | } | 121 | } |
108 | } | 122 | } |
109 | void IOLayerBase::setSpeed( Speed sp ) { | 123 | void IOLayerBase::setSpeed( Speed sp ) { |
110 | int index = -1; | 124 | int index = -1; |
111 | switch( sp ) { | 125 | switch( sp ) { |
112 | case Baud_115200: | 126 | case Baud_115200: |
113 | index = id_baud_115200; | 127 | index = id_baud_115200; |
114 | break; | 128 | break; |
115 | case Baud_57600: | 129 | case Baud_57600: |
116 | index = id_baud_57600; | 130 | index = id_baud_57600; |
117 | break; | 131 | break; |
118 | case Baud_38400: | 132 | case Baud_38400: |
119 | index = id_baud_38400; | 133 | index = id_baud_38400; |
120 | break; | 134 | break; |
121 | case Baud_19200: | 135 | case Baud_19200: |
122 | index = id_baud_19200; | 136 | index = id_baud_19200; |
123 | break; | 137 | break; |
124 | default: | 138 | default: |
125 | case Baud_9600: | 139 | case Baud_9600: |
126 | index = id_baud_9600; | 140 | index = id_baud_9600; |
127 | break; | 141 | break; |
128 | } | 142 | } |
129 | m_speedBox->setCurrentItem(index ); | 143 | m_speedBox->setCurrentItem(index ); |
130 | } | 144 | } |
145 | |||
146 | void IOLayerBase::setData( Data data ) { | ||
147 | switch( data ) { | ||
148 | case Data_Five: | ||
149 | m_data5->setChecked( true ); | ||
150 | break; | ||
151 | case Data_Six: | ||
152 | m_data6->setChecked( true ); | ||
153 | break; | ||
154 | case Data_Seven: | ||
155 | m_data7->setChecked( true ); | ||
156 | break; | ||
157 | default: | ||
158 | m_data8->setChecked( true ); | ||
159 | break; | ||
160 | } | ||
161 | } | ||
162 | |||
163 | |||
164 | void IOLayerBase::setStop( Stop stop ) { | ||
165 | switch( stop ) { | ||
166 | case Stop_Two: | ||
167 | m_stop2->setChecked( true ); | ||
168 | break; | ||
169 | case Stop_OnePointFive: | ||
170 | m_stop15->setChecked( true ); | ||
171 | break; | ||
172 | default: | ||
173 | m_stop1->setChecked( true ); | ||
174 | break; | ||
175 | } | ||
176 | } | ||
177 | |||
178 | |||
179 | |||
131 | IOLayerBase::Flow IOLayerBase::flow()const { | 180 | IOLayerBase::Flow IOLayerBase::flow()const { |
132 | if (m_flowHw->isChecked() ) { | 181 | if (m_flowHw->isChecked() ) { |
133 | return Hardware; | 182 | return Hardware; |
134 | }else if( m_flowSw->isChecked() ) { | 183 | }else if( m_flowSw->isChecked() ) { |
135 | return Software; | 184 | return Software; |
136 | } else { | 185 | } else { |
137 | return None; | 186 | return None; |
138 | } | 187 | } |
139 | } | 188 | } |
140 | IOLayerBase::Parity IOLayerBase::parity()const { | 189 | IOLayerBase::Parity IOLayerBase::parity()const { |
141 | if ( m_parityOdd->isChecked() ) { | 190 | if ( m_parityOdd->isChecked() ) { |
142 | return Odd; | 191 | return Odd; |
143 | } else if ( m_parityEven->isChecked() ) { | 192 | } else if ( m_parityEven->isChecked() ) { |
144 | return Even; | 193 | return Even; |
145 | } else { | 194 | } else { |
146 | return NonePar; | 195 | return NonePar; |
147 | } | 196 | } |
148 | 197 | ||
149 | } | 198 | } |
150 | IOLayerBase::Speed IOLayerBase::speed()const{ | 199 | IOLayerBase::Speed IOLayerBase::speed()const{ |
151 | switch( m_speedBox->currentItem() ) { | 200 | switch( m_speedBox->currentItem() ) { |
152 | case id_baud_115200: | 201 | case id_baud_115200: |
153 | return Baud_115200; | 202 | return Baud_115200; |
154 | break; | 203 | break; |
155 | case id_baud_57600: | 204 | case id_baud_57600: |
156 | return Baud_57600; | 205 | return Baud_57600; |
157 | break; | 206 | break; |
158 | case id_baud_38400: | 207 | case id_baud_38400: |
159 | return Baud_38400; | 208 | return Baud_38400; |
160 | break; | 209 | break; |
161 | case id_baud_19200: | 210 | case id_baud_19200: |
162 | return Baud_19200; | 211 | return Baud_19200; |
163 | break; | 212 | break; |
164 | default: | 213 | default: |
165 | case id_baud_9600: | 214 | case id_baud_9600: |
166 | return Baud_9600; | 215 | return Baud_9600; |
167 | break; | 216 | break; |
168 | } | 217 | } |
169 | } | 218 | } |
219 | IOLayerBase::Data IOLayerBase::data()const { | ||
220 | if ( m_data5->isChecked() ) { | ||
221 | return Data_Five; | ||
222 | } else if ( m_data6->isChecked() ) { | ||
223 | return Data_Six; | ||
224 | } else if ( m_data7->isChecked() ) { | ||
225 | return Data_Seven; | ||
226 | } else { | ||
227 | return Data_Eight; | ||
228 | } | ||
229 | } | ||
230 | IOLayerBase::Stop IOLayerBase::stop()const { | ||
231 | if ( m_stop2->isChecked() ) { | ||
232 | return Stop_Two; | ||
233 | } else if ( m_stop15->isChecked() ) { | ||
234 | return Stop_OnePointFive; | ||
235 | } else { | ||
236 | return Stop_One; | ||
237 | } | ||
238 | } | ||
239 | |||
diff --git a/noncore/apps/opie-console/iolayerbase.h b/noncore/apps/opie-console/iolayerbase.h index 74de46a..e1b96df 100644 --- a/noncore/apps/opie-console/iolayerbase.h +++ b/noncore/apps/opie-console/iolayerbase.h | |||
@@ -1,49 +1,58 @@ | |||
1 | #ifndef OPIE_IO_LAYER_BASE_H | 1 | #ifndef OPIE_IO_LAYER_BASE_H |
2 | #define OPIE_IO_LAYER_BASE_H | 2 | #define OPIE_IO_LAYER_BASE_H |
3 | 3 | ||
4 | 4 | ||
5 | #include <qwidget.h> | 5 | #include <qwidget.h> |
6 | 6 | ||
7 | class QLabel; | 7 | class QLabel; |
8 | class QComboBox; | 8 | class QComboBox; |
9 | class QVBoxLayout; | 9 | class QVBoxLayout; |
10 | class QButtonGroup; | 10 | class QButtonGroup; |
11 | class QRadioButton; | 11 | class QRadioButton; |
12 | class QHBoxLayout; | 12 | class QHBoxLayout; |
13 | class IOLayerBase : public QWidget { | 13 | class IOLayerBase : public QWidget { |
14 | 14 | ||
15 | Q_OBJECT | 15 | Q_OBJECT |
16 | 16 | ||
17 | public: | 17 | public: |
18 | enum Flow { Hardware, Software, None }; | 18 | enum Flow { Hardware, Software, None }; |
19 | enum Parity{ Odd =2 , Even =1, NonePar =0 }; | 19 | enum Parity{ Odd =2 , Even =1, NonePar =0 }; |
20 | enum Speed{ Baud_115200, | 20 | enum Speed{ Baud_115200, |
21 | Baud_57600, | 21 | Baud_57600, |
22 | Baud_38400, | 22 | Baud_38400, |
23 | Baud_19200, | 23 | Baud_19200, |
24 | Baud_9600 }; | 24 | Baud_9600 }; |
25 | enum Data { Data_Five =5, Data_Six =6, Data_Seven=7, Data_Eight=8 }; | ||
26 | enum Stop { Stop_One =1, Stop_OnePointFive=15, Stop_Two=2 }; | ||
27 | |||
25 | IOLayerBase( QWidget* base, const char* name = 0l); | 28 | IOLayerBase( QWidget* base, const char* name = 0l); |
26 | ~IOLayerBase(); | 29 | ~IOLayerBase(); |
27 | 30 | ||
28 | void setFlow( Flow flo ); | 31 | void setFlow( Flow flo ); |
29 | void setParity( Parity par ); | 32 | void setParity( Parity par ); |
30 | void setSpeed( Speed speed ); | 33 | void setSpeed( Speed speed ); |
34 | void setData( Data data ); | ||
35 | void setStop( Stop stop ); | ||
31 | 36 | ||
32 | Flow flow()const; | 37 | Flow flow()const; |
33 | Parity parity()const; | 38 | Parity parity()const; |
34 | Speed speed()const; | 39 | Speed speed()const; |
40 | Data data()const; | ||
41 | Stop stop()const; | ||
35 | private: | 42 | private: |
36 | QVBoxLayout* m_lroot; | 43 | QVBoxLayout* m_lroot; |
37 | QLabel* m_speedLabel; | 44 | QLabel* m_speedLabel; |
38 | QComboBox* m_speedBox; | 45 | QComboBox* m_speedBox; |
39 | QButtonGroup* m_groupFlow; | 46 | QButtonGroup* m_groupFlow, *m_groupData, *m_groupStop ; |
40 | QRadioButton *m_flowHw, *m_flowSw, *m_flowNone; | 47 | QRadioButton *m_flowHw, *m_flowSw, *m_flowNone; |
41 | 48 | ||
42 | QButtonGroup* m_groupParity; | 49 | QButtonGroup* m_groupParity; |
43 | QRadioButton *m_parityOdd, *m_parityEven, *m_parityNone; | 50 | QRadioButton *m_parityOdd, *m_parityEven, *m_parityNone; |
51 | QRadioButton *m_data5, *m_data6, *m_data7, *m_data8; | ||
52 | QRadioButton *m_stop1, *m_stop15, *m_stop2; | ||
44 | QHBoxLayout* m_hbox; | 53 | QHBoxLayout* m_hbox; |
45 | QHBoxLayout* m_hboxPar; | 54 | QHBoxLayout* m_hboxPar; |
46 | }; | 55 | }; |
47 | 56 | ||
48 | 57 | ||
49 | #endif | 58 | #endif |
diff --git a/noncore/apps/opie-console/modemconfigwidget.cpp b/noncore/apps/opie-console/modemconfigwidget.cpp index ec83b9f..ce44dab 100644 --- a/noncore/apps/opie-console/modemconfigwidget.cpp +++ b/noncore/apps/opie-console/modemconfigwidget.cpp | |||
@@ -1,203 +1,255 @@ | |||
1 | #include <qlabel.h> | 1 | #include <qlabel.h> |
2 | #include <qlayout.h> | 2 | #include <qlayout.h> |
3 | #include <qcombobox.h> | 3 | #include <qcombobox.h> |
4 | #include <qlineedit.h> | 4 | #include <qlineedit.h> |
5 | #include <qpushbutton.h> | 5 | #include <qpushbutton.h> |
6 | #include <qhbox.h> | 6 | #include <qhbox.h> |
7 | #include <qregexp.h> | 7 | #include <qregexp.h> |
8 | 8 | ||
9 | #include "modemconfigwidget.h" | 9 | #include "modemconfigwidget.h" |
10 | #include "dialdialog.h" | 10 | #include "dialdialog.h" |
11 | 11 | ||
12 | namespace { | 12 | namespace { |
13 | void setCurrent( const QString& str, QComboBox* bo ) { | 13 | void setCurrent( const QString& str, QComboBox* bo ) { |
14 | uint b = bo->count(); | 14 | uint b = bo->count(); |
15 | for (int i = 0; i < bo->count(); i++ ) { | 15 | for (int i = 0; i < bo->count(); i++ ) { |
16 | if ( bo->text(i) == str ) { | 16 | if ( bo->text(i) == str ) { |
17 | bo->setCurrentItem( i ); | 17 | bo->setCurrentItem( i ); |
18 | return; | 18 | return; |
19 | } | 19 | } |
20 | } | 20 | } |
21 | bo->insertItem( str ); | 21 | bo->insertItem( str ); |
22 | bo->setCurrentItem( b ); | 22 | bo->setCurrentItem( b ); |
23 | } | 23 | } |
24 | } | 24 | } |
25 | 25 | ||
26 | ModemConfigWidget::ModemConfigWidget( const QString& name, QWidget* parent, | 26 | ModemConfigWidget::ModemConfigWidget( const QString& name, QWidget* parent, |
27 | const char* na ) | 27 | const char* na ) |
28 | : ProfileDialogConnectionWidget( name, parent, na ) { | 28 | : ProfileDialogConnectionWidget( name, parent, na ) { |
29 | 29 | ||
30 | m_lay = new QVBoxLayout( this ); | 30 | m_lay = new QVBoxLayout( this ); |
31 | m_device = new QLabel(tr( "Modem is attached to:" ), this ); | 31 | m_device = new QLabel(tr( "Modem is attached to:" ), this ); |
32 | m_deviceCmb = new QComboBox(this ); | 32 | m_deviceCmb = new QComboBox(this ); |
33 | m_deviceCmb->setEditable( TRUE ); | 33 | m_deviceCmb->setEditable( TRUE ); |
34 | 34 | ||
35 | QLabel* telLabel = new QLabel( this ); | 35 | QLabel* telLabel = new QLabel( this ); |
36 | telLabel->setText( tr( "Enter telefon number here:" ) ); | 36 | telLabel->setText( tr( "Enter telefon number here:" ) ); |
37 | m_telNumber = new QLineEdit( this ); | 37 | // m_telNumber = new QLineEdit( this ); |
38 | QHBox *buttonBox = new QHBox( this ); | 38 | QHBox *buttonBox = new QHBox( this ); |
39 | m_telNumber = new QLineEdit( buttonBox ); | ||
39 | QPushButton *atButton = new QPushButton( buttonBox ); | 40 | QPushButton *atButton = new QPushButton( buttonBox ); |
40 | atButton->setText( tr( "AT commands" ) ); | 41 | atButton->setText( tr( "AT commands" ) ); |
41 | // disabled for now | 42 | // disabled for now |
42 | atButton->hide(); | 43 | atButton->hide(); |
43 | connect( atButton, SIGNAL( clicked() ), this, SLOT( slotAT() ) ); | 44 | connect( atButton, SIGNAL( clicked() ), this, SLOT( slotAT() ) ); |
44 | 45 | ||
45 | QPushButton *dialButton = new QPushButton( buttonBox ); | 46 | QPushButton *dialButton = new QPushButton( buttonBox ); |
46 | dialButton->setText( tr( "Enter number" ) ); | 47 | dialButton->setText( tr( "Enter number" ) ); |
47 | connect( dialButton, SIGNAL( clicked() ), this, SLOT( slotDial() ) ); | 48 | connect( dialButton, SIGNAL( clicked() ), this, SLOT( slotDial() ) ); |
48 | 49 | ||
49 | |||
50 | m_base = new IOLayerBase( this, "base" ); | 50 | m_base = new IOLayerBase( this, "base" ); |
51 | 51 | ||
52 | m_lay->addWidget( m_device ); | 52 | m_lay->addWidget( m_device ); |
53 | m_lay->addWidget( m_deviceCmb ); | 53 | m_lay->addWidget( m_deviceCmb ); |
54 | m_lay->addWidget( telLabel ); | 54 | m_lay->addWidget( telLabel ); |
55 | m_lay->addWidget( m_telNumber ); | ||
56 | m_lay->addWidget( buttonBox ); | 55 | m_lay->addWidget( buttonBox ); |
57 | m_lay->addWidget( m_base ); | 56 | m_lay->addWidget( m_base ); |
57 | m_lay->addStretch( 0 ); | ||
58 | 58 | ||
59 | m_deviceCmb->insertItem( "/dev/ttyS0" ); | 59 | m_deviceCmb->insertItem( "/dev/ttyS0" ); |
60 | m_deviceCmb->insertItem( "/dev/ttyS1" ); | 60 | m_deviceCmb->insertItem( "/dev/ttyS1" ); |
61 | m_deviceCmb->insertItem( "/dev/ttyS2" ); | 61 | m_deviceCmb->insertItem( "/dev/ttyS2" ); |
62 | 62 | ||
63 | atConf = new ATConfigDialog( this, "ATConfig", true ); | 63 | atConf = new ATConfigDialog( this, "ATConfig", true ); |
64 | } | 64 | } |
65 | 65 | ||
66 | ModemConfigWidget::~ModemConfigWidget() { | 66 | ModemConfigWidget::~ModemConfigWidget() { |
67 | 67 | ||
68 | } | 68 | } |
69 | void ModemConfigWidget::load( const Profile& prof ) { | 69 | void ModemConfigWidget::load( const Profile& prof ) { |
70 | 70 | ||
71 | int rad_flow = prof.readNumEntry( "Flow" ); | 71 | int rad_flow = prof.readNumEntry( "Flow" ); |
72 | int rad_parity = prof.readNumEntry( "Parity" ); | 72 | int rad_parity = prof.readNumEntry( "Parity" ); |
73 | int speed = prof.readNumEntry( "Speed" ); | 73 | int speed = prof.readNumEntry( "Speed" ); |
74 | int dbits = prof.readNumEntry("DataBits"); | ||
75 | int sbits = prof.readNumEntry("StopBits"); | ||
74 | QString number = prof.readEntry( "Number" ); | 76 | QString number = prof.readEntry( "Number" ); |
75 | 77 | ||
76 | if ( !number.isEmpty() ) { | 78 | if ( !number.isEmpty() ) { |
77 | m_telNumber->setText( number ); | 79 | m_telNumber->setText( number ); |
78 | } | 80 | } |
79 | 81 | ||
80 | if ( rad_flow == 1 ) { | 82 | if ( rad_flow == 1 ) { |
81 | m_base->setFlow( IOLayerBase::Hardware ); | 83 | m_base->setFlow( IOLayerBase::Hardware ); |
82 | } else if (rad_flow == 2) { | 84 | } else if (rad_flow == 2) { |
83 | m_base->setFlow( IOLayerBase::Software ); | 85 | m_base->setFlow( IOLayerBase::Software ); |
84 | } else if (rad_flow == 0) { | 86 | } else if (rad_flow == 0) { |
85 | m_base->setFlow( IOLayerBase::None ); | 87 | m_base->setFlow( IOLayerBase::None ); |
86 | } | 88 | } |
87 | 89 | ||
88 | 90 | ||
89 | if ( rad_parity == 1 ) { | 91 | if ( rad_parity == 1 ) { |
90 | m_base->setParity( IOLayerBase::Even ); | 92 | m_base->setParity( IOLayerBase::Even ); |
91 | } else if ( rad_parity == 2 ){ | 93 | } else if ( rad_parity == 2 ){ |
92 | m_base->setParity( IOLayerBase::Odd ); | 94 | m_base->setParity( IOLayerBase::Odd ); |
93 | } else { | 95 | } else { |
94 | m_base->setParity( IOLayerBase::NonePar ); | 96 | m_base->setParity( IOLayerBase::NonePar ); |
95 | } | 97 | } |
96 | 98 | ||
97 | switch( speed ) { | 99 | switch( speed ) { |
98 | case 115200: | 100 | case 115200: |
99 | m_base->setSpeed( IOLayerBase::Baud_115200 ); | 101 | m_base->setSpeed( IOLayerBase::Baud_115200 ); |
100 | break; | 102 | break; |
101 | case 57600: | 103 | case 57600: |
102 | m_base->setSpeed( IOLayerBase::Baud_57600 ); | 104 | m_base->setSpeed( IOLayerBase::Baud_57600 ); |
103 | break; | 105 | break; |
104 | case 38400: | 106 | case 38400: |
105 | m_base->setSpeed( IOLayerBase::Baud_38400 ); | 107 | m_base->setSpeed( IOLayerBase::Baud_38400 ); |
106 | break; | 108 | break; |
107 | case 19200: | 109 | case 19200: |
108 | m_base->setSpeed( IOLayerBase::Baud_19200 ); | 110 | m_base->setSpeed( IOLayerBase::Baud_19200 ); |
109 | break; | 111 | break; |
110 | case 9600: | 112 | case 9600: |
111 | default: | 113 | default: |
112 | m_base->setSpeed( IOLayerBase::Baud_9600 ); | 114 | m_base->setSpeed( IOLayerBase::Baud_9600 ); |
113 | break; | 115 | break; |
114 | } | 116 | } |
115 | 117 | ||
118 | |||
119 | if ( dbits == 5) { | ||
120 | m_base->setData( IOLayerBase::Data_Five ); | ||
121 | } else if (rad_flow == 6) { | ||
122 | m_base->setData( IOLayerBase::Data_Six ); | ||
123 | } else if (rad_flow == 7) { | ||
124 | m_base->setData( IOLayerBase::Data_Seven ); | ||
125 | } else { | ||
126 | m_base->setData( IOLayerBase::Data_Eight ); | ||
127 | } | ||
128 | |||
129 | if ( sbits == 2) { | ||
130 | m_base->setStop( IOLayerBase::Stop_Two ); | ||
131 | } else if ( sbits == 15 ) { | ||
132 | m_base->setStop( IOLayerBase::Stop_OnePointFive ); | ||
133 | } else { | ||
134 | m_base->setStop( IOLayerBase::Stop_One ); | ||
135 | } | ||
136 | |||
137 | |||
138 | |||
116 | if ( prof.readEntry( "Device" ).isEmpty() ) { | 139 | if ( prof.readEntry( "Device" ).isEmpty() ) { |
117 | return; | 140 | return; |
118 | } | 141 | } |
119 | setCurrent( prof.readEntry( "Device" ), m_deviceCmb ); | 142 | setCurrent( prof.readEntry( "Device" ), m_deviceCmb ); |
120 | 143 | ||
121 | atConf->readConfig( prof ); | 144 | atConf->readConfig( prof ); |
122 | } | 145 | } |
123 | 146 | ||
124 | /* | 147 | /* |
125 | * save speed, | 148 | * save speed, |
126 | * flow, | 149 | * flow, |
127 | * parity | 150 | * parity |
128 | */ | 151 | */ |
129 | void ModemConfigWidget::save( Profile& prof ) { | 152 | void ModemConfigWidget::save( Profile& prof ) { |
130 | int flow, parity, speed; | 153 | int flow, parity, speed, data, stop; |
131 | flow = parity = speed = 0; | 154 | flow = parity = speed = data = stop = 0; |
132 | prof.writeEntry( "Device", m_deviceCmb->currentText() ); | 155 | prof.writeEntry( "Device", m_deviceCmb->currentText() ); |
133 | 156 | ||
134 | 157 | ||
135 | switch( m_base->flow() ) { | 158 | switch( m_base->flow() ) { |
136 | case IOLayerBase::None: | 159 | case IOLayerBase::None: |
137 | flow = 0; | 160 | flow = 0; |
138 | break; | 161 | break; |
139 | case IOLayerBase::Software: | 162 | case IOLayerBase::Software: |
140 | flow = 2; | 163 | flow = 2; |
141 | break; | 164 | break; |
142 | case IOLayerBase::Hardware: | 165 | case IOLayerBase::Hardware: |
143 | flow = 1; | 166 | flow = 1; |
144 | break; | 167 | break; |
145 | } | 168 | } |
146 | 169 | ||
147 | switch( m_base->parity() ) { | 170 | switch( m_base->parity() ) { |
148 | case IOLayerBase::Odd: | 171 | case IOLayerBase::Odd: |
149 | parity = 2; | 172 | parity = 2; |
150 | break; | 173 | break; |
151 | case IOLayerBase::Even: | 174 | case IOLayerBase::Even: |
152 | parity = 1; | 175 | parity = 1; |
153 | break; | 176 | break; |
154 | case IOLayerBase::NonePar: | 177 | case IOLayerBase::NonePar: |
155 | parity = 0; | 178 | parity = 0; |
156 | break; | 179 | break; |
157 | } | 180 | } |
158 | 181 | ||
159 | switch( m_base->speed() ) { | 182 | switch( m_base->speed() ) { |
160 | case IOLayerBase::Baud_115200: | 183 | case IOLayerBase::Baud_115200: |
161 | speed = 115200; | 184 | speed = 115200; |
162 | break; | 185 | break; |
163 | case IOLayerBase::Baud_57600: | 186 | case IOLayerBase::Baud_57600: |
164 | speed = 57600; | 187 | speed = 57600; |
165 | break; | 188 | break; |
166 | case IOLayerBase::Baud_38400: | 189 | case IOLayerBase::Baud_38400: |
167 | speed = 38400; | 190 | speed = 38400; |
168 | break; | 191 | break; |
169 | case IOLayerBase::Baud_19200: | 192 | case IOLayerBase::Baud_19200: |
170 | speed = 19200; | 193 | speed = 19200; |
171 | break; | 194 | break; |
172 | case IOLayerBase::Baud_9600: | 195 | case IOLayerBase::Baud_9600: |
173 | speed = 9600; | 196 | speed = 9600; |
174 | break; | 197 | break; |
175 | } | 198 | } |
176 | 199 | ||
200 | switch( m_base->data() ) { | ||
201 | case IOLayerBase::Data_Five: | ||
202 | data = 5; | ||
203 | break; | ||
204 | case IOLayerBase::Data_Six: | ||
205 | data = 6; | ||
206 | break; | ||
207 | case IOLayerBase::Data_Seven: | ||
208 | data = 7; | ||
209 | break; | ||
210 | case IOLayerBase::Data_Eight: | ||
211 | data = 8; | ||
212 | break; | ||
213 | } | ||
214 | |||
215 | switch( m_base->stop() ) { | ||
216 | case IOLayerBase::Stop_One: | ||
217 | stop = 1; | ||
218 | break; | ||
219 | case IOLayerBase::Stop_OnePointFive: | ||
220 | stop = 15; | ||
221 | break; | ||
222 | case IOLayerBase::Stop_Two: | ||
223 | stop = 2; | ||
224 | break; | ||
225 | } | ||
226 | |||
177 | prof.writeEntry( "Flow", flow ); | 227 | prof.writeEntry( "Flow", flow ); |
178 | prof.writeEntry( "Parity", parity ); | 228 | prof.writeEntry( "Parity", parity ); |
179 | prof.writeEntry( "Speed", speed ); | 229 | prof.writeEntry( "Speed", speed ); |
230 | prof.writeEntry("DataBits", data); | ||
231 | prof.writeEntry("StopBits", stop); | ||
180 | prof.writeEntry( "Number", m_telNumber->text() ); | 232 | prof.writeEntry( "Number", m_telNumber->text() ); |
181 | 233 | ||
182 | 234 | ||
183 | atConf->writeConfig(prof); | 235 | atConf->writeConfig(prof); |
184 | } | 236 | } |
185 | 237 | ||
186 | void ModemConfigWidget::slotAT() { | 238 | void ModemConfigWidget::slotAT() { |
187 | // ATConfigDialog conf( this, "ATConfig", true ); | 239 | // ATConfigDialog conf( this, "ATConfig", true ); |
188 | atConf->showMaximized(); | 240 | atConf->showMaximized(); |
189 | if ( atConf->exec() != QDialog::Accepted ) { | 241 | if ( atConf->exec() != QDialog::Accepted ) { |
190 | // reload old settings | 242 | // reload old settings |
191 | } | 243 | } |
192 | } | 244 | } |
193 | 245 | ||
194 | void ModemConfigWidget::slotDial() { | 246 | void ModemConfigWidget::slotDial() { |
195 | DialDialog dial( this, "DialConfig", true ); | 247 | DialDialog dial( this, "DialConfig", true ); |
196 | if(!m_telNumber->text().isEmpty()) { | 248 | if(!m_telNumber->text().isEmpty()) { |
197 | dial.setNumber(m_telNumber->text().replace(QRegExp("[\\-\\/\\ \\.\\,]"), "")); | 249 | dial.setNumber(m_telNumber->text().replace(QRegExp("[\\-\\/\\ \\.\\,]"), "")); |
198 | } | 250 | } |
199 | dial.showMaximized(); | 251 | dial.showMaximized(); |
200 | if ( dial.exec() == QDialog::Accepted ) { | 252 | if ( dial.exec() == QDialog::Accepted ) { |
201 | m_telNumber->setText( dial.number() ); | 253 | m_telNumber->setText( dial.number() ); |
202 | } | 254 | } |
203 | } | 255 | } |
diff --git a/noncore/apps/opie-console/serialconfigwidget.cpp b/noncore/apps/opie-console/serialconfigwidget.cpp index 5c6d975..3edf723 100644 --- a/noncore/apps/opie-console/serialconfigwidget.cpp +++ b/noncore/apps/opie-console/serialconfigwidget.cpp | |||
@@ -1,149 +1,198 @@ | |||
1 | #include <qlabel.h> | 1 | #include <qlabel.h> |
2 | #include <qlayout.h> | 2 | #include <qlayout.h> |
3 | #include <qcombobox.h> | 3 | #include <qcombobox.h> |
4 | 4 | ||
5 | #include "iolayerbase.h" | 5 | #include "iolayerbase.h" |
6 | #include "serialconfigwidget.h" | 6 | #include "serialconfigwidget.h" |
7 | 7 | ||
8 | namespace { | 8 | namespace { |
9 | void setCurrent( const QString& str, QComboBox* bo ) { | 9 | void setCurrent( const QString& str, QComboBox* bo ) { |
10 | uint b = bo->count(); | 10 | uint b = bo->count(); |
11 | for (int i = 0; i < bo->count(); i++ ) { | 11 | for (int i = 0; i < bo->count(); i++ ) { |
12 | if ( bo->text(i) == str ) { | 12 | if ( bo->text(i) == str ) { |
13 | bo->setCurrentItem( i ); | 13 | bo->setCurrentItem( i ); |
14 | return; | 14 | return; |
15 | } | 15 | } |
16 | } | 16 | } |
17 | bo->insertItem( str ); | 17 | bo->insertItem( str ); |
18 | bo->setCurrentItem( b ); | 18 | bo->setCurrentItem( b ); |
19 | } | 19 | } |
20 | 20 | ||
21 | 21 | ||
22 | } | 22 | } |
23 | 23 | ||
24 | SerialConfigWidget::SerialConfigWidget( const QString& name, | 24 | SerialConfigWidget::SerialConfigWidget( const QString& name, |
25 | QWidget* parent, | 25 | QWidget* parent, |
26 | const char* na ) | 26 | const char* na ) |
27 | : ProfileDialogConnectionWidget( name, parent, na ) { | 27 | : ProfileDialogConnectionWidget( name, parent, na ) { |
28 | 28 | ||
29 | m_lay = new QVBoxLayout(this ); | 29 | m_lay = new QVBoxLayout(this ); |
30 | m_device = new QLabel(tr("Device"), this ); | 30 | m_device = new QLabel(tr("Device"), this ); |
31 | m_deviceCmb = new QComboBox(this ); | 31 | m_deviceCmb = new QComboBox(this ); |
32 | m_deviceCmb->setEditable( TRUE ); | 32 | m_deviceCmb->setEditable( TRUE ); |
33 | 33 | ||
34 | m_base = new IOLayerBase(this, "base"); | 34 | m_base = new IOLayerBase(this, "base"); |
35 | 35 | ||
36 | m_lay->addWidget( m_device ); | 36 | m_lay->addWidget( m_device ); |
37 | m_lay->addWidget( m_deviceCmb ); | 37 | m_lay->addWidget( m_deviceCmb ); |
38 | m_lay->addWidget( m_base ); | 38 | m_lay->addWidget( m_base ); |
39 | 39 | ||
40 | m_deviceCmb->insertItem( "/dev/ttyS0" ); | 40 | m_deviceCmb->insertItem( "/dev/ttyS0" ); |
41 | m_deviceCmb->insertItem( "/dev/ttyS1" ); | 41 | m_deviceCmb->insertItem( "/dev/ttyS1" ); |
42 | m_deviceCmb->insertItem( "/dev/ttySA0"); | 42 | m_deviceCmb->insertItem( "/dev/ttySA0"); |
43 | m_deviceCmb->insertItem( "/dev/ttySA1"); | 43 | m_deviceCmb->insertItem( "/dev/ttySA1"); |
44 | 44 | ||
45 | } | 45 | } |
46 | SerialConfigWidget::~SerialConfigWidget() { | 46 | SerialConfigWidget::~SerialConfigWidget() { |
47 | 47 | ||
48 | } | 48 | } |
49 | void SerialConfigWidget::load( const Profile& prof ) { | 49 | void SerialConfigWidget::load( const Profile& prof ) { |
50 | int rad_flow = prof.readNumEntry("Flow"); | 50 | int rad_flow = prof.readNumEntry("Flow"); |
51 | int rad_parity = prof.readNumEntry("Parity"); | 51 | int rad_parity = prof.readNumEntry("Parity"); |
52 | int speed = prof.readNumEntry("Speed"); | 52 | int speed = prof.readNumEntry("Speed"); |
53 | int dbits = prof.readNumEntry("DataBits"); | ||
54 | int sbits = prof.readNumEntry("StopBits"); | ||
53 | 55 | ||
54 | if (rad_flow == 1) { | 56 | if (rad_flow == 1) { |
55 | m_base->setFlow( IOLayerBase::Hardware ); | 57 | m_base->setFlow( IOLayerBase::Hardware ); |
56 | } else if (rad_flow == 2) { | 58 | } else if (rad_flow == 2) { |
57 | m_base->setFlow( IOLayerBase::Software ); | 59 | m_base->setFlow( IOLayerBase::Software ); |
58 | } else { | 60 | } else { |
59 | m_base->setFlow( IOLayerBase::None ); | 61 | m_base->setFlow( IOLayerBase::None ); |
60 | } | 62 | } |
61 | 63 | ||
62 | if (rad_parity == 1) { | 64 | if (rad_parity == 1) { |
63 | m_base->setParity( IOLayerBase::Even ); | 65 | m_base->setParity( IOLayerBase::Even ); |
64 | } else if ( rad_parity == 2 ) { | 66 | } else if ( rad_parity == 2 ) { |
65 | m_base->setParity( IOLayerBase::Odd ); | 67 | m_base->setParity( IOLayerBase::Odd ); |
66 | } else { | 68 | } else { |
67 | m_base->setParity( IOLayerBase::NonePar ); | 69 | m_base->setParity( IOLayerBase::NonePar ); |
68 | } | 70 | } |
69 | 71 | ||
70 | switch( speed ) { | 72 | switch( speed ) { |
71 | case 115200: | 73 | case 115200: |
72 | m_base->setSpeed(IOLayerBase::Baud_115200 ); | 74 | m_base->setSpeed(IOLayerBase::Baud_115200 ); |
73 | break; | 75 | break; |
74 | case 57600: | 76 | case 57600: |
75 | m_base->setSpeed( IOLayerBase::Baud_57600 ); | 77 | m_base->setSpeed( IOLayerBase::Baud_57600 ); |
76 | break; | 78 | break; |
77 | case 38400: | 79 | case 38400: |
78 | m_base->setSpeed(IOLayerBase::Baud_38400 ); | 80 | m_base->setSpeed(IOLayerBase::Baud_38400 ); |
79 | break; | 81 | break; |
80 | case 19200: | 82 | case 19200: |
81 | m_base->setSpeed( IOLayerBase::Baud_19200 ); | 83 | m_base->setSpeed( IOLayerBase::Baud_19200 ); |
82 | break; | 84 | break; |
83 | case 9600: | 85 | case 9600: |
84 | default: | 86 | default: |
85 | m_base->setSpeed(IOLayerBase::Baud_9600 ); | 87 | m_base->setSpeed(IOLayerBase::Baud_9600 ); |
86 | break; | 88 | break; |
87 | } | 89 | } |
88 | 90 | ||
91 | if ( dbits == 5) { | ||
92 | m_base->setData( IOLayerBase::Data_Five ); | ||
93 | } else if (rad_flow == 6) { | ||
94 | m_base->setData( IOLayerBase::Data_Six ); | ||
95 | } else if (rad_flow == 7) { | ||
96 | m_base->setData( IOLayerBase::Data_Seven ); | ||
97 | } else { | ||
98 | m_base->setData( IOLayerBase::Data_Eight ); | ||
99 | } | ||
100 | |||
101 | if ( sbits == 2) { | ||
102 | m_base->setStop( IOLayerBase::Stop_Two ); | ||
103 | } else if ( sbits == 15 ) { | ||
104 | m_base->setStop( IOLayerBase::Stop_OnePointFive ); | ||
105 | } else { | ||
106 | m_base->setStop( IOLayerBase::Stop_One ); | ||
107 | } | ||
108 | |||
89 | if ( prof.readEntry("Device").isEmpty() ) return; | 109 | if ( prof.readEntry("Device").isEmpty() ) return; |
90 | setCurrent( prof.readEntry("Device"), m_deviceCmb ); | 110 | setCurrent( prof.readEntry("Device"), m_deviceCmb ); |
91 | 111 | ||
92 | } | 112 | } |
93 | /* | 113 | /* |
94 | * save speed, | 114 | * save speed, |
95 | * flow, | 115 | * flow, |
96 | * parity | 116 | * parity |
97 | */ | 117 | */ |
98 | void SerialConfigWidget::save( Profile& prof ) { | 118 | void SerialConfigWidget::save( Profile& prof ) { |
99 | int flow, parity, speed ; | 119 | int flow, parity, speed, data, stop; |
100 | flow = parity = speed = 0; | 120 | flow = parity = speed = data = stop = 0; |
101 | prof.writeEntry("Device", m_deviceCmb->currentText() ); | 121 | prof.writeEntry("Device", m_deviceCmb->currentText() ); |
102 | 122 | ||
103 | switch( m_base->flow() ) { | 123 | switch( m_base->flow() ) { |
104 | case IOLayerBase::None: | 124 | case IOLayerBase::None: |
105 | flow = 0; | 125 | flow = 0; |
106 | break; | 126 | break; |
107 | case IOLayerBase::Software: | 127 | case IOLayerBase::Software: |
108 | flow = 2; | 128 | flow = 2; |
109 | break; | 129 | break; |
110 | case IOLayerBase::Hardware: | 130 | case IOLayerBase::Hardware: |
111 | flow = 1; | 131 | flow = 1; |
112 | break; | 132 | break; |
113 | } | 133 | } |
114 | 134 | ||
115 | switch( m_base->parity() ) { | 135 | switch( m_base->parity() ) { |
116 | case IOLayerBase::Odd: | 136 | case IOLayerBase::Odd: |
117 | parity = 2; | 137 | parity = 2; |
118 | break; | 138 | break; |
119 | case IOLayerBase::Even: | 139 | case IOLayerBase::Even: |
120 | parity = 1; | 140 | parity = 1; |
121 | break; | 141 | break; |
122 | case IOLayerBase::NonePar: | 142 | case IOLayerBase::NonePar: |
123 | parity = 0; | 143 | parity = 0; |
124 | break; | 144 | break; |
125 | } | 145 | } |
126 | 146 | ||
127 | switch( m_base->speed() ) { | 147 | switch( m_base->speed() ) { |
128 | case IOLayerBase::Baud_115200: | 148 | case IOLayerBase::Baud_115200: |
129 | speed = 115200; | 149 | speed = 115200; |
130 | break; | 150 | break; |
131 | case IOLayerBase::Baud_57600: | 151 | case IOLayerBase::Baud_57600: |
132 | speed = 57600; | 152 | speed = 57600; |
133 | break; | 153 | break; |
134 | case IOLayerBase::Baud_38400: | 154 | case IOLayerBase::Baud_38400: |
135 | speed = 38400; | 155 | speed = 38400; |
136 | break; | 156 | break; |
137 | case IOLayerBase::Baud_19200: | 157 | case IOLayerBase::Baud_19200: |
138 | speed = 19200; | 158 | speed = 19200; |
139 | break; | 159 | break; |
140 | default: | 160 | default: |
141 | case IOLayerBase::Baud_9600: | 161 | case IOLayerBase::Baud_9600: |
142 | speed = 9600; | 162 | speed = 9600; |
143 | break; | 163 | break; |
144 | } | 164 | } |
145 | 165 | ||
166 | switch( m_base->data() ) { | ||
167 | case IOLayerBase::Data_Five: | ||
168 | data = 5; | ||
169 | break; | ||
170 | case IOLayerBase::Data_Six: | ||
171 | data = 6; | ||
172 | break; | ||
173 | case IOLayerBase::Data_Seven: | ||
174 | data = 7; | ||
175 | break; | ||
176 | case IOLayerBase::Data_Eight: | ||
177 | data = 8; | ||
178 | break; | ||
179 | } | ||
180 | |||
181 | switch( m_base->stop() ) { | ||
182 | case IOLayerBase::Stop_One: | ||
183 | stop = 1; | ||
184 | break; | ||
185 | case IOLayerBase::Stop_OnePointFive: | ||
186 | stop = 15; | ||
187 | break; | ||
188 | case IOLayerBase::Stop_Two: | ||
189 | stop = 2; | ||
190 | break; | ||
191 | } | ||
192 | |||
146 | prof.writeEntry("Flow", flow); | 193 | prof.writeEntry("Flow", flow); |
147 | prof.writeEntry("Parity", parity); | 194 | prof.writeEntry("Parity", parity); |
148 | prof.writeEntry("Speed", speed); | 195 | prof.writeEntry("Speed", speed); |
196 | prof.writeEntry("DataBits", data); | ||
197 | prof.writeEntry("StopBits", stop); | ||
149 | } | 198 | } |