Example #1
0
void kissSplashBG(int w, int h)
{
	int i,offX,offY;
	for (i=0;i<h;i=i+(h/50)+1) {
		offX=38*(((float)i)/(float)(h/8));
		offY=50*(((float)i)/(float)(h/8));
		draw_bg(w/2-offX,h/2-offY,((float)i)/(float)(h/8));
		sleep(.02);
		clear_bg(w/2-offX,h/2-offY,((float)i)/(float)(h/8));
	}
	graphics_fill(255,255,255);
}
void tof_data_read_thread::run()
{
    bool myoldbgs = false;
    mutex.lock();
    tof_data_read_worker wrk;
    connect(&wrk,SIGNAL(measurement_started()),this,SLOT(do_measurement_started()),Qt::QueuedConnection);
    connect(&wrk,SIGNAL(measurement_stopped()),this,SLOT(do_measurement_stopped()),Qt::QueuedConnection);
    connect(this,SIGNAL(bg_measurement_started()),&wrk,SLOT(clear_bg()),Qt::QueuedConnection);
    mutex.unlock();

    forever {
        mutex.lock();
        //wrk.setConfig(m_config);
        uibk_cloud_configuration l_config = m_config;
        bool bgs = bg_meas;

        wrk.save_current_background();
        mutex.unlock();

        states state = IDLE;
        states laststate = IDLE;
        while(state != FAILURE ){
            if (pause)
                break;
            if (restart)
                break;
            if (abort)
                return;

            switch(state){
            case IDLE:              {state =  wrk.idle(); break;}
            case CHECK_AQ_ACTIVE:   {state =  wrk.check_aqu_active(laststate); break;}
            case PREP_BUFFS:        {

                if(bgs){
                    state =  wrk.prepare_buffers_bg();
                }else{
                    wrk.setConfig(l_config);
                    wrk.init();
                    state =  wrk.prepare_buffers();
                    wrk.save_current_background();
                }
                break;
            }
            case WAIT_F_DTA:        {state =  wrk.wait_for_data(); break;}
            case SWAP_BUFS:         {state =  wrk.swap_buffers(); break;}
            case PROC_DTA:          {

                if(bgs){
                    if(myoldbgs != bgs)
                    {
                        wrk.clear_bg();

                    }
                    state = wrk.record_bg_spec();
                }else{
                    state =  wrk.process_data();
                    if(state != FAILURE){
                        QDateTime t                     = wrk.getMeantime();
                        QMap<QString, double> dta   = wrk.getGroups();
                        qDebug() << "(tof_data_read_thread::run()) Emiting data_processed()";
                        emit data_processed(t, dta);
                    }
                }
                myoldbgs = bgs;
                break;
            }
                //case FAILURE:           {state =  wrk.failure(state); break;}
            default:{break;}
            }
            if(state == FAILURE)
                wrk.failure(laststate);

        }

        mutex.lock();
        pause   = false;
        if (!restart)
            condition.wait(&mutex);
        restart = false;
        mutex.unlock();

    }
}