Example #1
0
void Thread::comError()
{
    //Now I'm paused...
    speedTimer->stop();
    resetSpeed();
    idleTimer->stop();

    // 	qDebug("%d, %d: retrycount: %d", serverId, threadId, retryCount);

    if (retryCount < RETRYCOUNT)
    {
        // 		qDebug("Starting %d,%d retry Timer", serverId, threadId);
        retryTimer->setSingleShot(true);
        retryTimer->start(retryTimeouts[retryCount] * 1000);
        emit sigThreadPaused(serverId, threadId, retryTimeouts[retryCount]);
        retryCount++;
    }
    else if (retryCount > RETRYCOUNT)
    //else if (retryCount > (RETRYCOUNT + threadTimeout + 1))
    {
        //Pause the thread!!!
        emit sigThreadPaused(serverId, threadId, 0);
    }
    else
    {
        retryTimer->setSingleShot(true);
        retryTimer->start(60000);
        retryCount++;

        emit sigThreadPaused(serverId, threadId, 60);
    }
}
Example #2
0
void Thread::canceled()
{
    if (nntpT->isRunning())
        nntpT->wait();

    speedTimer->stop();
    resetSpeed();
}
Example #3
0
void Thread::paused()
{
    speedTimer->stop();
    resetSpeed();

    // TODO	idleTimer->start(threadTimeout, true);
    // 	qDebug("Thread Paused");

}
/**
* \fn void resetMotionVariables(KaamObject* pObject)
* \brief Resets all variable relative to a jump.
*
* \param[in] pObject, pointer to the object to move.
* \returns void
*/
void resetMotionVariables(KaamObject* pObject)
{
	resetInputs();
	resetSpeed(&pObject->Xspeed, &pObject->Yspeed);
	resetAbsoluteCoordinates(pObject->objectSurface, &pObject->absoluteCoordinate.x, &pObject->absoluteCoordinate.y);
	pObject->relativeTime = 0;
	pObject->startMotion = 0;
	pObject->motionDirection = DOWN;
}
Example #5
0
void Orange::reset(GLint lives)
{
    if(lives != 0){
        resetSpeed();
        Vector3 _pos = Vector3((std::rand() % (60 - 0 + 1)) - 30, _position._y, (std::rand() % (60 - 0 + 1)) - 30);
        Entity::setInitPosition(_pos._x, _pos._y, _pos._z);
        _direction = Vector3(2 * ((double)(std::rand()) / RAND_MAX) - 1, 0, 2 * ((double)(std::rand()) / RAND_MAX) - 1);
        _direction.normalize();
        _base_speed = ((double)std::rand() / RAND_MAX)*0.010 + 0.005;
        DynamicObject::reset();
    }
    else reset();
}
Example #6
0
void correctSteering() {
	unsigned char lineArrayRaw = readLineSensor();

	dbg(lineArrayRaw);

	setMotor(MOTOR_LEFT, MD_FWD);
	setMotor(MOTOR_RIGHT, MD_FWD);

	bool leftOuter = false;
	bool rightOuter = false;

	resetSpeed();

	if (lineArrayRaw & 0x01) {
		setMotor(MOTOR_RIGHT, MD_REV);
		MOTORS_RIGHT = 65;
		MOTORS_LEFT = 100;

		rightOuter = true;
		_delay_ms(40);
	} else if (lineArrayRaw & 0x02) {
		MOTORS_RIGHT = 50;
		_delay_ms(10);
	}

	// --------------
	if (lineArrayRaw & 0x80) {
		setMotor(MOTOR_LEFT, MD_REV);
		MOTORS_LEFT = 65;
		MOTORS_RIGHT = 100;

		leftOuter = true;
		_delay_ms(40);

	} else if (lineArrayRaw & 0x40) {
		MOTORS_LEFT = 50;
		_delay_ms(10);
	}

	//---------
	if (leftOuter && rightOuter) {
		setMotor(MOTOR_LEFT, MD_FWD);
		setMotor(MOTOR_RIGHT, MD_REV);

		MOTORS_LEFT = 130;
		MOTORS_RIGHT = 60;

		_delay_ms(90);
	}
}
Example #7
0
Thread::Thread(uint _serverId, uint _threadId, uint to, uint rc, bool _validated, bool _validate, QWidget * p, NntpHost *nh) :
    serverId(_serverId), threadId(_threadId), threadTimeout(rc * 60 * 1000) /* minutes */, validated(_validated)
{
    retryCount = 0;
    timeout = to * 1000;

    //qDebug() << "Idle to = " << threadTimeout;
    threadBytes = new uint;
    *threadBytes = 0;
    prevBytes = 0;
    resetSpeed();

    QueueScheduler* queueScheduler = ((QMgr*)p)->getQueueScheduler();
    nntpT = new NntpThread(serverId, threadId, threadBytes, queueScheduler->getIsRatePeriod(), queueScheduler->getIsNilPeriod(), validated, _validate, nh, (QMgr*)p);

    connect(nntpT, SIGNAL(StartedWorking(int, int)), p, SLOT(started(int, int)));
    connect(nntpT, SIGNAL(Start(Job *)), p, SLOT(start(Job *)));
    connect(nntpT, SIGNAL(DownloadFinished(Job *)), p, SLOT(finished(Job *)));
    connect(nntpT, SIGNAL(DownloadCancelled(Job *)), p, SLOT(downloadCancelled(Job *)));
    connect(nntpT, SIGNAL(DownloadError(Job *, int)), p, SLOT(downloadError(Job *, int)));
    connect(nntpT, SIGNAL(Finished(Job *)), p, SLOT(finished(Job *)));
    connect(nntpT, SIGNAL(Cancelled(Job *)), p, SLOT(cancel(Job *)));
    connect(nntpT, SIGNAL(Err(Job *, int)), p, SLOT(Err(Job *, int)));
    connect(nntpT, SIGNAL(Failed(Job *, int)), p, SLOT(Failed(Job *, int)));
    connect(nntpT, SIGNAL(SigPaused(int, int, bool)), p, SLOT(paused(int, int, bool)));
    connect(nntpT, SIGNAL(SigDelayed_Delete(int, int)), p, SLOT(delayedDelete(int, int)));
    connect(nntpT, SIGNAL(SigReady(int, int)), p, SLOT(stopped(int, int)));
    connect(nntpT, SIGNAL(SigClosingConnection(int, int)), p, SLOT(connClosed(int, int)));
    connect(nntpT, SIGNAL(SigUpdate(Job *, uint, uint, uint)), p, SLOT(update(Job *, uint, uint, uint)));
    connect(nntpT, SIGNAL(SigUpdatePost(Job *, uint, uint, uint, uint)), p, SLOT(updatePost(Job *, uint, uint, uint, uint)));
    connect(nntpT, SIGNAL(SigUpdateLimits(Job *, uint, uint, uint)), p, SLOT(updateLimits(Job *, uint, uint, uint)));
    connect(nntpT, SIGNAL(sigHeaderDownloadProgress(Job*, quint64, quint64, quint64)), p, SLOT(slotHeaderDownloadProgress(Job*, quint64, quint64, quint64)));
    connect(nntpT, SIGNAL(SigExtensions(Job *, quint16, quint64)), p, SLOT(updateExtensions(Job *, quint16, quint64)));
    connect(nntpT, SIGNAL(logMessage(int, QString)), quban->getLogAlertList(), SLOT(logMessage(int, QString)));
    connect(nntpT, SIGNAL(logEvent(QString)), quban->getLogEventList(), SLOT(logEvent(QString)));

    connect(nntpT, SIGNAL(serverValidated(uint, bool, QString, QList<QSslError>)), p, SLOT(serverValidated(uint, bool, QString, QList<QSslError>)));

    connect(nntpT, SIGNAL(registerSocket(RcSslSocket*)), p, SIGNAL(registerSocket(RcSslSocket*))); // Pass it on to RateController
    connect(nntpT, SIGNAL(unregisterSocket(RcSslSocket*)), p, SIGNAL(unregisterSocket(RcSslSocket*))); // Pass it on to RateController

    speedTimer = new QTimer();
    speedTimer->setSingleShot(false);
    idleTimer = new QTimer();
    retryTimer = new QTimer();
    connect(speedTimer, SIGNAL(timeout()), SLOT(slotSpeedTimeout()));
    connect(idleTimer, SIGNAL(timeout()), SLOT(slotIdleTimeout()));
    connect(retryTimer, SIGNAL(timeout()), SLOT(slotRetryTimeout()));
}
Example #8
0
void hugWallL(int16 wallDistance){
	if((wallDistance > (DIST_THRESHOLD_L - SENSOR_NOISE)) && (wallDistance < (DIST_THRESHOLD_L + SENSOR_NOISE))){
		resetSpeed();
		moveForward(10);
	}

	if(wallDistance > (DIST_THRESHOLD_L + SENSOR_NOISE)){
		accelerateLeft(100);
		moveForward(10);
	}

	if(wallDistance < (DIST_THRESHOLD_L - SENSOR_NOISE)){
		accelerateRight(100);
		moveForward(10);
	}

	return;
}
Example #9
0
Spiker::Spiker()
{
    Enemy::spriteNumber = 2;
    resetSpeed();
    type = 1;
}
void GameManager::gameOver(){
    _gameOver=true;
    resetSpeed(0);
    resetPositions(0);
}
void GameManager::restart(){
    _vidas=5;
    resetSpeed(1);
    resetPositions(1);
}
Example #12
0
void Thread::started()
{
    speedTimer->start(1000);
    resetSpeed();
    idleTimer->stop();
}
Example #13
0
void Orange::reset()
{
    DynamicObject::reset();
	resetSpeed();
}