Closed
Bug 839370
Opened 11 years ago
Closed 11 years ago
[b2g-bluetooth] Update SDP if we failed to get service channel during the process of creating sockets
Categories
(Firefox OS Graveyard :: Bluetooth, defect)
Tracking
(blocking-b2g:leo+, firefox22 wontfix, firefox23 wontfix, firefox24 fixed, b2g18 fixed, b2g18-v1.0.0 wontfix, b2g18-v1.0.1 wontfix, b2g-v1.1hd fixed)
People
(Reporter: gyeh, Assigned: echou)
References
Details
(Whiteboard: [fixed-in-birch])
Attachments
(4 files, 4 obsolete files)
8.60 KB,
patch
|
gyeh
:
review+
|
Details | Diff | Splinter Review |
11.00 KB,
patch
|
gyeh
:
review+
|
Details | Diff | Splinter Review |
10.45 KB,
patch
|
Details | Diff | Splinter Review | |
15.55 KB,
patch
|
Details | Diff | Splinter Review |
If we failed to get create a socket since no proper service channel is returned from bluez, we try to refresh SDP and retry to create the socket again.
Reporter | ||
Comment 1•11 years ago
|
||
We may need this feature in some scenarios. For example, we pair our phone with a ubuntu laptop, in which the default setting of personal file sharing over Bluetooth is disabled. So we don't have the service channel of Oop recorded in our bluez. After enabling the setting, we don't need to unpair and pair again and can set file to the laptop.
Reporter | ||
Comment 2•11 years ago
|
||
I should describe the patch in this way. With this patch, we don't need to unpair and pair again to get new service record in bluez after enabling the setting on the laptop.
Reporter | ||
Comment 3•11 years ago
|
||
Attachment #711701 -
Flags: review?(echou)
Assignee | ||
Updated•11 years ago
|
Attachment #711701 -
Flags: review?(echou)
Assignee | ||
Comment 4•11 years ago
|
||
Since Bluetooth code has been largely revised, such as profile managers are not UnixSocketConsumer anymore, we need a new patch which is rebased on current codebase. The patches are almost ready.
Assignee | ||
Comment 5•11 years ago
|
||
Assignee: gyeh → echou
Attachment #711701 -
Attachment is obsolete: true
Attachment #751532 -
Flags: review?(gyeh)
Assignee | ||
Comment 6•11 years ago
|
||
Attachment #751535 -
Flags: review?(gyeh)
Reporter | ||
Comment 7•11 years ago
|
||
Comment on attachment 751532 [details] [diff] [review] patch 1: v1: Implement function UpdateSdpRecords() Review of attachment 751532 [details] [diff] [review]: ----------------------------------------------------------------- Would like to review again after patch updated and questions answered. ::: dom/bluetooth/linux/BluetoothDBusService.cpp @@ +2754,5 @@ > + BluetoothProfileManagerBase* mManager; > +}; > + > +void > +DiscoverServicesCb(DBusMessage* aMsg, void* aData) Since names of other callback functions are ended with Callback, can we rename this function to keep consistency? @@ +2777,5 @@ > + BluetoothProfileManagerBase* aManager) > +{ > + MOZ_ASSERT(NS_IsMainThread()); > + MOZ_ASSERT(mConnection); > + MOZ_ASSERT(!aDeviceAddress.IsEmpty()); Maybe we can also check aManger here to make sure it isn't null. @@ +2784,5 @@ > + > + UpdateSdpRecordsParameters* params = new UpdateSdpRecordsParameters(); > + params->mDeviceObjectPath = objectPath; > + params->mManager = aManager; > + Can we create an instance of OnUpdateSdpRecordsRunnable and keep |objectPath| and |aManager| as data member? Then, pass it into the following dbus call as the 4th argument. In this way, in the callback function, which is DiscoverServicesCb, we can cast the runnble back to type |OnUpdateSdpRecordsRunnable| and dispatch it to main thread. No need to create a struct for parameters, right?
Attachment #751532 -
Flags: review?(gyeh)
Assignee | ||
Comment 8•11 years ago
|
||
* Problems fixed and suggestion is taken!
Attachment #751532 -
Attachment is obsolete: true
Attachment #752126 -
Flags: review?(gyeh)
Assignee | ||
Comment 9•11 years ago
|
||
Attachment #751535 -
Attachment is obsolete: true
Attachment #751535 -
Flags: review?(gyeh)
Attachment #752127 -
Flags: review?(gyeh)
Reporter | ||
Comment 10•11 years ago
|
||
Comment on attachment 752127 [details] [diff] [review] patch 2: v2: Implement callback function OnUpdateSdpRecords() in BluetoothProfileManagers Review of attachment 752127 [details] [diff] [review]: ----------------------------------------------------------------- Overall is good. Comments for hfp manager and opp manager are pretty similar, so I only write comments on hfp part. Would like to see the patch again after updated. ::: dom/bluetooth/BluetoothHfpManager.cpp @@ +1010,4 @@ > BluetoothUuidHelper::GetString(BluetoothServiceClass::HEADSET, uuid); > } > > + mUpdateSdpRecordsTicket = 1; I think we don't need to assign |mUpdateSdpRecordsTicket| here again, right? @@ +1512,5 @@ > + // Since we have updated SDP records of the target device, we should > + // try to get the channel of target service again. > + if (NS_FAILED(bs->GetServiceChannel(aDeviceAddress, uuid, this))) { > + BluetoothValue v; > + DispatchBluetoothReply(mRunnable, v, How about this? DispatchBluetoothReply(mRunnable, BluetoothValue(), ...); So that we don't have to declare a BluetoothValue object before dispatching reply. @@ +1514,5 @@ > + if (NS_FAILED(bs->GetServiceChannel(aDeviceAddress, uuid, this))) { > + BluetoothValue v; > + DispatchBluetoothReply(mRunnable, v, > + NS_LITERAL_STRING(ERR_SERVICE_CHANNEL_NOT_FOUND)); > + return; The return statement can be discarded. @@ +1534,4 @@ > BluetoothValue v; > > if (aChannel < 0) { > + if (mUpdateSdpRecordsTicket-- > 0) { The conditional statement can be simplified to |mUpdateSdpRecordsTicket--| Or, if we make mUpdateSdpRecordsTicket as a boolean variable, the conditional statement would be |mUpdateSdpRecordsTicket| and re-assign it to false. @@ +1546,3 @@ > return; > } > I found there's a redundant return statement a few lines after. Can you help to remove it? if (!mSocket->Connect(NS_ConvertUTF16toUTF8(aDeviceAddress), aChannel)) { DispatchBluetoothReply(mRunnable, v, NS_LITERAL_STRING("SocketConnectionError")); mSocket = nullptr; Listen(); return; // not necessarily } ::: dom/bluetooth/BluetoothHfpManager.h @@ +132,5 @@ > int mNetworkSelectionMode; > bool mReceiveVgsFlag; > bool mBLDNProcessed; > + bool mIsHandsfree; > + int mUpdateSdpRecordsTicket; Can we just make it a boolean variable? ::: dom/bluetooth/BluetoothOppManager.cpp @@ +270,2 @@ > BluetoothValue v; > DispatchBluetoothReply(aRunnable, v, Again, we probably can use ctor of BluetoothValue to create an object as parameter.
Attachment #752127 -
Flags: review?(gyeh)
Reporter | ||
Comment 11•11 years ago
|
||
Comment on attachment 752126 [details] [diff] [review] patch 1: v2: Implement function UpdateSdpRecords() Review of attachment 752126 [details] [diff] [review]: ----------------------------------------------------------------- Perfect!
Reporter | ||
Comment 12•11 years ago
|
||
Comment on attachment 752126 [details] [diff] [review] patch 1: v2: Implement function UpdateSdpRecords() Review of attachment 752126 [details] [diff] [review]: ----------------------------------------------------------------- Perfect!
Attachment #752126 -
Flags: review?(gyeh) → review+
Assignee | ||
Comment 13•11 years ago
|
||
* nits picked
Attachment #752127 -
Attachment is obsolete: true
Attachment #752609 -
Flags: review?(gyeh)
Reporter | ||
Comment 14•11 years ago
|
||
Comment on attachment 752609 [details] [diff] [review] patch 2: v3: Implement callback function OnUpdateSdpRecords() in BluetoothProfileManagers Review of attachment 752609 [details] [diff] [review]: ----------------------------------------------------------------- r+'d with nits addressed. ::: dom/bluetooth/BluetoothHfpManager.cpp @@ +1014,2 @@ > BluetoothValue v; > DispatchBluetoothReply(aRunnable, v, You might want to use ctor of BluetoothValue here? ::: dom/bluetooth/BluetoothOppManager.cpp @@ +1477,5 @@ > + BluetoothUuidHelper::GetString(BluetoothServiceClass::OBJECT_PUSH, uuid); > + > + if (NS_FAILED(bs->GetServiceChannel(aDeviceAddress, uuid, this))) { > + BluetoothValue v; > + DispatchBluetoothReply(mRunnable, v, The same with above. ::: dom/bluetooth/linux/BluetoothDBusService.cpp @@ +2531,5 @@ > opp->Connect(aDeviceAddress, aRunnable); > } else { > BluetoothValue v; > + DispatchBluetoothReply(aRunnable, v, > + NS_LITERAL_STRING("UnknownProfileError")); The same with above.
Attachment #752609 -
Flags: review?(gyeh) → review+
Assignee | ||
Comment 15•11 years ago
|
||
birch: https://hg.mozilla.org/projects/birch/rev/3aae540739b8 https://hg.mozilla.org/projects/birch/rev/f8aadf7fa01b
Whiteboard: [fixed-in-birch]
Assignee | ||
Updated•11 years ago
|
Component: DOM: Device Interfaces → Bluetooth
Product: Core → Boot2Gecko
Version: 21 Branch → unspecified
Comment 16•11 years ago
|
||
https://hg.mozilla.org/mozilla-central/rev/f8aadf7fa01b https://hg.mozilla.org/mozilla-central/rev/3aae540739b8
Status: NEW → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Assignee | ||
Comment 17•11 years ago
|
||
Nominate this as leo+ since we need this to fix bug 884253 in b2g18.
Blocks: 884253
blocking-b2g: --- → leo?
Assignee | ||
Comment 19•11 years ago
|
||
* b2g18-specific patch
Assignee | ||
Comment 20•11 years ago
|
||
* b2g18-specific patch
Assignee | ||
Updated•11 years ago
|
status-b2g18:
--- → affected
status-b2g18-v1.0.1:
--- → wontfix
Comment 21•11 years ago
|
||
https://hg.mozilla.org/releases/mozilla-b2g18/rev/7a85f4b71618 https://hg.mozilla.org/releases/mozilla-b2g18/rev/5967e6bd0d64
status-b2g18-v1.0.0:
--- → wontfix
status-b2g-v1.1hd:
--- → affected
status-firefox22:
--- → wontfix
status-firefox23:
--- → wontfix
status-firefox24:
--- → fixed
Comment 22•11 years ago
|
||
https://hg.mozilla.org/releases/mozilla-b2g18_v1_1_0_hd/rev/7a85f4b71618 https://hg.mozilla.org/releases/mozilla-b2g18_v1_1_0_hd/rev/5967e6bd0d64
You need to log in
before you can comment on or make changes to this bug.
Description
•