Exemplo n.º 1
0
static void notifyCallback(CALLBACK *pcallback)
{
    processNotify *ppn = NULL;
    dbCommon  *precord;
    notifyPvt *pnotifyPvt;

    callbackGetUser(ppn,pcallback);
    pnotifyPvt = (notifyPvt *) ppn->pnotifyPvt;
    precord = dbChannelRecord(ppn->chan);
    dbScanLock(precord);
    epicsMutexMustLock(pnotifyGlobal->lock);
    assert(precord->ppnr);
    assert(pnotifyPvt->state == notifyRestartCallbackRequested ||
           pnotifyPvt->state == notifyUserCallbackRequested);
    assert(ellCount(&pnotifyPvt->waitList) == 0);
    if (pnotifyPvt->cancelWait) {
        if (pnotifyPvt->state == notifyRestartCallbackRequested) {
            restartCheck(precord->ppnr);
        }
        epicsEventSignal(pnotifyPvt->cancelEvent);
        epicsMutexUnlock(pnotifyGlobal->lock);
        dbScanUnlock(precord);
        return;
    }
    if(pnotifyPvt->state == notifyRestartCallbackRequested) {
        processNotifyCommon(ppn, precord);
        return;
    }
    /* All done. Clean up and call userCallback */
    pnotifyPvt->state = notifyUserCallbackActive;
    assert(precord->ppn!=ppn);
    callDone(precord, ppn);
}
Exemplo n.º 2
0
void QXmppRemoteMethod::gotResult( const QXmppRpcResponseIq &iq )
{
    if ( iq.id() == m_payload.id() )
    {
        m_result.hasError = false;
        m_result.result = iq.getPayload();
        emit callDone();
    }
}
void QXmppRemoteMethod::gotResult( const QXmppRpcResponseIq &iq )
{
    if ( iq.id() == m_payload.id() )
    {
        m_result.hasError = false;
        // FIXME: we don't handle multiple responses
        m_result.result = iq.values().first();
        emit callDone();
    }
}
void QXmppRemoteMethod::gotError( const QXmppRpcErrorIq &iq )
{
    if ( iq.id() == m_payload.id() )
    {
        m_result.hasError = true;
        m_result.errorMessage = iq.error().text();
        m_result.code = iq.error().type();
        emit callDone();
    }
}
Exemplo n.º 5
0
QXmppRemoteMethodResult QXmppRemoteMethod::call( )
{
    QEventLoop loop(this);
    connect( this, SIGNAL(callDone()), &loop, SLOT(quit()));
    QTimer::singleShot(30000,&loop, SLOT(quit())); // Timeout incase the other end hangs...

    m_client->sendPacket( m_payload );

    loop.exec( QEventLoop::ExcludeUserInputEvents | QEventLoop::WaitForMoreEvents );
    return m_result;
}
QXmppRemoteMethodResult QXmppRemoteMethod::call( )
{
    // FIXME : spinning an event loop is a VERY bad idea, it can cause
    // us to lose incoming packets
    QEventLoop loop(this);
    connect( this, SIGNAL(callDone()), &loop, SLOT(quit()));
    QTimer::singleShot(30000,&loop, SLOT(quit())); // Timeout incase the other end hangs...

    m_client->sendPacket( m_payload );

    loop.exec( QEventLoop::ExcludeUserInputEvents | QEventLoop::WaitForMoreEvents );
    return m_result;
}
Exemplo n.º 7
0
void XMLParser::parseTweets(QString twitterID)
{
    QString id = twitterID;

    if(id.isEmpty())
        return;

    QUrl url = QString("http://api.twitter.com/1/statuses/user_timeline.xml?screen_name=%1").arg(id);

    //QUrl url = QString("https://graph.facebook.com/me?access_token=");

    QNetworkRequest request(url);
    d->manager = new QNetworkAccessManager(this);
    QNetworkReply* reply = d->manager->get(request);

    connect(reply, SIGNAL(finished()) , this , SLOT(callDone()));
}
Exemplo n.º 8
0
static void processNotifyCommon(processNotify *ppn,dbCommon *precord)
{
    notifyPvt *pnotifyPvt = (notifyPvt *) ppn->pnotifyPvt;
    int didPut = 0;
    int doProcess = 0;

    if (precord->ppn &&
        pnotifyPvt->state != notifyRestartCallbackRequested) {
        /* Another processNotify owns the record */
        pnotifyPvt->state = notifyWaitForRestart; 
        ellSafeAdd(&precord->ppnr->restartList, &ppn->restartNode);
        epicsMutexUnlock(pnotifyGlobal->lock);
        dbScanUnlock(precord);
        return;
    } else if (precord->ppn) {
        assert(precord->ppn == ppn);
        assert(pnotifyPvt->state == notifyRestartCallbackRequested);
    }
    if (precord->pact) {
        precord->ppn = ppn;
        ellSafeAdd(&pnotifyPvt->waitList, &precord->ppnr->waitNode);
        pnotifyPvt->state = notifyRestartInProgress; 
        epicsMutexUnlock(pnotifyGlobal->lock);
        dbScanUnlock(precord);
        return;
    }
    if (ppn->requestType == putProcessRequest ||
        ppn->requestType == putProcessGetRequest) {
        /* Check if puts disabled */
        if (precord->disp && (dbChannelField(ppn->chan) != (void *) &precord->disp)) {
            ppn->putCallback(ppn, putDisabledType);
        } else {
            didPut = ppn->putCallback(ppn, putType);
        }
    }
    /* Check if dbProcess should be called */
    if (didPut &&
        ((dbChannelField(ppn->chan) == (void *) &precord->proc) ||
        (dbChannelFldDes(ppn->chan)->process_passive && precord->scan == 0)))
       doProcess = 1;
    else
        if (ppn->requestType == processGetRequest &&
            precord->scan == 0)
            doProcess = 1;

    if (doProcess) {
        ppn->wasProcessed = 1;
        precord->ppn = ppn;
        ellSafeAdd(&pnotifyPvt->waitList, &precord->ppnr->waitNode);
        pnotifyPvt->state = notifyProcessInProgress;
        epicsMutexUnlock(pnotifyGlobal->lock);
        dbProcess(precord);
        dbScanUnlock(precord);
        return;
    }
    if (pnotifyPvt->state == notifyRestartCallbackRequested) {
        restartCheck(precord->ppnr);
    }
    pnotifyPvt->state = notifyUserCallbackActive;
    assert(precord->ppn!=ppn);
    callDone(precord, ppn);
}