[Qt-interest] serial communication

Jason H scorp1us at yahoo.com
Tue Mar 30 17:49:46 CEST 2010


QxtSerialPort?






________________________________
From: Yuvraj <yuvraj.ragupathi at indieontech.com>
To: Thiago Macieira <thiago at kde.org>
Cc: qt-interest at trolltech.com
Sent: Tue, March 30, 2010 2:51:18 AM
Subject: [Qt-interest] serial communication

  Hi ,

Here i am opening the serial communication device file and writing some
data, in other hand i am not getting the data due to enter key( "/r/n")

my code is 
 
 file_descriptor = open("/dev/ttyS0",O_RDWR);
    if(file_descriptor > 0)
    {
         timer = new QTimer;
        timer1 =new QTimer;
       
QObject::connect(timer,SIGNAL(timeout()),this,SLOT(browser_append()));
       
QObject::connect(timer1,SIGNAL(timeout()),this,SLOT(on_send_clicked()));
        timer->start(1);
        timer1->start(10);
    }
    else
    {
        QMessageBox::information(0,"","Connection failed");
    }


void  window::on_send_clicked()
{
     int file_id;
   char send_data[150]= "Hi Hello\r\n";
    if(file_descriptor > 0)
    {
       file_id= write(file_descriptor,send_data,15);
       ui->send_text->clear();
       ui->send_text->setFocus();
       if(file_id > 0)
       {
           qDebug()<<"Data successfully written \n";
       }
       

    }
   
}

any  ideas?

Thanks

Yuvaraj R


      
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20100330/3606ccf8/attachment.html 


More information about the Qt-interest-old mailing list