Closed
Bug 796176
Opened 14 years ago
Closed 14 years ago
[b2g-bluetooth] Paired devices do not autoconnect on power-up
Categories
(Core :: DOM: Device Interfaces, defect)
Tracking
()
People
(Reporter: qdot, Assigned: qdot)
References
Details
(Whiteboard: [LOE: S])
Attachments
(2 files)
|
7.92 KB,
patch
|
cjones
:
review+
|
Details | Diff | Splinter Review |
|
16.38 KB,
patch
|
echou
:
review+
|
Details | Diff | Splinter Review |
Repro:
- Turn on bluetooth on phone
- Pair device
- Turn bluetooth device off
- Turn bluetooth device back on
Expected behavior:
Device automatically connects on power up
Actual behavior:
NOTHING. ABSOLUTELY NOTHING.
Comment 1•14 years ago
|
||
Nice UHF reference.
Bluetooth device pairing should Just WorkTM.
blocking-basecamp: ? → +
| Assignee | ||
Comment 3•14 years ago
|
||
Attachment #669400 -
Flags: review?(jones.chris.g)
| Assignee | ||
Comment 4•14 years ago
|
||
Attachment #669401 -
Flags: review?(echou)
Comment 5•14 years ago
|
||
Comment on attachment 669401 [details] [diff] [review]
Patch 2 (v1) - Make Bluetooth*Managers listen on startup/disconnect, stop listening to stop/connect
Review of attachment 669401 [details] [diff] [review]:
-----------------------------------------------------------------
Looks good to me, but I have several questions. Please take a look at it and I will r+ after revision is made or question is answered. Thanks in advance.
::: dom/bluetooth/BluetoothHfpManager.h
@@ +22,5 @@
> public:
> ~BluetoothHfpManager();
> static BluetoothHfpManager* Get();
> + virtual void ReceiveSocketData(mozilla::ipc::UnixSocketRawData* aMessage)
> + MOZ_OVERRIDE;
Nit: Please help to add MOZ_OVERRIDE to BluetoothOppManager.h and BluetoothScoManager.h
::: dom/bluetooth/BluetoothOppManager.cpp
@@ +463,5 @@
> }
> +
> +void
> +BluetoothOppManager::OnConnectSuccess()
> +{
I was wondering if we can add an parameter "device address" to this function. When a remote requests to send a file, a socket connection has to be created first. After that, OppManager will send a system message to inform Gaia of the request, and device address will be needed for apps retrieving device properties, especially device name. This is the only chance for OppManager to get connecting device address if the remote device initiated the connection.
@@ +469,5 @@
> +
> +void
> +BluetoothOppManager::OnConnectError()
> +{
> +}
Will we have OnDisconnected*()?
Comment on attachment 669400 [details] [diff] [review]
Patch 1 (v1) - UnixSocket changes to get connect/listen running main thread, connect status to consumers
Sorry for the review lag.
>diff --git a/ipc/unixsocket/UnixSocket.cpp b/ipc/unixsocket/UnixSocket.cpp
>+ void SetConsumerStatus(UnixSocketConsumer::ConnectionStatus s)
>+ {
>+ mConsumer->mConnectionStatus = s;
>+ }
Let's decouple UnixSocketConsumer from the impl a bit more by having
private UnixSocketConsumer::NotifySuccess/Error() methods called by
Impl, which set the status and make the right On*() call. So we can
remove this in favor of that.
>+class OnConnectSuccessTask : public nsRunnable
>+ NS_IMETHOD Run()
>+ {
>+ MOZ_ASSERT(NS_IsMainThread());
>+ if(!mImpl->mConsumer) {
>+ NS_WARNING("mConsumer is null!");
A more useful warning to consumers might be something like,
"CloseSocket() has already been called! (mConsumer is null)".
>+UnixSocketConsumer::UnixSocketConsumer() : mImpl(nullptr)
>+ , mConnectionStatus(DISCONNECTED)
Nit
UnixSocketConsumer::UnixSocketConsumer()
: mImpl(nullptr)
, mConnectionStatus(DISCONNECTED)
>diff --git a/ipc/unixsocket/UnixSocket.h b/ipc/unixsocket/UnixSocket.h
>- virtual bool Setup(int aFd) = 0;
>+ virtual bool Setup(int aFd) = 0;
Missed this before, but grammar nit: |SetUp()|.
>+ enum ConnectionStatus {
>+ DISCONNECTED = 0,
>+ CONNECTING = 1,
>+ CONNECTED = 2
>+ };
Call this SocketConnectionStatus, make the names SOCKET_*, and define
it outside the class (but inside mozilla::ipc) so that consumers don't
need to prefix |UnixSocketConsumer::| everywhere. (This is a C++ bug,
sorry.)
>+ virtual void OnConnectSuccess() = 0;
>+ virtual void OnConnectError() = 0;
>+
These need to be documented.
Looks good! r=me with above fixed.
Attachment #669400 -
Flags: review?(jones.chris.g) → review+
Comment 7•14 years ago
|
||
Comment on attachment 669401 [details] [diff] [review]
Patch 2 (v1) - Make Bluetooth*Managers listen on startup/disconnect, stop listening to stop/connect
Review of attachment 669401 [details] [diff] [review]:
-----------------------------------------------------------------
Looks good, r+ after revision is made or questions are answered.
Attachment #669401 -
Flags: review?(echou) → review+
| Assignee | ||
Comment 8•14 years ago
|
||
(In reply to Eric Chou [:ericchou] [:echou] from comment #5)
> I was wondering if we can add an parameter "device address" to this
> function. When a remote requests to send a file, a socket connection has to
> be created first. After that, OppManager will send a system message to
> inform Gaia of the request, and device address will be needed for apps
> retrieving device properties, especially device name. This is the only
> chance for OppManager to get connecting device address if the remote device
> initiated the connection.
We can't add device address to OnConnect because this is UnixSocket, which is a general class for raw unix sockets. That said, I might be able to figure out some other way of getting the information, but I'm not sure what kind of identification we get from bluetooth that a device has connected outside of the low level "Connected" attribute from DBus, which doesn't relate to UnixSocket? Any idea how android does this?
> @@ +469,5 @@
> > +
> > +void
> > +BluetoothOppManager::OnConnectError()
> > +{
> > +}
>
> Will we have OnDisconnected*()?
Oh, huh. Yeah. I should implement that.
| Assignee | ||
Comment 9•14 years ago
|
||
| Assignee | ||
Comment 10•14 years ago
|
||
OnDisconnect being handled in Bug 800247
Device Address being handled in Bug 800249
Comment 12•14 years ago
|
||
https://hg.mozilla.org/mozilla-central/rev/5521c75effb5
https://hg.mozilla.org/mozilla-central/rev/588d77a57013
Status: NEW → RESOLVED
Closed: 14 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla19
Comment 14•14 years ago
|
||
You need to log in
before you can comment on or make changes to this bug.
Description
•