QT蓝牙PAN

时间:2015-03-23 14:47:01

标签: qt bluetooth

我正在尝试在QT中创建蓝牙PAN管理器应用程序。我尝试使用QBluetoothSocke t类连接到Android手机中的蓝牙NAP服务。

if (socket)
        return;

    // Connect to service
    QBluetoothUuid uuid( QBluetoothUuid::NAP);

    socket = new QBluetoothSocket(QBluetoothServiceInfo::RfcommProtocol);
    qDebug() << "Create socket"<<remoteDevice;


     socket->connectToService(remoteDevice,uuid);
     qDebug() << socket->peerAddress();
     if ( !socket->isOpen() )
      {
            qDebug() << "Error Unabel to open socket" ;

      }
     qDebug() << "ConnectToService done";
    connect(socket, SIGNAL(readyRead()), this, SLOT(readSocket()));
    connect(socket, SIGNAL(connected()), this, SLOT(connected()));
    connect(socket, SIGNAL(disconnected()), this, SIGNAL(disconnected()));
    connect(socket, SIGNAL(error(QBluetoothSocket::SocketError)), this, SLOT(connectionError()));

QBluetoothSocket的connected()信号已被激活,但我无法访问手机的互联网连接。请帮我弄清楚问题。我正在使用Ubuntu 14.10

0 个答案:

没有答案