Closed Bug 790133 Opened 12 years ago Closed 12 years ago

[b2g-bluetooth] Fire devicecreated event with a BluetoothDevice

Categories

(Core :: DOM: Device Interfaces, defect)

ARM
Gonk (Firefox OS)
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla18
blocking-basecamp +

People

(Reporter: gyeh, Assigned: gyeh)

References

Details

(Whiteboard: [LOE:S] )

Attachments

(1 file, 3 obsolete files)

This is a followup of Bug 789014. When there's a random device try to pair with us, we need to create an actual BluetoothDevice first, and pass it to Gaia with a ondevicecreated event.
When Service gets "DeviceCreated", we create another thread to get device properties, and send the dict back to adapter which fires ondevicecreated event with an instance of BluetoothDevice.
Attachment #660343 - Flags: review?(kyle)
Comment on attachment 660343 [details] [diff] [review]
v1: Fire devicecreated event with a BluetoothDevice

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

::: dom/bluetooth/linux/BluetoothDBusService.cpp
@@ +1243,5 @@
> +    mDevicePath(aDevicePath),
> +    mSignalPath(aSignalPath)
> +  {
> +    MOZ_ASSERT(NS_IsMainThread());
> +    MOZ_ASSERT(aDevicePath && aSignalPath);

Nit: These are references, so not sure what you're asserting here?
Attachment #660343 - Flags: review?(kyle) → review+
Attachment #660343 - Flags: superreview?(mrbkap)
Oops! I'll remove the assertion in the final version patch. Thanks!
Comment on attachment 660343 [details] [diff] [review]
v1: Fire devicecreated event with a BluetoothDevice

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

sr=me with a couple of nits picked and one real comment fixed.

::: dom/bluetooth/BluetoothAdapter.cpp
@@ +315,5 @@
> +    NS_NewDOMBluetoothDeviceEvent(getter_AddRefs(event), nullptr, nullptr);
> +
> +    nsCOMPtr<nsIDOMBluetoothDeviceEvent> e = do_QueryInterface(event);
> +    e->InitBluetoothDeviceEvent(NS_LITERAL_STRING("devicecreated"),
> +                                     false, false, device);

Nit: this looks misindented.

::: dom/bluetooth/linux/BluetoothDBusService.cpp
@@ +919,5 @@
> +      NS_WARNING("BluetoothService not available!");
> +    }
> +
> +    if (NS_FAILED(bs->GetDevicePropertiesInternal(v, signalPath))) {
> +		  NS_WARNING("get properties failed");

Nit: looks like some tabs crept in here.

@@ +1277,5 @@
> +    if (msg) {
> +      dbus_message_unref(msg);
> +    }
> +
> +    BluetoothSignal signal(NS_ConvertUTF8toUTF16("DeviceCreated"),

This should be NS_LITERAL_STRING.
Attachment #660343 - Flags: superreview?(mrbkap) → superreview+
Nit picked.
Attachment #660343 - Attachment is obsolete: true
The old patch has been out-dated since the ipc patch has been landed, so I changed thee patch a little bit to fit in the current code base. Please help me to check, thanks.
Attachment #661088 - Attachment is obsolete: true
Attachment #661449 - Flags: review?(kyle)
Comment on attachment 661449 [details] [diff] [review]
v3: Fire devicecreated event with a BluetoothDevice

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

Looks good code-wise, at least in-process, need to file a followup for OOP. Have you tried running it with the settings app OOP'd just to make sure it doesn't crash? (Go into gaia/apps/system/js/window-manager.js, search for "Settings", it'll be an entry in the oop-blacklist or something like that, comment out that line, rebuild gaia)
Attachment #661449 - Flags: review?(kyle) → review+
Backout 5796eacef43c (bug 790133) for B2G compilation failures again 

https://hg.mozilla.org/integration/mozilla-inbound/rev/6f6429620051

Talked with Gina, and we think this is because I didn't push the right patch but pushed former one. Sorry about this.
Whiteboard: [LOE:S]
https://hg.mozilla.org/mozilla-central/rev/20200b3d443e
Status: NEW → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla18
Blocks: 791928
You need to log in before you can comment on or make changes to this bug.