March 9, 2012

ksiedzulek ksiedzulek
Lab Rat
17 posts

serial port connection and qt

 

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

now i have write simple console app:

  1. #include <QtCore/QCoreApplication>
  2. #include <QtMobility/qmobilityglobal.h>
  3. #include <qbluetoothsocket.h>
  4. #include <QDebug>
  5.  
  6. QTM_USE_NAMESPACE
  7.  
  8.  
  9.  
  10. int main(int argc, char *argv[])
  11. {
  12.  
  13.     QCoreApplication a(argc, argv);
  14.  
  15.  
  16.     QBluetoothSocket socket(QBluetoothSocket::RfcommSocket) ;
  17.     socket.connectToService(QBluetoothAddress("00:12:6F:XX:XX:XX"),1);
  18.  
  19.     qDebug()<<socket.peerName() ;
  20.     return a.exec();
  21. }

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:/

3 replies

March 9, 2012

favoritas37 favoritas37
Ant Farmer
147 posts

The Bluetooth Chat Example [doc.qt.nokia.com] 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.

March 9, 2012

ksiedzulek ksiedzulek
Lab Rat
17 posts

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.

June 14, 2012

-pZq- -pZq-
Lab Rat
19 posts

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…

 Signature 

Br.
pZq

 
  ‹‹ NetworkInfo for all modes possible?      [SOLVED] Qt Mobility / Service framework / Insufficient credentials to load a service instance / InvalidServiceLocation ››

You must log in to post a reply. Not a member yet? Register here!