Closed Bug 1026454 Opened 7 years ago Closed 7 years ago

Fire PropertyChanged when discovery state changes

Categories

(Firefox OS Graveyard :: Bluetooth, defect)

ARM
Gonk (Firefox OS)
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: ben.tian, Assigned: ben.tian)

Details

(Whiteboard: [webbt-api])

Attachments

(1 file, 3 obsolete files)

PropertyChanged of BluetoothAdapter should be fired when discovery state changes.
Whiteboard: [webbt-api]
Assignee: nobody → btian
Changes:
- Fire PropertyChanged when discovery state changes
- Revise macro BT_APPEND_NAMED_VALUE to handle atomic variables
- set mState=Disabled in BluetoothAdapter
- clean compilation warning by setting MOZ_FINAL.
Attachment #8441295 - Attachment is obsolete: true
Attachment #8441297 - Attachment is obsolete: true
Attachment #8442004 - Flags: review?(echou)
Comment on attachment 8442004 [details] [diff] [review]
Patch 1 (v2): Fire PropertyChanged when discovery state changes

Review of attachment 8442004 [details] [diff] [review]:
-----------------------------------------------------------------

r=me with nits addressed.

::: dom/bluetooth2/bluedroid/BluetoothServiceBluedroid.cpp
@@ +155,5 @@
>      BT_APPEND_NAMED_VALUE(props, "Name", sAdapterBdName);
>      BT_APPEND_NAMED_VALUE(props, "Address", sAdapterBdAddress);
> +    if (sAdapterDiscoverable) {
> +      sAdapterDiscoverable = false;
> +      BT_APPEND_NAMED_VALUE(props, "Discoverable", sAdapterDiscoverable);

I would prefer using a constant instead of a variable in such case to avoid potential access to the variable, especially when sAdapterDiscoverable and sAdapterDiscovering are Atomic<bool> which may take time to lock/unlock.

@@ +583,5 @@
> +
> +    BluetoothSignal signal(NS_LITERAL_STRING("PropertyChanged"),
> +                           NS_LITERAL_STRING(KEY_ADAPTER), props);
> +    BluetoothService* bs = BluetoothService::Get();
> +    NS_ENSURE_TRUE(bs, NS_ERROR_FAILURE);

Please do this check at the beginning of the function so that we can save some time if bs is null.
Attachment #8442004 - Flags: review?(echou) → review+
https://hg.mozilla.org/mozilla-central/rev/597a15e183a4
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.