Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. Bluetooth ERROR W libQmlBLE_armeabi-v7a.so: qt.bluetooth.android: Connecting to port is not supported

Bluetooth ERROR W libQmlBLE_armeabi-v7a.so: qt.bluetooth.android: Connecting to port is not supported

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
1 Posts 1 Posters 230 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • E Offline
    E Offline
    ENSAO_CHEIKH
    wrote on last edited by
    #1

    Hi all,

    So I am trying to connect my phone Android with ESP32 arduino ,using this code below, bu I am getting error :W libQmlBLE_armeabi-v7a.so: qt.bluetooth.android: Connecting to port is not supported

    #include "bluetooth.h"
    
    #include <QDebug>
    
    Bluetooth::Bluetooth(QObject *parent) : QObject(parent)
    {
        connect(this,SIGNAL(pairedSignal(QBluetoothAddress)),this,SLOT(connectDevice(QBluetoothAddress)));
    
    
    }
    
    QBluetoothAddress Bluetooth::getMyAdress()
    {
        return deviceLocal->address();
        qDebug()<< "My adress is" << deviceLocal->address();
                
    }
    
    void Bluetooth::setOnBluetooth()
    {
        deviceLocal->powerOn();
        deviceLocal->setHostMode(QBluetoothLocalDevice::HostDiscoverable);
        qDebug()<< deviceLocal->name()<<"Blutooth is ON" ;
    
        qDebug()<<"I am in Mode" <<deviceLocal->hostMode();
        
    }
    
    void Bluetooth::discoveredDevices()
    {
        QBluetoothDeviceDiscoveryAgent *discoveryAgent = new QBluetoothDeviceDiscoveryAgent(this);
    
        connect(discoveryAgent, SIGNAL(deviceDiscovered(QBluetoothDeviceInfo)),
                    this, SLOT(deviceDiscovered(QBluetoothDeviceInfo)));
    
    
            discoveryAgent->start();
            qDebug()<< "Starting searchin";
    
    }
    
    void Bluetooth::connectDevicer(const QBluetoothAddress &address)
    {
        //QBluetoothSocket *connectToDevice= new QBluetoothSocket(QBluetoothServiceInfo::RfcommProtocol);
        deviceLocal->requestPairing(address, QBluetoothLocalDevice::Paired);
        qDebug()<<"ConnectingDevice"<< connect(socket, SIGNAL(connected()), this, SLOT(socketConnected()));;
        connect(socket, SIGNAL(connected()), this, SLOT(socketConnected()));
        connect(socket, SIGNAL(readyRead()), this, SLOT(dataReady2Read()));
        qDebug()<< "Socket connection";
        socket->connectToService(addressPaired, QIODevice::ReadWrite);
        socket->open(QIODevice::ReadWrite);
        qDebug()<< "Socket connection"<< socket->isOpen();
    
    
    
    }
    
    void Bluetooth::socketConnected()
    {
        qDebug()<< "SocketConnected";
        QString Connection= "I am connected to:"+socket->peerAddress().toString()+":"+socket->peerPort();
    
        socket->write("OFF\n");
    }
    
    void Bluetooth::dataReady2Read()
    {
            QByteArray data;
            data = socket->readAll();
            qDebug()<< data;
    }
    
    
    void Bluetooth::onLed()
    {
    
    
        if (!socket->isOpen() || !socket->isWritable())return;
    
    
         socket->write("ON\n");
    
    
    
    }
    
    void Bluetooth::offLed()
    {
        if (!socket->isOpen() || !socket->isWritable())return;
    
    
         socket->write("OFF\n");
    
    }
    
    void Bluetooth::deviceDiscovered(const QBluetoothDeviceInfo &device)
    {
        qDebug() << "Found new device:" << device.name() << '(' << device.address().toString() << ')';
        addressPaired=device.address();
        connectDevicer(device.address());
    
    }
    
    
    1 Reply Last reply
    0

    • Login

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved