Closed Bug 1200124 Opened 9 years ago Closed 9 years ago

Correct PBAP order mapping

Categories

(Firefox OS Graveyard :: Bluetooth, defect)

ARM
Gonk (Firefox OS)
defect
Not set
normal

Tracking

(blocking-b2g:2.2r+, firefox43 fixed, b2g-v2.2r fixed, b2g-master fixed)

RESOLVED FIXED
FxOS-S7 (18Sep)
blocking-b2g 2.2r+
Tracking Status
firefox43 --- fixed
b2g-v2.2r --- fixed
b2g-master --- fixed

People

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

References

Details

Attachments

(4 files, 1 obsolete file)

The order mapping doesn't follow section 6.2.1 PBAP spec 1.2.
  0x00 = indexed
  0x01 = alphanumeric
  0x02 = phonetic

Also replace nsString with uint32_t for parameter passing to avoid such string mismatch error.
Assignee: nobody → btian
Attachment #8654726 - Flags: review?(shuang)
Depends on: 1199548
Blocks: 1195685
Comment on attachment 8654727 [details] [diff] [review]
[2.2r] Patch 2 (v1): Pass order and search key with uint32_t instead of nsString to avoid string mismatch error

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

Hi Ben,
Thanks for fixing this. Only one thing I think we shall handle it in BluetoothPbapManager instead of BluetoothAdapter. Do you agree?

::: dom/bluetooth/BluetoothAdapter.cpp
@@ +1173,5 @@
>      } else if (name.EqualsLiteral("order")) {
> +      using namespace mozilla::dom::vCardOrderTypeValues;
> +      uint32_t order =
> +        value.get_uint32_t() < ArrayLength(strings) ? value.get_uint32_t()
> +                                                    : 0; // default: indexed

Honestly I think the error handling (here the unexpected value and use default value "0, indexed") shall be handled in BluetoothPbapManager, not BluetoothAdapter. BluetoothPbapManager shall know PBAP logic and BluetoothAdapter shall simply compose |BluetoothVCardListingEventInit| event. Doe it make sense to you?

@@ +1179,5 @@
> +    } else if (name.EqualsLiteral("searchKey")) {
> +      using namespace mozilla::dom::vCardSearchKeyTypeValues;
> +      uint32_t searchKey =
> +        value.get_uint32_t() < ArrayLength(strings) ? value.get_uint32_t()
> +                                                    : 0; // default: name

Ditto.
Attachment #8654727 - Flags: review?(shuang)
(In reply to Shawn Huang [:shawnjohnjr] from comment #3)
> Honestly I think the error handling (here the unexpected value and use
> default value "0, indexed") shall be handled in BluetoothPbapManager, not
> BluetoothAdapter. BluetoothPbapManager shall know PBAP logic and
> BluetoothAdapter shall simply compose |BluetoothVCardListingEventInit|
> event. Doe it make sense to you?

I got your point. The reason I put it in BluetoothAdapter is to use the table stored in BluetoothPbapParameters.webidl. If the logic is in PBAP manager, PBAP manager has to either 1) keep an identical table or 2) access table in BluetoothPbapParameters.webidl to handle unexpected value.

Do you prefer option 2)? Also do you think we can remove the tables from BluetoothPbapParameters.webidl?
Flags: needinfo?(shuang)
Option 2) seems to be reasonable. If we removed tables (in this case, vCardOrderType/vCardSearchKeyType), we don't have dictionaries to let Gaia use, right? I think keeping the dictionaries and simply do type-conversion in BluetoothAdapter and do boundary check in BluetoothPbapManager.
Flags: needinfo?(shuang)
Revise based on reviewer's comment.
Attachment #8654727 - Attachment is obsolete: true
Attachment #8655867 - Flags: review?(shuang)
Comment on attachment 8655867 [details] [diff] [review]
[2.2r] Patch 2: Pass order and search key with uint32_t instead of nsString to avoid string mismatch error, r=shuang

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

Code looks good to me. Thank.
Attachment #8655867 - Flags: review?(shuang) → review+
Upload m-c patch.

Blake, can you review the webidl change that corrects order mapping to follow bluetooth Phonebook Access Profile (PBAP) spec as comment 0?
Attachment #8657684 - Flags: review?(mrbkap)
Attachment #8655867 - Attachment description: [2.2r] Patch 2 (v2): Pass order and search key with uint32_t instead of nsString to avoid string mismatch error → [2.2r] Patch 2: Pass order and search key with uint32_t instead of nsString to avoid string mismatch error, r=shuang
Attachment #8654726 - Attachment description: [2.2r] Patch 1 (v1): Correct PBAP order mapping → [2.2r] Patch 1: Correct PBAP order mapping, r=shuang
Attachment #8657684 - Flags: review?(mrbkap) → review+
Set 2.2r+ blocker since the bug disobeys PBAP spec.
blocking-b2g: --- → 2.2r+
Attachment #8654726 - Attachment description: [2.2r] Patch 1: Correct PBAP order mapping, r=shuang → [2.2r] Patch 1: Correct PBAP order mapping, r=shuang, r=mrbkap
https://hg.mozilla.org/mozilla-central/rev/fa0de2cded57
https://hg.mozilla.org/mozilla-central/rev/582d68dfb107
Status: NEW → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Target Milestone: --- → FxOS-S7 (18Sep)
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: