void S60DeviceRunConfigurationWidget::setSerialPort(int index)
{
    const SymbianUtils::SymbianDevice d = device(index);
    m_runConfiguration->setSerialPortName(d.portName());
    m_deviceInfoButton->setEnabled(index >= 0);
    clearDeviceInfo();
}
Esempio n. 2
0
void S60DeployConfigurationWidget::updateSerialDevices()
{
    m_serialPortsCombo->clear();
    clearDeviceInfo();
    const QString previouPortName = m_deployConfiguration->serialPortName();
    const QList<SymbianUtils::SymbianDevice> devices = SymbianUtils::SymbianDeviceManager::instance()->devices();
    int newIndex = -1;
    for (int i = 0; i < devices.size(); ++i) {
        const SymbianUtils::SymbianDevice &device = devices.at(i);
        m_serialPortsCombo->addItem(device.friendlyName(), qVariantFromValue(device));
        if (device.portName() == previouPortName)
            newIndex = i;
    }
    // Set new index: prefer to keep old or set to 0, if available.
    if (newIndex == -1 && !devices.empty())
        newIndex = 0;
    m_serialPortsCombo->setCurrentIndex(newIndex);
    if (newIndex == -1) {
        m_deviceInfoButton->setEnabled(false);
        m_deployConfiguration->setSerialPortName(QString());
    } else {
        m_deviceInfoButton->setEnabled(true);
        const QString newPortName = device(newIndex).portName();
        m_deployConfiguration->setSerialPortName(newPortName);
    }
    if (m_deployConfiguration->communicationChannel() != S60DeployConfiguration::CommunicationTrkSerialConnection)
        m_deviceInfoButton->setEnabled(false);
}
void S60DeviceRunConfigurationWidget::slotWaitingForTrkClosed()
{
    if (m_infoLauncher && m_infoLauncher->state() == trk::Launcher::WaitingForTrk) {
        m_infoLauncher->deleteLater();
        clearDeviceInfo();
        m_deviceInfoButton->setEnabled(true);
    }
}
Esempio n. 4
0
void S60DeployConfigurationWidget::updateDeviceInfo()
{
    //TODO: No CODA device info! Implement it when it is available
    if (m_deployConfiguration->communicationChannel() == S60DeployConfiguration::CommunicationTrkSerialConnection) {
        QTC_ASSERT(!m_infoLauncher, return)
                setDeviceInfoLabel(tr("Connecting..."));
        // Do a launcher run with the ping protocol. Prompt to connect and
        // go asynchronous afterwards to pop up launch trk box if a timeout occurs.
        QString message;
        const SymbianUtils::SymbianDevice commDev = currentDevice();
        m_infoLauncher = trk::Launcher::acquireFromDeviceManager(commDev.portName(), this, &message);
        if (!m_infoLauncher) {
            setDeviceInfoLabel(message, true);
            return;
        }
        connect(m_infoLauncher, SIGNAL(stateChanged(int)), this, SLOT(slotLauncherStateChanged(int)));

        m_infoLauncher->setSerialFrame(commDev.type() == SymbianUtils::SerialPortCommunication);
        m_infoLauncher->setTrkServerName(commDev.portName());

        // Prompt user
        const trk::PromptStartCommunicationResult src =
                S60RunConfigBluetoothStarter::startCommunication(m_infoLauncher->trkDevice(),
                                                                 this, &message);
        switch (src) {
        case trk::PromptStartCommunicationConnected:
            break;
        case trk::PromptStartCommunicationCanceled:
            clearDeviceInfo();
            m_infoLauncher->deleteLater();
            return;
        case trk::PromptStartCommunicationError:
            setDeviceInfoLabel(message, true);
            m_infoLauncher->deleteLater();
            return;
        };
        if (!m_infoLauncher->startServer(&message)) {
            setDeviceInfoLabel(message, true);
            m_infoLauncher->deleteLater();
            return;
        }
        // Wait for either timeout or results
        m_deviceInfoButton->setEnabled(false);
    } else