How to port Android Bluetooth Stack to other Embedded OS?

wabbas

Junior Member
Jan 11, 2017
2
0
1
Hi Everyone,

I am trying to port the android bluetooth stack, Bluedroid, to another Embedded Systems OS. Can anyone tell me where should I start from and where the core bluetooth stack is situated in android?
 

Cogman

Lifer
Sep 19, 2000
10,284
138
106
The source is available under the apache 2 licence

https://android.googlesource.com/platform/external/bluetooth/bluedroid/

And it looks like it is a linux kernel plugin. If you haven't already, I would suggest reading up on those.

That said, why? The effort of porting the full android bluetooth stack is going to be daunting. The main reason you would do it is because you want to avoid rewriting some app that uses it. However, that could easily end with you needing to pull in most if not all of the android ecosystem onto the embedded system to avoid rewriting some app.

You would likely be better served creating an abstraction layer over the bluetooth service and then maintaining two implementations for the specific embedded platform (which should already have drivers and documentation for their bluetooth chip) and the android bluetooth service.
 
  • Like
Reactions: wabbas

wabbas

Junior Member
Jan 11, 2017
2
0
1
The source is available under the apache 2 licence

https://android.googlesource.com/platform/external/bluetooth/bluedroid/

And it looks like it is a linux kernel plugin. If you haven't already, I would suggest reading up on those.

That said, why? The effort of porting the full android bluetooth stack is going to be daunting. The main reason you would do it is because you want to avoid rewriting some app that uses it. However, that could easily end with you needing to pull in most if not all of the android ecosystem onto the embedded system to avoid rewriting some app.

You would likely be better served creating an abstraction layer over the bluetooth service and then maintaining two implementations for the specific embedded platform (which should already have drivers and documentation for their bluetooth chip) and the android bluetooth service.
Actually I am trying to take out the stack part of Bluedroid and integrate it into another OS without any Android part in it. Now the problem is I don't know clearly which parts of the Bluedroid I should take given in the link mentioned by you and integrate them into that OS and what modification I will have to make, if any, in those parts.

A blog has mentioned that "I will have to reimplement the btif part of Bluedroid stack and There is a module named bt_vendor whose responsibility include resetting the communication bus, power management, and configuring firmware. So I need to adjust the bt_vendor module to drive the new hardware." Can you elaborate on that please; like what the btif folder actually does and similar other things. It would be a great help from your side.
 

Cogman

Lifer
Sep 19, 2000
10,284
138
106
I'm not familiar enough with bluedroid to tell you exactly what everything does. However, a cursory glance at the code makes it appear that btif is a go-between for the hardware and the Bluedroidz HAL.

If you want to do this, you probably should sit down and read the source in the btif folder. If that is too advanced then IMO you cannot do this, you don't have enough experience. The code isn't too terribly scary and the authors were kind enough to write descriptions on all of the source files describing what the file is doing.
 
  • Like
Reactions: wabbas