Beispiel #1
0
RankPool::RankPool(SQLiteDB *db, HashPool *hp, QObject *parent) :
    QObject(parent),
    db_(db),hp_(hp)
{
    connect( db_, SIGNAL(sigOpened()), this, SLOT(loadRankFromDB()));
    connect( db_, SIGNAL(sigClosed()), this, SLOT(clearCache()));
}
Beispiel #2
0
void Moto::initGui()
{
	ui.statusbar->showMessage( "Press F1 for help" );

    ui.speed_msr->setLabel( "x100" );
    ui.software->setEnabled( false );
    slotClosed();
    lockConfig();

    loadSettings();

    connect( this, SIGNAL(sigSpeed()),  this, SLOT(slotSpeed()) );
    connect( this, SIGNAL(sigStatus()), this, SLOT(slotStatus()) );
    connect( this, SIGNAL(sigConfig()), this, SLOT(slotConfig()) );
    connect( this, SIGNAL(sigOpened()), this, SLOT(slotOpened()) );
    connect( this, SIGNAL(sigClosed()), this, SLOT(slotClosed()) );

    // Binding GUI controls.
    connect( ui.throttle,  SIGNAL(valueChanged(int)),        this, SLOT(slotThrottleChanged(int)) );
    connect( ui.speed,     SIGNAL(valueChanged(int)),        this, SLOT(slotSpeedChanged(int)) );
    connect( ui.direction, SIGNAL(currentIndexChanged(int)), this, SLOT(slotDirectionChanged(int)) );
    connect( ui.unlock,    SIGNAL(clicked()),                this, SLOT(slotUnlock()) );
    connect( ui.apply,     SIGNAL(clicked()),                this, SLOT(slotApply()) );
    connect( ui.help,      SIGNAL(triggered()),              this, SLOT(slotHelp()) );

    m_speedTimer  = new QTimer();
    m_statusTimer = new QTimer();
    connect( m_speedTimer,  SIGNAL(timeout()), this, SLOT(slotSpeedTimeout()) );
    connect( m_statusTimer, SIGNAL(timeout()), this, SLOT(slotStatusTimeout()) );
    m_speedTimer->setInterval( 100 );
    m_statusTimer->setInterval( 1000 );
    m_speedTimer->start();
    m_statusTimer->start();
}
Beispiel #3
0
void Moto::asynchReadStatus()
{
    if ( !m_board->isOpen() )
    {
        bool res = m_board->open();
        if ( res )
        {
        	// Dmitry said, do not read configuration.
        	// Just load it from INI file.
            //asynchReadConfig();
            emit sigOpened();
        }
    }
    else
    {
        bool res = m_board->voltage( m_state.voltage );
        if ( !res )
            goto LBL_STATUS_CLOSED;
        Sleep::msleep( SLEEP );

        res = m_board->enKeySeat_1( m_state.keySeat_1 );
        if ( !res )
            goto LBL_STATUS_CLOSED;
        Sleep::msleep( SLEEP );

        res = m_board->enKeySeat_2( m_state.keySeat_2 );
        if ( !res )
            goto LBL_STATUS_CLOSED;
        Sleep::msleep( SLEEP );

        res = m_board->controllerT( m_state.controllerT );
        if ( !res )
            goto LBL_STATUS_CLOSED;
        Sleep::msleep( SLEEP );

        res = m_board->motorT( m_state.motorT );
        if ( !res )
            goto LBL_STATUS_CLOSED;
        Sleep::msleep( SLEEP );

        res = m_board->extInp_1( m_state.extInp_1 );
        if ( !res )
            goto LBL_STATUS_CLOSED;
        Sleep::msleep( SLEEP );

        res = m_board->extInp_2( m_state.extInp_2 );
        if ( !res )
            goto LBL_STATUS_CLOSED;
        Sleep::msleep( SLEEP );

        res = m_board->errorCode( m_state.errorCode );
        if ( !res )
            goto LBL_STATUS_CLOSED;
        Sleep::msleep( SLEEP );

        res = m_board->hours( m_state.hours );
        if ( !res )
            goto LBL_STATUS_CLOSED;
        Sleep::msleep( SLEEP );

        res = m_board->cycles( m_state.cycles );
        if ( !res )
            goto LBL_STATUS_CLOSED;
        Sleep::msleep( SLEEP );

        res = m_board->modelRev( m_state.modelRev );
        if ( !res )
            goto LBL_STATUS_CLOSED;
        Sleep::msleep( SLEEP );

        emit sigStatus();
    }

    return;
LBL_STATUS_CLOSED:
    emit sigClosed();
}