Serial port connection and qt



  • hi, i can't find example how to send datas over SPP:/

    now i have write simple console app:

    @#include <QtCore/QCoreApplication>
    #include <QtMobility/qmobilityglobal.h>
    #include <qbluetoothsocket.h>
    #include <QDebug>

    QTM_USE_NAMESPACE

    int main(int argc, char *argv[])
    {

    QCoreApplication a(argc, argv);
    
    
    QBluetoothSocket socket(QBluetoothSocket::RfcommSocket) ;
    socket.connectToService(QBluetoothAddress("00:12:6F:XX:XX:XX"),1);
    
    qDebug()<<socket.peerName() ;
    return a.exec&#40;&#41;;
    

    }@

    and this code connect me with my bluetooth module, but how to send datas? I have tried "socket.write(const char * data, qint64 maxSize) but it is not working:/



  • The "Bluetooth Chat Example":http://doc.qt.nokia.com/qtmobility/btchat.html is en example on how to use the SPP since you send data to others through serial port.

    It is quite well written but if you still have any question just ask.



  • thx for reply. I started with Bluetooth Chat Example and btscanner:)..I implemented a simple code on my AVR which works as follows: I send "char" and microcontroller return "[char]" and my code works-I have checked it with minicom.

    ....and 3 minutes ago I have changed btchatexample and it works! I don't know why I had prooblem with that:) please follow these topic, because I think I will have some problem in near future:)...oh, i see one: some chars are not returned in longer words:/..but I thing I will deal with that.



  • Hello, could you please share me your code.
    I have been playing around with QT quick components bluetooth that is very simple. I allthough seems that i can send a long string from N9 to PC terminal, from BluetoothModule (controlled by dsPic) to PC terminal, from Terminal to Bluetooth module BUT NOT FROM N9 to Bluetooth module. I haven't tried sending data from BT module to N9 since i do not need that for now. I read somewhere that the QT quick => QTconnectivity bluetooth component uses some data type that can be handled by most devices, but maybe there is something that either my dsPIC wont understand => Or the BT module that uses RN-41 chip.

    I have a working example for E72 (symbian 3rd) that works with the BT module but that code does not use any ready components (QT quick, connectivity etc...)

    If you are willing to share your code i would appreciate it. I tried once the BT chat example but it didn't work...
    either to peter@lydman.fi or in this forum...



  • Hello All,
    I am working on the same part of Qt if some has done pls do help I will be thankful.
    My Email: praveen0991kr@gmail.com

    praveen



  • Hi!
    I'm working on a project that need to capture data from a Bluethoot digital scale, which in theory send me the SPP protocol. Take the example of btchat, but do not understand how do you hear any connection. I tried with other applications bluetooth serial terminal type and receive data, but not how to implement it here. Thank you


Log in to reply
 

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