void test() { for (unsigned x(0); x < buffer_.width(); x+=10) { for (unsigned y(0); y < buffer_.height(); y+=10) { movePointer(x, y); checkFocus(true); checkPointer(x, y); } } movePointer(-1, -1); checkFocus(false); movePointer(5, 5); checkFocus(true); inputKeySend(BTN_LEFT, 1); checkButton(BTN_LEFT, 1); inputKeySend(BTN_LEFT, 0); checkButton(BTN_LEFT, 0); inputKeySend(BTN_RIGHT, 1); checkButton(BTN_RIGHT, 1); inputKeySend(BTN_RIGHT, 0); checkButton(BTN_RIGHT, 0); inputKeySend(BTN_MIDDLE, 1); checkButton(BTN_MIDDLE, 1); inputKeySend(BTN_MIDDLE, 0); checkButton(BTN_MIDDLE, 0); }
/*! * \brief Sets up graphical user interface. */ void Blank::setupGUI() { //set up user interface ui->setupUi(this); //initialise interface and settings intrfc = new BlankInterface(this); settings = new BlankSettings(); //point base pointers to child pointers interfaceBase = intrfc; settingsBase = settings; //start listening for incomming messages intrfc->start(); //connect signals/slots qRegisterMetaType<QVector<float> >("QVector<float>"); qRegisterMetaType< QVector<float> >("QVector<QStringList>"); QObject::connect(this, SIGNAL(tabSelected()), this, SLOT(show())); QObject::connect(intrfc, SIGNAL(gpuListReceived(QVector<QStringList>)), this, SLOT(setGpuList(QVector<QStringList>))); QObject::connect(intrfc, SIGNAL(statusReceived(int)), this, SLOT(statusChanged(int))); QObject::connect(intrfc, SIGNAL(parametersReceived(/*YourParameters*/)), settings, SLOT(setParameters(/*YourParameters*/))); QObject::connect(settings->ui->pushButton_ok, SIGNAL(clicked()), settings, SLOT(accept())); QObject::connect(settings, SIGNAL(accepted()), settings, SLOT(save())); QObject::connect(settings->ui->pushButton_cancel, SIGNAL(clicked()), settings, SLOT(reject())); //get the parameters from the module intrfc->sendParametersRequest(); //check if the modeule's tab is currently selected checkFocus(mainWindow->tabWidget->currentIndex()); }
void SequenceJob::setCurrentFilter(int value) { currentFilter = value; if (currentFilter == targetFilter) filterReady = true; if (filterReady && temperatureReady && filterPostFocusReady && (status == JOB_IDLE || status == JOB_ABORTED)) emit prepareComplete(); else if (filterReady && filterPostFocusReady == false) emit checkFocus(); }
void eWidget::hide() { if (!(state&stateShow)) return; if (state&stateVisible) { willHideChildren(); clear(); // hide -> immer erasen. dieses Hide ist IMMER explizit. } state&=~stateShow; checkFocus(); }
bool UINode::onFingerMotion (int64_t finger, uint16_t x, uint16_t y, int16_t dx, int16_t dy) { const bool focus = checkFocus(x, y); if (!focus) return false; for (UINodeListRevIter i = _nodes.rbegin(); i != _nodes.rend(); ++i) { UINode* nodePtr = *i; if (!nodePtr->hasFocus()) continue; nodePtr->onFingerMotion(finger, x - getRenderX(), y - getRenderY(), dx, dy); } return focus; }
void OMXCameraAdapter::handleFocusCallback() { OMX_PARAM_FOCUSSTATUSTYPE eFocusStatus; CameraHalEvent::FocusStatus focusStatus = CameraHalEvent::FOCUS_STATUS_FAIL; status_t ret = NO_ERROR; BaseCameraAdapter::AdapterState nextState; BaseCameraAdapter::getNextState(nextState); OMX_INIT_STRUCT(eFocusStatus, OMX_PARAM_FOCUSSTATUSTYPE); ret = checkFocus(&eFocusStatus); if (NO_ERROR != ret) { CAMHAL_LOGEA("Focus status check failed!"); // signal and unblock doAutoFocus if (AF_ACTIVE & nextState) { Mutex::Autolock lock(mDoAFMutex); mDoAFCond.broadcast(); } return; } if ( ( eFocusStatus.eFocusStatus != OMX_FocusStatusRequest ) && ( eFocusStatus.eFocusStatus != OMX_FocusStatusOff ) ) { // signal doAutoFocus when a end of scan message comes // ignore start of scan Mutex::Autolock lock(mDoAFMutex); mDoAFCond.broadcast(); } if (mParameters3A.Focus != (OMX_IMAGE_FOCUSCONTROLTYPE) OMX_IMAGE_FocusControlAuto) { CAMHAL_LOGDA("unregistered focus callback when not in CAF or doAutoFocus... not handling"); return; } // Handling for CAF Callbacks switch (eFocusStatus.eFocusStatus) { case OMX_FocusStatusRequest: focusStatus = CameraHalEvent::FOCUS_STATUS_PENDING; break; case OMX_FocusStatusReached: case OMX_FocusStatusOff: case OMX_FocusStatusUnableToReach: default: focusStatus = CameraHalEvent::FOCUS_STATUS_DONE; break; } notifyFocusSubscribers(focusStatus); }
/*--------------------------------------------------------*/ double AzReg_Tsrbase::get_dv(int nx) const { checkFocus("get_dv"); if (av_dv.size() > 0) { return av_dv.point(focus_nx)->get(nx); } const AzDvect *v_dbar = av_dbar.point(focus_nx); double dv = v_dbar->get(nx); int px = tree->node(nx)->parent_nx; if (px >= 0) { dv -= v_dbar->get(px); } return dv; }
/*--------------------------------------------------------*/ double AzReg_Tsrbase::get_dv2_sum() const { checkFocus("get_dv2_sum"); if (v_dv2_sum.rowNum() > 0) { return v_dv2_sum.get(focus_nx); } double my_dv2_sum = 0; int nx; for (nx = 0; nx < tree->nodeNum(); ++nx) { double dv = get_dv(nx); int depth = tree->node(nx)->depth; my_dv2_sum += reg_depth->apply(dv * dv, depth); } return my_dv2_sum; }
void eWidget::show() { if (state & stateShow) return; ASSERT(!(state&stateVisible)); state|=stateShow; if (!parent || (parent->state&stateVisible)) { ++getTLW()->just_showing; willShowChildren(); checkFocus(); --getTLW()->just_showing; redraw(); } }
/*! * \brief Sets up graphical user interface. */ void ERA::setupGUI() { //set up user interface ui->setupUi(this); //initialise interface, settings and network monitor intrfc = new ERAInterface(this); settings = new ERASettings(); networkMonitor = new ERANetworkMonitor(); //point base pointers to child pointers interfaceBase = intrfc; settingsBase = settings; //start listening for incomming messages intrfc->start(); //connect signals/slots qRegisterMetaType< QVector<float> >("QVector<float>"); qRegisterMetaType< QVector<float> >("QVector<QStringList>"); QObject::connect(this, SIGNAL(tabSelected()), this, SLOT(show())); QObject::connect(intrfc, SIGNAL(gpuListReceived(QVector<QStringList>)), this, SLOT(setGpuList(QVector<QStringList>))); QObject::connect(intrfc, SIGNAL(statusReceived(int)), this, SLOT(statusChanged(int))); QObject::connect(intrfc, SIGNAL(parametersReceived(int)), settings, SLOT(setParameters(int))); QObject::connect(intrfc, SIGNAL(dataReceived(int, double*, double*)), networkMonitor, SLOT(updatePlot(int, double*, double*))); QObject::connect(settings->ui->pushButton_ok, SIGNAL(clicked()), settings, SLOT(accept())); QObject::connect(settings, SIGNAL(accepted()), settings, SLOT(save())); QObject::connect(settings->ui->pushButton_cancel, SIGNAL(clicked()), settings, SLOT(reject())); QObject::connect(settings, SIGNAL(simulationModeChanged(int)), intrfc, SLOT(sendSimulationMode(int))); //get the parameters from the module intrfc->sendParametersRequest(); //initialise viewports initialiseViewports(); //check if the modeule's tab is currently selected checkFocus(mainWindow->tabWidget->currentIndex()); }
status_t OMXCameraAdapter::doAutoFocus() { status_t ret = NO_ERROR; OMX_ERRORTYPE eError = OMX_ErrorNone; OMX_IMAGE_CONFIG_FOCUSCONTROLTYPE focusControl; OMX_PARAM_FOCUSSTATUSTYPE focusStatus; OMX_CONFIG_BOOLEANTYPE bOMX; nsecs_t timeout = 0; LOG_FUNCTION_NAME; if ( OMX_StateInvalid == mComponentState ) { CAMHAL_LOGEA("OMX component in Invalid state"); returnFocusStatus(false); return -EINVAL; } if ( OMX_StateExecuting != mComponentState ) { CAMHAL_LOGEA("OMX component not in executing state"); returnFocusStatus(false); return NO_ERROR; } if( ((AF_ACTIVE & getState()) != AF_ACTIVE) && ((AF_ACTIVE & getNextState()) != AF_ACTIVE) ) { CAMHAL_LOGDA("Auto focus got canceled before doAutoFocus could be called"); return NO_ERROR; } OMX_INIT_STRUCT_PTR (&focusStatus, OMX_PARAM_FOCUSSTATUSTYPE); // If the app calls autoFocus, the camera will stop sending face callbacks. pauseFaceDetection(true); // This is needed for applying FOCUS_REGION correctly if ( (!mFocusAreas.isEmpty()) && (!mFocusAreas.itemAt(0)->isZeroArea())) { //Disable face priority setAlgoPriority(FACE_PRIORITY, FOCUS_ALGO, false); //Enable region algorithm priority setAlgoPriority(REGION_PRIORITY, FOCUS_ALGO, true); } OMX_INIT_STRUCT_PTR (&focusControl, OMX_IMAGE_CONFIG_FOCUSCONTROLTYPE); focusControl.eFocusControl = ( OMX_IMAGE_FOCUSCONTROLTYPE ) mParameters3A.Focus; if (mParameters3A.FocusLock) { // this basically means user never called cancelAutoFocus after a scan... // if this is the case we need to unlock AF to ensure we will do a scan if (set3ALock(mUserSetExpLock, mUserSetWbLock, OMX_FALSE) != NO_ERROR) { CAMHAL_LOGEA("Error Unlocking 3A locks"); } else { CAMHAL_LOGDA("AE/AWB unlocked successfully"); } } else if ( mParameters3A.Focus == OMX_IMAGE_FocusControlAuto ) { // In case we have CAF running we should first check the AF status. // If it has managed to lock, then do as usual and return status // immediately. ret = checkFocus(&focusStatus); if ( NO_ERROR != ret ) { CAMHAL_LOGEB("Focus status check failed 0x%x!", ret); return ret; } else { CAMHAL_LOGDB("Focus status check 0x%x!", focusStatus.eFocusStatus); } } if ( (focusControl.eFocusControl == OMX_IMAGE_FocusControlAuto && ( focusStatus.eFocusStatus == OMX_FocusStatusRequest || focusStatus.eFocusStatus == OMX_FocusStatusUnableToReach || focusStatus.eFocusStatus == OMX_FocusStatusLost ) ) || (mParameters3A.Focus != (OMX_IMAGE_FOCUSCONTROLTYPE)OMX_IMAGE_FocusControlAuto) ) { OMX_INIT_STRUCT_PTR (&bOMX, OMX_CONFIG_BOOLEANTYPE); bOMX.bEnabled = OMX_TRUE; //Enable focus scanning eError = OMX_SetConfig(mCameraAdapterParameters.mHandleComp, (OMX_INDEXTYPE)OMX_TI_IndexConfigAutofocusEnable, &bOMX); // force AF, Ducati will take care of whether CAF // or AF will be performed, depending on light conditions if ( focusControl.eFocusControl == OMX_IMAGE_FocusControlAuto && ( focusStatus.eFocusStatus == OMX_FocusStatusUnableToReach || focusStatus.eFocusStatus == OMX_FocusStatusLost ) ) { focusControl.eFocusControl = OMX_IMAGE_FocusControlAutoLock; } if ( focusControl.eFocusControl != OMX_IMAGE_FocusControlAuto ) { eError = OMX_SetConfig(mCameraAdapterParameters.mHandleComp, OMX_IndexConfigFocusControl, &focusControl); } if ( OMX_ErrorNone != eError ) { CAMHAL_LOGEB("Error while starting focus 0x%x", eError); return INVALID_OPERATION; } else { CAMHAL_LOGDA("Autofocus started successfully"); } // configure focus timeout based on capture mode timeout = (mCapMode == VIDEO_MODE) ? ( ( nsecs_t ) AF_VIDEO_CALLBACK_TIMEOUT * 1000 ) : ( ( nsecs_t ) AF_IMAGE_CALLBACK_TIMEOUT * 1000 ); { Mutex::Autolock lock(mDoAFMutex); ret = mDoAFCond.waitRelative(mDoAFMutex, timeout); } //If somethiing bad happened while we wait if (mComponentState == OMX_StateInvalid) { CAMHAL_LOGEA("Invalid State after Auto Focus Exitting!!!"); return -EINVAL; } if(ret != NO_ERROR) { CAMHAL_LOGEA("Autofocus callback timeout expired"); ret = returnFocusStatus(true); } else { ret = returnFocusStatus(false); } } else { // Focus mode in continuous if ( NO_ERROR == ret ) { ret = returnFocusStatus(true); mPending3Asettings |= SetFocus; } } LOG_FUNCTION_NAME_EXIT; return ret; }
status_t OMXCameraAdapter::returnFocusStatus(bool timeoutReached) { status_t ret = NO_ERROR; OMX_PARAM_FOCUSSTATUSTYPE eFocusStatus; CameraHalEvent::FocusStatus focusStatus = CameraHalEvent::FOCUS_STATUS_FAIL; BaseCameraAdapter::AdapterState state, nextState; BaseCameraAdapter::getState(state); BaseCameraAdapter::getNextState(nextState); LOG_FUNCTION_NAME; OMX_INIT_STRUCT(eFocusStatus, OMX_PARAM_FOCUSSTATUSTYPE); if( ((AF_ACTIVE & state ) != AF_ACTIVE) && ((AF_ACTIVE & nextState ) != AF_ACTIVE) ) { /// We don't send focus callback if focus was not started CAMHAL_LOGDA("Not sending focus callback because focus was not started"); return NO_ERROR; } if ( NO_ERROR == ret ) { if ( !timeoutReached ) { ret = checkFocus(&eFocusStatus); if ( NO_ERROR != ret ) { CAMHAL_LOGEA("Focus status check failed!"); } } } if ( NO_ERROR == ret ) { if ( timeoutReached ) { focusStatus = CameraHalEvent::FOCUS_STATUS_FAIL; } else { switch (eFocusStatus.eFocusStatus) { case OMX_FocusStatusReached: { focusStatus = CameraHalEvent::FOCUS_STATUS_SUCCESS; break; } case OMX_FocusStatusOff: // AF got canceled return NO_ERROR; case OMX_FocusStatusUnableToReach: case OMX_FocusStatusRequest: default: { focusStatus = CameraHalEvent::FOCUS_STATUS_FAIL; break; } } // Lock CAF after AF call if( set3ALock(mUserSetExpLock, mUserSetWbLock, OMX_TRUE) != NO_ERROR) { CAMHAL_LOGEA("Error Applying 3A locks"); } else { CAMHAL_LOGDA("Focus locked. Applied focus locks successfully"); } stopAutoFocus(); } //Query current focus distance after AF is complete updateFocusDistances(mParameters); } ret = BaseCameraAdapter::setState(CAMERA_CANCEL_AUTOFOCUS); if ( NO_ERROR == ret ) { ret = BaseCameraAdapter::commitState(); } else { ret |= BaseCameraAdapter::rollbackState(); } if ( NO_ERROR == ret ) { notifyFocusSubscribers(focusStatus); } // After focus, face detection will resume sending face callbacks pauseFaceDetection(false); LOG_FUNCTION_NAME_EXIT; return ret; }