Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. Problem with QBluetooth library ( Symbian Belle - Nokia 500)
Qt 6.11 is out! See what's new in the release blog

Problem with QBluetooth library ( Symbian Belle - Nokia 500)

Scheduled Pinned Locked Moved Mobile and Embedded
3 Posts 2 Posters 2.8k Views 1 Watching
  • 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.
  • D Offline
    D Offline
    duniu_bartek
    wrote on last edited by
    #1

    Hello

    I have a problem with QBluetooth library. My code is based on simple example from this "side":http://qt-project.org/doc/qt-5.0/qtbluetooth-overview.html

    @ QBluetoothLocalDevice LocalDevice;
    QString LocalDeviceName;

    if(LocalDevice.isValid()){
        LocalDevice.powerOn();
        LocalDeviceName=LocalDevice.name();
        LocalDevice.setHostMode(QBluetoothLocalDevice::HostDiscoverable);
    }
    
    QBluetoothDeviceDiscoveryAgent *DiscoveryAgent = new QBluetoothDeviceDiscoveryAgent(this);
    connect(DiscoveryAgent,SIGNAL(deviceDiscovered(const QBluetoothDeviceInfo&)),this,SLOT(deviceDiscovered(const QBluetoothDeviceInfo&)));
    
    DiscoveryAgent->start();@
    

    When I use start() method of that class with Bluetooth powered off, the debug console prints this:

    bq. [Qt Message] void QtMobility::BluetoothLinkManagerDeviceDiscoverer::setError(int) errorCode= -44
    Wątek zakończony błędem: Thread 0x587 has panicked. Category: KERN-EXEC; Reason: 0
    Wątek zakończony błędem: Thread 0x588 has panicked. Category: KERN-EXEC; Reason: 0
    Proces zakończył się.

    If manually turn on Bluetooth, compiler display this error:

    bq. [Qt Message] void QtMobility::BluetoothLinkManagerDeviceDiscoverer::setError(int) errorCode= -46
    Wątek zakończony błędem: Thread 0x552 has panicked. Category: KERN-EXEC; Reason: 0
    Wątek zakończony błędem: Thread 0x553 has panicked. Category: KERN-EXEC; Reason: 0
    Proces zakończył się.

    Does anyone know what is wrong? Thanks for your help

    1 Reply Last reply
    0
    • A Offline
      A Offline
      amccarthy
      wrote on last edited by
      #2

      The first error (-44) indicates that the hardware is not available, it is off. The second error (-46) indicates that you do not have the necessary permissions. You will need to add LocalServices to the TARGET.CAPABILITY variable in your .pro file. As an example the Qt Bluetooth examples declare the following capabilities:
      @
      symbian {
      TARGET.CAPABILITY = LocalServices UserEnvironment ReadUserData WriteUserData NetworkServices NetworkControl ReadDeviceData WriteDeviceData SwEvent
      }@

      1 Reply Last reply
      0
      • D Offline
        D Offline
        duniu_bartek
        wrote on last edited by
        #3

        Thank You :) now works, but appeared next problem :/ I am trying to establish connection between Phone and BTM222 Module ( BTM222 is it a simple bluetooth adapter with serial port interface ). DeviceDiscoveryAgent had found BTM222

        @ QBluetoothDeviceDiscoveryAgent *DiscoveryAgent = new QBluetoothDeviceDiscoveryAgent(this);
        connect(DiscoveryAgent,SIGNAL(deviceDiscovered(const QBluetoothDeviceInfo&)),this,SLOT(deviceDiscovered(const QBluetoothDeviceInfo&)));

        DiscoveryAgent->start();@
        

        bq. [Qt Message] Found new device "SERIAL ADAPTOR" ( "00:12:6F:23:8B:C2" )

        but ServiceDiscoveryAgent hadn't found any services. When I turn on Bluetooth in other phone ( Nokia N900 ) ServiceDiscoveryAgent found services. How can I connect to the BTM222 ( or other device) when I do not know his service

        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