Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Gizmotoy

macrumors 65816
Original poster
Nov 6, 2003
1,109
164
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.
 

robbieduncan

Moderator emeritus
Jul 24, 2002
25,611
893
Harrogate
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.
 

Gizmotoy

macrumors 65816
Original poster
Nov 6, 2003
1,109
164
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?
 

robbieduncan

Moderator emeritus
Jul 24, 2002
25,611
893
Harrogate
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.
 

Gizmotoy

macrumors 65816
Original poster
Nov 6, 2003
1,109
164
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.
 

robbieduncan

Moderator emeritus
Jul 24, 2002
25,611
893
Harrogate
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.
 

Gizmotoy

macrumors 65816
Original poster
Nov 6, 2003
1,109
164
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.
 

Gizmotoy

macrumors 65816
Original poster
Nov 6, 2003
1,109
164
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.
 

hvassing

macrumors newbie
Apr 16, 2007
2
0
Oslo, Norway
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.
 

robbieduncan

Moderator emeritus
Jul 24, 2002
25,611
893
Harrogate
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.

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.
 

hvassing

macrumors newbie
Apr 16, 2007
2
0
Oslo, Norway
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.

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

robbieduncan

Moderator emeritus
Jul 24, 2002
25,611
893
Harrogate
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!
 

Eraserhead

macrumors G4
Nov 3, 2005
10,434
12,250
UK
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!

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 ;)).
 

robbieduncan

Moderator emeritus
Jul 24, 2002
25,611
893
Harrogate
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 ;)).

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.
 

tomtom5005

macrumors newbie
Aug 11, 2008
3
0
Providence, Rhode Island
It's too large to attach here by 4Kb :( PM me your email address and I'll send you a copy...
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:::)
 

robbieduncan

Moderator emeritus
Jul 24, 2002
25,611
893
Harrogate
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:::)

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...
 

robbieduncan

Moderator emeritus
Jul 24, 2002
25,611
893
Harrogate
Robbie,
thank you.
my email is <removed>
Also i took a look at your Arctic escapade. Looks like you had fun. :D
Thankyou for you help.:)

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)
 

flofl

macrumors newbie
Aug 14, 2008
4
0
France
BT Barcode Scanner

Hello everyone!

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

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!

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.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.