Closed Bug 1159179 Opened 11 years ago Closed 11 years ago

Implement PBAP connection related functions

Categories

(Firefox OS Graveyard :: Bluetooth, defect)

ARM
Gonk (Firefox OS)
defect
Not set
normal

Tracking

(feature-b2g:2.2r+, firefox41 fixed, b2g-v2.2r fixed)

RESOLVED FIXED
2.2 S12 (15may)
feature-b2g 2.2r+
Tracking Status
firefox41 --- fixed
b2g-v2.2r --- fixed

People

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

References

Details

(Whiteboard: [red-tai])

Attachments

(6 files, 6 obsolete files)

10.52 KB, patch
Details | Diff | Splinter Review
14.73 KB, patch
shawnjohnjr
: review+
Details | Diff | Splinter Review
8.31 KB, patch
Details | Diff | Splinter Review
10.24 KB, patch
Details | Diff | Splinter Review
5.27 KB, patch
Details | Diff | Splinter Review
14.73 KB, patch
Details | Diff | Splinter Review
TODO - Listen PBAP socket as PSE & accept incoming connection - Reply to PBAP client connection/disconnection request
Attached patch WIP patch (v1) (obsolete) — Splinter Review
Assignee: nobody → btian
Attachment #8598535 - Attachment is obsolete: true
Attachment #8599175 - Flags: review?(shuang)
Attachment #8599176 - Flags: review?(shuang)
Attachment #8599179 - Flags: review?(shuang)
Whiteboard: [red-tai]
Comment on attachment 8599175 [details] [diff] [review] Patch 1/3 (v1): Add OBEX related functions Review of attachment 8599175 [details] [diff] [review]: ----------------------------------------------------------------- Overall code looks good. ::: dom/bluetooth/ObexBase.cpp @@ +27,5 @@ > return headerLength; > } > > int > +AppendHeader(uint8_t aHeaderId, uint8_t* aRetBuf, int aValue) Do you mind adding one line comment to explain the purpose of this function? After renaming this function, it's a bit hard to understand the purpose. ::: dom/bluetooth/ObexBase.h @@ +209,5 @@ > if (mHeaders[i]->mId == ObexHeaderId::Body || > mHeaders[i]->mId == ObexHeaderId::EndOfBody) { > + uint8_t* ptr = mHeaders[i]->mData.get(); > + *aRetBody = new uint8_t[mHeaders[i]->mDataLength]; > + nit:Remove this empty line. @@ +229,3 @@ > uint8_t* ptr = mHeaders[i]->mData.get(); > + *aRetTarget = new uint8_t[mHeaders[i]->mDataLength]; > + nit:Remove this empty line.
Attachment #8599175 - Flags: review?(shuang) → review+
Comment on attachment 8599176 [details] [diff] [review] Patch 2/3 (v1): Revise profile disconnection when BT stops Review of attachment 8599176 [details] [diff] [review]: ----------------------------------------------------------------- ::: dom/bluetooth/bluedroid/BluetoothServiceBluedroid.cpp @@ +351,5 @@ > + } > + > + if (sProfiles[i]->IsConnected()) { > + sProfiles[i]->Disconnect(nullptr); > + } else if (!profileName.EqualsLiteral("OPP") && What would happen if someone modifies managers' name? Maybe it's not a real problem, but if the change happens it's not easy to find the side effects.
Attachment #8599176 - Flags: review?(shuang) → review+
(In reply to Shawn Huang [:shawnjohnjr] from comment #6) > What would happen if someone modifies managers' name? Maybe it's not a real > problem, but if the change happens it's not easy to find the side effects. What do you mean by 'modify manager's name'? The name is queried on request [1] rather than a member variable. Also any suggestion? One way is to have empty |Reset| for OPP & PBAP managers. [1] https://dxr.mozilla.org/mozilla-central/source/dom/bluetooth/bluedroid/BluetoothOppManager.h#46
Flags: needinfo?(shuang)
Revise per reviewer's comment 5.
Attachment #8599175 - Attachment is obsolete: true
(In reply to Ben Tian [:btian] from comment #7) > (In reply to Shawn Huang [:shawnjohnjr] from comment #6) > > What would happen if someone modifies managers' name? Maybe it's not a real > > problem, but if the change happens it's not easy to find the side effects. > > What do you mean by 'modify manager's name'? The name is queried on request > [1] rather than a member variable. Also any suggestion? One way is to have > empty |Reset| for OPP & PBAP managers. > > [1] > https://dxr.mozilla.org/mozilla-central/source/dom/bluetooth/bluedroid/ > BluetoothOppManager.h#46 Keeping empty |Reset| seems to be trivial to me. Originally, I thought it's bad to check literal string (it depends on the assumption that no one is going to refactor the name) but now I think this is the easiest way. So please ignore my question.
Flags: needinfo?(shuang)
Revise |CompareHeaderTarget| function.
Attachment #8599179 - Attachment is obsolete: true
Attachment #8599179 - Flags: review?(shuang)
Attachment #8603267 - Flags: review?(shuang)
Changes: - add functions |AfterPbapConnected| and |AfterPbapDisconnected| to set/reset member variables - revise logs to be clear
Attachment #8603267 - Attachment is obsolete: true
Attachment #8603267 - Flags: review?(shuang)
Attachment #8603981 - Flags: review?(shuang)
Comment on attachment 8603981 [details] [diff] [review] Patch 3/3 (v3): Implement PBAP manger Review of attachment 8603981 [details] [diff] [review]: ----------------------------------------------------------------- Code looks good, and it's very similar with OPP manager. Some nits need your help. ::: dom/bluetooth/bluedroid/BluetoothPbapManager.cpp @@ +11,5 @@ > +#include "BluetoothSocket.h" > +#include "BluetoothUuid.h" > +#include "ObexBase.h" > + > +//#include "mozilla/dom/bluetooth/BluetoothTypes.h" nit: Please remove this line. @@ +163,5 @@ > + > + mServerSocket = > + new BluetoothSocket(this, BluetoothSocketType::RFCOMM, false, true); > + > + BT_LOGR("PBAP"); nit: Maybe you can have just one single message with a descriptive string. @@ +186,5 @@ > + const uint8_t* data = aMessage->GetData(); > + int receivedLength = aMessage->GetSize(); > + uint8_t opCode = data[0]; > + > + BT_LOGR("> 0x%x", opCode); If the opCode won't create much trouble, I prefer don't print it. @@ +208,5 @@ > + > + ReplyToConnect(); > + AfterPbapConnected(); > + break; > + nit: Please remove this blank line. @@ +222,5 @@ > + > + ReplyToDisconnectOrAbort(); > + AfterPbapDisconnected(); > + break; > + nit: Please remove this blank line. @@ +231,5 @@ > + case ObexRequestCode::SetPath: > + ReplyError(ObexResponseCode::BadRequest); > + BT_LOGR("Unsupported ObexRequestCode %x", opCode); > + break; > + nit: Please remove this blank line. @@ +350,5 @@ > + > +void > +BluetoothPbapManager::SendObexData(uint8_t* aData, uint8_t aOpcode, int aSize) > +{ > + BT_LOGR("< 0x%x", aOpcode); Do we really need to print opcode? @@ +362,5 @@ > + MOZ_ASSERT(aSocket); > + MOZ_ASSERT(aSocket == mServerSocket); > + MOZ_ASSERT(!mSocket); > + > + BT_LOGR("PBAP"); Ditto.
Attachment #8603981 - Flags: review?(shuang)
(In reply to Shawn Huang [:shawnjohnjr] from comment #12) > @@ +186,5 @@ > > + const uint8_t* data = aMessage->GetData(); > > + int receivedLength = aMessage->GetSize(); > > + uint8_t opCode = data[0]; > > + > > + BT_LOGR("> 0x%x", opCode); > > If the opCode won't create much trouble, I prefer don't print it. > > @@ +350,5 @@ > > + > > +void > > +BluetoothPbapManager::SendObexData(uint8_t* aData, uint8_t aOpcode, int aSize) > > +{ > > + BT_LOGR("< 0x%x", aOpcode); > > Do we really need to print opcode? I keep them for later development debugging. I'll remove in next patch.
Attachment #8603981 - Attachment is obsolete: true
Attachment #8604009 - Flags: review?(shuang)
Comment on attachment 8604009 [details] [diff] [review] [final] Patch 3/3: Implement PBAP manger, r=shuang Review of attachment 8604009 [details] [diff] [review]: ----------------------------------------------------------------- ::: dom/bluetooth/bluedroid/BluetoothPbapManager.cpp @@ +265,5 @@ > + > +void > +BluetoothPbapManager::AfterPbapConnected() > +{ > + mConnected = true; Do you plan to add more pieces of code in the future? I guess one line function is not necessary. @@ +271,5 @@ > + > +void > +BluetoothPbapManager::AfterPbapDisconnected() > +{ > + mConnected = false; Ditto.
Attachment #8604009 - Flags: review?(shuang) → review+
(In reply to Shawn Huang [:shawnjohnjr] from comment #15) > Do you plan to add more pieces of code in the future? I guess one line > function is not necessary. Yes, please refer to bug 1162902. I'll do some cleanup once all implementation are done.
ICS emulator fails to build since PBAP manager is unsupported for BlueZ. Revising patch and retry. https://treeherder.mozilla.org/#/jobs?repo=try&revision=8acc5dc6c76e
Add build flag to build for BlueZ on ICS emulator.
Attachment #8599176 - Attachment is obsolete: true
Attachment #8604009 - Attachment description: Patch 3/3 (v4): Implement PBAP manger → [final] Patch 3/3: Implement PBAP manger, r=shuang
Wesley, please help mark this bug feature-b2g:2.2r since BT feature PBAP depends on this bug.
Flags: needinfo?(whuang)
Blocks: 1162902
Depends on: 1152694
feature-b2g: --- → 2.2r+
Flags: needinfo?(whuang)
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: