Closed
Bug 1163499
Opened 9 years ago
Closed 9 years ago
[Bluetooth2] Implement GATT client support in daemon backend
Categories
(Firefox OS Graveyard :: Bluetooth, defect)
Tracking
(firefox41 fixed)
RESOLVED
FIXED
2.2 S13 (29may)
Tracking | Status | |
---|---|---|
firefox41 | --- | fixed |
People
(Reporter: yrliou, Assigned: yrliou)
References
Details
(Whiteboard: [webbt-api])
Attachments
(5 files, 11 obsolete files)
12.30 KB,
patch
|
Details | Diff | Splinter Review | |
3.93 KB,
patch
|
Details | Diff | Splinter Review | |
13.19 KB,
patch
|
Details | Diff | Splinter Review | |
63.56 KB,
patch
|
Details | Diff | Splinter Review | |
21.06 KB,
patch
|
Details | Diff | Splinter Review |
This bug is to trace the GATT support work in gecko using daemon backend.
Assignee | ||
Comment 1•9 years ago
|
||
Assignee | ||
Comment 2•9 years ago
|
||
Assignee | ||
Comment 3•9 years ago
|
||
Assignee | ||
Comment 4•9 years ago
|
||
Assignee | ||
Comment 5•9 years ago
|
||
* Note: gatt server is not supported yet.
Assignee | ||
Comment 6•9 years ago
|
||
There is an ongoing server work in Bug 1161991 which added server related pieces into BluetoothInterface.h. To avoid dependency, I would like to support gatt client only in this bug first. I will create another bug to finish the server part after Bug 1161991. (I'm experiencing slowness of bugzilla right now, will create it next week.)
Assignee | ||
Updated•9 years ago
|
Attachment #8609292 -
Flags: review?(tzimmermann)
Assignee | ||
Updated•9 years ago
|
Attachment #8609295 -
Flags: review?(tzimmermann)
Assignee | ||
Comment 7•9 years ago
|
||
Comment on attachment 8609286 [details] [diff] [review] Bug 1163499 - Patch1: Revise BluetoothGattInterface and result handler for daemon support. * Note: I'll revise all the commit message in these patch sets for replacing gatt with gatt client in next version.
Attachment #8609286 -
Flags: review?(tzimmermann)
Assignee | ||
Updated•9 years ago
|
Attachment #8609296 -
Flags: review?(tzimmermann)
Assignee | ||
Updated•9 years ago
|
Attachment #8609297 -
Flags: review?(tzimmermann)
Assignee | ||
Updated•9 years ago
|
Summary: [Bluetooth2] Implement GATT support in daemon backend → [Bluetooth2] Implement GATT client support in daemon backend
Assignee | ||
Comment 8•9 years ago
|
||
diff between v1 and v2: fix nexus5 build break and add test commmand functions.
Attachment #8609286 -
Attachment is obsolete: true
Attachment #8609286 -
Flags: review?(tzimmermann)
Attachment #8609918 -
Flags: review?(tzimmermann)
Assignee | ||
Comment 9•9 years ago
|
||
Attachment #8609295 -
Attachment is obsolete: true
Attachment #8609295 -
Flags: review?(tzimmermann)
Attachment #8609919 -
Flags: review?(tzimmermann)
Assignee | ||
Comment 10•9 years ago
|
||
Attachment #8609296 -
Attachment is obsolete: true
Attachment #8609296 -
Flags: review?(tzimmermann)
Attachment #8609920 -
Flags: review?(tzimmermann)
Comment 11•9 years ago
|
||
Comment on attachment 8609918 [details] [diff] [review] Bug 1163499 - Patch1(v2): Revise BluetoothGattInterface and result handler for daemon support. Review of attachment 8609918 [details] [diff] [review]: ----------------------------------------------------------------- The comments are mostly nits. I guess we won't make much use of the HAL backend anyway. ::: dom/bluetooth/BluetoothCommon.h @@ +733,1 @@ > uint8_t mStatus; There will be 1-byte gap after |mStatus| because of the alignment requirements in C++. I suggest to move |mStatus| after |mValueLength|. @@ +749,1 @@ > bool mIsNotify; I'd guess that 'bool' is 8 byte wide, so there will again be an 1-byte gap here. ::: dom/bluetooth/BluetoothInterface.h @@ +815,5 @@ > + char* aManufacturerData, > + uint16_t aServiceDataLen, > + char* aServiceData, > + uint16_t aServiceUUIDLen, > + char* aServiceUUID, Cleaning up the JS parameters from the interface! NICE! I think there was an include statement for <js*> that can be removed as well. ::: dom/bluetooth/bluedroid/BluetoothHALHelpers.cpp @@ +323,5 @@ > + > +nsresult > +Convert(const BluetoothGattTestParam& aIn, btgatt_test_params_t& aOut) > +{ > + nsresult rv; Please declare |rv| where it's first used. @@ +326,5 @@ > +{ > + nsresult rv; > + > + rv = Convert(aIn.mBdAddr, *aOut.bda1); > + NS_ENSURE_SUCCESS(rv, rv); |NS_ENSURE_SUCCESS| is deprecated AFAIK. The replacement pattern is if (NS_WARN_IF(NS_FAILED(rv))) { return rv; } @@ +331,5 @@ > + > + rv = Convert(aIn.mUuid, *aOut.uuid1); > + NS_ENSURE_SUCCESS(rv, rv); > + > + aOut.u1 = aIn.mU1; You should rather call |Convert(AOut.u2, aOut.u1)| for consistency with everything else.
Attachment #8609918 -
Flags: review?(tzimmermann) → review+
Comment 12•9 years ago
|
||
Comment on attachment 8609292 [details] [diff] [review] Bug 1163499 - Patch2: Add helpers for Bluetooth daemon GATT support. Review of attachment 8609292 [details] [diff] [review]: ----------------------------------------------------------------- Only nits. ::: dom/bluetooth/bluedroid/BluetoothDaemonHelpers.cpp @@ +516,5 @@ > + CONVERT(0x000f, GATT_STATUS_INSUFFICIENT_ENCRYPTION), > + CONVERT(0x0010, GATT_STATUS_UNSUPPORTED_GROUP_TYPE), > + CONVERT(0x0011, GATT_STATUS_INSUFFICIENT_RESOURCES) > + }; > + if (static_cast<uint32_t>(aIn) >= MOZ_ARRAY_LENGTH(sGattStatus)) { Please add |NS_WARN_IF| around this test, so that an error will be logged. And a comment on cleanliness: Casting |aIn| with a negative value to an 'uint32_t' type, will result in a large integer. While the check technically works it seems safer and cleaner to cast the array length to 'ssize_t' instead. This signed type is guaranteed to be large enough to hold size values. The overall pattern would look like if (NS_WARN_IF(aIn < 0) || NS_WARN_IF(aIn >= array-length as ssize_t)) { .. } @@ +1411,5 @@ > + nsresult rv = PackPDU(aIn.mUuid, aPDU); > + if (NS_FAILED(rv)) { > + return rv; > + } > + Maybe no empty line here (and in the functions below) to keep the code more compact and the file a bit shorter.
Attachment #8609292 -
Flags: review?(tzimmermann) → review+
Comment 13•9 years ago
|
||
Comment on attachment 8609919 [details] [diff] [review] Bug 1163499 - Patch3(v2): Add GATT module for Bluetooth daemon. Review of attachment 8609919 [details] [diff] [review]: ----------------------------------------------------------------- Looks good. ::: dom/bluetooth/bluedroid/BluetoothDaemonGattInterface.cpp @@ +29,5 @@ > +nsresult > +BluetoothDaemonGattModule::Send(BluetoothDaemonPDU* aPDU, > + BluetoothGattResultHandler* aRes) > +{ > + aRes->AddRef(); // Keep reference for response Please add if (aRes) { } around this line. Usually we use a result handler, but sometimes it might be omitted. @@ +35,5 @@ > +} > + > +nsresult > +BluetoothDaemonGattModule::Send(BluetoothDaemonPDU* aPDU, > + BluetoothGattClientResultHandler* aRes) I thought ClientResultHandler was removed in the first patch. No? @@ +1054,5 @@ > + pdu, UnpackConversion<BluetoothAddress, nsAString>(aArg1)); > + if (NS_FAILED(rv)) { > + return rv; > + } > + Maybe remove these empty lines to keep the code more compact.
Attachment #8609919 -
Flags: review?(tzimmermann) → review+
Comment 14•9 years ago
|
||
Comment on attachment 8609920 [details] [diff] [review] Bug 1163499 - Patch4(v2): Add GATT interface for Bluetooth daemon. Review of attachment 8609920 [details] [diff] [review]: ----------------------------------------------------------------- Looks good. ::: dom/bluetooth/bluedroid/BluetoothDaemonGattInterface.cpp @@ +1452,5 @@ > + void OnError(BluetoothStatus aStatus) override > + { > + MOZ_ASSERT(NS_IsMainThread()); > + > + BT_LOGR("%s:%d", __func__, __LINE__); Please remove the debug logging. :) @@ +1881,5 @@ > + sBluetoothDaemonGattClientInterface = > + new BluetoothDaemonGattClientInterface(mModule); > +#else > + sBluetoothDaemonGattClientInterface = > + new BluetoothDaemonGattClientInterface(); I think you want to set this to 'nullptr' instead.
Attachment #8609920 -
Flags: review?(tzimmermann) → review+
Comment 15•9 years ago
|
||
Comment on attachment 8609920 [details] [diff] [review] Bug 1163499 - Patch4(v2): Add GATT interface for Bluetooth daemon. Review of attachment 8609920 [details] [diff] [review]: ----------------------------------------------------------------- Looks good. ::: dom/bluetooth/bluedroid/BluetoothDaemonGattInterface.cpp @@ +1452,5 @@ > + void OnError(BluetoothStatus aStatus) override > + { > + MOZ_ASSERT(NS_IsMainThread()); > + > + BT_LOGR("%s:%d", __func__, __LINE__); Please remove the debug logging. :) @@ +1868,5 @@ > +BluetoothGattClientInterface* > +BluetoothDaemonGattInterface::GetBluetoothGattClientInterface() > +{ > + static BluetoothDaemonGattClientInterface* > + sBluetoothDaemonGattClientInterface; Please don't use a static field here. The field should be non-static as the overall interface management is implemented in |BluetoothDaemonInterface| and the manager classes. @@ +1876,5 @@ > + } > + > + MOZ_ASSERT(mModule); > + > +#if ANDROID_VERSION >= 19 You should not have to use 'ANDROID_VERSION' here. Just return an instance of this class. If GATT is not supported, the call to |Init| will fail. We have to handle such failures anyway, and it's an elegant way of moving system dependencies from Gecko to bluetoothd. @@ +1881,5 @@ > + sBluetoothDaemonGattClientInterface = > + new BluetoothDaemonGattClientInterface(mModule); > +#else > + sBluetoothDaemonGattClientInterface = > + new BluetoothDaemonGattClientInterface(); I think you want to set this to 'nullptr' instead.
Updated•9 years ago
|
Attachment #8609297 -
Flags: review?(tzimmermann) → review+
Comment 16•9 years ago
|
||
Hey Jocelyn, Good job! Before you land the patches, please build them on some combinations of Bluetooth v1/v2 and JB, KK and L. I'll prepare the daemon patches for review and send them out later today. You already tested them a bit, are you OK with reviewing the code?
Flags: needinfo?(joliu)
Assignee | ||
Comment 17•9 years ago
|
||
(In reply to Thomas Zimmermann [:tzimmermann] [:tdz] from comment #16) > Hey Jocelyn, > > Good job! Before you land the patches, please build them on some > combinations of Bluetooth v1/v2 and JB, KK and L. > Will do, thanks for the reminder. > I'll prepare the daemon patches for review and send them out later today. > You already tested them a bit, are you OK with reviewing the code? Sure, but it might take more time consider the amounts of gatt functions and it's also my first time reviewing daemon code. ;)
Flags: needinfo?(joliu)
Assignee | ||
Comment 18•9 years ago
|
||
(In reply to Thomas Zimmermann [:tzimmermann] [:tdz] from comment #13) > Comment on attachment 8609919 [details] [diff] [review] > Bug 1163499 - Patch3(v2): Add GATT module for Bluetooth daemon. > > Review of attachment 8609919 [details] [diff] [review]: > ----------------------------------------------------------------- > > Looks good. > > @@ +35,5 @@ > > +} > > + > > +nsresult > > +BluetoothDaemonGattModule::Send(BluetoothDaemonPDU* aPDU, > > + BluetoothGattClientResultHandler* aRes) > > I thought ClientResultHandler was removed in the first patch. No? > No, it hasn't been removed yet, I only removed the |onError| function in GattClientResultHandler and use the one in GattResultHandler.
Assignee | ||
Comment 19•9 years ago
|
||
Thanks for your time, Thomas.
Attachment #8609918 -
Attachment is obsolete: true
Assignee | ||
Comment 20•9 years ago
|
||
Attachment #8609292 -
Attachment is obsolete: true
Assignee | ||
Comment 21•9 years ago
|
||
Attachment #8609919 -
Attachment is obsolete: true
Assignee | ||
Comment 22•9 years ago
|
||
Attachment #8609920 -
Attachment is obsolete: true
Assignee | ||
Comment 23•9 years ago
|
||
Attachment #8609297 -
Attachment is obsolete: true
Assignee | ||
Comment 24•9 years ago
|
||
try result: v1 + JB/KK/L : https://treeherder.mozilla.org/#/jobs?repo=try&revision=ddbff3bda0f3 v2 + JB/KK/L : https://treeherder.mozilla.org/#/jobs?repo=try&revision=d72e780e62f6
Assignee | ||
Updated•9 years ago
|
Attachment #8611052 -
Attachment description: Bug 1163499 - Patch5: Support GATT profile when using Bluetooth daemon. r=tzimmermann → [Final] Bug 1163499 - Patch5: Support GATT profile when using Bluetooth daemon. r=tzimmermann
Assignee | ||
Comment 25•9 years ago
|
||
- remove TypedArray.h including
Attachment #8611046 -
Attachment is obsolete: true
Assignee | ||
Comment 26•9 years ago
|
||
- be more consistent on the letter case in the comments
Attachment #8611049 -
Attachment is obsolete: true
Assignee | ||
Comment 27•9 years ago
|
||
- remove unused friend class declaration.
Attachment #8611050 -
Attachment is obsolete: true
Assignee | ||
Comment 28•9 years ago
|
||
try result: v1 + JB/KK/L : https://treeherder.mozilla.org/#/jobs?repo=try&revision=ddbff3bda0f3 v2 + JB/KK/L : https://treeherder.mozilla.org/#/jobs?repo=try&revision=d72e780e62f6 Windows build on try is broken yesterday, and they're all green after retry.
Keywords: checkin-needed
Comment 29•9 years ago
|
||
https://hg.mozilla.org/integration/b2g-inbound/rev/d7e3ea6a1c7c https://hg.mozilla.org/integration/b2g-inbound/rev/062246f7d1d4 https://hg.mozilla.org/integration/b2g-inbound/rev/7bd37e369b3a https://hg.mozilla.org/integration/b2g-inbound/rev/9a8bb7dbdcd3 https://hg.mozilla.org/integration/b2g-inbound/rev/a82cebbfbbf3
Keywords: checkin-needed
Comment 30•9 years ago
|
||
https://hg.mozilla.org/mozilla-central/rev/d7e3ea6a1c7c https://hg.mozilla.org/mozilla-central/rev/062246f7d1d4 https://hg.mozilla.org/mozilla-central/rev/7bd37e369b3a https://hg.mozilla.org/mozilla-central/rev/9a8bb7dbdcd3 https://hg.mozilla.org/mozilla-central/rev/a82cebbfbbf3
Status: NEW → RESOLVED
Closed: 9 years ago
status-firefox41:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → 2.2 S13 (29may)
You need to log in
before you can comment on or make changes to this bug.
Description
•