Closed Bug 1115337 Opened 10 years ago Closed 7 years ago

Refactor BluetoothDaemonProtocol

Categories

(Firefox OS Graveyard :: Bluetooth, defect)

ARM
Gonk (Firefox OS)
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED WONTFIX

People

(Reporter: brsun, Unassigned)

Details

Make inherited / cooperated relationship between BluetoothDaemonProtocol and BluetoothDaemonXXXModule clearer.
Hi (In reply to Bruce Sun [:brsun] from comment #50) > I found that the inherited / cooperated relationship between > BluetoothDaemonProtocol and BluetoothDaemonXXXModule are somewhat not so > rational: I think the problem is more complicated than you realize. The current design is not irrational, but the consequence of the way the HAL protocol and the APIs work. I put quite some thought into this, so it's actual rather rational (in the common meaning of this word). ;) > - RegisterModule() / UnregisterModule() is supposed to be declared in > BluetoothDaemonSetupModule. > - RegisterModule() / UnregisterModule() is not supposed to be declared > repeatedly in all profile-related BluetoothDaemonXXXModule. In the API, each module is stands for itself. If you initialize or cleanup, you need to Register or Unregister this module. This spec of the HAL protocol also says this. However registering is part of the Setup module. That means we need to call into the Setup module from any other module whenever we have to register that module. The easiest way for achieving this is the virtual method |RegisterModule|, which is currently declared by each module and implemented by |BluetoothDaemonProtocol|. > - Send() is not supposed to be declared repeatedly in all existing > BluetoothDaemonXXXModule. There are two socket connections to the daemon. Both are shared by all modules for sending and receiving. The connections must be maintained at a central place, which is |BluetoothDaemonProtocol|. By providing a virtual method |Send| in each module and implementing that method in |BluetoothDaemonProtocol|, we can offer the socket connections to all modules. I admit that these details are not obvious. The AVRCP patches in bug 1095488 add a lengthy comment to |BluetoothDaemonProtocol| that explains all this in detail.
Firefox OS is not being worked on
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → WONTFIX
You need to log in before you can comment on or make changes to this bug.