void SymbianIDeviceConfigurationWidget::updateDeviceInfo() { setDeviceInfoLabel(tr("Connecting")); if (symbianDevice()->communicationChannel() == SymbianIDevice::CommunicationCodaSerialConnection) { const SymbianUtils::SymbianDevice commDev = currentRawDevice(); m_codaInfoDevice = SymbianUtils::SymbianDeviceManager::instance()->getCodaDevice(commDev.portName()); if (m_codaInfoDevice.isNull()) { setDeviceInfoLabel(tr("Unable to create CODA connection. Please try again."), true); return; } if (!m_codaInfoDevice->device()->isOpen()) { setDeviceInfoLabel(m_codaInfoDevice->device()->errorString(), true); return; } //TODO error handling - for now just throw the command at coda m_codaInfoDevice->sendSymbianOsDataGetQtVersionCommand(Coda::CodaCallback(this, &SymbianIDeviceConfigurationWidget::getQtVersionCommandResult)); m_deviceInfoButton->setEnabled(false); m_codaTimeout->start(1000); } else if (symbianDevice()->communicationChannel() == SymbianIDevice::CommunicationCodaTcpConnection) { // collectingInfoFinished, which deletes m_codaDevice, can get called from within a coda callback, so need to use deleteLater m_codaInfoDevice = QSharedPointer<Coda::CodaDevice>(new Coda::CodaDevice, &QObject::deleteLater); connect(m_codaInfoDevice.data(), SIGNAL(codaEvent(Coda::CodaEvent)), this, SLOT(codaEvent(Coda::CodaEvent))); const QSharedPointer<QTcpSocket> codaSocket(new QTcpSocket); m_codaInfoDevice->setDevice(codaSocket); codaSocket->connectToHost(symbianDevice()->address(), symbianDevice()->port().toInt()); m_deviceInfoButton->setEnabled(false); m_codaTimeout->start(1500); } else setDeviceInfoLabel(tr("Currently there is no information about the device for this connection type."), true); }
bool CodaClientApplication::start() { m_startTime.start(); switch (m_mode) { case Ping: break; case Launch: { const QString args = m_launchArgs.join(QString(QLatin1Char(' '))); std::printf("Launching 0x%x '%s '%s' (debug: %d)\n", m_launchUID, qPrintable(m_launchBinary), qPrintable(args), m_launchDebug); } break; case Install: std::printf("Installing '%s' to '%s'\n", qPrintable(m_installSisFile), qPrintable(m_installTargetDrive)); break; case Uninstall: std::printf("Uninstalling 0x%x'\n", m_uninstallPackage); break; case Put: std::printf("Copying '%s' to '%s' in chunks of %lluKB\n", qPrintable(m_putLocalFile), qPrintable(m_putRemoteFile), m_putChunkSize / 1024); break; case Stat: std::printf("Retrieving attributes of '%s'\n", qPrintable(m_statRemoteFile)); break; case Invalid: break; } // Start connection m_trkDevice.reset(new Coda::CodaDevice); m_trkDevice->setVerbose(m_verbose); connect(m_trkDevice.data(), SIGNAL(error(QString)), this, SLOT(slotError(QString))); connect(m_trkDevice.data(), SIGNAL(logMessage(QString)), this, SLOT(slotTrkLogMessage(QString))); connect(m_trkDevice.data(), SIGNAL(codaEvent(Coda::CodaEvent)), this, SLOT(slotCodaEvent(Coda::CodaEvent))); connect(m_trkDevice.data(), SIGNAL(serialPong(QString)), this, SLOT(slotSerialPong(QString))); if (isSerialPort(m_address)) { // Serial const QSharedPointer<QIODevice> serialPort(new SymbianUtils::VirtualSerialDevice(m_address)); std::printf("Opening port %s...\n", qPrintable(m_address)); m_trkDevice->setSerialFrame(true); m_trkDevice->setDevice(serialPort); // Grab all data from start if (!serialPort->open(QIODevice::ReadWrite)) { std::fprintf(stderr, "Cannot open port: %s", qPrintable(serialPort->errorString())); return false; } // Initiate communication m_trkDevice->sendSerialPing(m_mode == Ping); } else { // TCP/IP const QSharedPointer<QTcpSocket> codaSocket(new QTcpSocket); m_trkDevice->setDevice(codaSocket); codaSocket->connectToHost(m_address, m_port); std::printf("Connecting to %s:%hu...\n", qPrintable(m_address), m_port); } return true; }