Qt World Summit: Register Today!

How to open /dev/rfcomm0

  • Hi
    I want to get my location from a gps Bluetooth device . First i create a connexion with the device using Bluetooth manager which create a /dev/rfcomm0 then i tested this ode but it didn't seems to open the device :
    #include <QtCore/QCoreApplication>
    #include <QFile>
    #include <QDebug>

    int main(int argc, char *argv[])
    QCoreApplication a(argc, argv);
    QFile file("/dev/rfcomm0");
    if (file.open(QFile::ReadOnly)) {
    qDebug() << "yatta";
    else qDebug() << ":(";

    return a.exec&#40;&#41;;

    this is the output i get :
    @Starting /home/morpheus/Qtproject/gps-build-desktop/gps...
    :( @
    I m planning on using the QNmeaPositionInfoSource class to get all necessary infos .

    Thanks in advance .

  • I have no idea on how to use the proposed API but as for the QFile problem, the first thing to do is check that your user has sufficient permissions to open /dev/rfcomm0.

  • And if the user doesn't have permission is it possible to give him permission to open file using Qt?

  • I've once tried to feed the raw NMEA data of my BT GPS through QNmeaPositionInfoSource without much success. I recently wrote gpsdpositioninfosource as part of cacheme which you'll find "here":https://api.pub.meego.com/public/source/home:harbaum/cacheme/cacheme_0.7.1.tar.gz?rev=f6f5ba90aa3bf9e217cadc7d212e0291&

    This connects to gpsd which in turn can access your bluetooth gps via /dev/rfcomm

  • That's great , i m actually working on meego using BT GPS device , i hope it will help me :)

Log in to reply