PDA

View Full Version : question about QSerialDevice (baudrate)



mastupristi
6th August 2009, 15:47
I'm tring to use QSerialDevice and I have a question (can you hear me kuzulis? ;) )
I work under linux and I tried in this way:

MyDevice = new TSerialDevice();
MyDevice->setDeviceName("/dev/ttyS0");
MyDevice->setBaudRate(19200);
MyDevice->open(QIODevice::ReadWrite | QIODevice::Unbuffered);

If I execute this code I can read in console:

TPosixSerialDevice::setBaudRate->Device is not open! Error!
Trying to open File
Opened File succesfully

so it seems wrond the order of calls, so I tried this:

MyDevice = new TSerialDevice();
MyDevice->setBaudRate(19200);
MyDevice->setDeviceName("/dev/ttyS0");
MyDevice->open(QIODevice::ReadWrite | QIODevice::Unbuffered);

No more error in console, but baudrate is set to default (9600) :(

So I tried to test baudrate of first piece of code, althought the error on setBaudRate() the baudrate is correctly set to 19200.

Is this a bug or I am wrong somewhere?

thanks

kuzulis
18th August 2009, 08:54
This is bug! :)

You must first open the device and then configure it!


that is not possible to set speed until the device is not really open!
It opens by default with the following parameters: 9600 8N1, and only then can set a new speed 19200


PS:
The library is still very crude, and it still might be bugs.
I am now completely transform it.