[Qt-interest] enter key event to serial communication

Yuvraj yuvraj.ragupathi at indieontech.com
Mon Feb 22 09:20:19 CET 2010


Arnold Krille wrote:
> On Monday 22 February 2010 07:39:22 Yuvraj wrote:
>   
>> Bradley T. Hughes wrote:
>>     
>>> On 02/19/2010 02:56 PM, Yuvraj wrote:
>>>       
>>>> Hi all
>>>>
>>>> How do i send a enter key event to serial communication devices?
>>>>         
>>> No offense, I don't see how this relates to Qt? Perhaps your question
>>> is best asked somewhere else (like a forum/mailing-list/news-group
>>> that specializes in serial communications?)
>>>       
>> No, my problem is sending enter key value(  QT  related). when i am
>> pressing the push-button i am doing below mentioned task..
>>
>> QString crlf;
>>     crlf = 0x0d;  // enter key value
>>     QString data1 = ui->send_text->text().append(crlf);
>>     com.writeData(data1.toLatin1(),100);
>>      ui->send_text->clear();
>>
>> but in receiver side it is waiting for enter key value ,once it get
>> enter key value , Then only it will do something
>>     
>
> Is "com" a QFile accessing the serial device? Then call "com.flush()" to make 
> sure the data is written...
> But why are you doing "com.writeData( ..., 100 )" ? Surely your string isn't 
> 100 chars long? Better do:
>
> QByteArray data1 = ui->send_text->text().toLatin1();
> data1.append(crlf);
> com.writeData(data1);
> com.flush();
> ui->send_text->clear();
>
> And maybe your crlf has the wrong value. Sometimes you can't even trust the 
> documentation, I have seen devices only working with lf or crlf when the docs 
> stated that it needs cr as line-end.
>
> Have fun,
>
> Arnold
>   
> ------------------------------------------------------------------------
>
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-interest
>   
Always i am getting some garbage value  at receiver side





Thanks

Yuvraj



More information about the Qt-interest-old mailing list