N900 + Bluetooth



  • Hi all!
    How can i creating simple application on Maemo 5 with using Bluetooth? I want to create simple applications sending data to external device.
    Could anybody show me sample with comments of code ?



  • What you need, is the Connectivity API from Qt Mobility 1.2. The following link has any information needed on that and contains some examples as well:
    http://doc.qt.nokia.com/qtmobility-1.2/connectivity-api.html



  • Ok, I know that need Connectivity API from Ot Mobility, but I can't add to my project QBluetooth library. In my app I want used Accelerometer (works seamlessly) and Bluetooth to control other electronic devices (Remote contolled cars). What must i do to add QBluetooth library to project?

    Thanks for your help :)



  • Before you begin make sure you have installed the latest version of Qt and Qt Mobility because Bluetooth was added not much long ago. So to be sure, i would suggest to run an update from the Maintenance tool in the Qt Creator.

    Then regarding you project changes:
    First add to your .pro file the following declaration to make that module of Qt Mobility available:
    @
    CONFIG += mobility
    MOBILITY = connectivity
    symbian {
    TARGET.CAPABILITY = LocalServices UserEnvironment ReadUserData WriteUserData NetworkServices
    }
    @

    Then in whichever class you need to use QBluetooth, you will add in the header a declaration like the following, depending on which QBluetooth classes you want to use (the following code is taken by bluetooth tennis example)
    @
    #include <qbluetoothserviceinfo.h>
    #include <qbluetoothsocket.h>

    QTM_BEGIN_NAMESPACE
    class QL2capServer;
    class QBluetoothSocket;
    class QBluetoothServiceInfo;
    QTM_END_NAMESPACE

    QTM_USE_NAMESPACE
    @

    The examples in the link posted above has all the information you are going to need.



  • Hi

    I add to my .pro file following definition
    @CONFIG += mobility
    MOBILITY = connectivity
    symbian {
    TARGET.CAPABILITY = LocalServices UserEnvironment ReadUserData WriteUserData NetworkServices
    }@

    But still I have problem with add qbluetooth library to project. When use QT Simulator all is well. When use Maemo5 the compiler gives me error:

    "error:Qbluetoothserviceinfo: No such file or directory
    C:\Users\Bartek\Desktop\test2\test2\mainwindow.h"

    Must I add qbluetooth library and other BT library to my project folder?


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.