コード例 #1
0
ファイル: mainwindow.cpp プロジェクト: ndtmike/WindsorLinx
MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    ui->setupUi(this);
    console = new Console;
    setCentralWidget(console);
    serial = new QSerialPort(this);
    serialTimeOut = new QTimer(this);

    initActionsConnections();
    saveFileName = "";

    connect(serial, SIGNAL(error(QSerialPort::SerialPortError)), this,
            SLOT(handleError(QSerialPort::SerialPortError)));
    connect(serial, SIGNAL(readyRead()), this, SLOT(readData()));
    connect(serialTimeOut,SIGNAL(timeout()), this,SLOT(endUpload()));

    DataUpload = false;

#ifndef QT_DEBUG
    QTimer* init_timer = new QTimer(this);
    init_timer->singleShot(100, this, SLOT(showSplash()));
#else
#ifdef TEST_REG
    QTimer* init_timer = new QTimer(this);
    init_timer->singleShot(100, this, SLOT(showSplash()));
#else
    QTimer* init_timer = new QTimer(this);
    init_timer->singleShot(20, this, SLOT(loadExampleFile()));
#endif
#endif
    connectTimer = new QTimer(this);
}
コード例 #2
0
//! [0]
MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
//! [0]
    ui->setupUi(this);
    console = new Console;
    console->setEnabled(false);
    setCentralWidget(console);
//! [1]
    serial = new QSerialPort(this);
//! [1]
    settings = new SettingsDialog;

    ui->actionConnect->setEnabled(true);
    ui->actionDisconnect->setEnabled(false);
    ui->actionQuit->setEnabled(true);
    ui->actionConfigure->setEnabled(true);

    initActionsConnections();

    connect(serial, SIGNAL(error(QSerialPort::SerialPortError)), this,
            SLOT(handleError(QSerialPort::SerialPortError)));

//! [2]
    connect(serial, SIGNAL(readyRead()), this, SLOT(readData()));
//! [2]
    connect(console, SIGNAL(getData(QByteArray)), this, SLOT(writeData(QByteArray)));
//! [3]
}
コード例 #3
0
ファイル: mainwindow.cpp プロジェクト: randyshirts/robomower
MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    ui->setupUi(this);
    console = new Console;
    serial = new QSerialPort(this);
    settings = new SettingsDialog;
    cRobot = new RobotGui;
    joystickTest = new Joypick;
    console->setEnabled(false);
    setCentralWidget(cRobot);


    ui->actionConnect->setEnabled(true);
    ui->actionDisconnect->setEnabled(false);
    ui->actionQuit->setEnabled(true);
    ui->actionConfigure->setEnabled(true);
    ui->actionTerminal->setEnabled(true);
    ui->actionJoystickTest->setEnabled(true);
    initActionsConnections();

    connect(serial, SIGNAL(error(QSerialPort::SerialPortError)), this,
            SLOT(handleError(QSerialPort::SerialPortError)));

    connect(serial, SIGNAL(readyRead()), this, SLOT(readData()));
    connect(console, SIGNAL(getData(QByteArray)), this, SLOT(writeData(QByteArray)));
    connect(cRobot, SIGNAL(getCommand(QByteArray)), this, SLOT(writeData(QByteArray)));
    connect(cRobot->cHeartBeat, SIGNAL(getHB(QByteArray)), this, SLOT(writeData(QByteArray)), Qt::UniqueConnection);
    connect(cRobot, SIGNAL(getCommand(QByteArray)), this, SLOT(writeData(QByteArray)));
}
コード例 #4
0
ファイル: mainwindow.cpp プロジェクト: ndtmike/Reboundlinx
MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    ui->setupUi(this);
    console = new Console;
    console->setEnabled(false);
    setCentralWidget(console);
    serial = new QSerialPort(this);
    settings = new SettingsDialog;
    serialTimeOut = new QTimer(this);
    ui->actionQuit->setEnabled(true);

    initActionsConnections();

    connect(serial, SIGNAL(error(QSerialPort::SerialPortError)), this,
            SLOT(handleError(QSerialPort::SerialPortError)));
    connect(serial, SIGNAL(readyRead()), this, SLOT(readData()));

    connect(console, SIGNAL(getData(QByteArray)), this, SLOT(writeData(QByteArray)));

    connect(serialTimeOut,SIGNAL(timeout()), this,SLOT(endUpload()));

    QTimer* init_timer = new QTimer(this);
    init_timer->singleShot(100, this, SLOT(showSplash()));
}
コード例 #5
0
ConsoleWindow::ConsoleWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::ConsoleWindow)
{
    QFile styleSheet(":/resources/styles/programwindow.qss");

    this->setObjectName("consoleWindow");
    if (!styleSheet.open(QIODevice::ReadOnly)) {
        qWarning("Unable to open :/resources/styles/programwindow.qss");
    } else {
        QString ss = styleSheet.readAll();
#ifdef Q_OS_MAC
                int paneLoc = 4;
                int tabBarLoc = 0;
#else
                int paneLoc = -1;
                int tabBarLoc = 5;
#endif
                ss = ss.arg(paneLoc).arg(tabBarLoc);
        this->setStyleSheet(ss);
    }

    ui->setupUi(this);
    console = new Console;
    console->setEnabled(false);
    setCentralWidget(console);
    serial = new QSerialPort(this);
    settings = new ConsoleSettings;

    QSettings settings;
    if (!settings.value("consolewindow/state").isNull()) {
        restoreState(settings.value("consolewindow/state").toByteArray());
    }
    if (!settings.value("consolewindow/geometry").isNull()) {
        restoreGeometry(settings.value("consolewindow/geometry").toByteArray());
    }

    ui->actionConnect->setEnabled(true);
    ui->actionDisconnect->setEnabled(false);
    ui->actionQuit->setEnabled(true);
    ui->actionConfigure->setEnabled(true);

    initActionsConnections();

    connect(serial, SIGNAL(error(QSerialPort::SerialPortError)), this,
            SLOT(handleError(QSerialPort::SerialPortError)));

    connect(serial, SIGNAL(readyRead()), this, SLOT(readData()));
    connect(console, SIGNAL(getData(QByteArray)), this, SLOT(writeData(QByteArray)));
}
コード例 #6
0
ファイル: mainwindow.cpp プロジェクト: gokhansolak/yap-6.3
//! [0]
MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
//! [0]
    ui->setupUi(this);
    console = new Console;
    console->setEnabled(false);
    setCentralWidget(console);
