#include "mainwindow.h"
#include "inout.h"
#include "ui_mainwindow.h"
#include <stdio.h>
#include <stdlib.h>
#include <fcntl.h>
#include <QDataStream>
#include <QTextStream>
#include <QFile>
#include <Q_INT32>
#include <QMessageBox>
#include <QPlainTextEdit>

MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    ui->setupUi(this);
}

MainWindow::~MainWindow()
{
    delete ui;
}
void MainWindow::on_endbutton_clicked()
{
   close();
}
void MainWindow::on_sendbutton_clicked()
{
    //send(ui->nummer->text,ui->sms->text,ui->output->text);

    //ui->output->setText("auf gehts");
    QString cport;
    QString ccommand;
    QString creturn;
    int lnanzahl=1;

    cport = "/dev/ttyUSB0";
    ccommand = "AT+CSCS=\"GSM\"\r";
    ccommand = ui->sms->toPlainText();


    comm_send(cport,ccommand,creturn,lnanzahl);
    comm_read(cport,ccommand,creturn,lnanzahl);

    ui->nr->setText("Anz:"+QString::number(lnanzahl));
    ui->output->setPlainText(creturn);


    //QMessageBox msgBox;
    //msgBox.setText(creturn);

    //int ret;
    //ret = msgBox.exec();


}
