Esempio n. 1
0
    void thread () {
        while (!mKillThread) {
            auto nextTimePoint = std::chrono::steady_clock::now() + tickInterval();

            // If an octet is available from the write buffer, load it into the
            // intermediate buffer. Otherwise, push nothing to keep the pipe
            // flowing.
            uint8_t octet;
            //printf("%s moving an octet from write buffer to intermediate buffer\n", mDebugName.c_str());
            mMedium.push(mWriteQueue.try_pop(octet)
                    ? Quantum(octet)
                    : Quantum(boost::none));

            // Feed the deliver callback if there's an octet available.
            auto quantum = mMedium.front();
            mMedium.pop();
            if (quantum) {
                //printf("%s outputing an octet\n", mDebugName.c_str());
                output(*quantum);
            }

            //printf("%s cycle complete\n", mDebugName.c_str());
            if (nextTimePoint < std::chrono::steady_clock::now()) {
                //fprintf(stderr, "Process is too slow to simulate this baud rate.\n");
            }
            else {
                std::this_thread::sleep_until(nextTimePoint);
            }
        }
    }
Esempio n. 2
0
void CAwardContainer::GfxTimerFiredL(TInt /*aId*/)
{
    if (iTicks < MAX_TICKS)
    {
        iTicks++;
    }
    Quantum();
    DrawView();
    DrawNow();
}
Esempio n. 3
0
AtmoSky::AtmoSky(DataPipe* pipeptr)
{
	//init variables
	pipe = pipeptr;
	windsp = 0;
	ctime = NULL;
	state = ASKY_NIGHT;

	//load settings
	day_sky.r = ((short)atoi(pipe->GetIniDataS(ATMOININAME,"DaySkyColorR").c_str()));
	day_sky.g = ((short)atoi(pipe->GetIniDataS(ATMOININAME,"DaySkyColorG").c_str()));
	day_sky.b = ((short)atoi(pipe->GetIniDataS(ATMOININAME,"DaySkyColorB").c_str()));
	day_cld.r = ((short)atoi(pipe->GetIniDataS(ATMOININAME,"DayCloudColorR").c_str()));
	day_cld.g = ((short)atoi(pipe->GetIniDataS(ATMOININAME,"DayCloudColorG").c_str()));
	day_cld.b = ((short)atoi(pipe->GetIniDataS(ATMOININAME,"DayCloudColorB").c_str()));
	ngh_sky.r = ((short)atoi(pipe->GetIniDataS(ATMOININAME,"NightSkyColorR").c_str()));
	ngh_sky.g = ((short)atoi(pipe->GetIniDataS(ATMOININAME,"NightSkyColorG").c_str()));
	ngh_sky.b = ((short)atoi(pipe->GetIniDataS(ATMOININAME,"NightSkyColorB").c_str()));
	ngh_cld.r = ((short)atoi(pipe->GetIniDataS(ATMOININAME,"NightCloudColorR").c_str()));
	ngh_cld.g = ((short)atoi(pipe->GetIniDataS(ATMOININAME,"NightCloudColorG").c_str()));
	ngh_cld.b = ((short)atoi(pipe->GetIniDataS(ATMOININAME,"NightCloudColorB").c_str()));

	dawnst = ((int)atoi(pipe->GetIniDataS(ATMOININAME,"DawnTime").c_str()));
	duskst = ((int)atoi(pipe->GetIniDataS(ATMOININAME,"DuskTime").c_str()));
	tranln = ((int)atoi(pipe->GetIniDataS(ATMOININAME,"Transition").c_str()));

	//calculate transitions
	trn_sky.r = (day_sky.r - ngh_sky.r) / (60 * tranln);
	trn_sky.g = (day_sky.g - ngh_sky.g) / (60 * tranln);
	trn_sky.b = (day_sky.b - ngh_sky.b) / (60 * tranln);
	trn_cld.r = (day_cld.r - ngh_cld.r) / (60 * tranln);
	trn_cld.g = (day_cld.g - ngh_cld.g) / (60 * tranln);
	trn_cld.b = (day_cld.b - ngh_cld.b) / (60 * tranln);

	//Initial update
	once = false;
	Quantum();
}
Esempio n. 4
0
void CPausedContainer::GfxTimerFiredL(TInt /*aId*/)
{
    Quantum();
    DrawView();
    DrawNow();
}