Rfcomm development

13 views
Skip to first unread message

Will Pearson

unread,
May 14, 2011, 5:07:22 PM5/14/11
to openla...@googlegroups.com
I've got a very skeletal android app that extracts a bt mac address
from a qrcode and attempts to connect to it. However I'm having
trouble connecting to my computer using rfcomm (for testing purposes).

I've altered my rfcomm.conf to connect on channel 0 and then rfcomm
listen hci0 0 which starts it listening. However the phone tries to
connect for a bit then fails. It sounds like this problem here.

http://stackoverflow.com/questions/3255406/trouble-connecting-android-bluetooth-client-socket-to-ubuntu-server-socket

I'll fire up my other laptop and scan mine in a bit using sdp.

Code is here: https://github.com/eb4890/qrblue if anyone wants to test.

It is a MyFirstAndroidApp and also the first bit of java I've written
for a while, so mainly bits copied and pasted.

I suspect I need to setup the UUID to be the same (I'm using a generic
SPP UUID I picked up from somewhere). Anyone know a way of doing this
easily (python) for testing purposes? Or do I need to borrow some
hardware?

Will

tom

unread,
May 16, 2011, 5:38:28 AM5/16/11
to OpenLaserTag
does this require any extra qrcode reading utils that we cant bundle
with an app?


On May 14, 10:07 pm, Will Pearson <wil.pear...@gmail.com> wrote:
> I've got a very skeletal android app that extracts a bt mac address
> from a qrcode and attempts to connect to it. However I'm having
> trouble connecting to my computer using rfcomm (for testing purposes).
>
> I've altered my rfcomm.conf to connect on channel 0 and then rfcomm
> listen hci0 0 which starts it listening. However the phone tries to
> connect for a bit then fails. It sounds like this problem here.
>
> http://stackoverflow.com/questions/3255406/trouble-connecting-android...
>
> I'll fire up my other laptop and scan mine in a bit using sdp.
>
> Code is here:https://github.com/eb4890/qrblueif anyone wants to test.

Bob Clough

unread,
May 16, 2011, 5:44:28 AM5/16/11
to openla...@googlegroups.com
If we add a usb host IC, we could use the new ADK stuff to install apps for us without QR and stuff, just plug in a cable, and it asks to install the app automagically.

It could also set up the bluetooth connection etc on both the host and the device end?

Will Pearson

unread,
May 16, 2011, 5:48:25 AM5/16/11
to openla...@googlegroups.com
On 16 May 2011 10:38, tom <bollo...@gmail.com> wrote:
> does this require any extra qrcode reading utils that we cant bundle
> with an app?
>

It uses the semi-standard barcode scanner app. Which is open source so
we could rip the code out if we can't find a way of bundling it.

Also it now works!

Also I am anti-ADK at the moment as it requires android 2.3. However
with a USB host we could do ADB stuff like

http://code.google.com/p/microbridge/

This does rely on the user being able to put their phone in debug mode.

Will

tom

unread,
May 16, 2011, 6:04:19 AM5/16/11
to OpenLaserTag
awesome! that seems to be bundled with most phones i've played with
anyway.

bob: i think were going with bluetooth mainly because its OS agnostic,
i know were not thinking of it now but if we stick with BT we can
potentially use iPhones etc.. It also saves a lot of code space on the
guns as we'd probably be using the builtin UART on the atmegas rather
than having to include the extra ADK library stuff

I've ordered some bits to play with the ADK anyway (partly for this
and partly for a breathalyser app :D)


Theres a G1 sitting in my box if you want to test this on an older
phone, I'll bring up the 1.5 Pulse I have as well

On May 16, 10:48 am, Will Pearson <wil.pear...@gmail.com> wrote:

Bob Clough

unread,
May 16, 2011, 6:18:54 AM5/16/11
to openla...@googlegroups.com
TBH i was thinking we could support both.

USB host would allow us to add extra accessories (USB missile launcher? pendrive? keyboard & mouse?),  costs about 4 quid to add and would make for easier setup for phones that support it.  If the phone doesnt, the user can always go with the QR / manual setup. 

tom

unread,
May 16, 2011, 6:31:22 AM5/16/11
to OpenLaserTag
why would the gun need a keyboard or mouse?

if the user cant support the qrcode reader then they can fall back to
scanning for discoverable BT devices and find the one that has the
same name as the gun theyre holding.

