Bluetooth serial port communication between e72 and a bluetooth module



  • Hi,

    i have a bluetooth stick module bought from mikroE.com. The stick claims to talk HCI or SPP.

    i'm very new to this qt development and i would want to get some help with this.

    First:
    Is there a simple way ?
    Does someone have a ready example ?
    Can i do this with Qbluetooth library only ?

    The only thing i need for now is an application that for e.g. sends a "hello uController" when a button is pressed on e72 mobile phone and then my module responds with "hello mobile phone"

    If i get this working. I can continue without help for quite long, i think :D

    So please share your knowledge if you got some.

    Br.
    pZq



  • I have now a working link between pc and dspic (microcontroller) via Bluetooth.
    I'm capturing the data sent from the dspic with hyperterminal and it really works.

    Download hyperterminal for win7&Vista from:
    "Hyperterminal":http://blog.nerdstogeeks.com/2009/06/hyper-terminal-for-vista-and-windows-7.html

    Still i need the help with the s60 5th edition coding through qt creator or what ever to create the E72 Software.



  • First of all, E72 has S60 3rd FP2.

    Now, since QBluetooth exists in Qt Mobility 1.2, this means (from what i know) that you can't use it on your platform because it is not supported.

    What i can suggest is to use "QBluetoothZero":https://projects.forum.nokia.com/qbluetooth . It needs Qt 4.6.3 and newer and works on your platform. For more details please advise the project's wiki page. A project using it can be found in this wiki page: "QuteMessenger bluetooth chat":http://www.developer.nokia.com/Community/Wiki/QuteMessenger_-_Bluetooth_Chat. It uses SPP to exchange chat messages. Respectively, you will be able to send any data you want.



  • Hi,

    and thank you for your reply.

    The QBluetoothZero was compiled yesterday but i have no clue why the libraries shall be compiled... It seemed just that the compilation moved some files into QT SDK folder.

    I guess i have to find somewhere that S60 3rd edition FP2, since my QT creator came only with 5th edition and compile that QBluetoothZero to that environment ?

    Br
    -pZq-



  • No no the QBluetoothZero is not mandatory to be compiled. In the home screen of the project's page you can download the binaries for Symbian. Then you can use the binaries directly by following the following wiki article: https://projects.developer.nokia.com/qbluetooth/wiki/binaries#Howtouse

    Also, the QuteMessenger example that i mentioned uses those binaries as well.

    So no you don't have to compile it, you are advised to use the binaries.

    To your second question, yes you will compile your program for Symbian 5th but with Qt 4.6.3. The version of Qt is mandatory because Qt 4.7.3 can't be installed on S60 3rd! If you don't have Qt 4.6.3 installed then got the the Qt Maintenance tool (Qt Creator -> Help -> Start Updater -> Package Manager -> Development Tools -> Symbian Toolchains -> S60 5th ed. -> Qt 4.6.3 for Symbian).

    :)



  • Thank you very much for the post.
    I will read that howto.

    I will return latest when my intentional program is working to post how it was made but most likely i will return quite soon when i'm jammed with something.



  • You are always welcomed.



  • I'm back and stuck.

    I cant select symbia 4.6.3 from dropdownlist of the compiler. Only 4.7.4 synbian anna is selectable (debug/release)

    I have installed the 4.6.3 symbian compiler but i can't select it ?



  • To fast to write the last post. I found it. Let's continue.
    It could be found in the projects sheet on the left hand side. => edit build configuration => add



  • oh c.r.ap!
    -there is problems with device debugger. CODA won't work and the only way this document says is to install QT sdk 1.1.2 , then i can use TRK debugger.
    I must try this tomorrow.

    Even though, I can BUILD the qutemessenger withouth errors or warings, but how am i able to move the built application into my phone for testing purposes ?



  • Till you make TRK work you can do the installation manually. First you need to generate the QuteMessenger.sis installation file. That will be created if you press Run to your project regardless if CODA/TRK/etc works. That willl generate the installation file

    Then there are several ways to do the manual installation.

    1. Connect the mobile to your pc. Using Nokia Suite double click the QuteMessenger and it will initiate the installation.

    2. Move the QuteMessenger.sis to your mobile either by connecting it by cable or by Bluetooth. Locate the file and initiate the installation through your mobile.



  • ok, thanks.

    There is still a problem. I can't find the QT sdk 1.1.2 installation file. The document states that i cannot update my current 1.1.4 to 1.1.2, or i can but the TRK wont then work. So i need a clean QT SDK installed.

    Didn't find it yesterday after 30min sailing on google. Maybe it can be installed in the QT creator installation custom installation mode ?



  • This is so hebrean (the coding of symbian apps)...

    If i just could turn the qutemessenger to bind connection between PC and phone and then the text that is wirtten in inputbox would be sent to PC. Then i would party party!

    i'll just have to bang my head against the table :P



  • All you have to do to achieve that is just to change the selected Serial Port Protocol (SPP) to the one used by your PC and you will be ready. Normally there are not that many SPP, actually most of the times only one so the first SPP that you discover through Service Discovery on the PC will propably work fine.



  • The problem is that even if i connect this quteapplication to the discovered bt-module or the pc, the q
    utemessenger will not change into the chat mode. Maybe the qutemessenger waits for a confirmation from the server side before it switches to the chat mode.?

    I can sometimes see the start chat option but when pressed, qutemessenger does nothing.



  • I found one interresting thing in the code => service name that i had not set on the bluetooth module.
    I set the servicename to SPP and changed the expectedservicename as SPP in qutemessenger code.

    I'll have to test this tomorrow.
    I somehow assume that this Qutemessenger can not be paired with pc because in pc we also would need to set the servicename, and i have no clue how to set the service name on pc without a PC application...

    I'll pass the result of how the matched servicenames worked, or if it didnt work.



  • The comparing between the service names was just to separate the multiple Serial Port Protocols and select the custom one we have created. Connecting to the PC of course is possible. As i said in a previous post of mine, to connect to the PC by Serial Port Profile you can as well ignore the comparing of the service names. Initiate a Service Discovery to the PC and the first SPP service that you will find, connect to it. That's all, no naming comparing or anything else.



  • Ok, i have still a little hard to find where the comparison of the services is made so that i remove the code lines (symbian or QT is new for me, 1 week experience) i'm gettin a little grip on it.
    Is the comparison in qutemessenger.cpp or the clien.cpp file ?
    Or is it even the code lines i just discovered => the exprectedServiceName codes ?

    aaa. while asking question i found it :D

    @

    if (QString::compare(exprectedServiceName, serv.getName()) == 0) ...

    @

    I'll have to play around. This is so rewarding !

    Thank you for help so far. I'm learning... close, but no cigar !



  • once i had it working with the BT module... Then i tried to get pc connection to work and later on with same settings, i couldn't get the connection to BT module any more. Always when the cell phone asks for the bt-module password => qutemessenger just quits.

    Nerve wrecking, once and again. I have to sleep over the night and see bad dreams :P



  • Btw. I couldn't connect to PC, i tried to find a serial port protocol from the PC Bluetooth device, but found only the bluetooth serial modem or similar.

    Well i don't really need the PC, but if i get it to work with pc, then it will work with the module and its more easy just play around with PC and mobile than its with playing with the BT module (which is for now a breadboard jungle).

    If you happen to know how i can communicate PC with mobile (qutemessenger) just tell me.
    When i turn on the bluetooth module (pc module) i have like 3 or 4 different comports available. Some are configurable, and some are not.

    It seems that the qutemessenger is configuring the SPP protocol on a different way, because as i earlier said, i can connect diy BT module to talk with PC BT module. (even though i removed the comparison of service names).

    If you are interrested in the PC <=> mobile communication, you could do a fast try comparing the untouched qutemessenger code and what you did to get it working on PC.
    Well, maybe your not interested but just incase you would be :D



  • The QuteMessenger works on PC as well. You just have to take a look at how to make QBluetoothZero work on Windows. The code of QuteMessenger works without change. So that could be of use for you.



  • Im pretty if not almost sure that no qutemessenger is needed on windows to make it possible to send text from mobile to windows terminal software that makes a use of serial port communication.

    I'm also sure that it will work like you said, but that solution will not help me on the diy BT module side since its pure hardware based communication.

    If i knew better the coding of s60, there whould not be any problems.
    I usually code everything in one main() function and this QT is a little object based i have only been coding c++. So its a bit confusing.

    But ok. I will continue my investigation.



  • i wish i knew what i did to get it work. Anyways now the communication works.
    Well one thing was, that i brought back the comparison of the SPP service.
    I named the rfcomservice name as SPP.
    I gave the BT module service name SPP.

    Then the comparison worked.

    I also reverted by uninstalling SDK 1.1.4 and the installing 1.1.2 while trying to get TRK agent working on E72. But i didn't get it working...

    Now i just need to strip off the unnecessary applications and i'm talking business. NOT but my hobby is on.

    Thank you again for the help you gave.

    So once again. I reverted the qutemessenger back to original with the difference that i commented out the fileexchange. So only chat selection possible. Otherwise the same as original. Well of course i changed the

    rfcommServerServiceName = QString("SSP");
    QString exprectedServiceName("SSP");

    So if you guys wondering the same thing as i did.
    Change the service name of your bt module to the same as in the qutemessenger.cpp file and its good!
    Also spend one week banging your head on the table or floor!



  • Actually now i think i know what the problem was of course in addition of the expectedSrvice tag.
    So i had detected my diy BT module from the mobilephone with the old code stating some other if non servicename. I detected it again deleting it first from the phone (known devices) and detected it again. I think it has to do something with the DIY BT module UUID (Universal unique ID) that maybe is changing each time the diy module is reconfigured. So i had the weird problem yesterday also, didn't work at all but then i tried to recognize the BT module again and the suddenly it started working... So i think that was the issue in many of non-working cases!


Log in to reply
 

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