Closed Bug 711601 Opened 13 years ago Closed 13 years ago

B2G Bluetooth Boiler Plate


(Core :: DOM: Device Interfaces, defect)

Gonk (Firefox OS)
Not set





(Reporter: qdot, Assigned: qdot)




(1 file, 2 obsolete files)

Metabug for B2G Bluetooth tasks
Assignee: nobody → kyle
Alias: b2g-bluetooth
Version: unspecified → Trunk
There's no "b2g bluetooth" ... there's the general DOM API, and the gonk impl of that API.  Do you mean the latter here?
Ah, yeah, mean gonk impl of API. I'll clear up the name of the bug a bit.
Summary: [meta] B2G Bluetooth → [meta] Bluetooth Implementation on B2G
Main idea is to make a python-bluez like interface in js. Starting with looking at
Why do we need to bind bluez to JS?  I'm not sure what we gain from that.  Can't the impl of the bluetooth interface live in C++?
The android bluetooth implementation diagram, henceforth referred to as the "diagram of sadness":

So, if we want to cover everything android covers, we'll need bindings to dbus (doable thru nsDBusService), sockets (more ipc/libevent threads like RIL?), and sysfs (for power). I think we have pieces for most of this already, but we'll have to figure out what's going to connect where, and how. First goal is still just to do discovery and bonding.
Let's focus on the highest-impact work first.  That's bluetooth headsets, right?  That part of the code looks like it can pretty self-contained.
Depends on: 713116
Starting up on device discovery, most of the work is going to be translating glue/gonk/frameworks/base/core/jni/android_server_BluetoothService.cpp into Gecko and the bt DOM. Obviously there's going to be lots of async happening here (requesting power enable/disable, waiting for updates from discovery, etc...), not quite sure how to handle that yet.
I should note that android_server_BluetoothService isn't doing anything particularly interesting or out of the ordinary for bluez dbus communication, it's just a good TODO list of functions for the low level DOM queries.
(In reply to Chris Jones [:cjones] [:warhammer] from comment #6)
> Let's focus on the highest-impact work first.
> That's bluetooth headsets, right? ...

Please also consider Human Interface Device (HID) support a "high-impact work".

I bought my first (lobotimized) "smart"phone 8 NOV 2011 from a dealer.
They had a stack of US$100 Motorola bluetooth keyboards that had come in that day,
"for Motorola ...".
My rep could pair one of those with my new Casio Commando Android device,
but not do any text entry with it.
He had no trouble pairing and using it on his Motorola device.

I later paid US$60 for a Targus Bluetooth Wireless Keyboard,
"for Tablets".
I can pair it, but not do anything else with it.

I do not know, and do not know how to find out,
whether Android 4.0, by Google or Cyanogenmod,
include bluetooth HID support for __all__ devices,
not just for Motorola and tablet devices.

So, please consider Human Interface Device (HID) support a "high-impact work".

Thank you,
Eddie Maddox
Comment on attachment 589688 [details] [diff] [review]
Patch 1: Boilerplate code for creating navigator.mozBluetooth object

Review of attachment 589688 [details] [diff] [review]:

Looks good! Just a couple little things below:

::: dom/base/Navigator.cpp
@@ +1086,5 @@
> +
> +    mBluetooth = new bluetooth::BluetoothAdapter();
> +
> +    // mBluetoothAdapter may be null here!

It had better not be! Remove that comment ;)

::: dom/bluetooth/BluetoothAdapter.cpp
@@ +1,4 @@
> +/* -*- Mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; tab-width: 40 -*- */
> +/* vim: set ts=2 et sw=2 tw=40: */
> +/* ***** BEGIN LICENSE BLOCK *****
> + * Version: MPL 1.1/GPL 2.0/LGPL 2.1

MPL2 now for all new code :)

@@ +50,5 @@
> +
> +NS_INTERFACE_MAP_BEGIN(BluetoothAdapter)

Nit: We usually indent these.

::: dom/bluetooth/BluetoothCommon.h
@@ +50,5 @@
> +class nsIDOMBluetooth;
> +
> +
> +class Adapter;

This has changed to BluetoothAdapter

::: dom/bluetooth/
@@ +50,5 @@
> +
> +include $(topsrcdir)/dom/
> +
> +                   $(NULL)

Nit: No need for the extra $(NULL) if it's only one

::: dom/
@@ +31,5 @@
> +ifdef MOZ_B2G_BT
> +  dom/bluetooth \
> +  $(NULL)

Nit: same here

::: dom/interfaces/base/nsIDOMNavigator.idl
@@ +39,4 @@
>  #include "domstubs.idl"
> +[scriptable, uuid(aafd8c5a-91c8-4c90-af2a-8c66b4d6773f)]

This looks unnecessary, you're not actually changing the interface.

::: layout/build/
@@ +242,4 @@
>  		   -I$(srcdir)/../xul/base/src \
>  		   -I$(srcdir)/../mathml \
>  		   -I$(topsrcdir)/content/base/src \
> +		   -I$(topsrcdir)/content/canvas/src \

Unrelated whitespace change?

::: toolkit/library/
@@ +427,5 @@
>    $(NULL)
> +ifdef MOZ_B2G_BT
> +OS_LIBS += \
> +  -lbluedroid \
> +  $(NULL)

Nit: single line here too.
Attachment #589688 - Flags: review?(bent.mozilla) → review+
Updated to fix nits and remove currently unneeded dbus inclusions.
Attachment #589688 - Attachment is obsolete: true
Whiteboard: [Leave open after merge]
Morphing this bug to what landed: just the boilerplate. Going to open a new bug for trackign.
Alias: b2g-bluetooth
No longer depends on: webbluetooth, 713116
Summary: [meta] Bluetooth Implementation on B2G → B2G Bluetooth Boiler Plate
Whiteboard: [Leave open after merge]
Closed: 13 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla13
Reopened due to qemu breakage
Resolution: FIXED → ---
Updated patch to remove inclusion of BT in gonk by default, until we can figure out how we want to deal with the emulator.
Attachment #595902 - Attachment is obsolete: true
Attachment #598859 - Flags: review?(bent.mozilla)
Attachment #598859 - Flags: review?(bent.mozilla) → review+
Closed: 13 years ago13 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.