BlueTooth Help

Discussion in 'Mac Programming' started by Gizmotoy, Apr 19, 2005.

  1. macrumors 6502a

    Gizmotoy

    Joined:
    Nov 6, 2003
    #1
    Hello,

    I was just wondering if anyone here has any experience with programming BlueTooth devices within XCode. Basically, I'm trying to set up the device as a RFCOMM serial port which data can be sent over. I only need a relatively simple text-type connection. The problem is Apple's developer examples and documentation are relatively sparse, and don't really help at all. If anyone has any ideas, or places to look for more information, they would be appreciated.
     
  2. Moderator emeritus

    robbieduncan

    Joined:
    Jul 24, 2002
    Location:
    London
    #2
    I wrote a little Bluetooth terminal app a while ago. The source and app is available to Download.

    Note that if you are using Bluetooth you need to stay single threaded. It stops working as soon as you go multi-threaded. You can get round it by doing all the coms in secondary helper app and talking to it over an NSConnection.
     
  3. thread starter macrumors 6502a

    Gizmotoy

    Joined:
    Nov 6, 2003
    #3
    You know, it's a pretty funny coincidence that you replied here. As it happens, I have taken a look at your Bluetooth program. I found that it worked fine connecting to a Cell Phone (although I couldn't figure out anything to do with it. I did come across the AT commands for my T610). What is happening is that I'm trying to use Bluetooth to basically send text back and forth between a module (that will be implemented with a microcontroller on a separate PCB), and my PowerBook.

    For some reason, I can't get your program to connect to the module. It simply crashes on initialization with no real error or anything. It is most likely a hardware error. The documentation for our chip is poor and I cannot figure out the proper AT commands it needs sent to enable it for serial communication. It does, however, appear to be almost exactly what I'm looking for.

    Anyway, the main problem was that I am unable to compile your source in the first place. It says that I'm missing the RDAppKit framework (RDAppKit.h and RDAKUpdateController.h, which appear to be custom frameworks you created but did not include in the source). I did searches for it all over Google and Apple and found nothing. Do you know what I'm missing?
     
  4. Moderator emeritus

    robbieduncan

    Joined:
    Jul 24, 2002
    Location:
    London
    #4
    Oops. The App depends on a my own AppKit extension framework. See this zip file. You will need to tell XCode where to find the compiled FrameWork so as it will include it in the app. Or extract the compiled version included in the pre-compiled app you should already have...

    Edit: Note that the terminal is really not very good. It works OK for phones but as it does not let you send control characters it might need some work for what you are doing.
     
  5. thread starter macrumors 6502a

    Gizmotoy

    Joined:
    Nov 6, 2003
    #5
    Wow, that's great. Thanks! I'll give it a shot and see how it goes.

    Thinking through, I can't come up with any reason why we'd need to send control characters. The other Bluetooth module will be initialized by our microcontroller. We just need to be able to open a serial connection on the PowerBook's Bluetooth chip. This would of course be connected to the external module. All we really need is to be able to send text over the link.

    I wanted to ask... how does your terminal determine if a phone supports the proper protocols to connect? Does it just look for, for example "Serial Port 1" (one of the listed services on my T616)? Or does the chip need to be set up in some certain way?

    Thanks for the help, and that framework especially.
     
  6. Moderator emeritus

    robbieduncan

    Joined:
    Jul 24, 2002
    Location:
    London
    #6
    Nope, it doesn't check anything. It basically assumes that the other end will accept standard AT style commands. As such it simply sends the text as typed to the other device. It attempts to open an RFCOM serial channel to do this. If the other device does not support this then the connection should fail.
     
  7. thread starter macrumors 6502a

    Gizmotoy

    Joined:
    Nov 6, 2003
    #7
    Alrighty, well that pretty much answered my question. We must be having a problem setting up the external chip for serial communications. The chip supports RFCOMM, but the setup process is complicated and undocumented. Something must be going wrong on that end. Thanks for the help.
     
  8. thread starter macrumors 6502a

    Gizmotoy

    Joined:
    Nov 6, 2003
    #8
    Just wanted to chime back in saying that we were able to get everything working properly. Once we had your custom framework, I was able to get the program to compile properly. To get your terminal to connect to our chip, we had to change the default from channel 5 to channel 1. Once we did that, it connected right up.

    Thanks for the help.
     
  9. Moderator emeritus

    robbieduncan

    Joined:
    Jul 24, 2002
    Location:
    London
    #9
    Cool :)

    Glad to here it's all working now. I hope you manage to do whatever it is you are trying to do!
     
  10. macrumors newbie

    Joined:
    Apr 16, 2007
    Location:
    Oslo, Norway
    #10
    Robbie Duncan:
    Could you please make the RDAppKit framework available again? It would also be great if you could write some more example code on to use the Bluetooth AT Terminal app.
     
  11. Moderator emeritus

    robbieduncan

    Joined:
    Jul 24, 2002
    Location:
    London
    #11
    I'll check where the zip is later. I'm sure it's hosted on my site but not linked for some reason.

    I'm not about to research the AT command sets required to write more examples: that's up to you. Google is there for a reason.
     
  12. macrumors newbie

    Joined:
    Apr 16, 2007
    Location:
    Oslo, Norway
    #12
    Thanks!
    I didn't mean it like that. I was just wondering because of the help-file in the Bluetooth AT app, and the example-page on your homepage. I'm just glad some wrote this kind of an app :)
     
  13. Moderator emeritus

    robbieduncan

    Joined:
    Jul 24, 2002
    Location:
    London
    #13
    iirc those documents are about the limit of my usage. I used it as a learning tool for an app I started writing but never released due to stability and complexity issues that would synchronise the SMS messages from a phone to a local storage area. Once there it would hold them forever (so you could delete them from your phone). It had a Mail style interface with folders etc. Thinking about it it's the sort of app that people still want. If only I had the time!
     
  14. macrumors G4

    Eraserhead

    Joined:
    Nov 3, 2005
    Location:
    UK
    #14
    Sounds interesting, and pretty useful, especially if your phone is like mine and makes you delete texts after the first hundred or so... Why not release the source you have under the GPL? At some stage I might take a look at it. (though if the iPhone can store texts on it's gigabytes of storage I'll probably just use that ;)).
     
  15. Moderator emeritus

    robbieduncan

    Joined:
    Jul 24, 2002
    Location:
    London
    #15
    At the moment I don't think it even compiles. If it worked at all I'd be happy to! If anyone wants a copy of it AS IS (source only) then please feel free to PM me with an email address and I'll send you a zip. If I get a second and can get the code cleaned up and compiling I'll post a thread here with a download link.

    Edit it add: it only ever worked with my Sony Ericsson phone. Although iirc I designed it so as you could extend it to support other phone types quite easily.
     
  16. Moderator emeritus

    robbieduncan

    Joined:
    Jul 24, 2002
    Location:
    London
    #16
    OK RDAppKit is now here
     
  17. macrumors G4

    Eraserhead

    Joined:
    Nov 3, 2005
    Location:
    UK
    #17
  18. macrumors newbie

    Joined:
    Jun 19, 2006
    #18
    Can anyone post a link for RDAppKit?
     
  19. Moderator emeritus

    robbieduncan

    Joined:
    Jul 24, 2002
    Location:
    London
    #19
    It's too large to attach here by 4Kb :( PM me your email address and I'll send you a copy...
     
  20. macrumors newbie

    Joined:
    Aug 11, 2008
    Location:
    Providence, Rhode Island
    #20
    Robbie,
    As you can tell I am a Newbie. I am interested in being able to send data out of an iphone via the blue tooth port. Nothing very complex, perhaps just signed integers. From the posts on this thread I can see that you have done something like this on a mac. Can you direct me to your application and frameworks and any help documentation you have? When i try to go to your site I get a website for an ISP instead. I really appreciate your help:::)
     
  21. Moderator emeritus

    robbieduncan

    Joined:
    Jul 24, 2002
    Location:
    London
    #21
    PM me your email address and I'll send you the code. My website is down and will probably not come back up for a while!

    I've no experience of using bluetooth on the iPhone so I've no idea if it's possible to do what you want or not...
     
  22. macrumors newbie

    Joined:
    Aug 11, 2008
    Location:
    Providence, Rhode Island
    #22
    Robbie,
    thank you.
    my email is
    Also i took a look at your Arctic escapade. Looks like you had fun. :D
    Thankyou for you help.:)
     
  23. Moderator emeritus

    robbieduncan

    Joined:
    Jul 24, 2002
    Location:
    London
    #23
    Tom, I meant send it in a Private Message (top right of the screen) rather than post it here to keep it private. You might want to edit your message to remove it as spammers automatically trawl forums to get email addresses :(

    And yes Norway was fun :)

    I have the address now: I'll send you the code when I get home (at work now, no access to a Mac)
     
  24. macrumors newbie

    Joined:
    Aug 11, 2008
    Location:
    Providence, Rhode Island
    #24
    Thankyou for your help and kindness:). I will email you if i am able to make the iphone bluetooth transmission work
     
  25. macrumors newbie

    Joined:
    Aug 14, 2008
    Location:
    France
    #25
    BT Barcode Scanner

    Hello everyone!

    My project is to comunicate with my Microvision BT ROV barcode scanner.

    Well, Robbie, I’ve just registered so I can’t PM people for the moment, but when I’ll be able to, I hope you will be OK to share your code with me too. :rolleyes:
    Your framework is referenced in many places, even in French forums!

    For the moment I succeeded in receiving barcode data with help of Apple’s RFCOMMSPPTestController, but when it comes to sending data, I’m lost…

    See you,

    Flofl.
     

Share This Page