Closed
Bug 929891
Opened 12 years ago
Closed 12 years ago
[Bluetooth][bluedroid] Enable/Disable Bluetooth
Categories
(Firefox OS Graveyard :: Bluetooth, defect)
Tracking
(Not tracked)
RESOLVED
FIXED
People
(Reporter: shawnjohnjr, Assigned: shawnjohnjr)
References
Details
Attachments
(1 file, 5 obsolete files)
|
5.35 KB,
patch
|
echou
:
review+
|
Details | Diff | Splinter Review |
Enable / Disable Bluetooth.
Gaia can get events (AdapterAdded / Disabled)
| Assignee | ||
Comment 1•12 years ago
|
||
Attachment #820885 -
Flags: review?(echou)
| Assignee | ||
Updated•12 years ago
|
Attachment #820885 -
Attachment is obsolete: true
Attachment #820885 -
Flags: review?(echou)
| Assignee | ||
Comment 2•12 years ago
|
||
This patch only enable/disable bluetooth, gaia can get AdapterAdded/Disabled event
Attachment #820898 -
Flags: review?(echou)
Comment 3•12 years ago
|
||
Comment on attachment 820898 [details] [diff] [review]
Bug 929891 - [Bluetooth][bluedroid] Enable/Disable Bluetooth
Review of attachment 820898 [details] [diff] [review]:
-----------------------------------------------------------------
Hi Shawn, please see my comments below. Most are nits. Happy to review again once new patch is ready.
::: dom/bluetooth/BluetoothServiceBluedroid.cpp
@@ +67,5 @@
> +/**
> + * Static callback functions
> + */
> +static void
> +AdapterStateChangeCallback(bt_state_t status)
nit: s/status/aStatus
@@ +82,5 @@
> + signalName = NS_LITERAL_STRING("Disabled");
> + }
> +
> + BluetoothValue aValue = true;
> + BluetoothSignal signal(signalName, NS_LITERAL_STRING(KEY_MANAGER), aValue);
Since this is the only place aValue is used, how about just
BluetoothSignal signal(signalName, NS_LITERAL_STRING(KEY_MANAGER), BluetoothValue(true));
@@ +111,5 @@
> + }
> + module->methods->open(module, BT_HARDWARE_MODULE_ID, &device);
> + sBtDevice = (bluetooth_device_t *)device;
> + sBtInterface = sBtDevice->get_bluetooth_interface();
> + BT_LOGD("Bluetooth HAL loaded");
super-nit: please add an extra line here. Then it would be more consistent with what you have done in EnsureBluetoothHalUnload().
@@ +120,5 @@
> +EnsureBluetoothHalUnload()
> +{
> + int err = 0;
> + sBtInterface = nullptr;
> + BT_LOGD("Bluetooth HAL unloaded (%s)", strerror(err));
Doesn't seem to be needed since err would be always 0 in this case. Please refine this function.
@@ +127,5 @@
> +}
> +
> +static nsresult
> +StartStopGonkBluetooth(bool aShouldEnable)
> +{
nit: MOZ_ASSERT(!NS_IsMainThread())
| Assignee | ||
Updated•12 years ago
|
Attachment #820898 -
Attachment is obsolete: true
Attachment #820898 -
Flags: review?(echou)
| Assignee | ||
Comment 4•12 years ago
|
||
Attachment #822114 -
Flags: review?(echou)
| Assignee | ||
Updated•12 years ago
|
Attachment #822114 -
Attachment is obsolete: true
Attachment #822114 -
Flags: review?(echou)
| Assignee | ||
Comment 5•12 years ago
|
||
Attachment #822131 -
Flags: review?(echou)
| Assignee | ||
Comment 6•12 years ago
|
||
> @@ +120,5 @@
> > +EnsureBluetoothHalUnload()
> > +{
> > + int err = 0;
> > + sBtInterface = nullptr;
> > + BT_LOGD("Bluetooth HAL unloaded (%s)", strerror(err));
>
> Doesn't seem to be needed since err would be always 0 in this case. Please
> refine this function.
I think this function shall be removed since it's unused function, and only assign null.
| Assignee | ||
Updated•12 years ago
|
Attachment #822131 -
Attachment is obsolete: true
Attachment #822131 -
Flags: review?(echou)
| Assignee | ||
Comment 7•12 years ago
|
||
Attachment #822134 -
Flags: review?(echou)
Comment 8•12 years ago
|
||
Comment on attachment 822134 [details] [diff] [review]
Bug 929891 - [Bluetooth][bluedroid] Enable/Disable Bluetooth
Review of attachment 822134 [details] [diff] [review]:
-----------------------------------------------------------------
::: dom/bluetooth/BluetoothServiceBluedroid.cpp
@@ +125,5 @@
> +
> + if (!EnsureBluetoothHalLoad()) {
> + BT_LOGR("Failed to load bluedroid library.\n");
> + return NS_ERROR_FAILURE;
> + }
I just found that there is a slight difference between this function and the same name function in BluetoothGonkService.cpp. The other function would return NS_OK if "Gaia requests to enable(disable) BT when Bluetooth is enabled(disabled)", but NS_ERROR_FAILURE would be returned here under the same circumstances.
Please add the condition check to ensure the logic in both functions are the same.
| Assignee | ||
Updated•12 years ago
|
Attachment #822134 -
Attachment is obsolete: true
Attachment #822134 -
Flags: review?(echou)
| Assignee | ||
Comment 9•12 years ago
|
||
Attachment #822236 -
Flags: review?(echou)
Comment 10•12 years ago
|
||
Comment on attachment 822236 [details] [diff] [review]
Bug 929891 - [Bluetooth][bluedroid] Enable/Disable Bluetooth
Review of attachment 822236 [details] [diff] [review]:
-----------------------------------------------------------------
Looks good. Thanks.
Attachment #822236 -
Flags: review?(echou) → review+
| Assignee | ||
Comment 11•12 years ago
|
||
| Assignee | ||
Comment 12•12 years ago
|
||
I also built JB 4.3 + Bluedroid combination.
Comment 13•12 years ago
|
||
Comment 14•12 years ago
|
||
Status: NEW → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
You need to log in
before you can comment on or make changes to this bug.
Description
•