Connect Doubts...
-
Hello everyone, me again asking something!
Well, first for all I like to thanks all friends that answer me here, thanks a lot.Well now I have another question, about connect function!
My software is connection on serial port, and I send some bytes to them... The external hardware connected to the serial port answer something for me.
I make this code to treat with the answer:@
Protocolo* prot = ProtocoloFactory::createProtocoloGetDate();
port = new QextSerialPort();
port->connect( port, SIGNAL(readyRead()), this, SLOT(readData()));
port->setPortName( dialogPortaSerial.getDeviceSelected() );
port->open(QIODevice::ReadWrite);
if (port->isOpen())
{
port->write( prot->toSerialPort() );
}
@When the buffer for serial port has something, I read the data... That's fine for me... but I want to have only one "port" to all application context, and on every "ProtocoloFactory::createProtocolo", I want to change the connect to the correct function... something like this:
@
Protocolo* prot = ProtocoloFactory::createProtocoloGetDate();
port = new QextSerialPort();
port->connect( port, SIGNAL(readyRead()), this, SLOT(readGetDate()));
port->setPortName( dialogPortaSerial.getDeviceSelected() );
port->open(QIODevice::ReadWrite);
if (port->isOpen())
{
port->write( prot->toSerialPort() );
}
Protocolo* protHour = ProtocoloFactory::createProtocoloGetHour();
port->connect( port, SIGNAL(readyRead()), this, SLOT(readGetHour()));
if (port->isOpen())
{
port->write( protHour->toSerialPort() );
}
@- It's just a example, it's the the correct code.
If I make two "connect" on the object port, the system will call the two methods (readGetDate() and readGetHour()) ¿???
Or not the code will "override" the first mehod, override the method readGetDate()?????Thanks all.
-
I test here, and both as called... How can I remove a connect?
-
I found the method disconnect, but I need to do a dynamic disconnection...
something like say "disconnect all"... -
There are several versions of disconnect, which take different sets of arguments. Did you read the docs on all of them?