Example #1
0
File: moto.cpp Project: z80/avrusb
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();
}
Example #2
0
void CMainWindow::connectSignals()
{
    connect(backend,SIGNAL(sigStatus(CCommand::status_t)), this, SLOT(slotReceivedData(CCommand::status_t)));
    connect(ui->pushPower, SIGNAL(toggled(bool)), this, SLOT(powerOn(bool)));
    connect(dbgWin,SIGNAL(sendData(QString&)),this,SLOT(slotSendData(QString&)));
    //connect(cmd,SIGNAL(sendData(QString&)),this,SLOT(slotSendData(QString&)));
    connect(ui->volume1, SIGNAL(valueChanged(double)), this,SLOT(slotVolume1(double)));
    //connect(ui->volume2, SIGNAL(valueChanged(double)), this,SLOT(slotVolume2(double)));
    connect(ui->knobSquelch,SIGNAL(valueChanged(double)), this, SLOT(slotSquelch(double)));
    connect(ui->knobIF,SIGNAL(valueChanged(double)), this, SLOT(slotIF(double)));
    connect(ui->pushNoiseBlanker,SIGNAL(toggled(bool)),this,SLOT(slotNoiseBlanker(bool)));
    connect(ui->pushAGC,SIGNAL(toggled(bool)),this,SLOT(slotAGC(bool)));
    connect(ui->pushVSC,SIGNAL(toggled(bool)),this,SLOT(slotVSC(bool)));


    // Connect filters
    connect(ui->filterGroup, SIGNAL(buttonClicked(int)), this, SLOT(slotFilter(int)));
    // Connect Moudlation mode
    connect(ui->modeGroup,SIGNAL(buttonClicked(int)),this, SLOT(slotModulation(int)));

    // Frequency
    connect( display, SIGNAL(frequencyChanged(QString)), this,SLOT(slotFrequency(QString)));
    connect( myBandScope, SIGNAL(frequencyChanged(QString)), this, SLOT(slotFrequency(QString)));

    // Set threshold
    connect(ui->threshold, SIGNAL(valueChanged(int)), backend->getDecoder(), SLOT(slotThreshold(int)));
    connect(ui->correlationLength,SIGNAL(valueChanged(int)), backend->getDecoder(), SLOT(slotSetCorrelationLength(int)));

    // Connect Decoder
    connect(ui->decoderList, SIGNAL(currentIndexChanged(int)), this, SLOT(slotDecoderChange(int)));

    // Channel change
    connect(ui->channel, SIGNAL(currentIndexChanged(int)), backend->getDecoder(), SLOT(slotSetChannel(int)));

    // Connect Scope type
    connect(ui->cbPlotterType , SIGNAL(currentIndexChanged(int)),this, SLOT(slotScopeChanged(int)));
    connect(ui->refreshRate, SIGNAL(valueChanged(int)), this, SLOT(slotRefreshRate(int)));
    connect(ui->cbWindow, SIGNAL(currentIndexChanged(QString)), this, SLOT(slotWindowFunction(QString)));

    // Band Scope
    connect(ui->pushBandscope,SIGNAL(clicked(bool)),this,SLOT(slotBandScope(bool)));
    connect(ui->cbBandwidth, SIGNAL(currentIndexChanged(int)), this, SLOT(slotBandScopeWidth(int)));
    connect(ui->cbStepsize, SIGNAL(currentIndexChanged(int)), this, SLOT(slotBandScopeStep(int)));

    // Step size change
    connect(ui->pushStepUp,SIGNAL(clicked()), this, SLOT(slotStepUp()));
    connect(ui->pushStepDown,SIGNAL(clicked()), this, SLOT(slotStepDown()));

    // Connect load file
    connect(ui->actionLoad, SIGNAL(triggered()), this, SLOT(slotLoadFile()));
    connect(display, SIGNAL(radioChanged(int)), this, SLOT(slotRadioClicked(int)));
    connect(ui->actionSettings, SIGNAL(triggered()), this, SLOT(slotSettings()));
    // Connect spectrum widget
    connect(backend->getDecoder(),SIGNAL(sigRawSamples(double*,double*,int)),mySpectrum,SLOT(slotRawSamples(double*,double*,int)));

    // Connect Demodulator to debug windows
    connect(backend->getDecoder(),SIGNAL(sendData(QString)),this,SLOT(slotDemodulatorData(QString)));
}
Example #3
0
LuaMachine::LuaMachine( QXmppPeer * parent, TInit init )
    : QObject( parent )
{
	pd = new PD( this, init );
    pd->client = parent;

    connect( this,       SIGNAL(sigPrint(QString)), 
             this,       SLOT(slotPrint(QString)), 
             Qt::QueuedConnection );
    connect( this,       SIGNAL(sigStatus(QString, QString)),
             this,       SLOT(slotStatus(QString, QString)),
             Qt::QueuedConnection );
    connect( this,       SIGNAL(sigProcess(QString)),
             this,       SLOT(slotProcess(QString)),
             Qt::QueuedConnection );
    connect( pd->client, SIGNAL(textmsg(QString)),
             this,       SLOT(qxmppMessageReceived(QString)), 
             Qt::QueuedConnection );
}
Example #4
0
//结算 Settlement
unsigned char TransOnlinePro::SettlementPro(void)
{
    unsigned char ucResult = SUCCESS_TRACKDATA;

    emit sigStatus("Initial Settlement");

    if((ucResult = ReversalPro()))
        return ucResult;

    xDATA::ReadValidFile(xDATA::DataSaveTransInfo);
    if(!g_transInfo.auiTransIndex[0])
        return ERR_TRANSEMPTY;

    if(!ucResult)
        ucResult = TRANS_ONLINE_Settlement_pack(TransMode_Settle, &g_transInfo.TransTotal);
    if(!ucResult)
        ucResult = GenSendReceive();
    if(!ucResult)
        ucResult = TRANS_ONLINE_Settlement_unpack();

    if(ucResult == ERR_SETTLE_UNBALANCE)
    {
        emit sigStatus("Settlement Unbalance");

        for(unsigned int uiIndex = 0; uiIndex < g_constantParam.uiMaxTotalNb; uiIndex++)
        {
            if(!g_transInfo.auiTransIndex[uiIndex])
                break;

            QString str;
            str.append("Batch Uploading :: ");
            str.append(QString::number(uiIndex));
            emit sigStatus(str);

            memset(&g_saveTrans, 0, sizeof(NORMAL_TRANS));
            ucResult = xDATA::ReadSubsectionFile(xDATA::DataSaveSaveTrans, uiIndex);
            if(!ucResult)
                ucResult = TRANS_ONLINE_BatchUpload_pack(&g_saveTrans);
            if(!ucResult)
                ucResult = GenSendReceive();
            if(!ucResult)
                ucResult = TRANS_ONLINE_BatchUpload_unpack();
        }
        if(!ucResult)
        {
            emit sigStatus("Finishing Settlement");

            ucResult = TRANS_ONLINE_Settlement_pack(TransMode_Settle2, &g_transInfo.TransTotal);
            if(!ucResult)
                ucResult = GenSendReceive();
            if(!ucResult)
                ucResult = TRANS_ONLINE_Settlement_unpack();
        }
    }
#if 0
    //参数更新
    if(!ucResult)
    {
        //清数据
        SAV_CleanCurrentBatch();
        //更新批次
        if(g_changeParam.ulBatchNumber >= 1 && g_changeParam.ulBatchNumber < 999999)
            ++g_changeParam.ulBatchNumber;
        else
            g_changeParam.ulBatchNumber = 1;

        xDATA::WriteValidFile(xDATA::DataSaveChange);
    }
#endif
    return ucResult;
}
Example #5
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();
}
Example #6
0
void LuaMachine::status( const QString & tag, const QString & stri )
{
    emit sigStatus( tag, stri );
}