On May 16, 11:18 am, Bob Clough <para...@ivixor.net> wrote:
> TBH i was thinking we could support both.
>
> USB host would allow us to add extra accessories (USB missile launcher?
> pendrive? keyboard & mouse?),  costs about 4 quid to add and would make for
> easier setup for phones that support it.  If the phone doesnt, the user can
> always go with the QR / manual setup.
>

tom

unread,
May 20, 2011, 9:48:35 AM5/20/11
to OpenLaserTag
bit of an odd one, but my phone doesnt have the zxing app installed by
default. Theres a way to install it automatically tho

http://code.google.com/p/zxing/source/browse/trunk/android-integration/src/com/google/zxing/integration/android/IntentIntegrator.java

Will Pearson

unread,
May 21, 2011, 9:28:28 AM5/21/11
to openla...@googlegroups.com
On 20 May 2011 14:48, tom <bollo...@gmail.com> wrote:
> bit of an odd one, but my phone doesnt have the zxing app installed by
> default. Theres a way to install it automatically tho
>
> http://code.google.com/p/zxing/source/browse/trunk/android-integration/src/com/google/zxing/integration/android/IntentIntegrator.java
>
Yeah that is on my todo list. Also I'm not going to make the code to
be used as a Service. As that would make the interface to the
bluetooth device different if you don't set it up with a qrcode, and
be very crufty.

So I'm going to make it an Activity to be inherited from, so you get
direct access to the socket.

Will

tom

unread,
May 23, 2011, 6:35:14 AM5/23/11
to OpenLaserTag
I also had a crack at starting a service to handle BT connections. The
plan is to use it to convert gun commands to intents that a GUI (or
other things) can listen for.

I've also been looking at maintaining SPP connections whilst
discovering new adapters ( for proximity things), its not going well :
(


On May 21, 2:28 pm, Will Pearson <wil.pear...@gmail.com> wrote:
> On 20 May 2011 14:48, tom <bollocks...@gmail.com> wrote:> bit of an odd one, but my phone doesnt have the zxing app installed by
> > default. Theres a way to install it automatically tho
>
> >http://code.google.com/p/zxing/source/browse/trunk/android-integratio...

Will Pearson

unread,
May 23, 2011, 7:55:55 AM5/23/11
to openla...@googlegroups.com
On 23 May 2011 11:35, tom <bollo...@gmail.com> wrote:
> I also had a crack at starting a service to handle BT connections. The
> plan is to use it to convert gun commands to intents that a GUI (or
> other things) can listen for.

Mind posting the source somewhere? I've been looking for an example of
a service that gets data and then informs (potentially multiple)
activities of the data it gets. Does it rely on setting up the intent
again each time (a la comet requests), so that you can use
Activity.setResult () or does it have to be done by making the gui etc
broadcast listeners(I've not looked at those)?

Will

tom

unread,
May 23, 2011, 8:07:07 AM5/23/11
to openla...@googlegroups.com
I'll go for Broadcast listeners to start with and see how that runs, not
written that part yet though :)

While I think about it I'll knock up some simple GUI tests too

tom

unread,
May 24, 2011, 7:40:37 AM5/24/11
to OpenLaserTag
well it works quite nicely so far. I've got a service that spawns a
thread to do the BT reading/writing. The service then forwards things
out as broadcast intents. Works rather well

Next step is to see what happens with serial connections and periodic
scanning

tom

unread,
May 26, 2011, 5:16:08 AM5/26/11
to OpenLaserTag
https://github.com/fridgehead/LaserTagTest

i'm a git noob so let me know if I've cocked anything up!

tom

unread,
May 29, 2011, 12:32:22 PM5/29/11
to OpenLaserTag
annoying issue:

You cant initiate an rfcomm connection to a device that you havent
bonded to before. The phone requests a PIN from teh remote device but
never tells the user.
You have to bond the devices first :/

Will Pearson

unread,
May 29, 2011, 2:12:18 PM5/29/11
to openla...@googlegroups.com

Thtf might be because you are trying to open a socket in a background thread.

tom

unread,
May 29, 2011, 2:21:12 PM5/29/11
to openla...@googlegroups.com
nope, doesnt look like it. At the moment its trapping it and warning the user but i'll look into it deeper later
Reply all
Reply to author
Forward
0 new messages