author | dwmw2 <dwmw2> | 2002-04-02 16:51:01 (UTC) |
---|---|---|
committer | dwmw2 <dwmw2> | 2002-04-02 16:51:01 (UTC) |
commit | ac91ca1bd03f14eef87711efcddddae0e6475b44 (patch) (unidiff) | |
tree | 7357bc0302c4dc91120a125816391753990a2790 /noncore | |
parent | 42e978133012df5c8e7a367e565ea1454f9beb9b (diff) | |
download | opie-ac91ca1bd03f14eef87711efcddddae0e6475b44.zip opie-ac91ca1bd03f14eef87711efcddddae0e6475b44.tar.gz opie-ac91ca1bd03f14eef87711efcddddae0e6475b44.tar.bz2 |
Remove all deletions of 'port' and 'me'. It's got a silly pointless automatic
ref-counting thingy. Gsmlib _really_ needs rewriting without the gratuitous bloat.
-rw-r--r-- | noncore/unsupported/gsmtool/gsmtool.cpp | 18 | ||||
-rw-r--r-- | noncore/unsupported/gsmtool/gsmtool.h | 1 |
2 files changed, 7 insertions, 12 deletions
diff --git a/noncore/unsupported/gsmtool/gsmtool.cpp b/noncore/unsupported/gsmtool/gsmtool.cpp index 14ef368..38c8c59 100644 --- a/noncore/unsupported/gsmtool/gsmtool.cpp +++ b/noncore/unsupported/gsmtool/gsmtool.cpp | |||
@@ -19,13 +19,12 @@ using namespace gsmlib; | |||
19 | */ | 19 | */ |
20 | GSMTool::GSMTool( QWidget* parent, const char* name, WFlags fl ) | 20 | GSMTool::GSMTool( QWidget* parent, const char* name, WFlags fl ) |
21 | : GSMToolBase( parent, name, fl ) | 21 | : GSMToolBase( parent, name, fl ) |
22 | { | 22 | { |
23 | devicelocked = 0; | 23 | devicelocked = 0; |
24 | me = NULL; | 24 | me = NULL; |
25 | port = NULL; | ||
26 | setConnected(FALSE); | 25 | setConnected(FALSE); |
27 | /* FIXME: Persistent settings for device/baudrate */ | 26 | /* FIXME: Persistent settings for device/baudrate */ |
28 | connect(ConnectButton, SIGNAL(clicked()), this, SLOT(doConnectButton())); | 27 | connect(ConnectButton, SIGNAL(clicked()), this, SLOT(doConnectButton())); |
29 | connect(ScanButton, SIGNAL(clicked()), this, SLOT(doScanButton())); | 28 | connect(ScanButton, SIGNAL(clicked()), this, SLOT(doScanButton())); |
30 | connect(TabWidget2, SIGNAL(currentChanged(QWidget *)), this, SLOT(doTabChanged())); | 29 | connect(TabWidget2, SIGNAL(currentChanged(QWidget *)), this, SLOT(doTabChanged())); |
31 | timerid = -1; // Is this not possible normally? | 30 | timerid = -1; // Is this not possible normally? |
@@ -135,52 +134,51 @@ void GSMTool::doScanButton() | |||
135 | } | 134 | } |
136 | /* | 135 | /* |
137 | * A simple slot... not very interesting. | 136 | * A simple slot... not very interesting. |
138 | */ | 137 | */ |
139 | void GSMTool::doConnectButton() | 138 | void GSMTool::doConnectButton() |
140 | { | 139 | { |
140 | gsmlib::Port *port; | ||
141 | |||
141 | speed_t rate; | 142 | speed_t rate; |
142 | devicename = strdup(DeviceName->currentText().local8Bit().data()); | 143 | devicename = strdup(DeviceName->currentText().local8Bit().data()); |
143 | rate = baudrates[BaudRate->currentItem()]; | 144 | rate = baudrates[BaudRate->currentItem()]; |
144 | 145 | ||
145 | qDebug("Connect Button Pressed"); | 146 | qDebug("Connect Button Pressed"); |
146 | MfrText->setText("Opening..."); | 147 | MfrText->setText("Opening..."); |
147 | ModelText->setText(""); | 148 | ModelText->setText(""); |
148 | RevisionText->setText(""); | 149 | RevisionText->setText(""); |
149 | SerialText->setText(""); | 150 | SerialText->setText(""); |
150 | 151 | ||
151 | setConnected(FALSE); | 152 | setConnected(FALSE); |
152 | if (me) { | 153 | if (me) { |
153 | // delete me; | ||
154 | me = NULL; | 154 | me = NULL; |
155 | } | 155 | } |
156 | if (port) { | ||
157 | // delete port; | ||
158 | port = NULL; | ||
159 | } | ||
160 | 156 | ||
161 | if (lockDevice()) { | 157 | if (lockDevice()) { |
162 | qDebug("lockDevice() failed\n"); | 158 | qDebug("lockDevice() failed\n"); |
159 | MfrText->setText("Lock port failed"); | ||
163 | }; | 160 | }; |
164 | 161 | ||
165 | qDebug("Device name is %s\n", devicename); | 162 | qDebug("Device name is %s\n", devicename); |
166 | 163 | ||
167 | try { | 164 | try { |
168 | port = new UnixSerialPort(devicename, rate, DEFAULT_INIT_STRING, 0); | 165 | port = new UnixSerialPort(devicename, rate, DEFAULT_INIT_STRING, 0); |
169 | } catch (GsmException) { | 166 | } catch (GsmException) { |
170 | qDebug("port failed"); | 167 | qDebug("port failed"); |
168 | MfrText->setText("Open port failed"); | ||
171 | return; | 169 | return; |
172 | } | 170 | } |
173 | MfrText->setText("Initialising..."); | 171 | MfrText->setText("Initialising..."); |
174 | qDebug("got port"); | 172 | qDebug("got port"); |
175 | try { | 173 | try { |
176 | me = new MeTa(port); | 174 | me = new MeTa(port); |
177 | } catch (GsmException) { | 175 | } catch (GsmException) { |
178 | qDebug("meta failed"); | 176 | qDebug("meta failed"); |
179 | delete port; | 177 | MfrText->setText("Initialise GSM unit failed"); |
180 | port = NULL; | 178 | me = NULL; |
181 | unlockDevice(); | 179 | unlockDevice(); |
182 | return; | 180 | return; |
183 | } | 181 | } |
184 | 182 | ||
185 | qDebug("Opened"); | 183 | qDebug("Opened"); |
186 | 184 | ||
@@ -189,16 +187,14 @@ void GSMTool::doConnectButton() | |||
189 | MfrText->setText("Querying..."); | 187 | MfrText->setText("Querying..."); |
190 | 188 | ||
191 | try { | 189 | try { |
192 | ifo = me->getMEInfo(); | 190 | ifo = me->getMEInfo(); |
193 | } catch (GsmException) { | 191 | } catch (GsmException) { |
194 | qDebug("getMEInfo failed"); | 192 | qDebug("getMEInfo failed"); |
195 | delete me; | 193 | MfrText->setText("Query GSM unit failed"); |
196 | me = NULL; | 194 | me = NULL; |
197 | delete port; | ||
198 | port = NULL; | ||
199 | unlockDevice(); | 195 | unlockDevice(); |
200 | return; | 196 | return; |
201 | } | 197 | } |
202 | 198 | ||
203 | MfrText->setText(ifo._manufacturer.c_str()); | 199 | MfrText->setText(ifo._manufacturer.c_str()); |
204 | ModelText->setText(ifo._model.c_str()); | 200 | ModelText->setText(ifo._model.c_str()); |
diff --git a/noncore/unsupported/gsmtool/gsmtool.h b/noncore/unsupported/gsmtool/gsmtool.h index cb19f54..1625cb1 100644 --- a/noncore/unsupported/gsmtool/gsmtool.h +++ b/noncore/unsupported/gsmtool/gsmtool.h | |||
@@ -24,13 +24,12 @@ private slots: | |||
24 | private: | 24 | private: |
25 | static const speed_t baudrates[]; | 25 | static const speed_t baudrates[]; |
26 | int devicelocked; | 26 | int devicelocked; |
27 | int timerid; | 27 | int timerid; |
28 | 28 | ||
29 | gsmlib::MeTa *me; | 29 | gsmlib::MeTa *me; |
30 | gsmlib::Port *port; | ||
31 | 30 | ||
32 | char *devicename; | 31 | char *devicename; |
33 | speed_t baudrate; | 32 | speed_t baudrate; |
34 | 33 | ||
35 | int lockDevice( ); | 34 | int lockDevice( ); |
36 | void unlockDevice( ); | 35 | void unlockDevice( ); |