Active Topics

 


Reply
Thread Tools
pillar's Avatar
Posts: 154 | Thanked: 124 times | Joined on Mar 2007
#11
Yes, very much interested in this as well, any updates on progress?
 
Posts: 227 | Thanked: 51 times | Joined on Feb 2006
#12
I am no expert but there doesn't seem to be any experts helping out. So I may have this all wrong but here is what I have figured out so far:

1. QT has a module in progress for bluetooth connections but it is not complete and is not part of the stuff that is supposed to be delivered by years end.
http://qt.nokia.com/developer/qt-roa...nnectivity-api

2. You can establish an RFComm channel and connection through DBUS interactions But I have not been able to locate any C++ examples that make sense to me.

The way I am solving the problem for my own personal use is to use the Queen Beecon widget to create a desktop shortcut for the command line "rfcomm bind" command. It is not a good solution to deploy to other people but if you have one or two devices you want to play with like me, it will let you develop the rest of your application while you wait for other solutions.
__________________
David Smoot
 
Posts: 61 | Thanked: 36 times | Joined on Feb 2006 @ Harpenden
#13
I've done this in Python, but I'm now trying to port over to C++ and I'm stumped
 
pillar's Avatar
Posts: 154 | Thanked: 124 times | Joined on Mar 2007
#14
QtMobility 1.2 will include this and there seems to be a tech preview out, but I don't know of maemo5 has the backend for it..
 
Posts: 724 | Thanked: 1,255 times | Joined on Nov 2007 @ Cambridge, UK
#15
The Bluetooth stuff that is being developed for Qt Mobilitys' Connectivity module does have Maemo5/Linux support. I actually had to implement my own version for an app I'm working on. You should be able to just use their sources though. I'll probably try and compile it myself, as now I'm planning to release my app open I can use their code.
 
Posts: 227 | Thanked: 51 times | Joined on Feb 2006
#16
Thanks for all the help, still working on this. Some progress, some problems.

I went to the QT git site and cloned the latest to my hard drive. Did ./configure, make, sudo make install. Everything worked after I grabbed the alsa dev library.

I went into the examples folder and found a service discovery example for bluetooth. It built just fine on my linux desktop version of QT creator and it displayed the bluetooth mac and names of all the bluetooth devices nearby. That was a big step forward.

But it does not build when I select the maemo target, obviously because I only built the examples for my desktop. So the next question is this:

Can I somehow "cross compile" the git snapshot I downloaded for Maemo using my desktop or do I have to have the full scratchbox environment installed to build the qt mobility snapshot?

Thanks,
David
__________________
David Smoot
 
Posts: 61 | Thanked: 36 times | Joined on Feb 2006 @ Harpenden
#17
OK, here is some code I just got running on my N900. It connected a to a bluetooth rs232 adapter, created a device /dev/rfcomm0 and then disconnected it. Hope it is of some help.

Code:
    QString address = "00:12:6F:03:BC:63";
    QString service = "spp";

    QDBusConnection bus = QDBusConnection::systemBus();
    QDBusInterface manager_iface("org.bluez", "/","org.bluez.Manager", bus);

    QDBusReply<QDBusObjectPath > devices = manager_iface.call("DefaultAdapter");

    if (devices.isValid())
    {
        QDBusObjectPath defaultAdapter = devices.value();
        QString defaultAdapterPath = defaultAdapter.path();
        qDebug() << defaultAdapterPath;

        QDBusInterface adapter_iface("org.bluez",defaultAdapterPath,"org.bluez.Adapter",bus);
        QDBusReply<QDBusObjectPath> path = adapter_iface.call("FindDevice",address);

        if(path.isValid())
        {
            QDBusInterface serial_iface("org.bluez",defaultAdapterPath,"org.bluez.Serial",bus);

            QDBusMessage node = serial_iface.call("Connect",service);
            qDebug() << node;
            QVariant dev = node.arguments().at(0);
            qDebug() << dev;
            QDBusMessage result = serial_iface.call("Disconnect",dev);
            qDebug() << result;
        }
        else
        {
            qDebug() << path.error();
        }
    }
    else
    {
        qDebug() << devices.error();
    }
 

The Following 2 Users Say Thank You to scudderfish For This Useful Post:
Posts: 61 | Thanked: 36 times | Joined on Feb 2006 @ Harpenden
#18
I've generated some classes (mainly lifted from the bluez dbus qt example) and commited them here

https://garage.maemo.org/plugins/scm...ot=maegasquirt

Pretty much the same code as before now looks like
Code:
    org::bluez::Manager manager(BLUEZ_SERVICE_NAME,
                                BLUEZ_MANAGER_PATH, QDBusConnection::systemBus());


    QDBusPendingReply<QDBusObjectPath> dpath = manager.DefaultAdapter();
    dpath.waitForFinished();
    if (!dpath.isValid())
    {
        qCritical() << "Unable to find default Bluetooth adapter";
        return -1;
    }

    QDBusObjectPath adapterPath = dpath.value();

    org::bluez::Adapter adapter(BLUEZ_SERVICE_NAME,
                                adapterPath.path(), QDBusConnection::systemBus());
    if (!adapter.isValid())
    {
        qCritical() << "Can't get valid adapter object reference!";
        return -1;
    }

    QDBusPendingReply<QDBusObjectPath> device = adapter.FindDevice("00:12:6F:03:BC:63");

    device.waitForFinished();
    if (device.isValid())
    {
        QDBusPendingReply<> reply = adapter.RemoveDevice(device.value());
        reply.waitForFinished();
    }
 
Posts: 20 | Thanked: 18 times | Joined on Sep 2009 @ Valencia (Spain)
#19
May be the solution could be easier.

Taking into account that you want to use a SPP-profile (a virtual serial port), you could consider to read/write this port directly.

I use QextSerialPort library ( http://code.google.com/p/qextserialport/ ) on Linux an Windows boxes, including Bluettoth SPP for GPSs.

I haven't yet tried to compile it on Maemo, but considering that it is Linux, I think it will work.

If other guys consider that this approach could work, I can try it. (No much time now, I'm fighting against telephony extesions for Symbian ).

Regards,
Àngel
 
Posts: 724 | Thanked: 1,255 times | Joined on Nov 2007 @ Cambridge, UK
#20
I've already got an app that does this, if you can wait I plan on releasing it next week.
 
Reply


 
Forum Jump


All times are GMT. The time now is 17:27.