S60: Provide a MessageBox for starting serial communication as well.

Generalize the concept of the Bluetooth starter, extract base class
BaseCommunicationStarter that can be used to start a serial communication
without further resources (listener) as well. Introduce convenience
functions for both types.

Note: This will only work for COM-ports that are not used otherwise
by the operating system.
This commit is contained in:
Friedemann Kleint
2009-10-26 15:37:09 +01:00
parent c6e9c041a7
commit 4091efb47f
13 changed files with 291 additions and 145 deletions

View File

@@ -1512,30 +1512,22 @@ void TrkGdbAdapter::startAdapter()
debugMessage(_("TRYING TO START ADAPTER"));
logMessage(QLatin1String("### Starting TrkGdbAdapter"));
m_trkDevice->setSerialFrame(effectiveTrkDeviceType() != TrkOptions::BlueTooth);
// Prompt the user for a bluetooth connection
const QString device = effectiveTrkDevice();
QString message;
if (effectiveTrkDeviceType() == TrkOptions::BlueTooth) {
S60DebuggerBluetoothStarter starter(m_trkDevice);
starter.setDevice(device);
const trk::StartBluetoothGuiResult src = trk::startBluetoothGui(starter, 0, &message);
switch (src) {
case trk::BluetoothGuiConnected:
break;
case trk::BluetoothGuiCanceled:
emit adapterStartFailed(message, QString());
return;
case trk::BluetoothGuiError:
emit adapterStartFailed(message, TrkOptionsPage::settingsId());
return;
};
} else {
if (!m_trkDevice->isOpen() && !m_trkDevice->open(device, &message)) {
message = tr("Failed to connect to %1: %2\nCheck whether TRK is running.").arg(device).arg(message);
logMessage(message);
emit adapterStartFailed(message, TrkOptionsPage::settingsId());
return;
}
// Prompt the user to start communication
QString message;
const trk::PromptStartCommunicationResult src =
S60DebuggerBluetoothStarter::startCommunication(m_trkDevice,
effectiveTrkDevice(),
effectiveTrkDeviceType(),
0, &message);
switch (src) {
case trk::PromptStartCommunicationConnected:
break;
case trk::PromptStartCommunicationCanceled:
emit adapterStartFailed(message, QString());
return;
case trk::PromptStartCommunicationError:
emit adapterStartFailed(message, TrkOptionsPage::settingsId());
return;
}
QTC_ASSERT(m_gdbServer == 0, delete m_gdbServer);