Exemplo n.º 1
0
CriusGUI::CriusGUI(QWidget *parent) :
    QMainWindow(parent),
    ui_(new Ui::CriusGUI),
    active_(false),
    connected_(false)
{
    // Create SerialCommThread
    SerialCommThread* serial_thread = new SerialCommThread();
    QThread*  thread = new QThread;
    serial_thread->moveToThread(thread);
    connect(thread, SIGNAL(started()), serial_thread, SLOT(init()));

    connect(this, SIGNAL(loadFCConfig()), serial_thread, SLOT(requestConfig()));
    connect(this, SIGNAL(sendFCConfig(QByteArray)), serial_thread, SLOT(sendConfig(QByteArray)));
    connect(this, SIGNAL(sendSerialConfig(QString)),
            serial_thread,
            SLOT(connectSerial(QString)));
    connect(this, SIGNAL(sendSerialDisconnect()), serial_thread, SLOT(disconnectSerial()));

    connect(serial_thread, SIGNAL(sendData(QByteArray)), this, SLOT(getSerialData(QByteArray)));
    connect(serial_thread, SIGNAL(sendSerialPortInfo(QStringList)), this, SLOT(receiveSerialPortInfo(QStringList)));
    connect(this, SIGNAL(sendGotACK()), serial_thread, SLOT(receiveACK()));

    thread->start();

    // Setup UI
    ui_->setupUi(this);

    // Initialize plots
    imu_plot_= new TimePlot(ui_->imu_plot, ui_->imu_plot->geometry().width()/2, 6);
    control_plot_ = new TimePlot(ui_->control_plot,  ui_->control_plot->geometry().width()/2, 4);
}
Exemplo n.º 2
0
void SerialMonitor::disconnectedSerial(){
	//Desconectado
	connect(ui->connectButton, SIGNAL(clicked()), this, SLOT(connectSerial()));
	disconnect(ui->connectButton, SIGNAL(clicked()), this, SLOT(disconnectSerial()));

	setSerialPort(serialPort);
}
Exemplo n.º 3
0
void Serial::handleError(QSerialPort::SerialPortError error)
{
    if ( (SerialPort->isOpen()) && (error == QSerialPort::ResourceError))
    {
        error_(SerialPort->errorString().toLocal8Bit());
        disconnectSerial();
    }
}
CloudWatcherController::~CloudWatcherController() {
  if (firmwareVersion != NULL) {
    delete [] firmwareVersion;
  }


  disconnectSerial();
}
Exemplo n.º 5
0
void SerialMonitor::connectedSerial(){
	//Conectado
	disconnect(ui->connectButton, SIGNAL(clicked()), this, SLOT(connectSerial()));
	connect(ui->connectButton, SIGNAL(clicked()), this, SLOT(disconnectSerial()));

	ui->connectButton->setEnabled(true);
	ui->connectButton->setText(tr("Disconnect"));
}
Exemplo n.º 6
0
void SerialMonitor::readException(QString what){
	disconnectSerial();
	setSerialPort(ui->menuSerialPorts->getDefaultPort());

	QMessageBox(QMessageBox::Critical,
			tr("Read error"),
			what,
			QMessageBox::Ok
		   ).exec();
}
Exemplo n.º 7
0
int main (int argc, const char * argv[])
{
    bool connection;
    
    connection = connectSerial("/dev/tty.SmartBlueMiniGPSe644-GP");
    
    if (connection) {
        printf("connected\n");
        
        readNMEA(kReadCount);
        
        disconnectSerial();
    }
    else {
        printf("not connected\n");
    }
    
    return 0;
}