Esempio n. 1
0
OnlineDataConnection* OnlineNode::connection()
{
	if (_connection == NULL) {
		_connection = new OnlineDataConnection(_manager, this);
		connect(_connection, SIGNAL(finished()), this, SLOT(connectionFinished()));
	}

	return _connection;
}
ReaderManipulatorWidget::ReaderManipulatorWidget(const Settings::ConnectionType type, QWidget *parent) :
    QWidget(parent),
    ui(new Ui::ReaderManipulatorWidget),
    m_connectionType(type)
{
    ui->setupUi(this);

    ui->btStartPauseReading->setIcon(QIcon(":/icons/icon-ok"));
    ui->btClearOutput->setIcon(QIcon(":/icons/icon-clear"));
    ui->btSendCommand->setIcon(QIcon(":/icons/icon-send"));
    ui->btLogTo->setIcon(QIcon(":/icons/icon-search"));

    // Log file.
    m_logFile = new QFile(this);
    m_useLogFile = false;

    // Define the default window state.
    ui->btLogTo->setEnabled(true);
    ui->cbLogType->setEnabled(true);
    ui->btSendCommand->setEnabled(false);
    ui->leCommand->setEnabled(false);
    ui->cbLogType->addItem(tr("Append"), QIODevice::Append);
    ui->cbLogType->addItem(tr("Overwrite"), QIODevice::WriteOnly);
    ui->cbInputType->addItem("ASCII", SerialCommunication::KASCII);
    ui->cbInputType->addItem(tr("Number"), SerialCommunication::KNumber);

    connect(ui->btSendCommand, SIGNAL(clicked()), this, SLOT(btSendCommandClicked()));
    connect(ui->leCommand, SIGNAL(returnPressed()), this, SLOT(leCommandReturnPressed()));
    connect(ui->btStartPauseReading, SIGNAL(clicked(bool)), this, SLOT(btStartPauseReadingClicked(bool)));
    connect(ui->btLogTo, SIGNAL(clicked()), this, SLOT(btLogToClicked()));
    connect(ui->btClearOutput, SIGNAL(clicked()), this, SLOT(btClearOutputClicked()));

    if(type == Settings::KNetwork){
        connect(NetworkCommunication::instance(),SIGNAL(connectionFailed()),this, SLOT(connectionFinished()));
    }else{
        connect(SerialCommunication::instance(),SIGNAL(connectionFailed()),this, SLOT(connectionFinished()));
    }

    // instantiate the RI-CTL-MB2B-30 Manipulator and add it to the main tab.
    m_mb2b30 = new RICTLMB2B30Widget(m_connectionType, this);
    ui->tabWidget->addTab(m_mb2b30, "RI-CTL-MB2B-30");
}