Exemplo n.º 1
0
// Cancel all requests with a parent index in the range from startPI to endPI (inclusive)
void ex_queue::cancelRequestWithParentIndexRange(queue_index startPI, queue_index endPI)
{
  queue_index i = head_;

  // search through all existing entries for the parent indexes within the range
  if(endPI >= startPI) {
    while (!isVacant(i))
      {
        // if this entry is within the range, cancel it
        if (queue_[i&mask_].downState.parentIndex >= startPI &&
            queue_[i&mask_].downState.parentIndex <= endPI)
          cancelRequest(i);
        i++;
      }
  } else if(startPI > endPI) {
    // If endPI has wrapped around, the range also wraps.
    while (!isVacant(i))
      {
        // if this entry is within the range, cancel it
        if (queue_[i&mask_].downState.parentIndex >= startPI ||
            queue_[i&mask_].downState.parentIndex <= endPI)
          cancelRequest(i);
        i++;
      }
  }
}
Exemplo n.º 2
0
bool BondRealtimeInfo::requestDataFromWind(const QString &windCode, bool isRealtime) {
//    qDebug() << Q_FUNC_INFO();

    this->bondCode = windCode;

    if (reqID != 0) {
        cancelRequest();//同时会将上次请求的ID清零
    }

    std::wstring indicators = L"rt_vwap,rt_high,rt_low,rt_last,rt_last_amt,rt_last_vol,rt_latest,rt_vol,rt_amt,\
            rt_bid1,rt_bid2,rt_bid3,rt_bid4,rt_bid5,\
            rt_ask1,rt_ask2,rt_ask3,rt_ask4,rt_ask5,\
            rt_bsize1,rt_bsize2,rt_bsize3,rt_bsize4,rt_bsize5,\
            rt_asize1,rt_asize2,rt_asize3,rt_asize4,rt_asize5";

    if (isRealtime) {
        reqID = MyWSQ(this->bondCode, indicators.c_str(), L"REALTIME=Y", dataPro, this);
    } else {
        reqID = MyWSQ(this->bondCode, indicators.c_str(), L"REALTIME=N", dataPro, this);
    }

    bool res = false;
    if (reqID != 0) {
//        qDebug() << Q_FUNC_INFO();
        res = true;
    }
    return res;
}
Exemplo n.º 3
0
MapRipForm::MapRipForm(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::MapRipForm)
{
    ui->setupUi(this);
    connect(ui->cancelButton,SIGNAL(clicked()),this,SIGNAL(cancelRequest()));
}
Exemplo n.º 4
0
bool InformationPanel::urlChanged()
{
    if (!url().isValid()) {
        return false;
    }

    if (!isVisible()) {
        return true;
    }

    cancelRequest();
    m_selection.clear();

    if (!isEqualToShownUrl(url())) {
        m_shownUrl = url();
        m_fileItem = KFileItem();

        // Update the content with a delay. This gives
        // the directory lister the chance to show the content
        // before expensive operations are done to show
        // meta information.
        m_urlChangedTimer->start();
    }

    return true;
}
Exemplo n.º 5
0
void InformationPanel::showItemInfo()
{
    if (!isVisible()) {
        return;
    }

    cancelRequest();

    if (m_fileItem.isNull() && (m_selection.count() > 1)) {
        // The information for a selection of items should be shown
        m_content->showItems(m_selection);
    } else {
        // The information for exactly one item should be shown
        KFileItem item;
        if (!m_fileItem.isNull()) {
            item = m_fileItem;
        } else if (!m_selection.isEmpty()) {
            Q_ASSERT(m_selection.count() == 1);
            item = m_selection.first();
        }

        if (item.isNull()) {
            // No item is hovered and no selection has been done: provide
            // an item for the currently shown directory.
            m_folderStatJob = KIO::stat(url(), KIO::HideProgressInfo);
            connect(m_folderStatJob, SIGNAL(result(KJob*)),
                    this, SLOT(slotFolderStatFinished(KJob*)));
        } else {
Exemplo n.º 6
0
void InformationPanel::requestDelayedItemInfo(const KFileItem& item)
{
    if (!isVisible() || (item.isNull() && m_fileItem.isNull())) {
        return;
    }

    if (QApplication::mouseButtons() & Qt::LeftButton) {
        // Ignore the request of an item information when a rubberband
        // selection is ongoing.
        return;
    }

    cancelRequest();

    if (item.isNull()) {
        // The cursor is above the viewport. If files are selected,
        // show information regarding the selection.
        if (m_selection.size() > 0) {
            m_fileItem = KFileItem();
            m_infoTimer->start();
        }
    } else if (item.url().isValid() && !isEqualToShownUrl(item.url())) {
        // The cursor is above an item that is not shown currently
        m_urlCandidate = item.url();
        m_fileItem = item;
        m_infoTimer->start();
    }
}
Exemplo n.º 7
0
void HttpLibcurl::shutdown()
{
	while (! mActiveOps.empty())
	{
		HttpOpRequest * op(* mActiveOps.begin());
		mActiveOps.erase(mActiveOps.begin());

		cancelRequest(op);
		op->release();
	}

	if (mMultiHandles)
	{
		for (int policy_class(0); policy_class < mPolicyCount; ++policy_class)
		{
			if (mMultiHandles[policy_class])
			{
				curl_multi_cleanup(mMultiHandles[policy_class]);
				mMultiHandles[policy_class] = 0;
			}
		}

		delete [] mMultiHandles;
		mMultiHandles = NULL;

		delete [] mActiveHandles;
		mActiveHandles = NULL;

		delete [] mDirtyPolicy;
		mDirtyPolicy = NULL;
	}

	mPolicyCount = 0;
}
Exemplo n.º 8
0
BondRealtimeInfo::~BondRealtimeInfo() {
//    qDebug() << Q_FUNC_INFO;
    if (RWLock_realtime != NULL) {
        delete RWLock_realtime;
        RWLock_realtime = NULL;
    }

    cancelRequest();
}
Exemplo n.º 9
0
void TokenQueue::cancelActiveRequestTokens(const uint32_t& userType)
{
	std::list<uint32_t> tokens;
	activeRequestTokens(userType, tokens);
	if (!tokens.empty()) {
		std::list<uint32_t>::iterator tokenIt;
		for (tokenIt = tokens.begin(); tokenIt != tokens.end(); ++tokenIt) {
			cancelRequest(*tokenIt);
		}
	}
}
Exemplo n.º 10
0
void AddAction::updateForPageChange()
{
	if(indexOf(currentPage()) == 1) requestNextPress(); else cancelRequest();
	switch(indexOf(currentPage()))
	{	case 0: break;
		case 1: break;
		case 2: break;
		case 3: break;
		case 4: break;
	}
	updateButtonStates();
}
Exemplo n.º 11
0
void ex_queue::cancelRequestWithParentIndex(queue_index pindex)
{
  queue_index i = head_;

  // search through all existing entries for the given parent index
  while (!isVacant(i))
    {
      // if this entry has the given parent index, cancel it
      if (queue_[i&mask_].downState.parentIndex == pindex)
        cancelRequest(i);
      i++;
    }
}
SNMPRemoteAgent::~SNMPRemoteAgent() {
	if(_bInit) {
		_pSession->unregisterRemoteAgent(this);
		SnmpFreeContext(_hContext);
		SnmpFreeEntity(_hEntity);
		_bInit = false;
	}
	if(_mySession && _pSession != NULL) {
		delete _pSession;
	}
	std::map<int,SNMPRequest*>::iterator i;
	while((i=_requestMap.begin()) != _requestMap.end()) {
		cancelRequest((*i).first);
	}
}
Exemplo n.º 13
0
void NemoThumbnailLoader::updateRequest(NemoThumbnailItem *item, bool identityChanged)
{
    QString fileName;
    QByteArray cacheKey;
    if (identityChanged) {
        fileName = item->m_source.toLocalFile();
        cacheKey = NemoThumbnailProvider::cacheKey(fileName, item->m_sourceSize);
        if (item->m_fillMode == NemoThumbnailItem::PreserveAspectFit)
            cacheKey += 'F';

        QPixmap pixmap;
        if (QPixmapCache::find(cacheKey, &pixmap)) {
            if (item->m_request)
                cancelRequest(item);
            item->m_pixmap = pixmap;
            item->setImplicitWidth(pixmap.width());
            item->setImplicitHeight(pixmap.height());
            return;
        }
    }

    QMutexLocker locker(&m_mutex);

    if (!item->m_request) {                     // There's no current request.
        item->m_request = new ThumbnailRequest(item, fileName, cacheKey);
    } else if (item->m_request->previous) {     // The current request is pending.
        if (identityChanged) {
            item->m_request->cacheKey = cacheKey;
            item->m_request->fileName = fileName;
            item->m_request->size = item->m_sourceSize;
            item->m_request->fillMode = item->m_fillMode;
        }
        item->m_request->mimeType = item->m_mimeType;
    } else {                                    // The current request is being processed. Replace it.
        item->m_request->item = 0;
        item->m_request = identityChanged
                ? new ThumbnailRequest(item, fileName, cacheKey)
                : new ThumbnailRequest(item, item->m_request->fileName, item->m_request->cacheKey);
    }

    ThumbnailRequest::enqueue(m_thumbnailRequests[item->m_priority], item->m_request);

    m_waitCondition.wakeOne();
}
Exemplo n.º 14
0
ExportMeanDialog::ExportMeanDialog(QWidget* parent, const char* name)
    : QWidget(parent, name)
{
    // just need some buttons and a qline edit..
    setCaption("Export Means");
    QPushButton* requestButton = new QPushButton("Export Means", this, "requestButton");
    connect(requestButton, SIGNAL(clicked()), this, SLOT(requestMeans()) );

    QPushButton* cancelButton = new QPushButton("Cancel", this, "cancelButton");
    connect(cancelButton, SIGNAL(clicked()), this, SLOT(cancelRequest()) );

    QPushButton* fileButton = new QPushButton("Specify File", this, "fileButton");
    connect(fileButton, SIGNAL(clicked()), this, SLOT(getFileName()) );

    fileName = new QLineEdit(this, "fileName");

    // a button Group and a number of buttons..
    QLabel* normLabel = new QLabel("Normalisation Method", this, "normLabel");
    QButtonGroup* normGroup = new QButtonGroup("normGroup");
    zscore = new QRadioButton("z-score", this, "zscore");
    mscore = new QRadioButton("m-score", this, "mscore");
    raw = new QRadioButton("raw", this, "raw");
    // this is very ugly, but I can't seem to get it to work.. so well otherwise.
    normGroup->insert(zscore);
    normGroup->insert(mscore);
    normGroup->insert(raw);

    // and set up some sort of layout .. 
    QVBoxLayout* vbox = new QVBoxLayout(this, 2, 2, "vbox");
    vbox->addWidget(normLabel);
    vbox->addWidget(zscore);
    vbox->addWidget(mscore);
    vbox->addWidget(raw);

    QHBoxLayout* fileBox = new QHBoxLayout(vbox);
    fileBox->addWidget(fileName);
    fileBox->addWidget(fileButton);
    vbox->addStretch();
    QHBoxLayout* buttonBox = new QHBoxLayout(vbox);
    buttonBox->addWidget(cancelButton);
    buttonBox->addStretch();
    buttonBox->addWidget(requestButton);
}
Exemplo n.º 15
0
// Implements the transport part of any cancel operation.
// See if the handle is an active operation and if so,
// use the more complicated transport-based cancelation
// method to kill the request.
bool HttpLibcurl::cancel(HttpHandle handle)
{
	HttpOpRequest * op(static_cast<HttpOpRequest *>(handle));
	active_set_t::iterator it(mActiveOps.find(op));
	if (mActiveOps.end() == it)
	{
		return false;
	}

	// Cancel request
	cancelRequest(op);

	// Drop references
	mActiveOps.erase(it);
	--mActiveHandles[op->mReqPolicy];
	op->release();

	return true;
}
/*!
  \internal

  Destructor.
*/
FacebookRequest::~FacebookRequest()
{
    cancelRequest();
}
/*
 * Proxy for all I/O with a device
 * @author Dan Streetman
 */
JNIEXPORT void JNICALL Java_com_ibm_jusb_os_linux_JavaxUsb_nativeDeviceProxy
  ( JNIEnv *env, jclass JavaxUsb, jobject linuxDeviceProxy )
{
	int fd = 0;
	struct usbdevfs_urb *urb;
	int loop_count = 0;

	jclass LinuxDeviceProxy;
	jobject linuxRequest;
	jstring jkey;
	jmethodID startCompleted, isRequestWaiting, getReadyRequest, getCancelRequest;
	jmethodID getKey;

	LinuxDeviceProxy = (*env)->GetObjectClass( env, linuxDeviceProxy );
	startCompleted = (*env)->GetMethodID( env, LinuxDeviceProxy, "startCompleted", "(I)V" );
	isRequestWaiting = (*env)->GetMethodID( env, LinuxDeviceProxy, "isRequestWaiting", "()Z" );
	getReadyRequest = (*env)->GetMethodID( env, LinuxDeviceProxy, "getReadyRequest", "()Lcom/ibm/jusb/os/linux/LinuxRequest;" );
	getCancelRequest = (*env)->GetMethodID( env, LinuxDeviceProxy, "getCancelRequest", "()Lcom/ibm/jusb/os/linux/LinuxRequest;" );
	getKey = (*env)->GetMethodID( env, LinuxDeviceProxy, "getKey", "()Ljava/lang/String;" );
	jkey = (*env)->CallObjectMethod( env, linuxDeviceProxy, getKey );
	(*env)->DeleteLocalRef( env, LinuxDeviceProxy );

	errno = 0;
	fd = open_device( env, jkey, O_RDWR );
	(*env)->DeleteLocalRef( env, jkey );

	if (0 > fd) {
		dbg( MSG_ERROR, "nativeDeviceProxy : Could not open node for device!\n" );
		(*env)->CallVoidMethod( env, linuxDeviceProxy, startCompleted, errno );
		return;
	}

	(*env)->CallVoidMethod( env, linuxDeviceProxy, startCompleted, 0 );

	/* run forever...? */
	while (1) {
		/* FIXME - stop using polling! */
		if ( loop_count > 20 ) {
			usleep( 0 );
			loop_count = 0;
		}
		loop_count ++;

		if (JNI_TRUE == (*env)->CallBooleanMethod( env, linuxDeviceProxy, isRequestWaiting )) {
			if ((linuxRequest = (*env)->CallObjectMethod( env, linuxDeviceProxy, getReadyRequest ))) {
				dbg( MSG_DEBUG1, "nativeDeviceProxy : Got Request\n" );
				submitRequest( env, fd, linuxRequest );
				(*env)->DeleteLocalRef( env, linuxRequest );
				dbg( MSG_DEBUG1, "nativeDeviceProxy : Completed Request\n" );
			}

			if ((linuxRequest = (*env)->CallObjectMethod( env, linuxDeviceProxy, getCancelRequest ))) {
				dbg( MSG_DEBUG1, "nativeDeviceProxy : Got Abort Request\n" );
				cancelRequest( env, fd, linuxRequest );
				(*env)->DeleteLocalRef( env, linuxRequest );
				dbg( MSG_DEBUG1, "nativeDeviceProxy : Completed Abort Request\n" );
			}
		}

		if (!(ioctl( fd, USBDEVFS_REAPURBNDELAY, &urb ))) {
			dbg( MSG_DEBUG1, "nativeDeviceProxy : Got completed URB\n" );
			linuxRequest = urb->usercontext;
			completeRequest( env, linuxRequest );
			(*env)->DeleteGlobalRef( env, linuxRequest );
			dbg( MSG_DEBUG1, "nativeDeviceProxy : Finished completed URB\n" );
		}
	}

	dbg( MSG_ERROR, "nativeDeviceProxy : Proxy exiting!  ERROR!\n" );

	close( fd );
}
status_t BnCameraDeviceUser::onTransact(
    uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags)
{
    switch(code) {
        case DISCONNECT: {
            ALOGV("DISCONNECT");
            CHECK_INTERFACE(ICameraDeviceUser, data, reply);
            disconnect();
            reply->writeNoException();
            return NO_ERROR;
        } break;
        case SUBMIT_REQUEST: {
            CHECK_INTERFACE(ICameraDeviceUser, data, reply);

            // arg0 = request
            sp<CaptureRequest> request;
            if (data.readInt32() != 0) {
                request = new CaptureRequest();
                request->readFromParcel(const_cast<Parcel*>(&data));
            }

            // arg1 = streaming (bool)
            bool repeating = data.readInt32();

            // return code: requestId (int32)
            reply->writeNoException();
            int64_t lastFrameNumber = -1;
            reply->writeInt32(submitRequest(request, repeating, &lastFrameNumber));
            reply->writeInt32(1);
            reply->writeInt64(lastFrameNumber);

            return NO_ERROR;
        } break;
        case SUBMIT_REQUEST_LIST: {
            CHECK_INTERFACE(ICameraDeviceUser, data, reply);

            List<sp<CaptureRequest> > requestList;
            int requestListSize = data.readInt32();
            for (int i = 0; i < requestListSize; i++) {
                if (data.readInt32() != 0) {
                    sp<CaptureRequest> request = new CaptureRequest();
                    if (request->readFromParcel(const_cast<Parcel*>(&data)) != OK) {
                        return BAD_VALUE;
                    }
                    requestList.push_back(request);
                } else {
                    sp<CaptureRequest> request = 0;
                    requestList.push_back(request);
                    ALOGE("A request is missing. Sending in null request.");
                }
            }

            bool repeating = data.readInt32();

            reply->writeNoException();
            int64_t lastFrameNumber = -1;
            reply->writeInt32(submitRequestList(requestList, repeating, &lastFrameNumber));
            reply->writeInt32(1);
            reply->writeInt64(lastFrameNumber);

            return NO_ERROR;
        } break;
        case CANCEL_REQUEST: {
            CHECK_INTERFACE(ICameraDeviceUser, data, reply);
            int requestId = data.readInt32();
            reply->writeNoException();
            int64_t lastFrameNumber = -1;
            reply->writeInt32(cancelRequest(requestId, &lastFrameNumber));
            reply->writeInt32(1);
            reply->writeInt64(lastFrameNumber);
            return NO_ERROR;
        } break;
        case DELETE_STREAM: {
            CHECK_INTERFACE(ICameraDeviceUser, data, reply);
            int streamId = data.readInt32();
            reply->writeNoException();
            reply->writeInt32(deleteStream(streamId));
            return NO_ERROR;
        } break;
        case CREATE_STREAM: {
            CHECK_INTERFACE(ICameraDeviceUser, data, reply);

            status_t ret = BAD_VALUE;
            if (data.readInt32() != 0) {
                OutputConfiguration outputConfiguration(data);
                ret = createStream(outputConfiguration);
            } else {
                ALOGE("%s: cannot take an empty OutputConfiguration", __FUNCTION__);
            }

            reply->writeNoException();
            ALOGV("%s: CREATE_STREAM: write noException", __FUNCTION__);
            reply->writeInt32(ret);
            ALOGV("%s: CREATE_STREAM: write ret = %d", __FUNCTION__, ret);

            return NO_ERROR;
        } break;
        case CREATE_INPUT_STREAM: {
            CHECK_INTERFACE(ICameraDeviceUser, data, reply);
            int width, height, format;

            width = data.readInt32();
            height = data.readInt32();
            format = data.readInt32();
            status_t ret = createInputStream(width, height, format);

            reply->writeNoException();
            reply->writeInt32(ret);
            return NO_ERROR;

        } break;
        case GET_INPUT_SURFACE: {
            CHECK_INTERFACE(ICameraDeviceUser, data, reply);

            sp<IGraphicBufferProducer> bp;
            status_t ret = getInputBufferProducer(&bp);
            sp<IBinder> b(IInterface::asBinder(ret == OK ? bp : NULL));

            reply->writeNoException();
            reply->writeInt32(ret);
            reply->writeInt32(1);
            reply->writeString16(String16("camera input")); // name of surface
            reply->writeStrongBinder(b);

            return NO_ERROR;
        } break;
        case CREATE_DEFAULT_REQUEST: {
            CHECK_INTERFACE(ICameraDeviceUser, data, reply);

            int templateId = data.readInt32();

            CameraMetadata request;
            status_t ret;
            ret = createDefaultRequest(templateId, &request);

            reply->writeNoException();
            reply->writeInt32(ret);

            // out-variables are after exception and return value
            reply->writeInt32(1); // to mark presence of metadata object
            request.writeToParcel(const_cast<Parcel*>(reply));

            return NO_ERROR;
        } break;
        case GET_CAMERA_INFO: {
            CHECK_INTERFACE(ICameraDeviceUser, data, reply);

            CameraMetadata info;
            status_t ret;
            ret = getCameraInfo(&info);

            reply->writeNoException();
            reply->writeInt32(ret);

            // out-variables are after exception and return value
            reply->writeInt32(1); // to mark presence of metadata object
            info.writeToParcel(reply);

            return NO_ERROR;
        } break;
        case WAIT_UNTIL_IDLE: {
            CHECK_INTERFACE(ICameraDeviceUser, data, reply);
            reply->writeNoException();
            reply->writeInt32(waitUntilIdle());
            return NO_ERROR;
        } break;
        case FLUSH: {
            CHECK_INTERFACE(ICameraDeviceUser, data, reply);
            reply->writeNoException();
            int64_t lastFrameNumber = -1;
            reply->writeInt32(flush(&lastFrameNumber));
            reply->writeInt32(1);
            reply->writeInt64(lastFrameNumber);
            return NO_ERROR;
        }
        case BEGIN_CONFIGURE: {
            CHECK_INTERFACE(ICameraDeviceUser, data, reply);
            reply->writeNoException();
            reply->writeInt32(beginConfigure());
            return NO_ERROR;
        } break;
        case END_CONFIGURE: {
            CHECK_INTERFACE(ICameraDeviceUser, data, reply);
            bool isConstrainedHighSpeed = data.readInt32();
            reply->writeNoException();
            reply->writeInt32(endConfigure(isConstrainedHighSpeed));
            return NO_ERROR;
        } break;
        case PREPARE: {
            CHECK_INTERFACE(ICameraDeviceUser, data, reply);
            int streamId = data.readInt32();
            reply->writeNoException();
            reply->writeInt32(prepare(streamId));
            return NO_ERROR;
        } break;
        case TEAR_DOWN: {
            CHECK_INTERFACE(ICameraDeviceUser, data, reply);
            int streamId = data.readInt32();
            reply->writeNoException();
            reply->writeInt32(tearDown(streamId));
            return NO_ERROR;
        } break;

        default:
            return BBinder::onTransact(code, data, reply, flags);
    }
}
Exemplo n.º 19
0
void ParserAbstract::networkReplyTimedOut()
{
    cancelRequest();
    emit errorOccured(tr("Request timed out."));
}
Exemplo n.º 20
0
void FahrplanParserThread::run()
{
    ParserAbstract *m_parser;

    switch (i_parser) {
        default:
        case 0:
            m_parser = new ParserMobileBahnDe();
            break;
        case 1:
            m_parser = new ParserXmlOebbAt();
            break;
        case 2:
            m_parser = new ParserXmlRejseplanenDk();
            break;
        case 3:
            m_parser = new ParserXmlSbbCh();
            break;
        case 4:
            m_parser = new ParserXmlNri();
            break;
        case 5:
            m_parser = new ParserXmlVasttrafikSe();
            break;
        case 6:
            m_parser = new ParserPTVVicGovAu();
            break;
        case 7:
            m_parser = new ParserSydneyEFA();
            break;
        case 8:
            m_parser = new ParserSFBayEFA();
            break;
        case 9:
            m_parser = new ParserIrelandEFA();
            break;
        case 10:
            m_parser = new ParserDubaiEFA();
            break;
        case 11:
            m_parser = new ParserNinetwo();
            break;
        case 12:
            m_parser = new ParserMunichEFA();
            break;
        case 13:
            m_parser = new ParserSalzburgEFA();
            break;
        case 14:
            m_parser = new ParserResRobot();
            break;
        case 15:
            m_parser = new ParserFinlandMatka();
            break;
    }

    m_name = m_parser->name();
    m_short_name = m_parser->shortName();
    m_uid = m_parser->uid();
    m_trainrestrictions = m_parser->getTrainRestrictions();
    m_supports_gps = m_parser->supportsGps();
    m_supports_via = m_parser->supportsVia();
    m_supports_timetable = m_parser->supportsTimeTable();
    m_supports_timetabledirection = m_parser->supportsTimeTableDirection();

    qRegisterMetaType<ParserAbstract::Mode>("ParserAbstract::Mode");
    //Connect thread requests with actual parser
    connect(this, SIGNAL(requestCancelRequest()), m_parser, SLOT(cancelRequest()), Qt::QueuedConnection);
    connect(this, SIGNAL(requestFindStationsByName(QString)), m_parser, SLOT(findStationsByName(QString)), Qt::QueuedConnection);
    connect(this, SIGNAL(requestFindStationsByCoordinates(qreal,qreal)), m_parser, SLOT(findStationsByCoordinates(qreal,qreal)), Qt::QueuedConnection);
    connect(this, SIGNAL(requestGetJourneyDetails(QString)), m_parser, SLOT(getJourneyDetails(QString)), Qt::QueuedConnection);
    connect(this, SIGNAL(requestGetTimeTableForStation(Station,Station,QDateTime,ParserAbstract::Mode,int)), m_parser, SLOT(getTimeTableForStation(Station,Station,QDateTime,ParserAbstract::Mode,int)), Qt::QueuedConnection);
    connect(this, SIGNAL(requestSearchJourney(Station,Station,Station,QDateTime,ParserAbstract::Mode,int)), m_parser, SLOT(searchJourney(Station,Station,Station,QDateTime,ParserAbstract::Mode,int)), Qt::QueuedConnection);
    connect(this, SIGNAL(requestSearchJourneyEarlier()), m_parser, SLOT(searchJourneyEarlier()), Qt::QueuedConnection);
    connect(this, SIGNAL(requestSearchJourneyLater()), m_parser, SLOT(searchJourneyLater()), Qt::QueuedConnection);

    //Connect parser responses with threads corresponding results
    connect(m_parser, SIGNAL(errorOccured(QString)), this, SIGNAL(errorOccured(QString)), Qt::QueuedConnection);
    connect(m_parser, SIGNAL(journeyDetailsResult(JourneyDetailResultList*)), this, SIGNAL(journeyDetailsResult(JourneyDetailResultList*)), Qt::QueuedConnection);
    connect(m_parser, SIGNAL(journeyResult(JourneyResultList*)), this, SIGNAL(journeyResult(JourneyResultList*)), Qt::QueuedConnection);
    connect(m_parser, SIGNAL(stationsResult(StationsList)), this, SIGNAL(stationsResult(StationsList)), Qt::QueuedConnection);
    connect(m_parser, SIGNAL(timetableResult(TimetableEntriesList)), this, SIGNAL(timeTableResult(TimetableEntriesList)), Qt::QueuedConnection);

    m_ready = true;

    // Autodelete after thread finishes.
    connect(this, SIGNAL(finished()), SLOT(deleteLater()));

    exec();

    delete m_parser;
}
Exemplo n.º 21
0
void ImgurUploader::cancel()
{
    emit cancelRequest();
}
Exemplo n.º 22
0
CAsyncHttp::~CAsyncHttp(void)
{
    cancelRequest("*", true);
    LOG(INFO) + "Thread shutdown";
}
Exemplo n.º 23
0
/*
 * Description : slot function for active network event
 * Parameters  : aEvent, see the definition of IRQNetworkEvent
 */
void IRCategoryView::networkRequestNotified(IRQNetworkEvent aEvent)
{
    Q_ASSERT(iViewParameter != EIRViewPara_InvalidId);
    
    if (getViewManager()->currentView() != this)
    {
        return;
    }
    
    switch (aEvent)
    {
    case EIRQNetworkConnectionEstablished:
        if (EIR_UseNetwork_StartingView == getUseNetworkReason())
        {
            IRQIsdsClient::IRQIsdsClientInterfaceIDs request = IRQIsdsClient::EGenre;
        
            switch (iViewParameter)
            {
            case EIRViewPara_Genre:
                request = IRQIsdsClient::EGenre;
                break;

            case EIRViewPara_Language:
                request = IRQIsdsClient::ELanguages;
                break;

            case EIRViewPara_Country:
                request = IRQIsdsClient::ECountries;
                break;

            default:
                break;
            }

            connectToIsdsClient();
            bool cache = false;
            iIsdsClient->isdsCategoryRequest(request, cache);
            iApplication->startLoadingAnimation(this, SLOT(cancelRequest()));
        }
        //for there may be some cache, and when we click, we need to handle here        
        else if ( EIR_UseNetwork_SelectItem == getUseNetworkReason())
        {
            handleItemSelected();               
        }        
        
        break;
       
    case EIRQConnectingCancelled:
    case EIRQDisplayNetworkMessageNoConnectivity:
        if (iListView->model()->rowCount() == 0)
        {
            getViewManager()->activateView(EIRView_MainView);
        }
        else
        {
            setCheckedAction();
        }
        
        break;
        
    default:
        setCheckedAction();
        break;
    }
    
    setUseNetworkReason(EIR_UseNetwork_NoReason);
}
Exemplo n.º 24
0
void IRCategoryView::loadCategory(IRQIsdsClient::IRQIsdsClientInterfaceIDs aCategory)
{
    connectToIsdsClient();
    
    bool cache = false;
    switch (aCategory)
    {
    case IRQIsdsClient::EGenre : 
        if (EIRViewPara_Genre != getViewParameter())
        {
            //the view is used for other categories other than Genre
            resetCurrentItem();
        }
        setViewParameter(EIRViewPara_Genre);
        setFlag(EViewFlag_ClearStackWhenActivate|EViewFlag_StickyViewEnabled);
        iIsdsClient->isdsCategoryRequest(IRQIsdsClient::EGenre, cache);
        break;
        
    case IRQIsdsClient::ELanguages : 
#ifdef SUBTITLE_STR_BY_LOCID
        setHeadingText(hbTrId("txt_irad_list_stations_by_language"));
#else
        setHeadingText(hbTrId("Stations by language"));        
#endif
        if (EIRViewPara_Language != getViewParameter())
        {
            //the view is used for other categories other than Language
            resetCurrentItem();
        }
        setViewParameter(EIRViewPara_Language);
        clearFlag(EViewFlag_ClearStackWhenActivate);
        clearFlag(EViewFlag_StickyViewEnabled);
        iIsdsClient->isdsCategoryRequest(IRQIsdsClient::ELanguages, cache);
        break;
        
    case IRQIsdsClient::ECountries :
#ifdef SUBTITLE_STR_BY_LOCID
        setHeadingText(hbTrId("txt_irad_list_stations_by_country_region"));
#else
        setHeadingText(hbTrId("Stations by country/region"));        
#endif
        if (EIRViewPara_Country != getViewParameter())
        {
            //the view is used for other categories other than Country
            resetCurrentItem();
        }
        setViewParameter(EIRViewPara_Country);
        clearFlag(EViewFlag_ClearStackWhenActivate);
        clearFlag(EViewFlag_StickyViewEnabled);
        iIsdsClient->isdsCategoryRequest(IRQIsdsClient::ECountries, cache);
        break;
        
    default:
        Q_ASSERT(false);
        break;
    }
    
    if (!cache)
    {
        iApplication->startLoadingAnimation(this, SLOT(cancelRequest()));
    }
}
status_t BnCameraDeviceUser::onTransact(
    uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags)
{
    switch(code) {
        case DISCONNECT: {
            ALOGV("DISCONNECT");
            CHECK_INTERFACE(ICameraDeviceUser, data, reply);
            disconnect();
            reply->writeNoException();
            return NO_ERROR;
        } break;
        case SUBMIT_REQUEST: {
            CHECK_INTERFACE(ICameraDeviceUser, data, reply);

            // arg0 = request
            sp<CaptureRequest> request;
            if (data.readInt32() != 0) {
                request = new CaptureRequest();
                request->readFromParcel(const_cast<Parcel*>(&data));
            }

            // arg1 = streaming (bool)
            bool repeating = data.readInt32();

            // return code: requestId (int32)
            reply->writeNoException();
            int64_t lastFrameNumber = -1;
            reply->writeInt32(submitRequest(request, repeating, &lastFrameNumber));
            reply->writeInt32(1);
            reply->writeInt64(lastFrameNumber);

            return NO_ERROR;
        } break;
        case SUBMIT_REQUEST_LIST: {
            CHECK_INTERFACE(ICameraDeviceUser, data, reply);

            List<sp<CaptureRequest> > requestList;
            int requestListSize = data.readInt32();
            for (int i = 0; i < requestListSize; i++) {
                if (data.readInt32() != 0) {
                    sp<CaptureRequest> request = new CaptureRequest();
                    if (request->readFromParcel(const_cast<Parcel*>(&data)) != OK) {
                        return BAD_VALUE;
                    }
                    requestList.push_back(request);
                } else {
                    sp<CaptureRequest> request = 0;
                    requestList.push_back(request);
                    ALOGE("A request is missing. Sending in null request.");
                }
            }

            bool repeating = data.readInt32();

            reply->writeNoException();
            int64_t lastFrameNumber = -1;
            reply->writeInt32(submitRequestList(requestList, repeating, &lastFrameNumber));
            reply->writeInt32(1);
            reply->writeInt64(lastFrameNumber);

            return NO_ERROR;
        } break;
        case CANCEL_REQUEST: {
            CHECK_INTERFACE(ICameraDeviceUser, data, reply);
            int requestId = data.readInt32();
            reply->writeNoException();
            int64_t lastFrameNumber = -1;
            reply->writeInt32(cancelRequest(requestId, &lastFrameNumber));
            reply->writeInt32(1);
            reply->writeInt64(lastFrameNumber);
            return NO_ERROR;
        } break;
        case DELETE_STREAM: {
            CHECK_INTERFACE(ICameraDeviceUser, data, reply);
            int streamId = data.readInt32();
            reply->writeNoException();
            reply->writeInt32(deleteStream(streamId));
            return NO_ERROR;
        } break;
        case CREATE_STREAM: {
            CHECK_INTERFACE(ICameraDeviceUser, data, reply);
            int width, height, format;

            width = data.readInt32();
            ALOGV("%s: CREATE_STREAM: width = %d", __FUNCTION__, width);
            height = data.readInt32();
            ALOGV("%s: CREATE_STREAM: height = %d", __FUNCTION__, height);
            format = data.readInt32();
            ALOGV("%s: CREATE_STREAM: format = %d", __FUNCTION__, format);

            sp<IGraphicBufferProducer> bp;
            if (data.readInt32() != 0) {
                String16 name = readMaybeEmptyString16(data);
                bp = interface_cast<IGraphicBufferProducer>(
                        data.readStrongBinder());

                ALOGV("%s: CREATE_STREAM: bp = %p, name = %s", __FUNCTION__,
                      bp.get(), String8(name).string());
            } else {
                ALOGV("%s: CREATE_STREAM: bp = unset, name = unset",
                      __FUNCTION__);
            }

            status_t ret;
            ret = createStream(width, height, format, bp);

            reply->writeNoException();
            ALOGV("%s: CREATE_STREAM: write noException", __FUNCTION__);
            reply->writeInt32(ret);
            ALOGV("%s: CREATE_STREAM: write ret = %d", __FUNCTION__, ret);

            return NO_ERROR;
        } break;

        case CREATE_DEFAULT_REQUEST: {
            CHECK_INTERFACE(ICameraDeviceUser, data, reply);

            int templateId = data.readInt32();

            CameraMetadata request;
            status_t ret;
            ret = createDefaultRequest(templateId, &request);

            reply->writeNoException();
            reply->writeInt32(ret);

            // out-variables are after exception and return value
            reply->writeInt32(1); // to mark presence of metadata object
            request.writeToParcel(const_cast<Parcel*>(reply));

            return NO_ERROR;
        } break;
        case GET_CAMERA_INFO: {
            CHECK_INTERFACE(ICameraDeviceUser, data, reply);

            CameraMetadata info;
            status_t ret;
            ret = getCameraInfo(&info);

            reply->writeNoException();
            reply->writeInt32(ret);

            // out-variables are after exception and return value
            reply->writeInt32(1); // to mark presence of metadata object
            info.writeToParcel(reply);

            return NO_ERROR;
        } break;
        case WAIT_UNTIL_IDLE: {
            CHECK_INTERFACE(ICameraDeviceUser, data, reply);
            reply->writeNoException();
            reply->writeInt32(waitUntilIdle());
            return NO_ERROR;
        } break;
        case FLUSH: {
            CHECK_INTERFACE(ICameraDeviceUser, data, reply);
            reply->writeNoException();
            int64_t lastFrameNumber = -1;
            reply->writeInt32(flush(&lastFrameNumber));
            reply->writeInt32(1);
            reply->writeInt64(lastFrameNumber);
            return NO_ERROR;
        }
        case BEGIN_CONFIGURE: {
            CHECK_INTERFACE(ICameraDeviceUser, data, reply);
            reply->writeNoException();
            reply->writeInt32(beginConfigure());
            return NO_ERROR;
        } break;
        case END_CONFIGURE: {
            CHECK_INTERFACE(ICameraDeviceUser, data, reply);
            reply->writeNoException();
            reply->writeInt32(endConfigure());
            return NO_ERROR;
        } break;
        default:
            return BBinder::onTransact(code, data, reply, flags);
    }
}
Exemplo n.º 26
0
void PomfUploader::cancel()
{
    emit cancelRequest();
}