status_t CameraAcc::waitForAndExecuteMessage()
{
    LOG2("@%s", __FUNCTION__);

    status_t status = NO_ERROR;
    Message msg;
    mMessageQueue.receive(&msg);

    switch (msg.id) {
        case MESSAGE_ID_EXIT:
            status = handleExit();
            break;
        case MESSAGE_ID_HOST_ALLOC:
            status = handleMessageHostAlloc(msg.data.alloc);
            break;
        case MESSAGE_ID_MAP:
            status = handleMessageMap(msg.data.map);
            break;
        case MESSAGE_ID_WAIT_STANDALONE:
            status = handleMessageWaitStandalone();
            break;
        default:
            status = INVALID_OPERATION;
            break;
    }
    if (status != NO_ERROR) {
        ALOGE("operation failed, ID = %d, status = %d", msg.id, status);
    }
    return status;
}
status_t PanoramaThread::PanoramaStitchThread::waitForAndExecuteMessage()
{
    LOG2("@%s", __FUNCTION__);
    status_t status = NO_ERROR;
    Message msg;
    mMessageQueue.receive(&msg);

    switch (msg.id)
    {
        case MESSAGE_ID_STITCH:
            status = handleMessageStitch(msg.data.stitch);
            break;
        case MESSAGE_ID_EXIT:
            status = handleExit();
            break;
        case MESSAGE_ID_FLUSH:
            status = handleFlush();
            break;
        default:
            status = INVALID_OPERATION;
            break;
    }
    if (status != NO_ERROR) {
        LOGE("operation failed, ID = %d, status = %d", msg.id, status);
    }
    return status;
}
status_t PostCaptureThread::waitForAndExecuteMessage()
{
    LOG2("@%s", __FUNCTION__);
    status_t status = NO_ERROR;
    Message msg;
    mMessageQueue.receive(&msg);

    switch (msg.id)
    {
        case MESSAGE_ID_PROCESS_ITEM:
            status = handleProcessItem(msg.data.procItem);
            break;
        case MESSAGE_ID_CANCEL_PROCESS_ITEM:
            status = handleCancelProcessItem();
            break;
        case MESSAGE_ID_EXIT:
            status = handleExit();
            break;
        default:
            status = INVALID_OPERATION;
            break;
    }
    if (status != NO_ERROR) {
        LOGE("operation failed, ID = %d, status = %d", msg.id, status);
    }
    return status;
}
void
AppExceptionHandler::handleUnknown()
{
    if(d_->defexit_)
    {
        handleExit();
    } else
    {
        handleLogOnly();
    }
}
status_t AccManagerThread::waitForAndExecuteMessage()
{
    LOG2("@%s", __FUNCTION__);

    status_t status = NO_ERROR;
    Message msg;
    mMessageQueue.receive(&msg);

    switch (msg.id) {
        case MESSAGE_ID_EXIT:
            status = handleExit();
            break;
        case MESSAGE_ID_LOAD:
            status = handleMessageLoad(msg.data.fw);
            break;
        case MESSAGE_ID_ALLOC:
            status = handleMessageAlloc(msg.data.alloc);
            break;
        case MESSAGE_ID_FREE:
            status = handleMessageFree(msg.data.buffer);
            break;
        case MESSAGE_ID_MAP:
            status = handleMessageMap(msg.data.map);
            break;
        case MESSAGE_ID_UNMAP:
            status = handleMessageUnmap(msg.data.map);
            break;
        case MESSAGE_ID_SEND_ARG:
            status = handleMessageSetArgToBeSend(msg.data.map);
            break;
        case MESSAGE_ID_CONFIGURE_ISP_STANDALONE:
            status = handleMessageConfigureIspStandalone(msg.data.configureIspStandalone);
            break;
        case MESSAGE_ID_RETURN_BUFFER:
            status = handleMessageReturnBuffer(msg.data.ret);
            break;
        case MESSAGE_ID_LOAD_ISP_EXTENSIONS:
            status = handleMessageLoadIspExtensions();
            break;
        case MESSAGE_ID_UNLOAD_ISP_EXTENSIONS:
            status = handleMessageUnloadIspExtensions();
            break;
        case MESSAGE_ID_FRAME:
            status = handleMessageFrame(msg.data.frame);
            break;
        default:
            status = INVALID_OPERATION;
            break;
    }
    if (status != NO_ERROR) {
        LOGE("operation failed, ID = %d, status = %d", msg.id, status);
    }
    return status;
}
status_t PanoramaThread::waitForAndExecuteMessage()
{
    LOG2("@%s", __FUNCTION__);
    status_t status = NO_ERROR;
    Message msg;
    mMessageQueue.receive(&msg);

    switch (msg.id)
    {
        case MESSAGE_ID_STITCH:
            status = handleStitch(msg.data.stitch);
            break;
        case MESSAGE_ID_EXIT:
            status = handleExit();
            break;
        case MESSAGE_ID_FRAME:
            status = handleFrame(msg.data.frame);
            break;
        case MESSAGE_ID_FINALIZE:
            status = handleMessageFinalize();
            break;
        case MESSAGE_ID_START_PANORAMA:
            status = handleMessageStartPanorama();
            break;
        case MESSAGE_ID_STOP_PANORAMA:
            status = handleMessageStopPanorama(msg.data.stop);
            break;
        case MESSAGE_ID_START_PANORAMA_CAPTURE:
            status = handleMessageStartPanoramaCapture();
            break;
        case MESSAGE_ID_STOP_PANORAMA_CAPTURE:
            status = handleMessageStopPanoramaCapture();
            break;
        case MESSAGE_ID_THUMBNAILSIZE:
            status = handleMessageThumbnailSize(msg.data.thumbnail);
            break;
        case MESSAGE_ID_FLUSH:
            status = handleMessageFlush();
            break;
        default:
            status = INVALID_OPERATION;
            break;
    }
    if (status != NO_ERROR) {
        LOGE("operation failed, ID = %d, status = %d", msg.id, status);
    }
    return status;
}
void handleComm(int comid, int args, char* p1, char* p2) {
    switch (comid) {
        case 0:
            if (args != 1) handleError("load", compareargs(1, args));
            else handleLoad(p1);
            break;
        case 1:
            if (args != 0) handleError("execute", 1);
            else handleExecute();
            break;
        case 2:
            if (args != 0) handleError("debug", 1);
            else handleDebug();
            break;
        case 3:
            if (args != 2) handleError("dump", compareargs(2, args));
            else handleDump(p1, p2);
            break;
        case 4:
            if (args != 0) handleError("help", 1);
            else handleHelp();
            break;
        case 5:
            if (args != 1) handleError("assemble", compareargs(1, args));
            else handleAssemble(p1);
            break;
        case 6:
            if (args != 0) handleError("directory", 1);
            else handleDirectory();
            break;
        case 7:
            handleExit(); // no argscheck for exit;
            break;
        default:
            handleError("command not recognized\n", -2);
    }
}// </editor-fold>
status_t PostProcThread::waitForAndExecuteMessage()
{
    LOG2("@%s", __FUNCTION__);
    status_t status = NO_ERROR;
    Message msg;
    mMessageQueue.receive(&msg);

    switch (msg.id)
    {
    case MESSAGE_ID_FRAME:
        status = handleFrame(msg.data.frame);
        break;
    case MESSAGE_ID_EXIT:
        status = handleExit();
        break;
    case MESSAGE_ID_START_FACE_DETECTION:
        status = handleMessageStartFaceDetection();
        break;
    case MESSAGE_ID_STOP_FACE_DETECTION:
        status = handleMessageStopFaceDetection();
        break;
    case MESSAGE_ID_CAPTURE_ON_TRIGGER:
        status = handleMessageCaptureOnTrigger();
        break;
    case MESSAGE_ID_STOP_CAPTURE_ON_TRIGGER:
        status = handleMessageStopCaptureOnTrigger();
        break;
    case MESSAGE_ID_START_SMART_SHUTTER:
        status = handleMessageStartSmartShutter(msg.data.smartShutterParam);
        break;
    case MESSAGE_ID_STOP_SMART_SHUTTER:
        status = handleMessageStopSmartShutter(msg.data.smartShutterParam);
        break;
    case MESSAGE_ID_IS_SMILE_RUNNING:
        status = handleMessageIsSmileRunning();
        break;
    case MESSAGE_ID_GET_SMILE_THRESHOLD:
        status = handleMessageGetSmileThreshold();
        break;
    case MESSAGE_ID_IS_BLINK_RUNNING:
        status = handleMessageIsBlinkRunning();
        break;
    case MESSAGE_ID_GET_BLINK_THRESHOLD:
        status = handleMessageGetBlinkThreshold();
        break;
    case MESSAGE_ID_IS_SMART_CAPTURE_TRIGGERED:
        status = handleMessageIsSmartCaptureTriggered();
        break;
    case MESSAGE_ID_RESET_SMART_CAPTURE_TRIGGER:
        status = handleMessageResetSmartCaptureTrigger();
        break;
    case MESSAGE_ID_FORCE_SMART_CAPTURE_TRIGGER:
        status = handleMessageForceSmartCaptureTrigger();
        break;
    case MESSAGE_ID_START_FACE_RECOGNITION:
        status = handleMessageStartFaceRecognition();
        break;
    case MESSAGE_ID_STOP_FACE_RECOGNITION:
        status = handleMessageStopFaceRecognition();
        break;
    case MESSAGE_ID_IS_FACE_RECOGNITION_RUNNING:
        status = handleMessageIsFaceRecognitionRunning();
        break;
    case MESSAGE_ID_LOAD_ISP_EXTENSIONS:
        status = handleMessageLoadIspExtensions(msg.data.loadIspExtensions);
        break;
    case MESSAGE_ID_UNLOAD_ISP_EXTENSIONS:
        status = handleMessageUnloadIspExtensions();
        break;
    case MESSAGE_ID_SET_ZOOM:
        status = handleMessageSetZoom(msg.data.config);
        break;
    case MESSAGE_ID_SET_ROTATION:
        status = handleMessageSetRotation(msg.data.config);
        break;
    case MESSAGE_ID_SET_AUTO_LOW_LIGHT:
        status = handleMessageSetAutoLowLight(msg.data.config);
        break;
    default:
        status = INVALID_OPERATION;
        break;
    }
    if (status != NO_ERROR) {
        LOGE("operation failed, ID = %d, status = %d", msg.id, status);
    }
    return status;
}
Exemple #9
0
void settings_frame::OnClose(wxCloseEvent& /*unused*/)
{
	if (!alreadyCalled) {
		handleExit();
	}
}
Exemple #10
0
void settings_frame::OnMenuChoice(wxCommandEvent& event)
{
	switch (event.GetId()) {
		case ID_MENUITEM_SAVE:
			if (saveSettingsAbstract())
				(abstract_panel::settingsChanged) = false;
			if (simpleTab != 0)
				simpleTab->saveCbxChoices();
			break;

		case ID_MENUITEM_QUIT:
			handleExit();
			break;

		case ID_MENUITEM_RESET:
			if ((customMessageBox(SS_MAIN_ICON, _("Reset ALL settings to default values?"), _("Confirmation needed"), wxYES_NO | wxCANCEL)) == wxYES) {
				resetSettings();
			}
			break;

		case ID_MENUITEM_SIMPLE:
			if (sett().getMode() == SET_MODE_EXPERT) {
				sett().setMode(SET_MODE_SIMPLE);

				simpleTab = new tab_simple(this, notebook, ID_SIMPLE);
				notebook->InsertPage(0, simpleTab, simpleTabCap);
				simpleTab->updateControls(UPDATE_ALL);

				//if not on ui page goto simple
				if (notebook->GetSelection() != 1) {
					notebook->SetSelection(0);
				}
				for (int i = notebook->GetPageCount() - 1; i > 1; i--) { //delete all pages expect page 0 + 1
					notebook->DeletePage(i);
				}
				qualityTab = 0;
				detailTab = 0;
				audioTab = 0;
				//				hotkeyTab = 0;
				SetTitle(TowxString(getSpringlobbyName()) + _("(simple mode)"));
				if (!sett().getDisableWarning()) {
					customMessageBox(SS_MAIN_ICON, expertModeWarning, _("Hint"), wxOK);
				}
			}
			break;

		case ID_MENUITEM_EXPERT:
			if (sett().getMode() == SET_MODE_SIMPLE) {
				switchToExpertMode();
			}
			break;
		case ID_MENUITEM_DISABLE_WARN:
			sett().setDisableWarning(menuFile->IsChecked(ID_MENUITEM_DISABLE_WARN));
			break;

		case ID_MENUITEM_ABOUT:
			aboutbox().Show();
			break;
		case ID_MENUITEM_CONTACT:
			aboutbox().openContactPage();
			break;
		case ID_MENUITEM_BUGREPORT:
			aboutbox().openNewTicket();
			break;
	}
}
Exemple #11
0
void GrimEngine::mainLoop() {
	_movieTime = 0;
	_frameTime = 0;
	_frameStart = g_system->getMillis();
	_frameCounter = 0;
	_timeAccum = 0;
	_frameTimeCollection = 0;
	_prevSmushFrame = 0;
	_savegameLoadRequest = false;
	_savegameSaveRequest = false;
	_savegameFileName = NULL;
	_refreshShadowMask = false;

	for (;;) {
		uint32 startTime = g_system->getMillis();

		if (_savegameLoadRequest) {
			savegameRestore();
		}
		if (_savegameSaveRequest) {
			savegameSave();
		}

		g_imuse->flushTracks();
		g_imuse->refreshScripts();

		if (_mode == ENGINE_MODE_IDLE) {
			// don't kill CPU
			g_system->delayMillis(10);
			continue;
		}

		// Process events
		Common::Event event;
		while (g_system->getEventManager()->pollEvent(event)) {
			// Handle any buttons, keys and joystick operations
			if (event.type == Common::EVENT_KEYDOWN) {
				if (_mode != ENGINE_MODE_DRAW && _mode != ENGINE_MODE_SMUSH && (event.kbd.ascii == 'q')) {
					handleExit();
					break;
				} else {
					handleChars(event.type, event.kbd.keycode, event.kbd.flags, event.kbd.ascii);
				}
			}
			if (event.type == Common::EVENT_KEYDOWN || event.type == Common::EVENT_KEYUP) {
				handleControls(event.type, event.kbd.keycode, event.kbd.flags, event.kbd.ascii);
			}
			// Check for "Hard" quit"
			if (event.type == Common::EVENT_QUIT)
				return;
			if (event.type == Common::EVENT_SCREEN_CHANGED)
				_refreshDrawNeeded = true;
		}

		luaUpdate();

		if (_mode != ENGINE_MODE_PAUSE) {
			updateDisplayScene();
			doFlip();
		}

		if (g_imuseState != -1) {
			g_imuse->setMusicState(g_imuseState);
			g_imuseState = -1;
		}

		uint32 endTime = g_system->getMillis();
		if (startTime > endTime)
			continue;
		uint32 diffTime = endTime - startTime;
		if (_speedLimitMs == 0)
			continue;
		if (diffTime < _speedLimitMs) {
			uint32 delayTime = _speedLimitMs - diffTime;
			g_system->delayMillis(delayTime);
		}
	}
}
Exemple #12
0
void settings_frame::OnMenuChoice(wxCommandEvent& event) {
	switch (event.GetId()) {
		case ID_MENUITEM_SAVE:
			if (abstract_panel::saveSettings())
			 (abstract_panel::settingsChanged) = false;
			if (simpleTab!=0)
        			simpleTab->saveCbxChoices();
		 break;

		case ID_MENUITEM_QUIT:
				handleExit();
		 break;

		case ID_MENUITEM_RESET:
			if ((customMessageBox(SS_MAIN_ICON,_("Reset ALL settings to default values?"), _("Confirmation needed"), wxYES_NO)) == wxYES) {
						resetSettings();
			}
		 break;

		case ID_MENUITEM_SIMPLE:
			if (sett().getMode()==SET_MODE_EXPERT)
				sett().setMode(SET_MODE_SIMPLE);

				simpleTab = new tab_simple(this,notebook,ID_SIMPLE);
				notebook->InsertPage(0,simpleTab,simpleTabCap);
				simpleTab->updateControls(UPDATE_ALL);

				//if not on ui page goto simple
				if (notebook->GetSelection()!=1)
					notebook->SetSelection(0);

				notebook->DeletePage(4);
				notebook->DeletePage(3);
				notebook->DeletePage(2);
				qualityTab = 0;
				detailTab = 0;
				audioTab = 0;

				SetTitle(_("SpringSettings (simple mode)"));
				if (!sett().getDisableWarning()){
					customMessageBox(SS_MAIN_ICON,expertModeWarning, _("Hint"), wxOK);
				}
		  break;

		case ID_MENUITEM_EXPERT:
			if (sett().getMode()==SET_MODE_SIMPLE) {
				switchToExpertMode();
			}
			break;
		case ID_MENUITEM_DISABLE_WARN:
			sett().setDisableWarning(menuFile->IsChecked(ID_MENUITEM_DISABLE_WARN));
			break;

		case ID_MENUITEM_ABOUT:
			showAbout();
			break;
		case ID_MENUITEM_CREDITS:
			showCredits();
			break;
		case ID_MENUITEM_CONTACT:
			openContactPage();
			break;
		case ID_MENUITEM_BUGREPORT:
			openNewTicket();
			break;
	}
}