Commit 273c4df9 authored by B-OURGER's avatar B-OURGER
Browse files

erstellen einer Serial verbindungsmoeglichkeit

parent ec3b1da0
......@@ -30,7 +30,7 @@ void Konsole::init_Nachricht(){ //Init Nachricht, die in der UI im Konsolenberei
void Konsole::on_bt_verbinden_clicked()
{
if(ui->cb_serial->isChecked() == true) {
if(ui->rb_serial->isChecked() == true) {
serialFile.setFileName(ui->tf_port->text());
if (!serialFile.open(QIODevice::ReadWrite | QIODevice::Text)) {
qDebug()<<"nicht verbunden";
......@@ -71,7 +71,7 @@ QString Konsole::updateKonsole(){
connectionSucc();
firstrun = false;
}
if(ui->cb_serial->isChecked() == true) {
if(ui->rb_serial->isChecked() == true) {
QByteArray line = serialFile.readLine();
QString lineToChop = QString(line);
lineToChop.remove("\n", Qt::CaseInsensitive);
......@@ -104,7 +104,7 @@ void Konsole::sendCommand(QString command_str){ //Sendet Nachricht an IP und POR
ui->tf_konsole->append(helptext);
return;
}
if(ui->cb_serial->isChecked() == true) {
if(ui->rb_serial->isChecked() == true) {
QTextStream out(&serialFile);
QString message = QString::number(commandID)+ " "+ command_str+" ;";
out << message;
......@@ -258,17 +258,20 @@ void Konsole::on_slider_speed_sliderReleased()
sendCommand("SP "+ui->lb_speed->text());
}
// aendert die Sichtbarkeit der Elemente in dem UI
void Konsole::on_cb_serial_stateChanged(int arg1)
void Konsole::on_rb_serial_clicked()
{
if(arg1 == 2)
{
ui->tf_ipaddr->setEnabled(false);
ui->bt_autoconnect->setEnabled(false);
ui->tf_port->setText("/dev/ttyUSB0");
} else {
ui->tf_ipaddr->setEnabled(true);
ui->bt_autoconnect->setEnabled(true);
ui->tf_port->setText("1025");
}
ui->tf_port->setEnabled(true);
ui->tf_ipaddr->setEnabled(false);
ui->bt_autoconnect->setEnabled(false);
ui->tf_port->setText("/dev/ttyUSB0");
//ui->tf_port->setText("/dev/cu.usbserial-131210");
}
void Konsole::on_rb_wifi_clicked()
{
ui->tf_port->setEnabled(true);
ui->tf_ipaddr->setEnabled(true);
ui->bt_autoconnect->setEnabled(true);
ui->tf_port->setText("1025");
}
......@@ -49,7 +49,9 @@ private slots:
void on_slider_speed_sliderReleased();
void on_cb_serial_stateChanged(int arg1);
void on_rb_serial_clicked();
void on_rb_wifi_clicked();
private:
Ui::Konsole *ui;
......
......@@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>963</width>
<height>621</height>
<width>960</width>
<height>616</height>
</rect>
</property>
<property name="windowTitle">
......@@ -486,10 +486,45 @@ Winkel pro click:</string>
</widget>
</item>
<item>
<widget class="QCheckBox" name="cb_serial">
<property name="text">
<string>Serial Communication</string>
<widget class="QGroupBox" name="groupBox_2">
<property name="minimumSize">
<size>
<width>0</width>
<height>60</height>
</size>
</property>
<property name="title">
<string>Communication</string>
</property>
<widget class="QWidget" name="horizontalLayoutWidget">
<property name="geometry">
<rect>
<x>10</x>
<y>20</y>
<width>431</width>
<height>41</height>
</rect>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_6">
<item>
<widget class="QRadioButton" name="rb_wifi">
<property name="text">
<string>WiFi</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="rb_serial">
<property name="text">
<string>Serial</string>
</property>
</widget>
</item>
</layout>
</widget>
</widget>
</item>
</layout>
......@@ -502,8 +537,8 @@ Winkel pro click:</string>
<rect>
<x>0</x>
<y>0</y>
<width>963</width>
<height>22</height>
<width>960</width>
<height>24</height>
</rect>
</property>
</widget>
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment