PDA

View Full Version : BlueTooth Help




Gizmotoy
Apr 19, 2005, 02:39 PM
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
Apr 20, 2005, 12:53 PM
I wrote a little Bluetooth terminal app a while ago. The source and app is available to Download (http://www.robbieduncan.net/cgi-bin/get_file.cgi?file=projects/mac/bluetooth_at_terminal/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
Apr 20, 2005, 04:19 PM
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
Apr 20, 2005, 04:27 PM
Oops. The App depends on a my own AppKit extension framework. See this zip file (http://www.robbieduncan.net/RDAppKit.zip). 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
Apr 20, 2005, 09:37 PM
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
Apr 21, 2005, 02:52 AM
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
Apr 21, 2005, 10:02 AM
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
Apr 25, 2005, 02:48 PM
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.

robbieduncan
Apr 25, 2005, 02:50 PM
Cool :)

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

hvassing
Apr 16, 2007, 09:39 AM
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
Apr 16, 2007, 09:52 AM
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
Apr 16, 2007, 10:27 AM
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
Apr 16, 2007, 10:47 AM
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
Apr 16, 2007, 11:19 AM
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
Apr 16, 2007, 11:25 AM
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.

robbieduncan
Apr 16, 2007, 01:22 PM
OK RDAppKit is now here (http://www.robbieduncan.net/RDAppKit.zip)

Eraserhead
Apr 16, 2007, 02:21 PM
OK, I'm gonna take a look at this over the next few weeks, I will stick the source up online quite soon on my website at
http://smscommander.erasersoft.com

if that doesn't work the direct link is http://www.erasersoft.com/smsCommander.html

I haven't looked at the source much yet, but I'll take a look over the next couple of weeks.

ptrael
May 18, 2008, 08:25 AM
Can anyone post a link for RDAppKit?

robbieduncan
May 18, 2008, 10:03 AM
It's too large to attach here by 4Kb :( PM me your email address and I'll send you a copy...

tomtom5005
Aug 11, 2008, 08:04 AM
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
Aug 11, 2008, 08:08 AM
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...

tomtom5005
Aug 11, 2008, 08:12 AM
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.:)

robbieduncan
Aug 11, 2008, 08:18 AM
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)

tomtom5005
Aug 11, 2008, 09:37 AM
Thankyou for your help and kindness:). I will email you if i am able to make the iphone bluetooth transmission work

flofl
Aug 14, 2008, 10:45 AM
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.

robbieduncan
Aug 14, 2008, 10:51 AM
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.

I'll stick the code for RDAppKit and my Bluetooth terminal app that everyone seems to like as an example on my iDisk and post a link later on. Might be later today, might be tomorrow as I am out tonight :D

flofl
Aug 14, 2008, 10:57 AM
I'll stick the code for RDAppKit and my Bluetooth terminal app that everyone seems to like as an example on my iDisk and post a link later on. Might be later today, might be tomorrow as I am out tonight :D

What a quick answer!! :)

Alright, I think that youíll help a lot of us by doing so!

Thanks!


PS: Have fun tonight!

robbieduncan
Aug 14, 2008, 11:06 AM
Right. When my website was up (I've not paid to keep the hosting and need to change host as my current one is not good) I was redirecting downloads to my iDisk anyway!

So here are the download links:

BluetoothATTerminal (1.0.3) (http://homepage.mac.com/robbieduncan/.Public/BluetoothATTerminal/BATT-1.0.3.tar.gz)
RDAppKit (http://homepage.mac.com/robbieduncan/.Public/RDAppKit.zip) (You only need it to compile, it doesn't have any Bluetooth stuff in it)

flofl
Aug 14, 2008, 11:09 AM
Thank you for your work! Iíll study it right now!

Flofl.

flofl
Aug 14, 2008, 11:37 AM
It solved my problem within a few minutes!

Thanks again, Iím prostrating to you! :) :)


Flofl.

Electrumpeter
Aug 16, 2008, 05:53 PM
Hi all and especially Robbie,

This thread becomes quite popular. I could probably use some of the insights here as well. In order to see the application Robbie wrote working I am also curious to the RDAppkit and I don't know how I can PM Robbie. So if somebody else uploaded the RDAppkit or Robbie would want to sent it to me, I would be very pleased.

I'm trying to make my trumpetcontroller that uses a bluetooth arduino as latency free as possible and without using the MAX/MSP serial object.

Best, Hans.

robbieduncan
Aug 17, 2008, 02:15 AM
So if somebody else uploaded the RDAppkit or Robbie would want to sent it to me, I would be very pleased.

I have uploaded it and linked as above, but RDAppKit does not have any Bluetooth stuff in it, you only need it to compile the terminal app. I have no extra knowledge above what's in that code. I can't help you with latency issues.