Example #1
0
void CodaSignalHandler::tcfEvent(const Coda::CodaEvent &event)
{
    reportMessage(tr("CODA event: Type: %1 Message: %2").arg(event.type()).arg(event.toString()));

    switch (event.type()) {
    case Coda::CodaEvent::LocatorHello:
        handleConnected(event);
        break;
    case Coda::CodaEvent::ProcessExitedEvent:
        handleAppExited(event);
        break;
    default:
        reportMessage(tr("CODA unhandled event: Type: %1 Message: %2").arg(event.type()).arg(event.toString()));
        break;
    }
}
void SymbianIDeviceConfigurationWidget::codaEvent(const Coda::CodaEvent &event)
{
    switch (event.type()) {
    case Coda::CodaEvent::LocatorHello: // Commands accepted now
        codaIncreaseProgress();
        if (m_codaInfoDevice)
            m_codaInfoDevice->sendSymbianOsDataGetQtVersionCommand(Coda::CodaCallback(this, &SymbianIDeviceConfigurationWidget::getQtVersionCommandResult));
        break;
    default:
        break;
    }
}
void CodaClientApplication::slotCodaEvent (const Coda::CodaEvent &ev)
{
    printTimeStamp();
    std::printf("Event: %s\n", qPrintable(ev.toString()));
    switch (ev.type()) {
    case Coda::CodaEvent::LocatorHello: // Commands accepted now
        switch (m_mode) {
        case Ping:
            break;
        case Launch:
            m_trkDevice->sendProcessStartCommand(Coda::CodaCallback(this, &CodaClientApplication::handleCreateProcess),
                                                 m_launchBinary, m_launchUID, m_launchArgs, QString(), m_launchDebug);
            break;
        case Install:
            if (m_installSilently) {
                m_trkDevice->sendSymbianInstallSilentInstallCommand(Coda::CodaCallback(this, &CodaClientApplication::handleSymbianInstall),
                                                                    m_installSisFile.toAscii(), m_installTargetDrive.toAscii());
            } else {
                m_trkDevice->sendSymbianInstallUIInstallCommand(Coda::CodaCallback(this, &CodaClientApplication::handleSymbianInstall),
                                                                m_installSisFile.toAscii());
            }
            break;
        case Uninstall:
            m_trkDevice->sendSymbianUninstallCommand(Coda::CodaCallback(this, &CodaClientApplication::handleUninstall),
                                                     m_uninstallPackage);
            break;
        case Put: {
            const unsigned flags =
                    Coda::CodaDevice::FileSystem_TCF_O_WRITE
                    |Coda::CodaDevice::FileSystem_TCF_O_CREAT
                    |Coda::CodaDevice::FileSystem_TCF_O_TRUNC;
            m_putWriteOk = false;
            m_trkDevice->sendFileSystemOpenCommand(Coda::CodaCallback(this, &CodaClientApplication::handleFileSystemOpen),
                                                   m_putRemoteFile.toAscii(), flags);
        }
        break;
        case Stat: {
            const unsigned flags = Coda::CodaDevice::FileSystem_TCF_O_READ;
            m_statFstatOk = false;
            m_trkDevice->sendFileSystemOpenCommand(Coda::CodaCallback(this, &CodaClientApplication::handleFileSystemOpen),
                                                   m_statRemoteFile.toAscii(), flags);
        }
        break;
        case Invalid:
            break;
        }
        break;
    case Coda::CodaEvent::RunControlModuleLoadSuspended:  {
        // Debug mode start: Continue:
        const Coda::CodaRunControlModuleLoadContextSuspendedEvent &me =
                static_cast<const Coda::CodaRunControlModuleLoadContextSuspendedEvent &>(ev);
        if (me.info().requireResume) {
            printTimeStamp();
            std::printf("Continuing...\n");
            m_trkDevice->sendRunControlResumeCommand(Coda::CodaCallback(), me.id());
        }
    }
        break;
    case Coda::CodaEvent::RunControlContextRemoved: // App terminated in debug mode
        doExit(0);
        break;
    default:
        break;
    }
}