Changeset - 51e636c4e69b
[Not reviewed]
Hasan Yavuz Ă–ZDERYA - 10 years ago 2015-10-10 13:52:59
hy@ozderya.net
implemented sending hex command
1 file changed with 5 insertions and 1 deletions:
0 comments (0 inline, 0 general)
commandpanel.cpp
Show inline comments
 
@@ -11,24 +11,25 @@
 
  serialplot is distributed in the hope that it will be useful,
 
  but WITHOUT ANY WARRANTY; without even the implied warranty of
 
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
  GNU General Public License for more details.
 

	
 
  You should have received a copy of the GNU General Public License
 
  along with serialplot.  If not, see <http://www.gnu.org/licenses/>.
 
*/
 

	
 
#include "commandpanel.h"
 
#include "ui_commandpanel.h"
 

	
 
#include <QByteArray>
 
#include <QtDebug>
 

	
 
CommandPanel::CommandPanel(QSerialPort* port, QWidget *parent) :
 
    QWidget(parent),
 
    ui(new Ui::CommandPanel)
 
{
 
    serialPort = port;
 

	
 
    ui->setupUi(this);
 
    ui->scrollAreaWidgetContents->setLayout(new QVBoxLayout);
 

	
 
    connect(ui->pbNew, &QPushButton::clicked, this, &CommandPanel::newCommand);
 
@@ -55,15 +56,18 @@ void CommandPanel::sendCommand(QString c
 
    }
 

	
 
    if (ascii)
 
    {
 
        qDebug() << "Sending" << command;
 
        if (serialPort->write(command.toLatin1()) < 0)
 
        {
 
            qCritical() << "Send command failed!";
 
        }
 
    }
 
    else
 
    {
 
        qCritical("NYI");
 
        if (serialPort->write(QByteArray::fromHex(command.toLatin1())) < 0)
 
        {
 
            qCritical() << "Send command failed!";
 
        }
 
    }
 
}
0 comments (0 inline, 0 general)