The solution to enable the Bluetooth transport on Android

5 posts / 0 new
Last post
The solution to enable the Bluetooth transport on Android
forsbilm's picture
Offline
Joined
03/15/2012 - 02:04
Posted
Thu, 05/24/2012 - 20:30

Hi guys,

          I am working in a research team which want to develop funny and interesting App using Alljoyn project.  My responsibility is to enable Bluetooth transport of AllJoyn project on different Android devices  and make bluetooth unit work correctly, since we found that we met some problems. Actually, I have been focusing on Alljoyn several months. Now, I can make Bluetooth transoprt of alljoyn work well. I would like to post some information to help you solve the issue what you may meet.

=====================================

 Environment:

Device: Google Galaxy Nexus

OS:      Android 4.0.3

BlueZ Version: 4.9.3

Alljoyn Service:  AllJoyn daemon with Wi-Fi and Bluetooth support

AllJoyn SDK Version: alljoyn-sdk-2-3-3-android

Test APP:   Chat from alljoyn-sdk-2-3-3-android

======================================

1. ISSUE:   AddRecord method call failed (org.freedesktop.DBus.Error.UnknownMethod - Method "AddRecord" with signature "s" on interface "org.bluez.Service" doesn't exist

When you run Chat App and start a AllJoyn service through Bluetooth protocol, you will meet this problem in your adb shell env. The reason what this happen is that the file service.c contained under plugins directory is not compiled into libbluetoothd.so.  To solve this issue, you can follow this steps.

1. you need merge this patch what I post below.

ICS/external/bluetooth/bluez$ git diff

diff --git a/plugins/Android.mk b/plugins/Android.mk

index 33c7789..f76701a 100755

--- a/plugins/Android.mk

+++ b/plugins/Android.mk

@@ -10,6 +10,7 @@ LOCAL_SRC_FILES:= \

        hciops.c \

        mgmtops.c \

        dbusoob.c \

+       service.c

 

 LOCAL_CFLAGS:= \

        -DVERSION=\"4.93\" \

diff --git a/plugins/builtin.h b/plugins/builtin.h

index ebc7d62..8ba012f 100644

--- a/plugins/builtin.h

+++ b/plugins/builtin.h

@@ -21,6 +21,8 @@

  *

  */

 extern struct bluetooth_plugin_desc __bluetooth_builtin_hciops;

+extern struct bluetooth_plugin_desc __bluetooth_builtin_service;

 static struct bluetooth_plugin_desc *__bluetooth_builtin[] = {

        &__bluetooth_builtin_hciops,

+    &__bluetooth_builtin_service,

        NULL };

diff --git a/plugins/service.c b/plugins/service.c

index d73cdea..7e003a1 100644

--- a/plugins/service.c

+++ b/plugins/service.c

@@ -34,6 +34,8 @@

 #include <bluetooth/sdp.h>

 #include <bluetooth/sdp_lib.h>

 

+#include <glib.h>

 #include <gdbus.h>

 

 #include "sdpd.h"

/external/bluetooth/glib$ git diff

diff --git a/glib/Android.mk b/glib/Android.mk

index 764f07c..174daef 100755

--- a/glib/Android.mk

+++ b/glib/Android.mk

@@ -7,6 +7,7 @@ LOCAL_SRC_FILES:= \

        giochannel.c \

        gkeyfile.c \

        gmain.c \

+       gmarkup.c \

        gmem.c \

        goption.c \

        gslice.c \

2. add gmarkup.c to /external/bluetooth/glib/glib. The file is in the attachmemt list. Please rename file to gmarkup.c.

 

Attachments: 

Re: The solution to enable the Bluetooth transport on Android
vikramsm's picture
Offline
Joined
10/01/2012 - 23:07

Hi Forsblim,

When you say that you got the BT working in AllJoyn Chat application, do you mean to say that if you just run the Chat app with AllJoyn-Daemon running already on 2 devices, the chat will work?

OR both the devices should be paired to get the chat messages across?

Thanks,

Vikram

Re: The solution to enable the Bluetooth transport on Android
Nikhil Dabhade Moderator
Nikhil Dabhade's picture
Offline
Joined
01/27/2011 - 17:39

Hi Vikram,

You do not need to pair the devices explicitly. Bluetooth needs to be turned on though. 

Nikhil

Re: The solution to enable the Bluetooth transport on Android
xtream's picture
Offline
Joined
06/28/2013 - 06:26

Do you know if Bluetooth of alljoyn is working with htc google nexus one?

Thank you in advance

Re: The solution to enable the Bluetooth transport on Android
Nikhil Dabhade Moderator
Nikhil Dabhade's picture
Offline
Joined
01/27/2011 - 17:39

If the Nexus one in question has BlueZ stack. Typically if it has an OS prior to Jellybean and is rooted you could get AllJoyn with Bluetooth running on it.

Nikhil