Example #1
0
UtlBoolean MprRecorder::termDtmf(int currentToneKey)
{
	UtlBoolean res = FALSE;
	if ((currentToneKey == 11) || (currentToneKey == 1) || (currentToneKey == 0) ||
		(currentToneKey == -1))
	{
	 // Only if it's the # or 1 or 0 key, we terminate the recording.
	 // This is a temp solution for Weck.
	 //  -  We may want to make this configurable in the near future.
	 //  -  Or we may want to modify the VXI engine to hanfle grammar
	 //     inside a record field.

		OsSysLog::add(FAC_MP, PRI_INFO, "MprRecorder::termDtmf entering - key=%d, mFileDescriptor=%d, mStatus=%d",
         currentToneKey, mFileDescriptor, mStatus);

		mTermKey = currentToneKey;
		if (mTermKey != -1)
			res = closeRecorder();
	}

	return res;
}
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow){
    ui->setupUi(this);
    QFontDatabase::addApplicationFont(":/fonts/DigitFont.ttf");


/*
    QFile f("C:\\Users\\user\\Desktop\\fake.txt");
    f.open(QFile::Text|QFile::WriteOnly);
    QTextStream stream(&f);
    for(uint i=0; i<10000; i++){
        QString n = QString::number(i,16);
        int sin = sinf(i)*100000;
        int cos = cosf(i)*100000;
        while(n.size()<4)n.prepend('0');

        stream<<"#0d#0a#44#41#54";
        stream<<"#"<<n.at(0)<<n.at(1);
        stream<<"#"<<n.at(2)<<n.at(3);
        stream<<"#00#02#01#00#01#01";

        QString c = QString::number(sin,16);
        while(c.size()>8)c = c.remove(0,1);
        while(c.size()<8)c = c.prepend('0');
        for(int j=0; j<8;j++){
            if(j%2==0)stream<<"#";
            stream<<c.at(8-j-1);
        }

        c = QString::number(cos,16);
        while(c.size()>8)c = c.remove(0,1);
        while(c.size()<8)c = c.prepend('0');
        for(int j=0; j<8;j++){
            if(j%2==0)stream<<"#";
            stream<<c.at(8-j-1);
        }


        stream<<"#0d#0a\n";
    }
    f.close();


    */
    /*
    QNetworkProxy proxy;
    proxy.setType(QNetworkProxy::HttpProxy);
    proxy.setHostName("192.168.0.1");
    proxy.setPort(8080);
    QNetworkProxy::setApplicationProxy(proxy);
*/

    //Puntatori globali alle istanze delle view da usare per accedere ad esse da classi esterne
    this->mainWindow = this;
    this->logConsole = ui->logConsoleTable;
    this->recordingViews = ui->recordingSessionViews;
    this->analyzerViews = ui->analyzerSessionViews;
    //this->aboutDialog = new AboutDialog(this);

    //Refresh porte seriali
    on_buttonRefreshPort_clicked();

    //gsm = new GSMInterface();
    recordingSession = new RecordingSession(gsm, this);
    analyzerSession = new AnalyzerSession(this);
    ui->comboTrack->setModel(new QSqlQueryModel());
    ui->comboVehicle->setModel(new QSqlQueryModel());

    connect(ui->showGraficiInSommario, SIGNAL(toggled(bool)), recordingViews->summaryView->chartSum, SLOT(setVisible(bool)));
    connect(recordingViews->summaryView->chartSum, SIGNAL(onClose(bool)), ui->showGraficiInSommario, SLOT(setChecked(bool)));

    connect(ui->showCruscottoInSommario, SIGNAL(toggled(bool)), recordingViews->summaryView->dashSum, SLOT(setVisible(bool)));
    connect(recordingViews->summaryView->dashSum, SIGNAL(onClose(bool)), ui->showCruscottoInSommario, SLOT(setChecked(bool)));

    connect(ui->showGPSInSommario, SIGNAL(toggled(bool)), recordingViews->summaryView->gpsSum, SLOT(setVisible(bool)));
    connect(recordingViews->summaryView->gpsSum, SIGNAL(onClose(bool)), ui->showGPSInSommario, SLOT(setChecked(bool)));

    connect(ui->showTimerInSommario, SIGNAL(toggled(bool)), recordingViews->summaryView->timeSum, SLOT(setVisible(bool)));
    connect(recordingViews->summaryView->timeSum, SIGNAL(onClose(bool)), ui->showTimerInSommario, SLOT(setChecked(bool)));

    connect(ui->actionChiudi_Recorder, SIGNAL(triggered()), this, SLOT(closeRecorder()));

    connect(gsm, SIGNAL(writeOnConsole(QString)), logConsole, SLOT(addToLog(QString)));
}