Closed Bug 1122327 Opened 10 years ago Closed 10 years ago

[System][Bluetooth] Wrap current Bluetooth module to instanciable format

Categories

(Firefox OS Graveyard :: Bluetooth, defect)

ARM
Gonk (Firefox OS)
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: gasolin, Assigned: gasolin)

References

Details

Attachments

(2 files)

Current BT related status icon depends on window.Bluetooth to get profileConnection stat, which will cause problem when we switch to bluetooth APIv2 The affect files include: media_playback screen_manager sound_manager statusbar system_nfc_connect_dialog Besides, we'd better follow the naming convention in Settings/Bluetooth to rename current Bluetooth.js/BluetoothTransfer.js to Bluetooth1.js/BluetoothTransfer1.js and make APIv2 version use the origin name. The work need to based on icon per module bug 1098168
Blocks: 1093084
@alive I'd like wrap current Bluetooth module to instanciable format, and implement same profileConnection api on Bluetooth v2. Therefore we only have to change file reference to non-capital 'window.bluetooth'. Is it make sense to you? // pseudo code in bluetooth_core if (APIv1) { window.bluetooth = new Bluetooth1(); (v1) ... else { // APIv2 window.bluetooth = new Bluetooth(); (v2); .. }
Flags: needinfo?(alive)
Assignee: nobody → gasolin
Found after rename window.Bluetooth in Bluetooth.js to window.Bluetooth1, the follow code simply works in bluetooth_core window.Bluetooth = window.Bluetooth1; window.BluetoothTransfer = window.BluetoothTransfer1; window.Bluetooth.init(); window.BluetoothTransfer.init(); So we don't have to change affect files and not have to change the existing Bluetooth v1 file too much.
Flags: needinfo?(alive)
Comment on attachment 8550039 [details] [review] [PullReq] gasolin:issue-1122327 to mozilla-b2g:master * rename module to fit the naming convention in Settings/Bluetooth * fix lint error of Bluetooth Transfer test nfc/BT paring transfer test fine The current approach also make API change independent to statusbar and other system part.
Attachment #8550039 - Flags: review?(iliu)
Attachment #8550039 - Flags: review?(alive)
Comment on attachment 8550039 [details] [review] [PullReq] gasolin:issue-1122327 to mozilla-b2g:master gij is fail, will fix it before review. Change to feedback? instead.
Attachment #8550039 - Flags: review?(iliu)
Attachment #8550039 - Flags: review?(alive)
Attachment #8550039 - Flags: feedback?(iliu)
Attachment #8550039 - Flags: feedback?(alive)
Comment on attachment 8550039 [details] [review] [PullReq] gasolin:issue-1122327 to mozilla-b2g:master I don't see big value before there is a Bluetooth2.js but anyway.
Attachment #8550039 - Flags: feedback?(alive) → feedback+
Comment on attachment 8550039 [details] [review] [PullReq] gasolin:issue-1122327 to mozilla-b2g:master Feedback + for me. The major change is to fit the old v1 code base. And we no need to do too much refinement since we also want to refactor the code base for v2. We would like to make Bluetooth() module be new-able in system app in the feature.
Attachment #8550039 - Flags: feedback?(iliu) → feedback+
Thanks for feedback. I will send another PR based on bug 1098168
Status: NEW → ASSIGNED
Depends on: 1098168
Summary: [System][Bluetooth] Make BT profile connection independent from API version → [System][Bluetooth] Wrap current Bluetooth module to instanciable format
Comment on attachment 8574533 [details] [review] [gaia] gasolin:issue-1122327-3 > mozilla-b2g:master The patch wrap BTv1 via Lazyload and fix bluetooth_transfer.js jshint error. Transfer and quicksettings works fine on v1 device. In future patch I'd like to reuse bluetooth_transfer for both v1/v2, so the naming is unchanged. Will try to move bluetooth_transfer to instanciable format in future patch.
Attachment #8574533 - Flags: review?(iliu)
Attachment #8574533 - Flags: review?(alive)
Comment on attachment 8574533 [details] [review] [gaia] gasolin:issue-1122327-3 > mozilla-b2g:master nits
Attachment #8574533 - Flags: review?(alive) → review+
Comment on attachment 8574533 [details] [review] [gaia] gasolin:issue-1122327-3 > mozilla-b2g:master r+ with me! Thanks for your effort here.
Attachment #8574533 - Flags: review?(iliu) → review+
Thanks for review! Will rename this._debug to this.debug for consistency. Will land after gij + gip test cases fixed
Depends on: 1141442
Blocks: 1090799
treeherfer green after bug 1141442 fixed, merged to master https://github.com/mozilla-b2g/gaia/commit/f1bcd41e881a42b75336a48942c59a767782e0ee Since the indent fix make followup PR harder to merge, would like to fix indent after related patch landed. Thanks!
Status: ASSIGNED → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: