Question

I am trying to open my Huwawei USB dongle using "QextSerialPort".

My PORT details are as follows

Port Name:
Product ID:
Physical Name: \Device\000000ca
Vendor Id:
Friend Name:  SB

Port Name:
Product ID:?
Physical Name: \Device\USBPDO-10
Vendor Id: ?
Friend Name:  TH

Port Name: COM3
Product ID:
Physical Name: \Device\BthModem0
Vendor Id:
Friend Name: Standard Serial over Bluetooth link (COM3)

Port Name: COM4
Product ID:
Physical Name: \Device\BthModem2
Vendor Id:
Friend Name: Standard Serial over Bluetooth link (COM4)

Port Name: COM5
Product ID:
Physical Name: \Device\BthModem1
Vendor Id:
Friend Name: Standard Modem over Bluetooth link

Port Name: COM6
Product ID:?
Physical Name: \Device\000000e2
Vendor Id: ?
Friend Name: HUAWEI Mobile Connect - 3G Application Interface (COM6)

Port Name: COM7
Product ID:?
Physical Name: \Device\000000e0
Vendor Id: ?
Friend Name: HUAWEI Mobile Connect - 3G Modem

Port Name: COM8
Product ID:?
Physical Name: \Device\000000e3
Vendor Id: ?
Friend Name: HUAWEI Mobile Connect - 3G PC UI Interface (COM8)

I trying to open MY USB dongle, so I can send SMS. Following is my code for opening

#include "MyClass.h"
#include <qstring.h>
#include <qdebug.h>


int main()
{
    QextSerialPort *port = new QextSerialPort("COM7");
    port->open(QIODevice::ReadWrite);
    cout << port->isOpen();

    system("pause");
    return 0;

}

When I run this code, what I get is

QWinEventNotifier: Can only be used with threads started with QThread 
1

This shows the port id Open, but what about that message? Does that means I can't proceed with other code? I want to know this before I code anything else.

Was it helpful?

Solution

Most likely, you need to create a QApplication, without it many things like events and signals/slots won't work:

int main()
{
    QApplication app;

    QextSerialPort *port = new QextSerialPort("COM7");
    port->open(QIODevice::ReadWrite);
    cout << port->isOpen();

    system("pause");

    return app.exec();
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top