PDA

View Full Version : setting port in qexserialport



Myx
27th May 2009, 09:45
Hey everybody,

just got a question if anyone noticed similar problem to mine...

im using qt 4.5 with qexserialport 1.2 alpha

got a device connected to USB Serial Port (FTDI)

I noticed that it actually cant open (or set) the port correctly... like something in windows functions

the application works ok only if i open the chosen port with other program (like putty,realterm etc.) close it and then open it with my application and communication works perfectly... but if i remove a cable and plug it again than windows closes and openes virtual port again and qextserialport cant set it parameters correctly

some examples witch are in the library work the same way

here is my port settings


port = new QextSerialPort(COM, QextSerialPort::EventDriven);
port->setBaudRate(BAUD57600);
port->setFlowControl(FLOW_OFF);
port->setParity(PAR_NONE);
port->setDataBits(DATA_8);
port->setStopBits(STOP_1);
port->setTimeout(500);
port->open(QIODevice::ReadWrite | QIODevice::Unbuffered);


read function


//receive data from RS485 ... 422
char data[1024];
//int numBytes;
//int bytesRead;
QStringList msg_list;
float var;
port->readLine(data, sizeof(data));


before i had implementation of read() but it was the same


write function


if (port->isOpen()){
port->write(message.toAscii(),
message.length());
}


just wanted to add that read and write are in other thread

Myx
27th May 2009, 15:13
ok problem is solved... u just had to load port setting after calling QIODevice::open

easy correction directly in library

dc.castonguay
15th April 2011, 16:49
Hi Myx,

Is it possible for you to show me how you fixed that problem in the library please?

Thank you!