Implementing own bluetooth profile for android

966 views
Skip to first unread message

Mikhail Gudkov

unread,
Oct 5, 2011, 1:47:58 AM10/5/11
to android-platform
I'm trying to implement Handsfree bluetooth profile for android (HF
side). I have succesfully connected through rfcomm and it allows me to
send/receive AT commands to/from AG. But what about voice? In
documentation I have read about synchronous connection, and tried to
accept connection from SCO socket:

int sock = socket(AF_BLUETOOTH, SOCK_SEQPACKET, BTPROTO_SCO)

But nothing happens.

Is this a correct type of socket, or I need something different then
SCO?

Alexander Petrov

unread,
Oct 5, 2011, 4:06:54 AM10/5/11
to android-...@googlegroups.com
you can't do it 

2011/10/5 Mikhail Gudkov <gmv...@gmail.com>

--
You received this message because you are subscribed to the Google Groups "android-platform" group.
To post to this group, send email to android-...@googlegroups.com.
To unsubscribe from this group, send email to android-platfo...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/android-platform?hl=en.


Mikhail Gudkov

unread,
Oct 5, 2011, 7:00:58 AM10/5/11
to android-platform
Correct me if I am wrong. There is no solution to implement this
profile on android?

Alexander Petrov

unread,
Oct 5, 2011, 10:17:18 AM10/5/11
to android-...@googlegroups.com
in android > 2.1 bluez sco.ko driver doesn't transfer SCO data
you try open SCO kernel socket and send/recv SCO data, but it can't work
SCO data transfered using PCM port on bluetooth chip worked with some vendor codecs - android and bluez doesn't participated in this process
2011/10/5 Mikhail Gudkov <gmv...@gmail.com>
Correct me if I am wrong. There is no solution to implement this
profile on android?

Mikhail Gudkov

unread,
Oct 5, 2011, 2:20:46 PM10/5/11
to android-platform
thanks

penguin359

unread,
Oct 5, 2011, 6:54:05 PM10/5/11
to android-...@googlegroups.com
On a related note, but slightly different profile, I've been interested in implementing an application utilizing the Bluetooth HID Profile, but not as a master as other projects, but as a slave.  In other words, Android acting as a Keyboard, Mouse, or other HID device itself.  My ultimate goal would be to write an Android app that acts as a PowerPoint Presenter Remote using standard Bluetooth HID and not one of the hacks out there that utilizes SSP and RFCOMM and requires software running on the host operation.  It it possible or allowed to get this level of access to the Bluetooth stack in Android?

I know it may not be completely portable as I've heard that Samsung phones use their own incompatible Bluetooth stack, but for those Android devices utilizing Bluez, would this be doable?

Alexander Petrov

unread,
Oct 6, 2011, 10:51:56 AM10/6/11
to android-...@googlegroups.com
penguin359, HID profile has two sides - Host and Human Interface Device
you want implement Human Interface Device
you should check is Bluez on Linux (and on Android of course) supports this side

Mikhail Gudkov, using this socket with the BTPROTO_SCO you must be able to establish SCO connection, (but you can't get and send data)
see in framework/base/core/jni/android_bluetooth_ScoSocket.cpp ScoSocket implementation or use this Java class

but i think there are another problem - one bluetooth device can create only one SCO connection, and maybe android heandsfree service already create it before you

2011/10/6 penguin359 <lor...@north-winds.org>
On a related note, but slightly different profile, I've been interested in implementing an application utilizing the Bluetooth HID Profile, but not as a master as other projects, but as a slave.  In other words, Android acting as a Keyboard, Mouse, or other HID device itself.  My ultimate goal would be to write an Android app that acts as a PowerPoint Presenter Remote using standard Bluetooth HID and not one of the hacks out there that utilizes SSP and RFCOMM and requires software running on the host operation.  It it possible or allowed to get this level of access to the Bluetooth stack in Android?

I know it may not be completely portable as I've heard that Samsung phones use their own incompatible Bluetooth stack, but for those Android devices utilizing Bluez, would this be doable?
--
You received this message because you are subscribed to the Google Groups "android-platform" group.
To view this discussion on the web visit https://groups.google.com/d/msg/android-platform/-/Wbew-xosImQJ.

Mikhail Gudkov

unread,
Oct 7, 2011, 8:43:17 AM10/7/11
to android-platform
I am already tryed ScoSocket, results are same.

About android handsfree. I'm build CM with some fixes and now "sdptool
browse local" dont found HF record on my device. Witout than I can not
even create rfcomm on reserved channel.
Reply all
Reply to author
Forward
0 new messages