PDA

View Full Version : QextSerialPort and modem



kaszewczyk
4th November 2009, 18:55
Hello, i have problem with opening port with modem on it, i connect phone with my notebook by bluetooth. Im using QextSerialPort to communicate with COM port, my application is working with normal RS232 cable but when on COM is modem the port dont want to open, anny suggestions how to deal with it?

this is how i make QextSerialPort object

this->port = new QextSerialPort(this->portInformations->portName);
this is how i open the port

this->port->open(QIODevice::ReadWrite);

Best Regards
kaszewczyk

squidge
4th November 2009, 21:33
and what is this->portInformations->portName value?

kaszewczyk
4th November 2009, 22:08
This is class where i hold all the port informations as a number of data bits, stop bits etc

squidge
4th November 2009, 22:32
portName is a class?

kaszewczyk
5th November 2009, 06:50
Sorry mate i get it wrong it was late when i read your post, the portName is QString with port name chosen by user. The portInformations is object of class where i hold all port informations it has only public members. Sorry agin for my mistake.

Best Regards
kaszewczyk

Goldmmbr
5th November 2009, 15:23
what is the exact value of portName used when calling:


this->port = new QextSerialPort(this->portInformations->portName);


are you sure that port exists on your system? and/or it is enabled in bios?

kaszewczyk
5th November 2009, 19:08
Yes, i am sure because i can use system Hyperterminal with that port :)

Lesiok
6th November 2009, 09:20
Please show us what is in this->portInformations->portName.
For higher number of COM ports You must specify port name as "\\.\COMnn". I don't remember what is boundary value. Of course You can use this long name of COM port with all numbers.

kaszewczyk
6th November 2009, 11:25
This PortInformations look like this:


class PortInformations{
public:
QString portName;
QString nrOfDataBits:
//etc...
}

This could be a problem because the modem is on COM40 but i dont know how to add "\\.\" to QString cus i cand doing by operator + ?

squidge
6th November 2009, 12:45
portName.prepend("\\\\.\\") ?

Lesiok
6th November 2009, 18:25
This PortInformations look like this:


class PortInformations{
public:
QString portName;
QString nrOfDataBits:
//etc...
}

This could be a problem because the modem is on COM40 but i dont know how to add "\\.\" to QString cus i cand doing by operator + ?


QString CreatePortName( int portNumber )
{
return QString("\\\\.\\%1").arg(portNumber);
}

kaszewczyk
7th November 2009, 11:19
Thanks it work :)

Best Regards
kaszewczyk

squidge
7th November 2009, 17:05
It would have been solved much earlier too if you had given us the information :)

I gave up asking, two more people asked the same question and yet you still held out.

Maybe next time?