void MainWindow::on_pushButton_clicked()
{
const char enable[12]={0xEF,0X01,0XFF,0XFF,0XFF,0XFF,0X01,0X00,0X03,0X01,0X00,0X05};
textEdit->setText(data);
qDebug()<<"\n enabletext123:"<<textEdit->toPlainText();
writeData(data);
}
void MainWindow::on_pushIdentity_clicked()
{
const char identify[17]={0xef,0x01,0xff,0xff,0xff,0xff,0x01,0x00,0x08,0x1b,0x01,0x00,0x00,0x01,0x01,0x00,0x27};
// port->write(data);
textEdit->setText(data1);
qDebug()<<"\n identytext1234:"<<textEdit->toPlainText();
writeData(data1);
}
void MainWindow
::writeData(const QByteArray &data
) {
qDebug()<< port->write(data);
qDebug()<<"write data:"<<data;
for(int i=0;i<=5000;i++);
}
void MainWindow::readData()
{
port->flush();
int count=response.size();
qDebug()<<"\n no. of bytes read"<<response.count();
textEdit->append(response)
qDebug()<<"read data:"<<response;
}
void MainWindow::on_pushButton_clicked()
{
const char enable[12]={0xEF,0X01,0XFF,0XFF,0XFF,0XFF,0X01,0X00,0X03,0X01,0X00,0X05};
QByteArray data = QByteArray::fromRawData(enable, sizeof(enable));
textEdit->setText(data);
qDebug()<<"\n enabletext123:"<<textEdit->toPlainText();
writeData(data);
}
void MainWindow::on_pushIdentity_clicked()
{
const char identify[17]={0xef,0x01,0xff,0xff,0xff,0xff,0x01,0x00,0x08,0x1b,0x01,0x00,0x00,0x01,0x01,0x00,0x27};
QByteArray data1 = QByteArray::fromRawData(identify, sizeof(identify));
// port->write(data);
textEdit->setText(data1);
qDebug()<<"\n identytext1234:"<<textEdit->toPlainText();
writeData(data1);
}
void MainWindow::writeData(const QByteArray &data)
{
qDebug()<< port->write(data);
qDebug()<<"write data:"<<data;
for(int i=0;i<=5000;i++);
}
void MainWindow::readData()
{
port->flush();
QByteArray response=port->readAll();
int count=response.size();
qDebug()<<"\n no. of bytes read"<<response.count();
textEdit->append(response)
qDebug()<<"read data:"<<response;
}
To copy to clipboard, switch view to plain text mode
Bookmarks