//! [1]
//! [1]
    settings = new SettingsDialog;

    ui->actionConnect->setEnabled(true);
    ui->actionDisconnect->setEnabled(false);
    ui->actionQuit->setEnabled(true);
    ui->actionConfigure->setEnabled(true);

    initActionsConnections();

///! [2]
    connect(console, &Console::getData, this, &MainWindow::writeData);
//! [3]
}
コード例 #7
0
ファイル: mainwindow.cpp プロジェクト: jrosser/honeymon
MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    ui->setupUi(this);
    console = new Console;
    console->setEnabled(false);

    tabs = new QTabWidget();
    setCentralWidget(tabs);

    serial = new QSerialPort(this);
    settings = new SettingsDialog;

    ui->actionConnect->setEnabled(true);
    ui->actionDisconnect->setEnabled(false);
    ui->actionQuit->setEnabled(true);
    ui->actionConfigure->setEnabled(true);
    ui->actionAscii->setEnabled(true);
    ui->actionBinary->setEnabled(true);

    nodeNames = new NodeNames();
    logFile = new LogFile();

    decoder = new Decoder();
    connect(decoder, SIGNAL(logMessage(QString)), logFile, SLOT(add(QString)));

    tempDistModel = new TempModel(this);
    tempDistModel->setNodeNameHelper(nodeNames);

    zoneSetpointModel = new SetpointModel(this);
    zoneSetpointModel->setNodeNameHelper(nodeNames);

    demandModel = new DemandModel(this);
    demandModel->setNodeNameHelper(nodeNames);

    commandModel = new CommandModel(this);
    commandModel->setNodeNameHelper(nodeNames);

    nowNextModel = new ProgNowNextModel(this);
    nowNextModel->setNodeNameHelper(nodeNames);

    unknown1060Model = new Unknown18Model(this);
    unknown1060Model->setNodeNameHelper(nodeNames);

    unknown1100Model = new Unknown16Model(this);
    unknown1100Model->setNodeNameHelper(nodeNames);

    unknown0008Model = new Unknown16Model(this);
    unknown0008Model->setNodeNameHelper(nodeNames);

    unknown0009Model = new Unknown16Model(this);
    unknown0009Model->setNodeNameHelper(nodeNames);

    unknown1F09Model = new Unknown16Model(this);
    unknown1F09Model->setNodeNameHelper(nodeNames);

    unknown3B00Model = new Unknown16Model(this);
    unknown3B00Model->setNodeNameHelper(nodeNames);

    messageModel = new MessageModel(this);

    MessageTab *messageTab = new MessageTab();
    messageTab->setMessageCountersModel(commandModel);
    messageTab->setMessageLogModel(messageModel);
    tabs->addTab(messageTab, "Messages");

    TemperaturesTab *temperaturesTab = new TemperaturesTab();
    temperaturesTab->setMeasuredTempsModel(tempDistModel);
    temperaturesTab->setSetpointsModel(zoneSetpointModel);
    temperaturesTab->setDemandsModel(demandModel);
    temperaturesTab->setProgNowNextModel(nowNextModel);

    tabs->addTab(temperaturesTab, "Temperatures");

    UnknownTab *unknownTab = new UnknownTab();
    unknownTab->set0008Model(unknown0008Model);
    unknownTab->set0009Model(unknown0009Model);
    unknownTab->set1060Model(unknown1060Model);
    unknownTab->set1100Model(unknown1100Model);
    unknownTab->set1F09Model(unknown1F09Model);
    unknownTab->set3B00Model(unknown3B00Model);
    tabs->addTab(unknownTab, "Unknown messages");

    DecoderTab *decoderTab = new DecoderTab();
    tabs->addTab(decoderTab, "Decoder");

    tabs->addTab(console, "Console");

    initActionsConnections();

    parser=NULL;
    setBinaryParser();

    connect(serial, SIGNAL(readyRead()), this, SLOT(readData()));

    connect(decoder, SIGNAL(consoleMessage(QString)), this, SLOT(message(QString)));
    connect(decoder, SIGNAL(gotMessage(QByteArray)), messageModel, SLOT(newData(QByteArray)));

    //connect decoded messages to tables
    connect(decoder, SIGNAL(zoneTempDistribution(quint32,quint32,quint32,float)), tempDistModel, SLOT(newData(quint32,quint32,quint32,float)));
    connect(decoder, SIGNAL(zoneSetpointSetting(quint32,quint32,quint32,float)), zoneSetpointModel, SLOT(newData(quint32,quint32,quint32,float)));
    connect(decoder, SIGNAL(heatDemand(quint32,quint32,quint32,quint32)), demandModel, SLOT(newData(quint32, quint32, quint32, quint32)));
    connect(decoder, SIGNAL(gotCommand(quint32,quint32,quint32)), commandModel, SLOT(newData(quint32,quint32,quint32)));
    connect(decoder, SIGNAL(programmerNowNext(quint32,quint32,float,float,quint32)), nowNextModel, SLOT(newData(quint32, quint32, float, float, quint32)));

    //connect unknown messages to tables
    connect(decoder, SIGNAL(unknown1060(quint32,quint32,QByteArray)), unknown1060Model, SLOT(newData(quint32,quint32,QByteArray)));
    connect(decoder, SIGNAL(unknown1100(quint32,QByteArray)), unknown1100Model, SLOT(newData(quint32,QByteArray)));
    connect(decoder, SIGNAL(unknown0008(quint32,QByteArray)), unknown0008Model, SLOT(newData(quint32,QByteArray)));
    connect(decoder, SIGNAL(unknown0009(quint32,QByteArray)), unknown0009Model, SLOT(newData(quint32,QByteArray)));
    connect(decoder, SIGNAL(unknown1F09(quint32,QByteArray)), unknown1F09Model, SLOT(newData(quint32,QByteArray)));
    connect(decoder, SIGNAL(unknown3B00(quint32,QByteArray)), unknown3B00Model, SLOT(newData(quint32,QByteArray)));

    //connect decoder stats to decoder tab
    connect(decoder, SIGNAL(inputByteCount(quint32)), decoderTab, SLOT(inputByteCount(quint32)));
    connect(decoder, SIGNAL(candidatePayloadCount(quint32)), decoderTab, SLOT(candidatePayloadCount(quint32)));
    connect(decoder, SIGNAL(overLengthMessageCount(quint32)), decoderTab, SLOT(overLengthMessageCount(quint32)));
    connect(decoder, SIGNAL(lengthOddCount(quint32)), decoderTab, SLOT(lengthOddCount(quint32)));
    connect(decoder, SIGNAL(manchesterInvalidCount(quint32)), decoderTab, SLOT(manchesterInvalidCount(quint32)));
    connect(decoder, SIGNAL(validMessageCount(quint32)), decoderTab, SLOT(validMessageCount(quint32)));

    //connect decoded messages to influxdb
    connect(decoder, SIGNAL(influxData(QString)), this, SLOT(writeInflux(QString)));

    //receive broadcast traffic from RF receiver
    udpSocket = new QUdpSocket(this);
    udpSocket->bind(8888, QUdpSocket::ShareAddress);

    connect(udpSocket, SIGNAL(readyRead()),
            this, SLOT(readPendingDatagrams()));

    //send influx format data
    influxSocket = new QUdpSocket(this);
}