0

「QextSerialPort」を使用して Huwawei USB ドングルを開こうとしています。

私のPORTの詳細は次のとおりです

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)

SMS を送信できるように、MY USB ドングルを開こうとしています。以下は、開くための私のコードです

#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;

}

このコードを実行すると、得られるのは

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

これはポート ID Open を示していますが、そのメッセージはどうでしょうか? それは、他のコードを進めることができないということですか? 他のことをコーディングする前に、これを知りたいです。

4

1 に答える 1

3

ほとんどの場合、 を作成する必要があります。作成しQApplicationないと、イベントやシグナル/スロットなどの多くのことが機能しません。

int main()
{
    QApplication app;

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

    system("pause");

    return app.exec();
}
于 2013-05-06T08:49:25.847 に答える