Merge m-c to inbound. a=merge

This commit is contained in:
Ryan VanderMeulen 2015-06-15 15:56:20 -04:00
commit e3ce9c3d4c
126 changed files with 4121 additions and 2188 deletions

View File

@ -277,7 +277,7 @@ let LogShake = {
try {
LogCapture.getScreenshot().then(screenshot => {
logArrays["logshake-screenshot.png"] = screenshot;
logArrays["screenshot.png"] = screenshot;
});
} catch (ex) {
Cu.reportError("Unable to get screenshot dump: " + ex);

View File

@ -15,7 +15,7 @@
<project name="platform_build" path="build" remote="b2g" revision="e862ab9177af664f00b4522e2350f4cb13866d73">
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="gaia" path="gaia" remote="mozillaorg" revision="1bf2da102560481748ff3f6202fbed5c4daa5832"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="0c073eda92b099bc008488e52edb0745c5f7975e"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="3477513bcd385571aa01c0d074849e35bd5e2376"/>
<project name="librecovery" path="librecovery" remote="b2g" revision="1b3591a50ed352fc6ddb77462b7b35d0bfa555a3"/>
@ -146,7 +146,7 @@
<project name="platform/hardware/ril" path="hardware/ril" revision="12b1977cc704b35f2e9db2bb423fa405348bc2f3"/>
<project name="platform/system/bluetooth" path="system/bluetooth" revision="985bf15264d865fe7b9c5b45f61c451cbaafa43d"/>
<project name="platform/system/core" path="system/core" revision="42839aedcf70bf6bc92a3b7ea4a5cc9bf9aef3f9"/>
<project name="platform_system_nfcd" path="system/nfcd" remote="b2g" revision="d82e00fb6380b4f6cea7a96213913ee9eb441239"/>
<project name="platform_system_nfcd" path="system/nfcd" remote="b2g" revision="476b3e194d8582ec8bc9968190d896c10c7b3be7"/>
<project name="platform/system/qcom" path="system/qcom" revision="63e3f6f176caad587d42bba4c16b66d953fb23c2"/>
<project name="platform/vendor/qcom/copper" path="device/qcom/msm8974" revision="ec7bc1a26610922156d7d412b4d3de6b4adb93da"/>
<project name="vendor_broadcom_wlan" path="vendor/broadcom/wlan" remote="b2g" revision="114b9491a8a919687da4e22fbd89fab511d6d8d7"/>

View File

@ -15,7 +15,7 @@
<project name="platform_build" path="build" remote="b2g" revision="e862ab9177af664f00b4522e2350f4cb13866d73">
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="gaia" path="gaia" remote="mozillaorg" revision="1bf2da102560481748ff3f6202fbed5c4daa5832"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="0c073eda92b099bc008488e52edb0745c5f7975e"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="3477513bcd385571aa01c0d074849e35bd5e2376"/>
<project name="librecovery" path="librecovery" remote="b2g" revision="1b3591a50ed352fc6ddb77462b7b35d0bfa555a3"/>

View File

@ -19,7 +19,7 @@
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="1bf2da102560481748ff3f6202fbed5c4daa5832"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="0c073eda92b099bc008488e52edb0745c5f7975e"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="3477513bcd385571aa01c0d074849e35bd5e2376"/>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="5ef30994f4778b4052e58a4383dbe7890048c87e"/>
<project name="platform_hardware_ril" path="hardware/ril" remote="b2g" revision="87a2d8ab9248540910e56921654367b78a587095"/>

View File

@ -17,7 +17,7 @@
</project>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="5ef30994f4778b4052e58a4383dbe7890048c87e"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="1bf2da102560481748ff3f6202fbed5c4daa5832"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="0c073eda92b099bc008488e52edb0745c5f7975e"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="3477513bcd385571aa01c0d074849e35bd5e2376"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="46da1a05ac04157669685246d70ac59d48699c9e"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="94516f787d477dc307e4566f415e0d2f0794f6b9"/>
@ -135,7 +135,7 @@
<project name="platform_external_qemu" path="external/qemu" remote="b2g" revision="c5f8d282efe4a4e8b1e31a37300944e338e60e4f"/>
<project name="platform/external/wpa_supplicant_8" path="external/wpa_supplicant_8" revision="0e56e450367cd802241b27164a2979188242b95f"/>
<project name="platform_hardware_ril" path="hardware/ril" remote="b2g" revision="9f28c4faea3b2f01db227b2467b08aeba96d9bec"/>
<project name="platform_system_nfcd" path="system/nfcd" remote="b2g" revision="d82e00fb6380b4f6cea7a96213913ee9eb441239"/>
<project name="platform_system_nfcd" path="system/nfcd" remote="b2g" revision="476b3e194d8582ec8bc9968190d896c10c7b3be7"/>
<project name="android-sdk" path="sdk" remote="b2g" revision="8b1365af38c9a653df97349ee53a3f5d64fd590a"/>
<project name="darwinstreamingserver" path="system/darwinstreamingserver" remote="b2g" revision="cf85968c7f85e0ec36e72c87ceb4837a943b8af6"/>
</manifest>

View File

@ -15,7 +15,7 @@
<project name="platform_build" path="build" remote="b2g" revision="e862ab9177af664f00b4522e2350f4cb13866d73">
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="gaia" path="gaia" remote="mozillaorg" revision="1bf2da102560481748ff3f6202fbed5c4daa5832"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="0c073eda92b099bc008488e52edb0745c5f7975e"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="3477513bcd385571aa01c0d074849e35bd5e2376"/>
<project name="librecovery" path="librecovery" remote="b2g" revision="1b3591a50ed352fc6ddb77462b7b35d0bfa555a3"/>
@ -133,7 +133,7 @@
<project name="platform/external/libnfc-nci" path="external/libnfc-nci" revision="f37bd545063039e30a92f2550ae78c0e6e4e2d08"/>
<project name="platform_external_wpa_supplicant_8" path="external/wpa_supplicant_8" remote="b2g" revision="0c6a6547cd1fd302fa2b0f6e375654df36bf0ec4"/>
<project name="platform_hardware_ril" path="hardware/ril" remote="b2g" revision="2b62676f02abb7633aac619e0f92c7fd70216860"/>
<project name="platform_system_nfcd" path="system/nfcd" remote="b2g" revision="d82e00fb6380b4f6cea7a96213913ee9eb441239"/>
<project name="platform_system_nfcd" path="system/nfcd" remote="b2g" revision="476b3e194d8582ec8bc9968190d896c10c7b3be7"/>
<project name="platform/development" path="development" revision="5968ff4e13e0d696ad8d972281fc27ae5a12829b"/>
<project name="android-sdk" path="sdk" remote="b2g" revision="0951179277915335251c5e11d242e4e1a8c2236f"/>
<project name="darwinstreamingserver" path="system/darwinstreamingserver" remote="b2g" revision="cf85968c7f85e0ec36e72c87ceb4837a943b8af6"/>

View File

@ -15,7 +15,7 @@
<project name="platform_build" path="build" remote="b2g" revision="61e82f99bb8bc78d52b5717e9a2481ec7267fa33">
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="gaia" path="gaia" remote="mozillaorg" revision="1bf2da102560481748ff3f6202fbed5c4daa5832"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="0c073eda92b099bc008488e52edb0745c5f7975e"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="3477513bcd385571aa01c0d074849e35bd5e2376"/>
<project name="librecovery" path="librecovery" remote="b2g" revision="1b3591a50ed352fc6ddb77462b7b35d0bfa555a3"/>

View File

@ -19,7 +19,7 @@
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="1bf2da102560481748ff3f6202fbed5c4daa5832"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="0c073eda92b099bc008488e52edb0745c5f7975e"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="3477513bcd385571aa01c0d074849e35bd5e2376"/>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="5ef30994f4778b4052e58a4383dbe7890048c87e"/>
<project name="platform_hardware_ril" path="hardware/ril" remote="b2g" revision="87a2d8ab9248540910e56921654367b78a587095"/>

View File

@ -15,7 +15,7 @@
<project name="platform_build" path="build" remote="b2g" revision="e862ab9177af664f00b4522e2350f4cb13866d73">
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="gaia" path="gaia" remote="mozillaorg" revision="1bf2da102560481748ff3f6202fbed5c4daa5832"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="0c073eda92b099bc008488e52edb0745c5f7975e"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="3477513bcd385571aa01c0d074849e35bd5e2376"/>
<project name="librecovery" path="librecovery" remote="b2g" revision="1b3591a50ed352fc6ddb77462b7b35d0bfa555a3"/>
@ -146,7 +146,7 @@
<project name="platform/hardware/ril" path="hardware/ril" revision="12b1977cc704b35f2e9db2bb423fa405348bc2f3"/>
<project name="platform/system/bluetooth" path="system/bluetooth" revision="985bf15264d865fe7b9c5b45f61c451cbaafa43d"/>
<project name="platform/system/core" path="system/core" revision="42839aedcf70bf6bc92a3b7ea4a5cc9bf9aef3f9"/>
<project name="platform_system_nfcd" path="system/nfcd" remote="b2g" revision="d82e00fb6380b4f6cea7a96213913ee9eb441239"/>
<project name="platform_system_nfcd" path="system/nfcd" remote="b2g" revision="476b3e194d8582ec8bc9968190d896c10c7b3be7"/>
<project name="platform/system/qcom" path="system/qcom" revision="63e3f6f176caad587d42bba4c16b66d953fb23c2"/>
<project name="platform/vendor/qcom-opensource/wlan/prima" path="vendor/qcom/opensource/wlan/prima" revision="d8952a42771045fca73ec600e2b42a4c7129d723"/>
<project name="platform/vendor/qcom/msm8610" path="device/qcom/msm8610" revision="4c187c1f3a0dffd8e51a961735474ea703535b99"/>

View File

@ -1,9 +1,9 @@
{
"git": {
"git_revision": "1bf2da102560481748ff3f6202fbed5c4daa5832",
"git_revision": "0c073eda92b099bc008488e52edb0745c5f7975e",
"remote": "https://git.mozilla.org/releases/gaia.git",
"branch": ""
},
"revision": "79a7d364c5b78cd193be2c401b7763f325f44314",
"revision": "43b90c58070717da08d510200a0c848da68a4390",
"repo_path": "integration/gaia-central"
}

View File

@ -17,7 +17,7 @@
</project>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="5ef30994f4778b4052e58a4383dbe7890048c87e"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="1bf2da102560481748ff3f6202fbed5c4daa5832"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="0c073eda92b099bc008488e52edb0745c5f7975e"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="3477513bcd385571aa01c0d074849e35bd5e2376"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="46da1a05ac04157669685246d70ac59d48699c9e"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="94516f787d477dc307e4566f415e0d2f0794f6b9"/>
@ -130,7 +130,7 @@
<project name="device-mako" path="device/lge/mako" remote="b2g" revision="78d17f0c117f0c66dd55ee8d5c5dde8ccc93ecba"/>
<project name="device/generic/armv7-a-neon" path="device/generic/armv7-a-neon" revision="3a9a17613cc685aa232432566ad6cc607eab4ec1"/>
<project name="device/lge/mako-kernel" path="device/lge/mako-kernel" revision="d1729e53d71d711c8fde25eab8728ff2b9b4df0e"/>
<project name="platform_system_nfcd" path="system/nfcd" remote="b2g" revision="d82e00fb6380b4f6cea7a96213913ee9eb441239"/>
<project name="platform_system_nfcd" path="system/nfcd" remote="b2g" revision="476b3e194d8582ec8bc9968190d896c10c7b3be7"/>
<project name="platform/external/libnfc-nci" path="external/libnfc-nci" revision="7d33aaf740bbf6c7c6e9c34a92b371eda311b66b"/>
<project name="platform/external/wpa_supplicant_8" path="external/wpa_supplicant_8" revision="0e56e450367cd802241b27164a2979188242b95f"/>
<project name="platform/hardware/broadcom/wlan" path="hardware/broadcom/wlan" revision="0e1929fa3aa38bf9d40e9e953d619fab8164c82e"/>

View File

@ -15,7 +15,7 @@
<project name="platform_build" path="build" remote="b2g" revision="61e82f99bb8bc78d52b5717e9a2481ec7267fa33">
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="gaia" path="gaia" remote="mozillaorg" revision="1bf2da102560481748ff3f6202fbed5c4daa5832"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="0c073eda92b099bc008488e52edb0745c5f7975e"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="3477513bcd385571aa01c0d074849e35bd5e2376"/>
<project name="librecovery" path="librecovery" remote="b2g" revision="1b3591a50ed352fc6ddb77462b7b35d0bfa555a3"/>
@ -156,5 +156,5 @@
<project name="platform/hardware/qcom/sensors" path="hardware/qcom/sensors" revision="fde83fdf67e9b919f8a49008725bd595221bf33f"/>
<project name="platform/hardware/qcom/wlan" path="hardware/qcom/wlan" revision="6417804bea95f6e46094a01a06025a86e28c5b0d"/>
<project name="platform/hardware/ril" path="hardware/ril" revision="e00d716e7e3d31729f75399855b6921e90cb0b66"/>
<project name="platform_system_nfcd" path="system/nfcd" remote="b2g" revision="d82e00fb6380b4f6cea7a96213913ee9eb441239"/>
<project name="platform_system_nfcd" path="system/nfcd" remote="b2g" revision="476b3e194d8582ec8bc9968190d896c10c7b3be7"/>
</manifest>

View File

@ -337,6 +337,7 @@ let AboutReaderListener = {
break;
case "pagehide":
this.cancelPotentialPendingReadabilityCheck();
sendAsyncMessage("Reader:UpdateReaderButton", { isArticle: false });
break;
@ -353,12 +354,42 @@ let AboutReaderListener = {
}
},
/**
* NB: this function will update the state of the reader button asynchronously
* after the next mozAfterPaint call (assuming reader mode is enabled and
* this is a suitable document). Calling it on things which won't be
* painted is not going to work.
*/
updateReaderButton: function(forceNonArticle) {
if (!ReaderMode.isEnabledForParseOnLoad || this.isAboutReader ||
!(content.document instanceof content.HTMLDocument) ||
content.document.mozSyntheticDocument) {
return;
}
this.scheduleReadabilityCheckPostPaint(forceNonArticle);
},
cancelPotentialPendingReadabilityCheck: function() {
if (this._pendingReadabilityCheck) {
removeEventListener("MozAfterPaint", this._pendingReadabilityCheck);
delete this._pendingReadabilityCheck;
}
},
scheduleReadabilityCheckPostPaint: function(forceNonArticle) {
if (this._pendingReadabilityCheck) {
// We need to stop this check before we re-add one because we don't know
// if forceNonArticle was true or false last time.
this.cancelPotentialPendingReadabilityCheck();
}
this._pendingReadabilityCheck = this.onPaintWhenWaitedFor.bind(this, forceNonArticle);
addEventListener("MozAfterPaint", this._pendingReadabilityCheck);
},
onPaintWhenWaitedFor: function(forceNonArticle) {
this.cancelPotentialPendingReadabilityCheck();
// Only send updates when there are articles; there's no point updating with
// |false| all the time.
if (ReaderMode.isProbablyReaderable(content.document)) {

View File

@ -478,6 +478,9 @@ skip-if = e10s # bug 1100687 - test directly manipulates content (content.docume
[browser_readerMode.js]
support-files =
readerModeArticle.html
[browser_readerMode_hidden_nodes.js]
support-files =
readerModeArticleHiddenNodes.html
[browser_bug1124271_readerModePinnedTab.js]
support-files =
readerModeArticle.html

View File

@ -0,0 +1,45 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
/**
* Test that the reader mode button appears and works properly on
* reader-able content, and that ReadingList button can open and close
* its Sidebar UI.
*/
const TEST_PREFS = [
["reader.parse-on-load.enabled", true],
["browser.reader.detectedFirstArticle", false],
];
const TEST_PATH = "http://example.com/browser/browser/base/content/test/general/";
let readerButton = document.getElementById("reader-mode-button");
add_task(function* test_reader_button() {
registerCleanupFunction(function() {
// Reset test prefs.
TEST_PREFS.forEach(([name, value]) => {
Services.prefs.clearUserPref(name);
});
while (gBrowser.tabs.length > 1) {
gBrowser.removeCurrentTab();
}
});
// Set required test prefs.
TEST_PREFS.forEach(([name, value]) => {
Services.prefs.setBoolPref(name, value);
});
let tab = gBrowser.selectedTab = gBrowser.addTab();
is_element_hidden(readerButton, "Reader mode button is not present on a new tab");
// Point tab to a test page that is not reader-able due to hidden nodes.
let url = TEST_PATH + "readerModeArticleHiddenNodes.html";
yield promiseTabLoadEvent(tab, url);
yield ContentTask.spawn(tab.linkedBrowser, "", function() {
return ContentTaskUtils.waitForEvent(content, "MozAfterPaint");
});
is_element_hidden(readerButton, "Reader mode button is still not present on tab with unreadable content.");
});

View File

@ -0,0 +1,22 @@
<!DOCTYPE html>
<html>
<head>
<title>Article title</title>
<meta name="description" content="This is the article description." />
</head>
<body>
<style>
p { display: none }
</style>
<header>Site header</header>
<div>
<h1>Article title</h1>
<h2 class="author">by Jane Doe</h2>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec a diam lectus. Sed sit amet ipsum mauris. Maecenas congue ligula ac quam viverra nec consectetur ante hendrerit. Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean ut gravida lorem. Ut turpis felis, pulvinar a semper sed, adipiscing id dolor. Pellentesque auctor nisi id magna consequat sagittis. Curabitur dapibus enim sit amet elit pharetra tincidunt feugiat nisl imperdiet. Ut convallis libero in urna ultrices accumsan. Donec sed odio eros. Donec viverra mi quis quam pulvinar at malesuada arcu rhoncus. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. In rutrum accumsan ultricies. Mauris vitae nisi at sem facilisis semper ac in est.</p>
<p>Vivamus fermentum semper porta. Nunc diam velit, adipiscing ut tristique vitae, sagittis vel odio. Maecenas convallis ullamcorper ultricies. Curabitur ornare, ligula semper consectetur sagittis, nisi diam iaculis velit, id fringilla sem nunc vel mi. Nam dictum, odio nec pretium volutpat, arcu ante placerat erat, non tristique elit urna et turpis. Quisque mi metus, ornare sit amet fermentum et, tincidunt et orci. Fusce eget orci a orci congue vestibulum. Ut dolor diam, elementum et vestibulum eu, porttitor vel elit. Curabitur venenatis pulvinar tellus gravida ornare. Sed et erat faucibus nunc euismod ultricies ut id justo. Nullam cursus suscipit nisi, et ultrices justo sodales nec. Fusce venenatis facilisis lectus ac semper. Aliquam at massa ipsum. Quisque bibendum purus convallis nulla ultrices ultricies. Nullam aliquam, mi eu aliquam tincidunt, purus velit laoreet tortor, viverra pretium nisi quam vitae mi. Fusce vel volutpat elit. Nam sagittis nisi dui.</p>
<p>Vivamus fermentum semper porta. Nunc diam velit, adipiscing ut tristique vitae, sagittis vel odio. Maecenas convallis ullamcorper ultricies. Curabitur ornare, ligula semper consectetur sagittis, nisi diam iaculis velit, id fringilla sem nunc vel mi. Nam dictum, odio nec pretium volutpat, arcu ante placerat erat, non tristique elit urna et turpis. Quisque mi metus, ornare sit amet fermentum et, tincidunt et orci. Fusce eget orci a orci congue vestibulum. Ut dolor diam, elementum et vestibulum eu, porttitor vel elit. Curabitur venenatis pulvinar tellus gravida ornare. Sed et erat faucibus nunc euismod ultricies ut id justo. Nullam cursus suscipit nisi, et ultrices justo sodales nec. Fusce venenatis facilisis lectus ac semper. Aliquam at massa ipsum. Quisque bibendum purus convallis nulla ultrices ultricies. Nullam aliquam, mi eu aliquam tincidunt, purus velit laoreet tortor, viverra pretium nisi quam vitae mi. Fusce vel volutpat elit. Nam sagittis nisi dui.</p>
<p>Vivamus fermentum semper porta. Nunc diam velit, adipiscing ut tristique vitae, sagittis vel odio. Maecenas convallis ullamcorper ultricies. Curabitur ornare, ligula semper consectetur sagittis, nisi diam iaculis velit, id fringilla sem nunc vel mi. Nam dictum, odio nec pretium volutpat, arcu ante placerat erat, non tristique elit urna et turpis. Quisque mi metus, ornare sit amet fermentum et, tincidunt et orci. Fusce eget orci a orci congue vestibulum. Ut dolor diam, elementum et vestibulum eu, porttitor vel elit. Curabitur venenatis pulvinar tellus gravida ornare. Sed et erat faucibus nunc euismod ultricies ut id justo. Nullam cursus suscipit nisi, et ultrices justo sodales nec. Fusce venenatis facilisis lectus ac semper. Aliquam at massa ipsum. Quisque bibendum purus convallis nulla ultrices ultricies. Nullam aliquam, mi eu aliquam tincidunt, purus velit laoreet tortor, viverra pretium nisi quam vitae mi. Fusce vel volutpat elit. Nam sagittis nisi dui.</p>
<p>Vivamus fermentum semper porta. Nunc diam velit, adipiscing ut tristique vitae, sagittis vel odio. Maecenas convallis ullamcorper ultricies. Curabitur ornare, ligula semper consectetur sagittis, nisi diam iaculis velit, id fringilla sem nunc vel mi. Nam dictum, odio nec pretium volutpat, arcu ante placerat erat, non tristique elit urna et turpis. Quisque mi metus, ornare sit amet fermentum et, tincidunt et orci. Fusce eget orci a orci congue vestibulum. Ut dolor diam, elementum et vestibulum eu, porttitor vel elit. Curabitur venenatis pulvinar tellus gravida ornare. Sed et erat faucibus nunc euismod ultricies ut id justo. Nullam cursus suscipit nisi, et ultrices justo sodales nec. Fusce venenatis facilisis lectus ac semper. Aliquam at massa ipsum. Quisque bibendum purus convallis nulla ultrices ultricies. Nullam aliquam, mi eu aliquam tincidunt, purus velit laoreet tortor, viverra pretium nisi quam vitae mi. Fusce vel volutpat elit. Nam sagittis nisi dui.</p>
</div>
</body>
</html>

View File

@ -114,6 +114,7 @@ let AnimationsController = {
"setPlaybackRate");
this.hasTargetNode = yield target.actorHasMethod("domwalker",
"getNodeFromActor");
this.isNewUI = Services.prefs.getBoolPref("devtools.inspector.animationInspectorV3");
if (this.destroyed) {
console.warn("Could not fully initialize the AnimationsController");
@ -240,11 +241,15 @@ let AnimationsController = {
for (let {type, player} of changes) {
if (type === "added") {
this.animationPlayers.push(player);
player.startAutoRefresh();
if (!this.isNewUI) {
player.startAutoRefresh();
}
}
if (type === "removed") {
player.stopAutoRefresh();
if (!this.isNewUI) {
player.stopAutoRefresh();
}
yield player.release();
let index = this.animationPlayers.indexOf(player);
this.animationPlayers.splice(index, 1);
@ -256,12 +261,20 @@ let AnimationsController = {
}),
startAllAutoRefresh: function() {
if (this.isNewUI) {
return;
}
for (let front of this.animationPlayers) {
front.startAutoRefresh();
}
},
stopAllAutoRefresh: function() {
if (this.isNewUI) {
return;
}
for (let front of this.animationPlayers) {
front.stopAutoRefresh();
}

View File

@ -3,14 +3,17 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
/* globals AnimationsController, document, performance, promise,
gToolbox, gInspector, requestAnimationFrame, cancelAnimationFrame, L10N */
"use strict";
const {createNode} = require("devtools/animationinspector/utils");
const {
PlayerMetaDataHeader,
PlaybackRateSelector,
AnimationTargetNode,
createNode
AnimationsTimeline
} = require("devtools/animationinspector/components");
/**
@ -22,7 +25,8 @@ let AnimationsPanel = {
initialize: Task.async(function*() {
if (AnimationsController.destroyed) {
console.warn("Could not initialize the animation-panel, controller was destroyed");
console.warn("Could not initialize the animation-panel, controller " +
"was destroyed");
return;
}
if (this.initialized) {
@ -45,13 +49,18 @@ let AnimationsPanel = {
this.togglePicker = hUtils.togglePicker.bind(hUtils);
this.onPickerStarted = this.onPickerStarted.bind(this);
this.onPickerStopped = this.onPickerStopped.bind(this);
this.createPlayerWidgets = this.createPlayerWidgets.bind(this);
this.refreshAnimations = this.refreshAnimations.bind(this);
this.toggleAll = this.toggleAll.bind(this);
this.onTabNavigated = this.onTabNavigated.bind(this);
this.startListeners();
yield this.createPlayerWidgets();
if (AnimationsController.isNewUI) {
this.animationsTimelineComponent = new AnimationsTimeline(gInspector);
this.animationsTimelineComponent.init(this.playersEl);
}
yield this.refreshAnimations();
this.initialized.resolve();
@ -69,6 +78,11 @@ let AnimationsPanel = {
this.destroyed = promise.defer();
this.stopListeners();
if (this.animationsTimelineComponent) {
this.animationsTimelineComponent.destroy();
this.animationsTimelineComponent = null;
}
yield this.destroyPlayerWidgets();
this.playersEl = this.errorMessageEl = null;
@ -79,7 +93,7 @@ let AnimationsPanel = {
startListeners: function() {
AnimationsController.on(AnimationsController.PLAYERS_UPDATED_EVENT,
this.createPlayerWidgets);
this.refreshAnimations);
this.pickerButtonEl.addEventListener("click", this.togglePicker, false);
gToolbox.on("picker-started", this.onPickerStarted);
@ -91,7 +105,7 @@ let AnimationsPanel = {
stopListeners: function() {
AnimationsController.off(AnimationsController.PLAYERS_UPDATED_EVENT,
this.createPlayerWidgets);
this.refreshAnimations);
this.pickerButtonEl.removeEventListener("click", this.togglePicker, false);
gToolbox.off("picker-started", this.onPickerStarted);
@ -122,16 +136,18 @@ let AnimationsPanel = {
toggleAll: Task.async(function*() {
let btnClass = this.toggleAllButtonEl.classList;
// Toggling all animations is async and it may be some time before each of
// the current players get their states updated, so toggle locally too, to
// avoid the timelines from jumping back and forth.
if (this.playerWidgets) {
let currentWidgetStateChange = [];
for (let widget of this.playerWidgets) {
currentWidgetStateChange.push(btnClass.contains("paused")
? widget.play() : widget.pause());
if (!AnimationsController.isNewUI) {
// Toggling all animations is async and it may be some time before each of
// the current players get their states updated, so toggle locally too, to
// avoid the timelines from jumping back and forth.
if (this.playerWidgets) {
let currentWidgetStateChange = [];
for (let widget of this.playerWidgets) {
currentWidgetStateChange.push(btnClass.contains("paused")
? widget.play() : widget.pause());
}
yield promise.all(currentWidgetStateChange).catch(Cu.reportError);
}
yield promise.all(currentWidgetStateChange).catch(Cu.reportError);
}
btnClass.toggle("paused");
@ -142,14 +158,21 @@ let AnimationsPanel = {
this.toggleAllButtonEl.classList.remove("paused");
},
createPlayerWidgets: Task.async(function*() {
refreshAnimations: Task.async(function*() {
let done = gInspector.updating("animationspanel");
// Empty the whole panel first.
this.hideErrorMessage();
yield this.destroyPlayerWidgets();
// If there are no players to show, show the error message instead and return.
// Re-render the timeline component.
if (this.animationsTimelineComponent) {
this.animationsTimelineComponent.render(
AnimationsController.animationPlayers);
}
// If there are no players to show, show the error message instead and
// return.
if (!AnimationsController.animationPlayers.length) {
this.displayErrorMessage();
this.emit(this.UI_UPDATED_EVENT);
@ -157,17 +180,21 @@ let AnimationsPanel = {
return;
}
// Otherwise, create player widgets.
this.playerWidgets = [];
let initPromises = [];
// Otherwise, create player widgets (only when isNewUI is false, the
// timeline has already been re-rendered).
if (!AnimationsController.isNewUI) {
this.playerWidgets = [];
let initPromises = [];
for (let player of AnimationsController.animationPlayers) {
let widget = new PlayerWidget(player, this.playersEl);
initPromises.push(widget.initialize());
this.playerWidgets.push(widget);
for (let player of AnimationsController.animationPlayers) {
let widget = new PlayerWidget(player, this.playersEl);
initPromises.push(widget.initialize());
this.playerWidgets.push(widget);
}
yield initPromises;
}
yield initPromises;
this.emit(this.UI_UPDATED_EVENT);
done();
}),
@ -392,9 +419,8 @@ PlayerWidget.prototype = {
onPlayPauseBtnClick: function() {
if (this.player.state.playState === "running") {
return this.pause();
} else {
return this.play();
}
return this.play();
},
onRewindBtnClick: function() {
@ -406,7 +432,7 @@ PlayerWidget.prototype = {
let time = state.duration;
if (state.iterationCount) {
time = state.iterationCount * state.duration;
time = state.iterationCount * state.duration;
}
this.setCurrentTime(time, true);
},
@ -466,7 +492,8 @@ PlayerWidget.prototype = {
*/
setCurrentTime: Task.async(function*(time, shouldPause) {
if (!AnimationsController.hasSetCurrentTime) {
throw new Error("This server version doesn't support setting animations' currentTime");
throw new Error("This server version doesn't support setting " +
"animations' currentTime");
}
if (shouldPause) {
@ -492,7 +519,8 @@ PlayerWidget.prototype = {
*/
setPlaybackRate: function(rate) {
if (!AnimationsController.hasSetPlaybackRate) {
throw new Error("This server version doesn't support setting animations' playbackRate");
throw new Error("This server version doesn't support setting " +
"animations' playbackRate");
}
return this.player.setPlaybackRate(rate);

View File

@ -3,6 +3,7 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
/* globals ViewHelpers */
"use strict";
@ -19,11 +20,20 @@
// 4. destroy the component:
// c.destroy();
const {Cu} = require('chrome');
const {Cu} = require("chrome");
Cu.import("resource:///modules/devtools/ViewHelpers.jsm");
const {Task} = Cu.import("resource://gre/modules/Task.jsm", {});
const {
createNode,
drawGraphElementBackground,
findOptimalTimeInterval
} = require("devtools/animationinspector/utils");
const STRINGS_URI = "chrome://browser/locale/devtools/animationinspector.properties";
const L10N = new ViewHelpers.L10N(STRINGS_URI);
const MILLIS_TIME_FORMAT_MAX_DURATION = 4000;
// The minimum spacing between 2 time graduation headers in the timeline (ms).
const TIME_GRADUATION_MIN_SPACING = 40;
/**
* UI component responsible for displaying and updating the player meta-data:
@ -75,9 +85,9 @@ PlayerMetaDataHeader.prototype = {
// Animation duration.
this.durationLabel = createNode({
parent: metaData,
nodeType: "span"
nodeType: "span",
textContent: L10N.getStr("player.animationDurationLabel")
});
this.durationLabel.textContent = L10N.getStr("player.animationDurationLabel");
this.durationValue = createNode({
parent: metaData,
@ -90,9 +100,9 @@ PlayerMetaDataHeader.prototype = {
nodeType: "span",
attributes: {
"style": "display:none;"
}
},
textContent: L10N.getStr("player.animationDelayLabel")
});
this.delayLabel.textContent = L10N.getStr("player.animationDelayLabel");
this.delayValue = createNode({
parent: metaData,
@ -106,9 +116,9 @@ PlayerMetaDataHeader.prototype = {
nodeType: "span",
attributes: {
"style": "display:none;"
}
},
textContent: L10N.getStr("player.animationIterationCountLabel")
});
this.iterationLabel.textContent = L10N.getStr("player.animationIterationCountLabel");
this.iterationValue = createNode({
parent: metaData,
@ -224,7 +234,7 @@ PlaybackRateSelector.prototype = {
* different from the existing presets.
*/
getCurrentPresets: function({playbackRate}) {
return [...new Set([...this.PRESETS, playbackRate])].sort((a,b) => a > b);
return [...new Set([...this.PRESETS, playbackRate])].sort((a, b) => a > b);
},
render: function(state) {
@ -248,9 +258,9 @@ PlaybackRateSelector.prototype = {
nodeType: "option",
attributes: {
value: preset,
}
},
textContent: L10N.getFormatStr("player.playbackRateLabel", preset)
});
option.textContent = L10N.getFormatStr("player.playbackRateLabel", preset);
if (preset === state.playbackRate) {
option.setAttribute("selected", "");
}
@ -261,7 +271,7 @@ PlaybackRateSelector.prototype = {
this.currentRate = state.playbackRate;
},
onSelectionChanged: function(e) {
onSelectionChanged: function() {
this.emit("rate-changed", parseFloat(this.el.value));
}
};
@ -272,9 +282,13 @@ PlaybackRateSelector.prototype = {
* @param {InspectorPanel} inspector Requires a reference to the inspector-panel
* to highlight and select the node, as well as refresh it when there are
* mutations.
* @param {Object} options Supported properties are:
* - compact {Boolean} Defaults to false. If true, nodes will be previewed like
* tag#id.class instead of <tag id="id" class="class">
*/
function AnimationTargetNode(inspector) {
function AnimationTargetNode(inspector, options={}) {
this.inspector = inspector;
this.options = options;
this.onPreviewMouseOver = this.onPreviewMouseOver.bind(this);
this.onPreviewMouseOut = this.onPreviewMouseOut.bind(this);
@ -313,7 +327,9 @@ AnimationTargetNode.prototype = {
nodeType: "span"
});
this.previewEl.appendChild(document.createTextNode("<"));
if (!this.options.compact) {
this.previewEl.appendChild(document.createTextNode("<"));
}
// Tag name.
this.tagNameEl = createNode({
@ -330,15 +346,26 @@ AnimationTargetNode.prototype = {
nodeType: "span"
});
createNode({
parent: this.idEl,
nodeType: "span",
attributes: {
"class": "attribute-name theme-fg-color2"
}
}).textContent = "id";
this.idEl.appendChild(document.createTextNode("=\""));
if (!this.options.compact) {
createNode({
parent: this.idEl,
nodeType: "span",
attributes: {
"class": "attribute-name theme-fg-color2"
},
textContent: "id"
});
this.idEl.appendChild(document.createTextNode("=\""));
} else {
createNode({
parent: this.idEl,
nodeType: "span",
attributes: {
"class": "theme-fg-color2"
},
textContent: "#"
});
}
createNode({
parent: this.idEl,
@ -348,7 +375,9 @@ AnimationTargetNode.prototype = {
}
});
this.idEl.appendChild(document.createTextNode("\""));
if (!this.options.compact) {
this.idEl.appendChild(document.createTextNode("\""));
}
// Class attribute container.
this.classEl = createNode({
@ -356,15 +385,26 @@ AnimationTargetNode.prototype = {
nodeType: "span"
});
createNode({
parent: this.classEl,
nodeType: "span",
attributes: {
"class": "attribute-name theme-fg-color2"
}
}).textContent = "class";
this.classEl.appendChild(document.createTextNode("=\""));
if (!this.options.compact) {
createNode({
parent: this.classEl,
nodeType: "span",
attributes: {
"class": "attribute-name theme-fg-color2"
},
textContent: "class"
});
this.classEl.appendChild(document.createTextNode("=\""));
} else {
createNode({
parent: this.classEl,
nodeType: "span",
attributes: {
"class": "theme-fg-color6"
},
textContent: "."
});
}
createNode({
parent: this.classEl,
@ -374,9 +414,10 @@ AnimationTargetNode.prototype = {
}
});
this.classEl.appendChild(document.createTextNode("\""));
this.previewEl.appendChild(document.createTextNode(">"));
if (!this.options.compact) {
this.classEl.appendChild(document.createTextNode("\""));
this.previewEl.appendChild(document.createTextNode(">"));
}
// Init events for highlighting and selecting the node.
this.previewEl.addEventListener("mouseover", this.onPreviewMouseOver);
@ -430,73 +471,359 @@ AnimationTargetNode.prototype = {
}
},
render: function(playerFront) {
render: Task.async(function*(playerFront) {
this.playerFront = playerFront;
this.inspector.walker.getNodeFromActor(playerFront.actorID, ["node"]).then(nodeFront => {
// We might have been destroyed in the meantime, or the node might not be found.
if (!this.el || !nodeFront) {
return;
}
this.nodeFront = undefined;
this.nodeFront = nodeFront;
let {tagName, attributes} = nodeFront;
this.tagNameEl.textContent = tagName.toLowerCase();
let idIndex = attributes.findIndex(({name}) => name === "id");
if (idIndex > -1 && attributes[idIndex].value) {
this.idEl.querySelector(".attribute-value").textContent =
attributes[idIndex].value;
this.idEl.style.display = "inline";
} else {
this.idEl.style.display = "none";
}
let classIndex = attributes.findIndex(({name}) => name === "class");
if (classIndex > -1 && attributes[classIndex].value) {
this.classEl.querySelector(".attribute-value").textContent =
attributes[classIndex].value;
this.classEl.style.display = "inline";
} else {
this.classEl.style.display = "none";
}
this.emit("target-retrieved");
}, e => {
this.nodeFront = null;
try {
this.nodeFront = yield this.inspector.walker.getNodeFromActor(
playerFront.actorID, ["node"]);
} catch (e) {
// We might have been destroyed in the meantime, or the node might not be
// found.
if (!this.el) {
console.warn("Cound't retrieve the animation target node, widget destroyed");
} else {
console.error(e);
console.warn("Cound't retrieve the animation target node, widget " +
"destroyed");
}
});
}
console.error(e);
return;
}
if (!this.nodeFront || !this.el) {
return;
}
let {tagName, attributes} = this.nodeFront;
this.tagNameEl.textContent = tagName.toLowerCase();
let idIndex = attributes.findIndex(({name}) => name === "id");
if (idIndex > -1 && attributes[idIndex].value) {
this.idEl.querySelector(".attribute-value").textContent =
attributes[idIndex].value;
this.idEl.style.display = "inline";
} else {
this.idEl.style.display = "none";
}
let classIndex = attributes.findIndex(({name}) => name === "class");
if (classIndex > -1 && attributes[classIndex].value) {
let value = attributes[classIndex].value;
if (this.options.compact) {
value = value.split(" ").join(".");
}
this.classEl.querySelector(".attribute-value").textContent = value;
this.classEl.style.display = "inline";
} else {
this.classEl.style.display = "none";
}
this.emit("target-retrieved");
})
};
/**
* DOM node creation helper function.
* @param {Object} Options to customize the node to be created.
* - nodeType {String} Optional, defaults to "div",
* - attributes {Object} Optional attributes object like
* {attrName1:value1, attrName2: value2, ...}
* - parent {DOMNode} Mandatory node to append the newly created node to.
* @return {DOMNode} The newly created node.
* The TimeScale helper object is used to know which size should something be
* displayed with in the animation panel, depending on the animations that are
* currently displayed.
* If there are 5 animations displayed, and the first one starts at 10000ms and
* the last one ends at 20000ms, then this helper can be used to convert any
* time in this range to a distance in pixels.
*
* For the helper to know how to convert, it needs to know all the animations.
* Whenever a new animation is added to the panel, addAnimation(state) should be
* called. reset() can be called to start over.
*/
function createNode(options) {
if (!options.parent) {
throw new Error("Missing parent DOMNode to create new node");
let TimeScale = {
minStartTime: Infinity,
maxEndTime: 0,
/**
* Add a new animation to time scale.
* @param {Object} state A PlayerFront.state object.
*/
addAnimation: function({startTime, delay, duration, iterationCount}) {
this.minStartTime = Math.min(this.minStartTime, startTime);
let length = delay + (duration * (!iterationCount ? 1 : iterationCount));
this.maxEndTime = Math.max(this.maxEndTime, startTime + length);
},
/**
* Reset the current time scale.
*/
reset: function() {
this.minStartTime = Infinity;
this.maxEndTime = 0;
},
/**
* Convert a startTime to a distance in pixels, in the current time scale.
* @param {Number} time
* @param {Number} containerWidth The width of the container element.
* @return {Number}
*/
startTimeToDistance: function(time, containerWidth) {
time -= this.minStartTime;
return this.durationToDistance(time, containerWidth);
},
/**
* Convert a duration to a distance in pixels, in the current time scale.
* @param {Number} time
* @param {Number} containerWidth The width of the container element.
* @return {Number}
*/
durationToDistance: function(duration, containerWidth) {
return containerWidth * duration / (this.maxEndTime - this.minStartTime);
},
/**
* Convert a distance in pixels to a time, in the current time scale.
* @param {Number} distance
* @param {Number} containerWidth The width of the container element.
* @return {Number}
*/
distanceToTime: function(distance, containerWidth) {
return this.minStartTime +
((this.maxEndTime - this.minStartTime) * distance / containerWidth);
},
/**
* Convert a distance in pixels to a time, in the current time scale.
* The time will be relative to the current minimum start time.
* @param {Number} distance
* @param {Number} containerWidth The width of the container element.
* @return {Number}
*/
distanceToRelativeTime: function(distance, containerWidth) {
let time = this.distanceToTime(distance, containerWidth);
return time - this.minStartTime;
},
/**
* Depending on the time scale, format the given time as milliseconds or
* seconds.
* @param {Number} time
* @return {String} The formatted time string.
*/
formatTime: function(time) {
let duration = this.maxEndTime - this.minStartTime;
// Format in milliseconds if the total duration is short enough.
if (duration <= MILLIS_TIME_FORMAT_MAX_DURATION) {
return L10N.getFormatStr("timeline.timeGraduationLabel", time.toFixed(0));
}
// Otherwise format in seconds.
return L10N.getFormatStr("player.timeLabel", (time / 1000).toFixed(1));
}
};
let type = options.nodeType || "div";
let node = options.parent.ownerDocument.createElement(type);
exports.TimeScale = TimeScale;
for (let name in options.attributes || {}) {
let value = options.attributes[name];
node.setAttribute(name, value);
}
/**
* UI component responsible for displaying a timeline for animations.
* The timeline is essentially a graph with time along the x axis and animations
* along the y axis.
* The time is represented with a graduation header at the top and a current
* time play head.
* Animations are organized by lines, with a left margin containing the preview
* of the target DOM element the animation applies to.
*/
function AnimationsTimeline(inspector) {
this.animations = [];
this.targetNodes = [];
this.inspector = inspector;
options.parent.appendChild(node);
return node;
this.onAnimationStateChanged = this.onAnimationStateChanged.bind(this);
}
exports.createNode = createNode;
exports.AnimationsTimeline = AnimationsTimeline;
AnimationsTimeline.prototype = {
init: function(containerEl) {
this.win = containerEl.ownerDocument.defaultView;
this.rootWrapperEl = createNode({
parent: containerEl,
attributes: {
"class": "animation-timeline"
}
});
this.timeHeaderEl = createNode({
parent: this.rootWrapperEl,
attributes: {
"class": "time-header"
}
});
this.animationsEl = createNode({
parent: this.rootWrapperEl,
nodeType: "ul",
attributes: {
"class": "animations"
}
});
},
destroy: function() {
this.unrender();
this.rootWrapperEl.remove();
this.animations = [];
this.rootWrapperEl = null;
this.timeHeaderEl = null;
this.animationsEl = null;
this.win = null;
this.inspector = null;
},
destroyTargetNodes: function() {
for (let targetNode of this.targetNodes) {
targetNode.destroy();
}
this.targetNodes = [];
},
unrender: function() {
for (let animation of this.animations) {
animation.off("changed", this.onAnimationStateChanged);
}
TimeScale.reset();
this.destroyTargetNodes();
this.animationsEl.innerHTML = "";
},
render: function(animations) {
this.unrender();
this.animations = animations;
if (!this.animations.length) {
return;
}
// Loop first to set the time scale for all current animations.
for (let {state} of animations) {
TimeScale.addAnimation(state);
}
this.drawHeaderAndBackground();
for (let animation of this.animations) {
animation.on("changed", this.onAnimationStateChanged);
// Each line contains the target animated node and the animation time
// block.
let animationEl = createNode({
parent: this.animationsEl,
nodeType: "li",
attributes: {
"class": "animation"
}
});
// Left sidebar for the animated node.
let animatedNodeEl = createNode({
parent: animationEl,
attributes: {
"class": "target"
}
});
let timeBlockEl = createNode({
parent: animationEl,
attributes: {
"class": "time-block"
}
});
this.drawTimeBlock(animation, timeBlockEl);
// Draw the animated node target.
let targetNode = new AnimationTargetNode(this.inspector, {compact: true});
targetNode.init(animatedNodeEl);
targetNode.render(animation);
// Save the targetNode so it can be destroyed later.
this.targetNodes.push(targetNode);
}
},
onAnimationStateChanged: function() {
// For now, simply re-render the component. The animation front's state has
// already been updated.
this.render(this.animations);
},
drawHeaderAndBackground: function() {
let width = this.timeHeaderEl.offsetWidth;
let scale = width / (TimeScale.maxEndTime - TimeScale.minStartTime);
drawGraphElementBackground(this.win.document, "time-graduations", width, scale);
// And the time graduation header.
this.timeHeaderEl.innerHTML = "";
let interval = findOptimalTimeInterval(scale, TIME_GRADUATION_MIN_SPACING);
for (let i = 0; i < width; i += interval) {
createNode({
parent: this.timeHeaderEl,
nodeType: "span",
attributes: {
"class": "time-tick",
"style": `left:${i}px`
},
textContent: TimeScale.formatTime(
TimeScale.distanceToRelativeTime(i, width))
});
}
},
drawTimeBlock: function({state}, el) {
let width = el.offsetWidth;
// Container for all iterations and delay. Positioned at the right start
// time.
let x = TimeScale.startTimeToDistance(state.startTime + (state.delay || 0),
width);
// With the right width (duration*duration).
let count = state.iterationCount || 1;
let w = TimeScale.durationToDistance(state.duration, width);
let iterations = createNode({
parent: el,
attributes: {
"class": "iterations" + (state.iterationCount ? "" : " infinite"),
// Individual iterations are represented by setting the size of the
// repeating linear-gradient.
"style": `left:${x}px;
width:${w * count}px;
background-size:${Math.max(w, 2)}px 100%;`
}
});
// The animation name is displayed over the iterations.
createNode({
parent: iterations,
attributes: {
"class": "name"
},
textContent: state.name
});
// Delay.
if (state.delay) {
let delay = TimeScale.durationToDistance(state.delay, width);
createNode({
parent: iterations,
attributes: {
"class": "delay",
"style": `left:-${delay}px;
width:${delay}px;`
}
});
}
}
};

View File

@ -5,7 +5,9 @@
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
BROWSER_CHROME_MANIFESTS += ['test/browser.ini']
XPCSHELL_TESTS_MANIFESTS += ['test/unit/xpcshell.ini']
EXTRA_JS_MODULES.devtools.animationinspector += [
'components.js',
'utils.js',
]

View File

@ -19,6 +19,9 @@ support-files =
[browser_animation_playerWidgets_dont_show_time_after_duration.js]
[browser_animation_playerWidgets_have_control_buttons.js]
[browser_animation_playerWidgets_meta_data.js]
[browser_animation_playerWidgets_scrubber_delayed.js]
[browser_animation_playerWidgets_scrubber_enabled.js]
[browser_animation_playerWidgets_scrubber_moves.js]
[browser_animation_playerWidgets_state_after_pause.js]
[browser_animation_playerWidgets_target_nodes.js]
[browser_animation_rate_select_shows_presets.js]
@ -30,9 +33,11 @@ support-files =
[browser_animation_setting_playbackRate_works.js]
[browser_animation_shows_player_on_valid_node.js]
[browser_animation_target_highlight_select.js]
[browser_animation_timeline_animates.js]
[browser_animation_timeline_is_enabled.js]
[browser_animation_timeline_waits_for_delay.js]
[browser_animation_timeline_displays_with_pref.js]
[browser_animation_timeline_header.js]
[browser_animation_timeline_shows_delay.js]
[browser_animation_timeline_shows_iterations.js]
[browser_animation_timeline_ui.js]
[browser_animation_toggle_button_resets_on_navigate.js]
[browser_animation_toggle_button_toggles_animations.js]
[browser_animation_toggle_button_updates_playerWidgets.js]

View File

@ -8,17 +8,44 @@
add_task(function*() {
yield addTab(TEST_URL_ROOT + "doc_simple_animation.html");
let {inspector, panel} = yield openAnimationInspector();
let {inspector, panel} = yield openAnimationInspector();
yield testEmptyPanel(inspector, panel);
({inspector, panel}) = yield closeAnimationInspectorAndRestartWithNewUI();
yield testEmptyPanel(inspector, panel, true);
});
function* testEmptyPanel(inspector, panel, isNewUI=false) {
info("Select node .still and check that the panel is empty");
let stillNode = yield getNodeFront(".still", inspector);
let onUpdated = panel.once(panel.UI_UPDATED_EVENT);
yield selectNode(stillNode, inspector);
ok(!panel.playerWidgets || !panel.playerWidgets.length,
"No player widgets displayed for a still node");
yield onUpdated;
if (isNewUI) {
is(panel.animationsTimelineComponent.animations.length, 0,
"No animation players stored in the timeline component for a still node");
is(panel.animationsTimelineComponent.animationsEl.childNodes.length, 0,
"No animation displayed in the timeline component for a still node");
} else {
ok(!panel.playerWidgets || !panel.playerWidgets.length,
"No player widgets displayed for a still node");
}
info("Select the comment text node and check that the panel is empty");
let commentNode = yield inspector.walker.previousSibling(stillNode);
onUpdated = panel.once(panel.UI_UPDATED_EVENT);
yield selectNode(commentNode, inspector);
ok(!panel.playerWidgets || !panel.playerWidgets.length,
"No player widgets displayed for a text node");
});
yield onUpdated;
if (isNewUI) {
is(panel.animationsTimelineComponent.animations.length, 0,
"No animation players stored in the timeline component for a text node");
is(panel.animationsTimelineComponent.animationsEl.childNodes.length, 0,
"No animation displayed in the timeline component for a text node");
} else {
ok(!panel.playerWidgets || !panel.playerWidgets.length,
"No player widgets displayed for a text node");
}
}

View File

@ -15,4 +15,13 @@ add_task(function*() {
ok(panel, "The animation panel exists");
ok(panel.playersEl, "The animation panel has been initialized");
({panel, controller}) = yield closeAnimationInspectorAndRestartWithNewUI();
ok(controller, "The animation controller exists");
ok(controller.animationsFront, "The animation controller has been initialized");
ok(panel, "The animation panel exists");
ok(panel.playersEl, "The animation panel has been initialized");
ok(panel.animationsTimelineComponent, "The animation panel has been initialized");
});

View File

@ -10,8 +10,15 @@
add_task(function*() {
yield addTab(TEST_URL_ROOT + "doc_simple_animation.html");
let {inspector, panel, controller} = yield openAnimationInspector();
let ui = yield openAnimationInspector();
yield testEventsOrder(ui);
ui = yield closeAnimationInspectorAndRestartWithNewUI();
yield testEventsOrder(ui);
});
function* testEventsOrder({inspector, panel, controller}) {
info("Listen for the players-updated, ui-updated and inspector-updated events");
let receivedEvents = [];
controller.once(controller.PLAYERS_UPDATED_EVENT, () => {
@ -19,7 +26,7 @@ add_task(function*() {
});
panel.once(panel.UI_UPDATED_EVENT, () => {
receivedEvents.push(panel.UI_UPDATED_EVENT);
})
});
inspector.once("inspector-updated", () => {
receivedEvents.push("inspector-updated");
});
@ -36,4 +43,4 @@ add_task(function*() {
"The second event received was the ui-updated event");
is(receivedEvents[2], "inspector-updated",
"The third event received was the inspector-updated event");
});
}

View File

@ -9,7 +9,14 @@
add_task(function*() {
yield addTab(TEST_URL_ROOT + "doc_body_animation.html");
let {panel} = yield openAnimationInspector();
is(panel.playerWidgets.length, 1, "One animation player is displayed after init");
let {panel} = yield openAnimationInspector();
is(panel.playerWidgets.length, 1,
"One animation player is displayed after init");
({panel}) = yield closeAnimationInspectorAndRestartWithNewUI();
is(panel.animationsTimelineComponent.animations.length, 1,
"One animation is handled by the timeline after init");
is(panel.animationsTimelineComponent.animationsEl.childNodes.length, 1,
"One animation is displayed after init");
});

View File

@ -27,5 +27,26 @@ add_task(function*() {
"The target element's content is correct");
let selectorEl = targetEl.querySelector(".node-selector");
ok(selectorEl, "The icon to select the target element in the inspector exists");
ok(selectorEl,
"The icon to select the target element in the inspector exists");
info("Test again with the new timeline UI");
({inspector, panel}) = yield closeAnimationInspectorAndRestartWithNewUI();
info("Select the simple animated node");
yield selectNode(".animated", inspector);
let targetNodeComponent = panel.animationsTimelineComponent.targetNodes[0];
// Make sure to wait for the target-retrieved event if the nodeFront hasn't
// yet been retrieved by the TargetNodeComponent.
if (!targetNodeComponent.nodeFront) {
yield targetNodeComponent.once("target-retrieved");
}
is(targetNodeComponent.el.textContent, "div#.ball.animated",
"The target element's content is correct");
selectorEl = targetNodeComponent.el.querySelector(".node-selector");
ok(selectorEl,
"The icon to select the target element in the inspector exists");
});

View File

@ -8,13 +8,19 @@
add_task(function*() {
yield addTab(TEST_URL_ROOT + "doc_simple_animation.html");
let {toolbox, inspector, panel} = yield openAnimationInspector();
let {inspector, panel} = yield openAnimationInspector();
yield testRefreshOnNewAnimation(inspector, panel);
({inspector, panel}) = yield closeAnimationInspectorAndRestartWithNewUI();
yield testRefreshOnNewAnimation(inspector, panel);
});
function* testRefreshOnNewAnimation(inspector, panel) {
info("Select a non animated node");
yield selectNode(".still", inspector);
is(panel.playersEl.querySelectorAll(".player-widget").length, 0,
"There are no player widgets in the panel");
assertAnimationsDisplayed(panel, 0);
info("Listen to the next UI update event");
let onPanelUpdated = panel.once(panel.UI_UPDATED_EVENT);
@ -29,6 +35,14 @@ add_task(function*() {
yield onPanelUpdated;
ok(true, "The panel update event was fired");
is(panel.playersEl.querySelectorAll(".player-widget").length, 1,
"There is one player widget in the panel");
});
assertAnimationsDisplayed(panel, 1);
info("Remove the animation class on the node");
onPanelUpdated = panel.once(panel.UI_UPDATED_EVENT);
yield executeInContent("devtools:test:setAttribute", {
selector: ".ball.animated",
attributeName: "class",
attributeValue: "ball still"
});
yield onPanelUpdated;
}

View File

@ -8,13 +8,21 @@
add_task(function*() {
yield addTab(TEST_URL_ROOT + "doc_simple_animation.html");
let {toolbox, inspector, panel} = yield openAnimationInspector();
let {inspector, panel} = yield openAnimationInspector();
yield testRefreshOnRemove(inspector, panel);
yield testAddedAnimationWorks(inspector, panel);
info("Reload and test again with the new UI");
({inspector, panel}) = yield closeAnimationInspectorAndRestartWithNewUI(true);
yield testRefreshOnRemove(inspector, panel, true);
});
function* testRefreshOnRemove(inspector, panel) {
info("Select a animated node");
yield selectNode(".animated", inspector);
is(panel.playersEl.querySelectorAll(".player-widget").length, 1,
"There is one player widget in the panel");
assertAnimationsDisplayed(panel, 1);
info("Listen to the next UI update event");
let onPanelUpdated = panel.once(panel.UI_UPDATED_EVENT);
@ -29,23 +37,24 @@ add_task(function*() {
yield onPanelUpdated;
ok(true, "The panel update event was fired");
is(panel.playersEl.querySelectorAll(".player-widget").length, 0,
"There are no player widgets in the panel anymore");
assertAnimationsDisplayed(panel, 0);
info("Add an finite animation on the node again, and wait for it to appear");
onPanelUpdated = panel.once(panel.UI_UPDATED_EVENT);
yield executeInContent("devtools:test:setAttribute", {
selector: ".test-node",
attributeName: "class",
attributeValue: "ball short"
attributeValue: "ball short test-node"
});
yield onPanelUpdated;
is(panel.playersEl.querySelectorAll(".player-widget").length, 1,
"There is one player widget in the panel again");
assertAnimationsDisplayed(panel, 1);
}
function* testAddedAnimationWorks(inspector, panel) {
info("Now wait until the animation finishes");
let widget = panel.playerWidgets[0];
yield waitForPlayState(widget.player, "finished")
yield waitForPlayState(widget.player, "finished");
is(panel.playersEl.querySelectorAll(".player-widget").length, 1,
"There is still a player widget in the panel after the animation finished");
@ -59,4 +68,4 @@ add_task(function*() {
EventUtils.synthesizeMouseAtCenter(input, {type: "mousedown"}, win);
yield onPaused;
ok(widget.el.classList.contains("paused"), "The widget is in paused mode");
});
}

View File

@ -8,8 +8,15 @@
add_task(function*() {
yield addTab(TEST_URL_ROOT + "doc_simple_animation.html");
let {toolbox, inspector, panel} = yield openAnimationInspector();
let {inspector, panel} = yield openAnimationInspector();
yield testRefresh(inspector, panel);
({inspector, panel}) = yield closeAnimationInspectorAndRestartWithNewUI();
yield testRefresh(inspector, panel);
});
function* testRefresh(inspector, panel) {
info("Select a non animated node");
yield selectNode(".still", inspector);
@ -19,14 +26,14 @@ add_task(function*() {
info("Select the animated node now");
yield selectNode(".animated", inspector);
ok(!panel.playerWidgets || !panel.playerWidgets.length,
assertAnimationsDisplayed(panel, 0,
"The panel doesn't show the animation data while inactive");
info("Switch to the animation panel");
inspector.sidebar.select("animationinspector");
yield panel.once(panel.UI_UPDATED_EVENT);
is(panel.playerWidgets.length, 1,
assertAnimationsDisplayed(panel, 1,
"The panel shows the animation data after selecting it");
info("Switch again to the rule-view");
@ -35,13 +42,13 @@ add_task(function*() {
info("Select the non animated node again");
yield selectNode(".still", inspector);
is(panel.playerWidgets.length, 1,
assertAnimationsDisplayed(panel, 1,
"The panel still shows the previous animation data since it is inactive");
info("Switch to the animation panel again");
inspector.sidebar.select("animationinspector");
yield panel.once(panel.UI_UPDATED_EVENT);
ok(!panel.playerWidgets || !panel.playerWidgets.length,
assertAnimationsDisplayed(panel, 0,
"The panel is now empty after refreshing");
});
}

View File

@ -22,4 +22,16 @@ add_task(function*() {
is(widget.el.parentNode, panel.playersEl,
"The player widget has been appended to the panel");
}
info("Test again with the new UI, making sure the same number of " +
"animation timelines is created");
({inspector, panel, controller}) = yield closeAnimationInspectorAndRestartWithNewUI();
let timeline = panel.animationsTimelineComponent;
info("Selecting the test animated node again");
yield selectNode(".multi", inspector);
is(controller.animationPlayers.length,
timeline.animationsEl.querySelectorAll(".animation").length,
"As many timeline elements were created as there are playerFronts");
});

View File

@ -9,12 +9,18 @@
add_task(function*() {
yield addTab(TEST_URL_ROOT + "doc_simple_animation.html");
let {inspector, panel} = yield openAnimationInspector();
let {inspector, panel} = yield openAnimationInspector();
yield testShowsAnimations(inspector, panel);
({inspector, panel}) = yield closeAnimationInspectorAndRestartWithNewUI();
yield testShowsAnimations(inspector, panel);
});
function* testShowsAnimations(inspector, panel) {
info("Select node .animated and check that the panel is not empty");
let node = yield getNodeFront(".animated", inspector);
yield selectNode(node, inspector);
is(panel.playerWidgets.length, 1,
"Exactly 1 player widget is shown for animated node");
});
assertAnimationsDisplayed(panel, 1);
}

View File

@ -9,14 +9,26 @@
add_task(function*() {
yield addTab(TEST_URL_ROOT + "doc_simple_animation.html");
let {toolbox, inspector, panel} = yield openAnimationInspector();
let ui = yield openAnimationInspector();
yield testTargetNode(ui);
ui = yield closeAnimationInspectorAndRestartWithNewUI();
yield testTargetNode(ui, true);
});
function* testTargetNode({toolbox, inspector, panel}, isNewUI) {
info("Select the simple animated node");
yield selectNode(".animated", inspector);
// Make sure to wait for the target-retrieved event if the nodeFront hasn't
// yet been retrieved by the TargetNodeComponent.
let targetNodeComponent = panel.playerWidgets[0].targetNodeComponent;
let targetNodeComponent;
if (isNewUI) {
targetNodeComponent = panel.animationsTimelineComponent.targetNodes[0];
} else {
targetNodeComponent = panel.playerWidgets[0].targetNodeComponent;
}
if (!targetNodeComponent.nodeFront) {
yield targetNodeComponent.once("target-retrieved");
}
@ -33,21 +45,29 @@ add_task(function*() {
ok(true, "The node-highlight event was fired");
is(targetNodeComponent.nodeFront, nodeFront,
"The highlighted node is the one stored on the animation widget");
is(nodeFront.tagName, "DIV", "The highlighted node has the correct tagName");
is(nodeFront.attributes[0].name, "class", "The highlighted node has the correct attributes");
is(nodeFront.attributes[0].value, "ball animated", "The highlighted node has the correct class");
is(nodeFront.tagName, "DIV",
"The highlighted node has the correct tagName");
is(nodeFront.attributes[0].name, "class",
"The highlighted node has the correct attributes");
is(nodeFront.attributes[0].value, "ball animated",
"The highlighted node has the correct class");
info("Select the body node in order to have the list of all animations");
yield selectNode("body", inspector);
// Make sure to wait for the target-retrieved event if the nodeFront hasn't
// yet been retrieved by the TargetNodeComponent.
targetNodeComponent = panel.playerWidgets[0].targetNodeComponent;
if (isNewUI) {
targetNodeComponent = panel.animationsTimelineComponent.targetNodes[0];
} else {
targetNodeComponent = panel.playerWidgets[0].targetNodeComponent;
}
if (!targetNodeComponent.nodeFront) {
yield targetNodeComponent.once("target-retrieved");
}
info("Click on the first animation widget's selector icon and wait for the selection to change");
info("Click on the first animation widget's selector icon and wait for the " +
"selection to change");
let onSelection = inspector.selection.once("new-node-front");
let onPanelUpdated = panel.once(panel.UI_UPDATED_EVENT);
let selectIconEl = targetNodeComponent.selectNodeEl;
@ -59,4 +79,4 @@ add_task(function*() {
"The selected node is the one stored on the animation widget");
yield onPanelUpdated;
});
}

View File

@ -0,0 +1,24 @@
/* vim: set ts=2 et sw=2 tw=80: */
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
// Check that the timeline-based UI is displayed instead of the playerwidget-
// based UI when the "devtools.inspector.animationInspectorV3" is set.
add_task(function*() {
yield addTab(TEST_URL_ROOT + "doc_simple_animation.html");
let {inspector, panel} = yield openAnimationInspectorNewUI();
info("Selecting the test node");
yield selectNode(".animated", inspector);
let timeline = panel.animationsTimelineComponent;
ok(timeline, "The timeline components was created");
is(timeline.rootWrapperEl.parentNode, panel.playersEl,
"The timeline component was appended in the DOM");
is(panel.playersEl.querySelectorAll(".player-widget").length, 0,
"There are no playerWidgets in the DOM");
});

View File

@ -0,0 +1,47 @@
/* vim: set ts=2 et sw=2 tw=80: */
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
// Check that the timeline-based UI shows correct time graduations in the
// header.
const {findOptimalTimeInterval} = require("devtools/animationinspector/utils");
const {TimeScale} = require("devtools/animationinspector/components");
// Should be kept in sync with TIME_GRADUATION_MIN_SPACING in components.js
const TIME_GRADUATION_MIN_SPACING = 40;
add_task(function*() {
yield addTab(TEST_URL_ROOT + "doc_simple_animation.html");
let {panel} = yield openAnimationInspectorNewUI();
let timeline = panel.animationsTimelineComponent;
let headerEl = timeline.timeHeaderEl;
info("Find out how many time graduations should there be");
let width = headerEl.offsetWidth;
let scale = width / (TimeScale.maxEndTime - TimeScale.minStartTime);
// Note that findOptimalTimeInterval is tested separately in xpcshell test
// test_findOptimalTimeInterval.js, so we assume that it works here.
let interval = findOptimalTimeInterval(scale, TIME_GRADUATION_MIN_SPACING);
let nb = Math.ceil(width / interval);
is(headerEl.querySelectorAll(".time-tick").length, nb,
"The expected number of time ticks were found");
info("Make sure graduations are evenly distributed and show the right times");
[...headerEl.querySelectorAll(".time-tick")].forEach((tick, i) => {
let left = parseFloat(tick.style.left);
is(Math.round(left), Math.round(i * interval),
"Graduation " + i + " is positioned correctly");
// Note that the distancetoRelativeTime and formatTime functions are tested
// separately in xpcshell test test_timeScale.js, so we assume that they
// work here.
let formattedTime = TimeScale.formatTime(
TimeScale.distanceToRelativeTime(i * interval, width));
is(tick.textContent, formattedTime,
"Graduation " + i + " has the right text content");
});
});

View File

@ -0,0 +1,30 @@
/* vim: set ts=2 et sw=2 tw=80: */
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
// Check that animation delay is visualized in the timeline-based UI when the
// animation is delayed.
add_task(function*() {
yield addTab(TEST_URL_ROOT + "doc_simple_animation.html");
let {inspector, panel} = yield openAnimationInspectorNewUI();
info("Selecting a delayed animated node");
yield selectNode(".delayed", inspector);
info("Getting the animation and delay elements from the panel");
let timelineEl = panel.animationsTimelineComponent.rootWrapperEl;
let delay = timelineEl.querySelector(".delay");
ok(delay, "The animation timeline contains the delay element");
info("Selecting a no-delay animated node");
yield selectNode(".animated", inspector);
info("Getting the animation and delay elements from the panel again");
delay = timelineEl.querySelector(".delay");
ok(!delay, "The animation timeline contains no delay element");
});

View File

@ -0,0 +1,51 @@
/* vim: set ts=2 et sw=2 tw=80: */
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
// Check that the timeline-based UI is displays as many iteration elements as
// there are iterations in an animation.
add_task(function*() {
yield addTab(TEST_URL_ROOT + "doc_simple_animation.html");
let {inspector, panel} = yield openAnimationInspectorNewUI();
info("Selecting the test node");
yield selectNode(".delayed", inspector);
info("Getting the animation element from the panel");
let timelineEl = panel.animationsTimelineComponent.rootWrapperEl;
let animation = timelineEl.querySelector(".time-block");
let iterations = animation.querySelector(".iterations");
// Iterations are rendered with a repeating linear-gradient, so we need to
// calculate how many iterations are represented by looking at the background
// size.
let iterationCount = getIterationCountFromBackground(iterations);
is(iterationCount, 10,
"The animation timeline contains the right number of iterations");
ok(!iterations.classList.contains("infinite"),
"The iteration element doesn't have the infinite class");
info("Selecting another test node with an infinite animation");
yield selectNode(".animated", inspector);
info("Getting the animation element from the panel again");
animation = timelineEl.querySelector(".time-block");
iterations = animation.querySelector(".iterations");
iterationCount = getIterationCountFromBackground(iterations);
is(iterationCount, 1,
"The animation timeline contains just one iteration");
ok(iterations.classList.contains("infinite"),
"The iteration element has the infinite class");
});
function getIterationCountFromBackground(el) {
let backgroundSize = parseFloat(el.style.backgroundSize.split(" ")[0]);
let width = el.offsetWidth;
return Math.round(width / backgroundSize);
}

View File

@ -0,0 +1,41 @@
/* vim: set ts=2 et sw=2 tw=80: */
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
// Check that the timeline-based UI contains the right elements.
add_task(function*() {
yield addTab(TEST_URL_ROOT + "doc_simple_animation.html");
let {panel} = yield openAnimationInspectorNewUI();
let timeline = panel.animationsTimelineComponent;
let el = timeline.rootWrapperEl;
ok(el.querySelector(".time-header"),
"The header element is in the DOM of the timeline");
ok(el.querySelectorAll(".time-header .time-tick").length,
"The header has some time graduations");
ok(el.querySelector(".animations"),
"The animations container is in the DOM of the timeline");
is(el.querySelectorAll(".animations .animation").length,
timeline.animations.length,
"The number of animations displayed matches the number of animations");
for (let i = 0; i < timeline.animations.length; i++) {
let animation = timeline.animations[i];
let animationEl = el.querySelectorAll(".animations .animation")[i];
ok(animationEl.querySelector(".target"),
"The animated node target element is in the DOM");
ok(animationEl.querySelector(".time-block"),
"The timeline element is in the DOM");
is(animationEl.querySelector(".name").textContent,
animation.state.name,
"The name on the timeline is correct");
ok(animationEl.querySelector(".iterations"),
"The timeline has iterations displayed");
}
});

View File

@ -11,7 +11,7 @@
add_task(function*() {
yield addTab(TEST_URL_ROOT + "doc_simple_animation.html");
let {inspector, panel} = yield openAnimationInspector();
let {panel} = yield openAnimationInspector();
info("Click the toggle button");
yield panel.toggleAll();

View File

@ -9,7 +9,7 @@
add_task(function*() {
yield addTab(TEST_URL_ROOT + "doc_simple_animation.html");
let {inspector, panel, window} = yield openAnimationInspector();
let {inspector, window} = yield openAnimationInspector();
let doc = window.document;
let toolbar = doc.querySelector("#toolbar");

View File

@ -9,36 +9,64 @@
add_task(function*() {
yield addTab(TEST_URL_ROOT + "doc_simple_animation.html");
let {panel, inspector} = yield openAnimationInspector();
let ui = yield openAnimationInspector();
yield testDataUpdates(ui);
info("Close the toolbox, reload the tab, and try again with the new UI");
ui = yield closeAnimationInspectorAndRestartWithNewUI(true);
yield testDataUpdates(ui, true);
});
function* testDataUpdates({panel, controller, inspector}, isNewUI=false) {
info("Select the test node");
yield selectNode(".animated", inspector);
info("Get the player widget");
let widget = panel.playerWidgets[0];
let animation = controller.animationPlayers[0];
yield setStyle(animation, "animationDuration", "5.5s", isNewUI);
yield setStyle(animation, "animationIterationCount", "300", isNewUI);
yield setStyle(animation, "animationDelay", "45s", isNewUI);
yield setStyle(widget, "animationDuration", "5.5s");
is(widget.metaDataComponent.durationValue.textContent, "5.50s",
"The widget shows the new duration");
if (isNewUI) {
let animationsEl = panel.animationsTimelineComponent.animationsEl;
let timeBlockEl = animationsEl.querySelector(".time-block");
yield setStyle(widget, "animationIterationCount", "300");
is(widget.metaDataComponent.iterationValue.textContent, "300",
"The widget shows the new iteration count");
// 45s delay + (300 * 5.5)s duration
let expectedTotalDuration = 1695 * 1000;
let timeRatio = expectedTotalDuration / timeBlockEl.offsetWidth;
yield setStyle(widget, "animationDelay", "45s");
is(widget.metaDataComponent.delayValue.textContent, "45s",
"The widget shows the new delay");
});
// XXX: the nb and size of each iteration cannot be tested easily (displayed
// using a linear-gradient background and capped at 2px wide). They should
// be tested in bug 1173761.
let delayWidth = parseFloat(timeBlockEl.querySelector(".delay").style.width);
is(Math.round(delayWidth * timeRatio), 45 * 1000,
"The timeline has the right delay");
} else {
let widget = panel.playerWidgets[0];
is(widget.metaDataComponent.durationValue.textContent, "5.50s",
"The widget shows the new duration");
is(widget.metaDataComponent.iterationValue.textContent, "300",
"The widget shows the new iteration count");
is(widget.metaDataComponent.delayValue.textContent, "45s",
"The widget shows the new delay");
}
}
function* setStyle(widget, name, value) {
function* setStyle(animation, name, value, isNewUI=false) {
info("Change the animation style via the content DOM. Setting " +
name + " to " + value);
let onAnimationChanged = once(animation, "changed");
yield executeInContent("devtools:test:setStyle", {
selector: ".animated",
propertyName: name,
propertyValue: value
});
yield onAnimationChanged;
info("Wait for the next state update");
yield onceNextPlayerRefresh(widget.player);
// If this is the playerWidget-based UI, wait for the auto-refresh event too
// to make sure the UI has updated.
if (!isNewUI) {
yield once(animation, animation.AUTO_REFRESH_EVENT);
}
}

View File

@ -7,9 +7,10 @@
const Cu = Components.utils;
const {gDevTools} = Cu.import("resource:///modules/devtools/gDevTools.jsm", {});
const {devtools} = Cu.import("resource://gre/modules/devtools/Loader.jsm", {});
const {require} = devtools;
const {Promise: promise} = Cu.import("resource://gre/modules/Promise.jsm", {});
const TargetFactory = devtools.TargetFactory;
const {console} = Components.utils.import("resource://gre/modules/devtools/Console.jsm", {});
const {console} = Cu.import("resource://gre/modules/devtools/Console.jsm", {});
const {ViewHelpers} = Cu.import("resource:///modules/devtools/ViewHelpers.jsm", {});
// All tests are asynchronous
@ -19,17 +20,20 @@ const TEST_URL_ROOT = "http://example.com/browser/browser/devtools/animationinsp
const ROOT_TEST_DIR = getRootDirectory(gTestPath);
const FRAME_SCRIPT_URL = ROOT_TEST_DIR + "doc_frame_script.js";
const COMMON_FRAME_SCRIPT_URL = "chrome://browser/content/devtools/frame-script-utils.js";
const NEW_UI_PREF = "devtools.inspector.animationInspectorV3";
// Auto clean-up when a test ends
registerCleanupFunction(function*() {
let target = TargetFactory.forTab(gBrowser.selectedTab);
yield gDevTools.closeToolbox(target);
yield closeAnimationInspector();
while (gBrowser.tabs.length > 1) {
gBrowser.removeCurrentTab();
}
});
// Make sure the new UI is off by default.
Services.prefs.setBoolPref(NEW_UI_PREF, false);
// Uncomment this pref to dump all devtools emitted events to the console.
// Services.prefs.setBoolPref("devtools.dump.emit", true);
@ -45,6 +49,7 @@ registerCleanupFunction(() => gDevTools.testing = false);
registerCleanupFunction(() => {
Services.prefs.clearUserPref("devtools.dump.emit");
Services.prefs.clearUserPref("devtools.debugger.log");
Services.prefs.clearUserPref(NEW_UI_PREF);
});
/**
@ -77,6 +82,13 @@ function addTab(url) {
return def.promise;
}
/**
* Switch ON the new UI pref.
*/
function enableNewUI() {
Services.prefs.setBoolPref(NEW_UI_PREF, true);
}
/**
* Reload the current tab location.
*/
@ -119,6 +131,25 @@ let selectNode = Task.async(function*(data, inspector, reason="test") {
yield updated;
});
/**
* Check if there are the expected number of animations being displayed in the
* panel right now.
* @param {AnimationsPanel} panel
* @param {Number} nbAnimations The expected number of animations.
* @param {String} msg An optional string to be used as the assertion message.
*/
function assertAnimationsDisplayed(panel, nbAnimations, msg="") {
let isNewUI = Services.prefs.getBoolPref(NEW_UI_PREF);
msg = msg || `There are ${nbAnimations} animations in the panel`;
if (isNewUI) {
is(panel.animationsTimelineComponent.animationsEl.childNodes.length,
nbAnimations, msg);
} else {
is(panel.playersEl.querySelectorAll(".player-widget").length,
nbAnimations, msg);
}
}
/**
* Takes an Inspector panel that was just created, and waits
* for a "inspector-updated" event as well as the animation inspector
@ -131,10 +162,9 @@ let waitForAnimationInspectorReady = Task.async(function*(inspector) {
let win = inspector.sidebar.getWindowForTab("animationinspector");
let updated = inspector.once("inspector-updated");
// In e10s, if we wait for underlying toolbox actors to
// load (by setting gDevTools.testing to true), we miss the "animationinspector-ready"
// event on the sidebar, so check to see if the iframe
// is already loaded.
// In e10s, if we wait for underlying toolbox actors to load (by setting
// gDevTools.testing to true), we miss the "animationinspector-ready" event on
// the sidebar, so check to see if the iframe is already loaded.
let tabReady = win.document.readyState === "complete" ?
promise.resolve() :
inspector.sidebar.once("animationinspector-ready");
@ -145,7 +175,7 @@ let waitForAnimationInspectorReady = Task.async(function*(inspector) {
/**
* Open the toolbox, with the inspector tool visible and the animationinspector
* sidebar selected.
* @return a promise that resolves when the inspector is ready
* @return a promise that resolves when the inspector is ready.
*/
let openAnimationInspector = Task.async(function*() {
let target = TargetFactory.forTab(gBrowser.selectedTab);
@ -185,6 +215,45 @@ let openAnimationInspector = Task.async(function*() {
};
});
/**
* Turn on the new timeline-based UI pref ON, and then open the toolbox, with
* the inspector tool visible and the animationinspector sidebar selected.
* @return a promise that resolves when the inspector is ready.
*/
function openAnimationInspectorNewUI() {
enableNewUI();
return openAnimationInspector();
}
/**
* Close the toolbox.
* @return a promise that resolves when the toolbox has closed.
*/
let closeAnimationInspector = Task.async(function*() {
let target = TargetFactory.forTab(gBrowser.selectedTab);
yield gDevTools.closeToolbox(target);
});
/**
* During the time period we migrate from the playerWidgets-based UI to the new
* AnimationTimeline UI, we'll want to run certain tests against both UI.
* This closes the toolbox, switch the new UI pref ON, and opens the toolbox
* again, with the animation inspector panel selected.
* @param {Boolean} reload Optionally reload the page after the toolbox was
* closed and before it is opened again.
* @return a promise that resolves when the animation inspector is ready.
*/
let closeAnimationInspectorAndRestartWithNewUI = Task.async(function*(reload) {
info("Close the toolbox and test again with the new UI");
yield closeAnimationInspector();
if (reload) {
yield reloadTab();
}
enableNewUI();
return yield openAnimationInspector();
});
/**
* Wait for the toolbox frame to receive focus after it loads
* @param {Toolbox} toolbox
@ -214,7 +283,7 @@ function hasSideBarTab(inspector, id) {
* @param {Object} target An observable object that either supports on/off or
* addEventListener/removeEventListener
* @param {String} eventName
* @param {Boolean} useCapture Optional, for addEventListener/removeEventListener
* @param {Boolean} useCapture Optional, for add/removeEventListener
* @return A promise that resolves when the event has been handled
*/
function once(target, eventName, useCapture=false) {
@ -278,9 +347,9 @@ function executeInContent(name, data={}, objects={}, expectResponse=true) {
mm.sendAsyncMessage(name, data, objects);
if (expectResponse) {
return waitForContentMessage(name);
} else {
return promise.resolve();
}
return promise.resolve();
}
function onceNextPlayerRefresh(player) {
@ -293,7 +362,9 @@ function onceNextPlayerRefresh(player) {
* Simulate a click on the playPause button of a playerWidget.
*/
let togglePlayPauseButton = Task.async(function*(widget) {
let nextState = widget.player.state.playState === "running" ? "paused" : "running";
let nextState = widget.player.state.playState === "running"
? "paused"
: "running";
// Note that instead of simulating a real event here, the callback is just
// called. This is better because the callback returns a promise, so we know
@ -344,7 +415,8 @@ let waitForStateCondition = Task.async(function*(player, conditionCheck, desc=""
* provided string.
* @param {AnimationPlayerFront} player
* @param {String} playState The playState to expect.
* @return {Promise} Resolves when the playState has changed to the expected value.
* @return {Promise} Resolves when the playState has changed to the expected
* value.
*/
function waitForPlayState(player, playState) {
return waitForStateCondition(player, state => {

View File

@ -0,0 +1,4 @@
{
// Extend from the common devtools xpcshell eslintrc config.
"extends": "../../../.eslintrc.xpcshell"
}

View File

@ -0,0 +1,85 @@
/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
/* vim: set ts=2 et sw=2 tw=80: */
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
/* eslint no-eval:0 */
"use strict";
const Cu = Components.utils;
const {devtools} = Cu.import("resource://gre/modules/devtools/Loader.jsm", {});
const {require} = devtools;
const {findOptimalTimeInterval} = require("devtools/animationinspector/utils");
// This test array contains objects that are used to test the
// findOptimalTimeInterval function. Each object should have the following
// properties:
// - desc: an optional string that will be printed out
// - timeScale: a number that represents how many pixels is 1ms
// - minSpacing: an optional number that represents the minim space between 2
// time graduations
// - expectedInterval: a number that you expect the findOptimalTimeInterval
// function to return as a result.
// Optionally you can pass a string where `interval` is the calculated
// interval, this string will be eval'd and tested to be truthy.
const TEST_DATA = [{
desc: "With 1px being 1ms and no minSpacing, expect the interval to be the " +
"default min spacing",
timeScale: 1,
minSpacing: undefined,
expectedInterval: 10
}, {
desc: "With 1px being 1ms and a custom minSpacing being a multiple of 10 " +
"expect the interval to be the custom min spacing",
timeScale: 1,
minSpacing: 40,
expectedInterval: 40
}, {
desc: "With 1px being 1ms and a custom minSpacing not being multiple of 10 " +
"expect the interval to be the next multiple of 10",
timeScale: 1,
minSpacing: 13,
expectedInterval: 20
}, {
desc: "If 1ms corresponds to a distance that is greater than the min " +
"spacing then, expect the interval to be this distance",
timeScale: 20,
minSpacing: undefined,
expectedInterval: 20
}, {
desc: "If 1ms corresponds to a distance that is greater than the min " +
"spacing then, expect the interval to be this distance, even if it " +
"isn't a multiple of 10",
timeScale: 33,
minSpacing: undefined,
expectedInterval: 33
}, {
desc: "If 1ms is a very small distance, then expect this distance to be " +
"multiplied by 10, 20, 40, 80, etc... until it goes over the min " +
"spacing",
timeScale: 0.001,
minSpacing: undefined,
expectedInterval: 10.24
}, {
desc: "If the time scale is such that we need to iterate more than the " +
"maximum allowed number of iterations, then expect an interval lower " +
"than the minimum one",
timeScale: 1e-31,
minSpacing: undefined,
expectedInterval: "interval < 10"
}];
function run_test() {
for (let {timeScale, desc, minSpacing, expectedInterval} of TEST_DATA) {
do_print("Testing timeScale: " + timeScale + " and minSpacing: " +
minSpacing + ". Expecting " + expectedInterval + ".");
let interval = findOptimalTimeInterval(timeScale, minSpacing);
if (typeof expectedInterval == "string") {
ok(eval(expectedInterval), desc);
} else {
equal(interval, expectedInterval, desc);
}
}
}

View File

@ -0,0 +1,191 @@
/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
/* vim: set ts=2 et sw=2 tw=80: */
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
const Cu = Components.utils;
const {devtools} = Cu.import("resource://gre/modules/devtools/Loader.jsm", {});
const {require} = devtools;
const {TimeScale} = require("devtools/animationinspector/components");
const TEST_ANIMATIONS = [{
startTime: 500,
delay: 0,
duration: 1000,
iterationCount: 1
}, {
startTime: 400,
delay: 100,
duration: 10,
iterationCount: 100
}, {
startTime: 50,
delay: 1000,
duration: 100,
iterationCount: 20
}];
const EXPECTED_MIN_START = 50;
const EXPECTED_MAX_END = 3050;
const TEST_STARTTIME_TO_DISTANCE = [{
time: 50,
width: 100,
expectedDistance: 0
}, {
time: 50,
width: 0,
expectedDistance: 0
}, {
time: 3050,
width: 200,
expectedDistance: 200
}, {
time: 1550,
width: 200,
expectedDistance: 100
}];
const TEST_DURATION_TO_DISTANCE = [{
time: 3000,
width: 100,
expectedDistance: 100
}, {
time: 0,
width: 100,
expectedDistance: 0
}];
const TEST_DISTANCE_TO_TIME = [{
distance: 100,
width: 100,
expectedTime: 3050
}, {
distance: 0,
width: 100,
expectedTime: 50
}, {
distance: 25,
width: 200,
expectedTime: 425
}];
const TEST_DISTANCE_TO_RELATIVE_TIME = [{
distance: 100,
width: 100,
expectedTime: 3000
}, {
distance: 0,
width: 100,
expectedTime: 0
}, {
distance: 25,
width: 200,
expectedTime: 375
}];
const TEST_FORMAT_TIME_MS = [{
time: 0,
expectedFormattedTime: "0ms"
}, {
time: 3540.341,
expectedFormattedTime: "3540ms"
}, {
time: 1.99,
expectedFormattedTime: "2ms"
}, {
time: 4000,
expectedFormattedTime: "4000ms"
}];
const TEST_FORMAT_TIME_S = [{
time: 0,
expectedFormattedTime: "0.0s"
}, {
time: 3540.341,
expectedFormattedTime: "3.5s"
}, {
time: 1.99,
expectedFormattedTime: "0.0s"
}, {
time: 4000,
expectedFormattedTime: "4.0s"
}, {
time: 102540,
expectedFormattedTime: "102.5s"
}, {
time: 102940,
expectedFormattedTime: "102.9s"
}];
function run_test() {
do_print("Check the default min/max range values");
equal(TimeScale.minStartTime, Infinity);
equal(TimeScale.maxEndTime, 0);
do_print("Test adding a few animations");
for (let {startTime, delay, duration, iterationCount} of TEST_ANIMATIONS) {
TimeScale.addAnimation({startTime, delay, duration, iterationCount});
}
equal(TimeScale.minStartTime, EXPECTED_MIN_START);
equal(TimeScale.maxEndTime, EXPECTED_MAX_END);
do_print("Test reseting the animations");
TimeScale.reset();
equal(TimeScale.minStartTime, Infinity);
equal(TimeScale.maxEndTime, 0);
do_print("Test adding the animations again");
for (let {startTime, delay, duration, iterationCount} of TEST_ANIMATIONS) {
TimeScale.addAnimation({startTime, delay, duration, iterationCount});
}
equal(TimeScale.minStartTime, EXPECTED_MIN_START);
equal(TimeScale.maxEndTime, EXPECTED_MAX_END);
do_print("Test converting start times to distances");
for (let {time, width, expectedDistance} of TEST_STARTTIME_TO_DISTANCE) {
let distance = TimeScale.startTimeToDistance(time, width);
equal(distance, expectedDistance);
}
do_print("Test converting durations to distances");
for (let {time, width, expectedDistance} of TEST_DURATION_TO_DISTANCE) {
let distance = TimeScale.durationToDistance(time, width);
equal(distance, expectedDistance);
}
do_print("Test converting distances to times");
for (let {distance, width, expectedTime} of TEST_DISTANCE_TO_TIME) {
let time = TimeScale.distanceToTime(distance, width);
equal(time, expectedTime);
}
do_print("Test converting distances to relative times");
for (let {distance, width, expectedTime} of TEST_DISTANCE_TO_RELATIVE_TIME) {
let time = TimeScale.distanceToRelativeTime(distance, width);
equal(time, expectedTime);
}
do_print("Test formatting times (millis)");
for (let {time, expectedFormattedTime} of TEST_FORMAT_TIME_MS) {
let formattedTime = TimeScale.formatTime(time);
equal(formattedTime, expectedFormattedTime);
}
// Add 1 more animation to increase the range and test more time formatting
// cases.
TimeScale.addAnimation({
startTime: 3000,
duration: 5000,
delay: 0,
iterationCount: 1
});
do_print("Test formatting times (seconds)");
for (let {time, expectedFormattedTime} of TEST_FORMAT_TIME_S) {
let formattedTime = TimeScale.formatTime(time);
equal(formattedTime, expectedFormattedTime);
}
}

View File

@ -0,0 +1,9 @@
[DEFAULT]
tags = devtools
head =
tail =
firefox-appdir = browser
skip-if = toolkit == 'android' || toolkit == 'gonk'
[test_findOptimalTimeInterval.js]
[test_timeScale.js]

View File

@ -0,0 +1,134 @@
/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
/* vim: set ft=javascript ts=2 et sw=2 tw=80: */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
"use strict";
// How many times, maximum, can we loop before we find the optimal time
// interval in the timeline graph.
const OPTIMAL_TIME_INTERVAL_MAX_ITERS = 100;
// Background time graduations should be multiple of this number of millis.
const TIME_INTERVAL_MULTIPLE = 10;
const TIME_INTERVAL_SCALES = 3;
// The default minimum spacing between time graduations in px.
const TIME_GRADUATION_MIN_SPACING = 10;
// RGB color for the time interval background.
const TIME_INTERVAL_COLOR = [128, 136, 144];
const TIME_INTERVAL_OPACITY_MIN = 32; // byte
const TIME_INTERVAL_OPACITY_ADD = 32; // byte
/**
* DOM node creation helper function.
* @param {Object} Options to customize the node to be created.
* - nodeType {String} Optional, defaults to "div",
* - attributes {Object} Optional attributes object like
* {attrName1:value1, attrName2: value2, ...}
* - parent {DOMNode} Mandatory node to append the newly created node to.
* - textContent {String} Optional text for the node.
* @return {DOMNode} The newly created node.
*/
function createNode(options) {
if (!options.parent) {
throw new Error("Missing parent DOMNode to create new node");
}
let type = options.nodeType || "div";
let node = options.parent.ownerDocument.createElement(type);
for (let name in options.attributes || {}) {
let value = options.attributes[name];
node.setAttribute(name, value);
}
if (options.textContent) {
node.textContent = options.textContent;
}
options.parent.appendChild(node);
return node;
}
exports.createNode = createNode;
/**
* Given a data-scale, draw the background for a graph (vertical lines) into a
* canvas and set that canvas as an image-element with an ID that can be used
* from CSS.
* @param {Document} document The document where the image-element should be set.
* @param {String} id The ID for the image-element.
* @param {Number} graphWidth The width of the graph.
* @param {Number} timeScale How many px is 1ms in the graph.
*/
function drawGraphElementBackground(document, id, graphWidth, timeScale) {
let canvas = document.createElement("canvas");
let ctx = canvas.getContext("2d");
// Set the canvas width (as requested) and height (1px, repeated along the Y
// axis).
canvas.width = graphWidth;
canvas.height = 1;
// Create the image data array which will receive the pixels.
let imageData = ctx.createImageData(canvas.width, canvas.height);
let pixelArray = imageData.data;
let buf = new ArrayBuffer(pixelArray.length);
let view8bit = new Uint8ClampedArray(buf);
let view32bit = new Uint32Array(buf);
// Build new millisecond tick lines...
let [r, g, b] = TIME_INTERVAL_COLOR;
let alphaComponent = TIME_INTERVAL_OPACITY_MIN;
let interval = findOptimalTimeInterval(timeScale);
// Insert one pixel for each division on each scale.
for (let i = 1; i <= TIME_INTERVAL_SCALES; i++) {
let increment = interval * Math.pow(2, i);
for (let x = 0; x < canvas.width; x += increment) {
let position = x | 0;
view32bit[position] = (alphaComponent << 24) | (b << 16) | (g << 8) | r;
}
alphaComponent += TIME_INTERVAL_OPACITY_ADD;
}
// Flush the image data and cache the waterfall background.
pixelArray.set(view8bit);
ctx.putImageData(imageData, 0, 0);
document.mozSetImageElement(id, canvas);
}
exports.drawGraphElementBackground = drawGraphElementBackground;
/**
* Find the optimal interval between time graduations in the animation timeline
* graph based on a time scale and a minimum spacing.
* @param {Number} timeScale How many px is 1ms in the graph.
* @param {Number} minSpacing The minimum spacing between 2 graduations,
* defaults to TIME_GRADUATION_MIN_SPACING.
* @return {Number} The optimal interval, in pixels.
*/
function findOptimalTimeInterval(timeScale,
minSpacing=TIME_GRADUATION_MIN_SPACING) {
let timingStep = TIME_INTERVAL_MULTIPLE;
let numIters = 0;
if (timeScale > minSpacing) {
return timeScale;
}
while (true) {
let scaledStep = timeScale * timingStep;
if (++numIters > OPTIMAL_TIME_INTERVAL_MAX_ITERS) {
return scaledStep;
}
if (scaledStep < minSpacing) {
timingStep *= 2;
continue;
}
return scaledStep;
}
}
exports.findOptimalTimeInterval = findOptimalTimeInterval;

View File

@ -106,14 +106,13 @@ BottomHost.prototype = {
}
this.isMinimized = true;
this.frame.style.marginBottom = -this.frame.height + height + "px";
this._splitter.classList.add("disabled");
let onTransitionEnd = () => {
this.frame.removeEventListener("transitionend", onTransitionEnd);
this.emit("minimized");
};
this.frame.addEventListener("transitionend", onTransitionEnd);
this.frame.style.marginBottom = -this.frame.height + height + "px";
this._splitter.classList.add("disabled");
},
/**
@ -126,14 +125,13 @@ BottomHost.prototype = {
}
this.isMinimized = false;
this.frame.style.marginBottom = "0";
this._splitter.classList.remove("disabled");
let onTransitionEnd = () => {
this.frame.removeEventListener("transitionend", onTransitionEnd);
this.emit("maximized");
};
this.frame.addEventListener("transitionend", onTransitionEnd);
this.frame.style.marginBottom = "0";
this._splitter.classList.remove("disabled");
},
/**

View File

@ -8,7 +8,7 @@
* and parsing out the blueprint to generate correct values for markers.
*/
const { Ci } = require("chrome");
const { Cu, Ci } = require("chrome");
loader.lazyRequireGetter(this, "L10N",
"devtools/performance/global", true);
@ -22,6 +22,18 @@ loader.lazyRequireGetter(this, "WebConsoleUtils",
// String used to fill in platform data when it should be hidden.
const GECKO_SYMBOL = "(Gecko)";
/**
* Takes a marker, blueprint, and filter list and
* determines if this marker should be filtered or not.
*/
function isMarkerValid (marker, filter) {
let isUnknown = !(marker.name in TIMELINE_BLUEPRINT);
if (isUnknown) {
return filter.indexOf("UNKNOWN") === -1;
}
return filter.indexOf(marker.name) === -1;
}
/**
* Returns the correct label to display for passed in marker, based
* off of the blueprints.
@ -30,7 +42,7 @@ const GECKO_SYMBOL = "(Gecko)";
* @return {string}
*/
function getMarkerLabel (marker) {
let blueprint = TIMELINE_BLUEPRINT[marker.name];
let blueprint = getBlueprintFor(marker);
// Either use the label function in the blueprint, or use it directly
// as a string.
return typeof blueprint.label === "function" ? blueprint.label(marker) : blueprint.label;
@ -44,7 +56,7 @@ function getMarkerLabel (marker) {
* @return {string}
*/
function getMarkerClassName (type) {
let blueprint = TIMELINE_BLUEPRINT[type];
let blueprint = getBlueprintFor({ name: type });
// Either use the label function in the blueprint, or use it directly
// as a string.
let className = typeof blueprint.label === "function" ? blueprint.label() : blueprint.label;
@ -72,7 +84,7 @@ function getMarkerClassName (type) {
* @return {Array<object>}
*/
function getMarkerFields (marker) {
let blueprint = TIMELINE_BLUEPRINT[marker.name];
let blueprint = getBlueprintFor(marker);
// If blueprint.fields is a function, use that
if (typeof blueprint.fields === "function") {
@ -111,7 +123,7 @@ const DOM = {
* @return {Array<Element>}
*/
buildFields: function (doc, marker) {
let blueprint = TIMELINE_BLUEPRINT[marker.name];
let blueprint = getBlueprintFor(marker);
let fields = getMarkerFields(marker);
return fields.map(({ label, value }) => DOM.buildNameValueLabel(doc, label, value));
@ -125,7 +137,7 @@ const DOM = {
* @return {Element}
*/
buildTitle: function (doc, marker) {
let blueprint = TIMELINE_BLUEPRINT[marker.name];
let blueprint = getBlueprintFor(marker);
let hbox = doc.createElement("hbox");
hbox.setAttribute("align", "center");
@ -377,6 +389,14 @@ const JS_MARKER_MAP = {
* A series of formatters used by the blueprint.
*/
const Formatters = {
/**
* Uses the marker name as the label for markers that do not have
* a blueprint entry. Uses "Other" in the marker filter menu.
*/
UnknownLabel: function (marker={}) {
return marker.name || L10N.getStr("timeline.label.unknown");
},
GCLabel: function (marker={}) {
let label = L10N.getStr("timeline.label.garbageCollection");
// Only if a `nonincrementalReason` exists, do we want to label
@ -444,9 +464,22 @@ const Formatters = {
},
};
/**
* Takes a marker and returns the definition for that marker type,
* falling back to the UNKNOWN definition if undefined.
*
* @param {Marker} marker
* @return {object}
*/
function getBlueprintFor (marker) {
return TIMELINE_BLUEPRINT[marker.name] || TIMELINE_BLUEPRINT.UNKNOWN;
}
exports.isMarkerValid = isMarkerValid;
exports.getMarkerLabel = getMarkerLabel;
exports.getMarkerClassName = getMarkerClassName;
exports.getMarkerFields = getMarkerFields;
exports.DOM = DOM;
exports.CollapseFunctions = CollapseFunctions;
exports.Formatters = Formatters;
exports.getBlueprintFor = getBlueprintFor;

View File

@ -196,55 +196,6 @@ function getProfileThreadFromAllocations(allocations) {
return thread;
}
/**
* Gets the current timeline blueprint without the hidden markers.
*
* @param blueprint
* The default timeline blueprint.
* @param array hiddenMarkers
* A list of hidden markers' names.
* @return object
* The filtered timeline blueprint.
*/
function getFilteredBlueprint({ blueprint, hiddenMarkers }) {
// Clone functions here just to prevent an error, as the blueprint
// contains functions (even though we do not use them).
let filteredBlueprint = Cu.cloneInto(blueprint, {}, { cloneFunctions: true });
let maybeRemovedGroups = new Set();
let removedGroups = new Set();
// 1. Remove hidden markers from the blueprint.
for (let hiddenMarkerName of hiddenMarkers) {
maybeRemovedGroups.add(filteredBlueprint[hiddenMarkerName].group);
delete filteredBlueprint[hiddenMarkerName];
}
// 2. Get a list of all the groups that will be removed.
for (let maybeRemovedGroup of maybeRemovedGroups) {
let markerNames = Object.keys(filteredBlueprint);
let isGroupRemoved = markerNames.every(e => filteredBlueprint[e].group != maybeRemovedGroup);
if (isGroupRemoved) {
removedGroups.add(maybeRemovedGroup);
}
}
// 3. Offset groups so that their indices are consecutive.
for (let removedGroup of removedGroups) {
let markerNames = Object.keys(filteredBlueprint);
for (let markerName of markerNames) {
let markerDetails = filteredBlueprint[markerName];
if (markerDetails.group > removedGroup) {
markerDetails.group--;
}
}
}
return filteredBlueprint;
};
/**
* Deduplicates a profile by deduplicating stacks, frames, and strings.
*
@ -571,7 +522,6 @@ exports.offsetSampleTimes = offsetSampleTimes;
exports.offsetMarkerTimes = offsetMarkerTimes;
exports.offsetAndScaleTimestamps = offsetAndScaleTimestamps;
exports.getProfileThreadFromAllocations = getProfileThreadFromAllocations;
exports.getFilteredBlueprint = getFilteredBlueprint;
exports.deflateProfile = deflateProfile;
exports.deflateThread = deflateThread;
exports.UniqueStrings = UniqueStrings;

View File

@ -7,27 +7,25 @@
* Utility functions for collapsing markers into a waterfall.
*/
loader.lazyRequireGetter(this, "TIMELINE_BLUEPRINT",
"devtools/performance/markers", true);
loader.lazyRequireGetter(this, "getBlueprintFor",
"devtools/performance/marker-utils", true);
/**
* Collapses markers into a tree-like structure.
* @param object markerNode
* @param array markersList
* @param ?object blueprint
*/
function collapseMarkersIntoNode({ markerNode, markersList, blueprint }) {
function collapseMarkersIntoNode({ markerNode, markersList }) {
let { getCurrentParentNode, collapseMarker, addParentNode, popParentNode } = createParentNodeFactory(markerNode);
blueprint = blueprint || TIMELINE_BLUEPRINT;
for (let i = 0, len = markersList.length; i < len; i++) {
let curr = markersList[i];
let parentNode = getCurrentParentNode();
let def = blueprint[curr.name];
let collapse = def.collapseFunc || (() => null);
let blueprint = getBlueprintFor(curr);
let collapse = blueprint.collapseFunc || (() => null);
let peek = distance => markersList[i + distance];
let foundParent = false;
let collapseInfo = collapse(parentNode, curr, peek);
if (collapseInfo) {

View File

@ -55,6 +55,16 @@ const { Formatters, CollapseFunctions: collapse } = require("devtools/performanc
* updated as well.
*/
const TIMELINE_BLUEPRINT = {
/* Default definition used for markers that occur but
* are not defined here. Should ultimately be defined, but this gives
* us room to work on the front end separately from the platform. */
"UNKNOWN": {
group: 2,
colorName: "graphs-grey",
collapseFunc: collapse.child,
label: Formatters.UnknownLabel
},
/* Group 0 - Reflow and Rendering pipeline */
"Styles": {
group: 0,
@ -131,7 +141,7 @@ const TIMELINE_BLUEPRINT = {
/* Group 2 - User Controlled */
"ConsoleTime": {
group: 2,
colorName: "graphs-grey",
colorName: "graphs-blue",
label: sublabelForProperty(L10N.getStr("timeline.label.consoleTime"), "causeName"),
fields: [{
property: "causeName",

View File

@ -135,8 +135,8 @@ MemoryGraph.prototype = Heritage.extend(PerformanceGraph.prototype, {
}
});
function TimelineGraph(parent, blueprint) {
MarkersOverview.call(this, parent, blueprint);
function TimelineGraph(parent, filter) {
MarkersOverview.call(this, parent, filter);
}
TimelineGraph.prototype = Heritage.extend(MarkersOverview.prototype, {
@ -163,7 +163,6 @@ const GRAPH_DEFINITIONS = {
timeline: {
constructor: TimelineGraph,
selector: "#markers-overview",
needsBlueprints: true,
primaryLink: true
}
};
@ -174,15 +173,15 @@ const GRAPH_DEFINITIONS = {
*
* @param {object} definition
* @param {DOMElement} root
* @param {function} getBlueprint
* @param {function} getFilter
* @param {function} getTheme
*/
function GraphsController ({ definition, root, getBlueprint, getTheme }) {
function GraphsController ({ definition, root, getFilter, getTheme }) {
this._graphs = {};
this._enabled = new Set();
this._definition = definition || GRAPH_DEFINITIONS;
this._root = root;
this._getBlueprint = getBlueprint;
this._getFilter = getFilter;
this._getTheme = getTheme;
this._primaryLink = Object.keys(this._definition).filter(name => this._definition[name].primaryLink)[0];
this.$ = root.ownerDocument.querySelector.bind(root.ownerDocument);
@ -369,8 +368,8 @@ GraphsController.prototype = {
_construct: Task.async(function *(graphName) {
let def = this._definition[graphName];
let el = this.$(def.selector);
let blueprint = def.needsBlueprints ? this._getBlueprint() : void 0;
let graph = this._graphs[graphName] = new def.constructor(el, blueprint);
let filter = this._getFilter();
let graph = this._graphs[graphName] = new def.constructor(el, filter);
graph.graphName = graphName;
yield graph.ready();

View File

@ -13,8 +13,6 @@ loader.lazyRequireGetter(this, "EventEmitter",
"devtools/toolkit/event-emitter");
loader.lazyRequireGetter(this, "L10N",
"devtools/performance/global", true);
loader.lazyRequireGetter(this, "TIMELINE_BLUEPRINT",
"devtools/performance/markers", true);
loader.lazyRequireGetter(this, "MarkerUtils",
"devtools/performance/marker-utils");

View File

@ -11,11 +11,10 @@
const { Cc, Ci, Cu, Cr } = require("chrome");
const { Heritage } = require("resource:///modules/devtools/ViewHelpers.jsm");
const { AbstractTreeItem } = require("resource:///modules/devtools/AbstractTreeItem.jsm");
const { TIMELINE_BLUEPRINT: ORIGINAL_BP } = require("devtools/performance/markers");
loader.lazyRequireGetter(this, "MarkerUtils",
"devtools/performance/marker-utils");
const HTML_NS = "http://www.w3.org/1999/xhtml";
const LEVEL_INDENT = 10; // px
@ -60,15 +59,14 @@ MarkerView.prototype = Heritage.extend(AbstractTreeItem.prototype, {
},
/**
* Sets a list of names and colors used to paint markers.
* @see TIMELINE_BLUEPRINT in timeline/widgets/global.js
* @param object blueprint
* Sets a list of marker types to be filtered out of this view.
* @param Array<String> filter
*/
set blueprint(blueprint) {
this.root._blueprint = blueprint;
set filter(filter) {
this.root._filter = filter;
},
get blueprint() {
return this.root._blueprint;
get filter() {
return this.root._filter;
},
/**
@ -139,7 +137,6 @@ MarkerView.prototype = Heritage.extend(AbstractTreeItem.prototype, {
if (!submarkers || !submarkers.length) {
return;
}
let blueprint = this.root._blueprint;
let startTime = this.root._interval.startTime;
let endTime = this.root._interval.endTime;
let newLevel = this.level + 1;
@ -147,17 +144,15 @@ MarkerView.prototype = Heritage.extend(AbstractTreeItem.prototype, {
for (let i = 0, len = submarkers.length; i < len; i++) {
let marker = submarkers[i];
// If this marker isn't in the global timeline blueprint, don't display
// it, but dump a warning message to the console.
if (!(marker.name in blueprint)) {
if (!(marker.name in ORIGINAL_BP)) {
console.warn(`Marker not found in timeline blueprint: ${marker.name}.`);
}
// Skip filtered markers
if (!MarkerUtils.isMarkerValid(marker, this.filter)) {
continue;
}
if (!isMarkerInRange(marker, startTime|0, endTime|0)) {
continue;
}
children.push(new MarkerView({
owner: this,
marker: marker,
@ -175,15 +170,12 @@ MarkerView.prototype = Heritage.extend(AbstractTreeItem.prototype, {
*/
_buildMarkerCells: function(doc, targetNode, arrowNode) {
let marker = this.marker;
let style = this.root._blueprint[marker.name];
let blueprint = MarkerUtils.getBlueprintFor(marker);
let startTime = this.root._interval.startTime;
let endTime = this.root._interval.endTime;
let sidebarCell = this._buildMarkerSidebar(
doc, style, marker);
let timebarCell = this._buildMarkerTimebar(
doc, style, marker, startTime, endTime, arrowNode);
let sidebarCell = this._buildMarkerSidebar(doc, blueprint, marker);
let timebarCell = this._buildMarkerTimebar(doc, blueprint, marker, startTime, endTime, arrowNode);
targetNode.appendChild(sidebarCell);
targetNode.appendChild(timebarCell);

View File

@ -21,6 +21,10 @@ loader.lazyRequireGetter(this, "L10N",
"devtools/performance/global", true);
loader.lazyRequireGetter(this, "TickUtils",
"devtools/performance/waterfall-ticks", true);
loader.lazyRequireGetter(this, "MarkerUtils",
"devtools/performance/marker-utils");
loader.lazyRequireGetter(this, "TIMELINE_BLUEPRINT",
"devtools/performance/markers", true);
const OVERVIEW_HEADER_HEIGHT = 14; // px
const OVERVIEW_ROW_HEIGHT = 11; // px
@ -28,14 +32,12 @@ const OVERVIEW_ROW_HEIGHT = 11; // px
const OVERVIEW_SELECTION_LINE_COLOR = "#666";
const OVERVIEW_CLIPHEAD_LINE_COLOR = "#555";
const FIND_OPTIMAL_TICK_INTERVAL_MAX_ITERS = 100;
const OVERVIEW_HEADER_TICKS_MULTIPLE = 100; // ms
const OVERVIEW_HEADER_TICKS_SPACING_MIN = 75; // px
const OVERVIEW_HEADER_TEXT_FONT_SIZE = 9; // px
const OVERVIEW_HEADER_TEXT_FONT_FAMILY = "sans-serif";
const OVERVIEW_HEADER_TEXT_PADDING_LEFT = 6; // px
const OVERVIEW_HEADER_TEXT_PADDING_TOP = 1; // px
const OVERVIEW_MARKERS_COLOR_STOPS = [0, 0.1, 0.75, 1];
const OVERVIEW_MARKER_WIDTH_MIN = 4; // px
const OVERVIEW_GROUP_VERTICAL_PADDING = 5; // px
@ -44,13 +46,13 @@ const OVERVIEW_GROUP_VERTICAL_PADDING = 5; // px
*
* @param nsIDOMNode parent
* The parent node holding the overview.
* @param Object blueprint
* List of names and colors defining markers.
* @param Array<String> filter
* List of names of marker types that should not be shown.
*/
function MarkersOverview(parent, blueprint, ...args) {
function MarkersOverview(parent, filter=[], ...args) {
AbstractCanvasGraph.apply(this, [parent, "markers-overview", ...args]);
this.setTheme();
this.setBlueprint(blueprint);
this.setFilter(filter);
}
MarkersOverview.prototype = Heritage.extend(AbstractCanvasGraph.prototype, {
@ -64,21 +66,36 @@ MarkersOverview.prototype = Heritage.extend(AbstractCanvasGraph.prototype, {
* Compute the height of the overview.
*/
get fixedHeight() {
return this.headerHeight + this.rowHeight * (this._lastGroup + 1);
return this.headerHeight + this.rowHeight * this._numberOfGroups;
},
/**
* List of names and colors used to paint this overview.
* @see TIMELINE_BLUEPRINT in timeline/widgets/global.js
* List of marker types that should not be shown in the graph.
*/
setBlueprint: function(blueprint) {
setFilter: function (filter) {
this._paintBatches = new Map();
this._lastGroup = 0;
this._filter = filter;
this._groupMap = Object.create(null);
for (let type in blueprint) {
this._paintBatches.set(type, { style: blueprint[type], batch: [] });
this._lastGroup = Math.max(this._lastGroup, blueprint[type].group || 0);
let observedGroups = new Set();
for (let type in TIMELINE_BLUEPRINT) {
if (filter.indexOf(type) !== -1) {
continue;
}
this._paintBatches.set(type, { definition: TIMELINE_BLUEPRINT[type], batch: [] });
observedGroups.add(TIMELINE_BLUEPRINT[type].group);
}
// Take our set of observed groups and order them and map
// the group numbers to fill in the holes via `_groupMap`.
// This normalizes our rows by removing rows that aren't used
// if filters are enabled.
let actualPosition = 0;
for (let groupNumber of Array.from(observedGroups).sort()) {
this._groupMap[groupNumber] = actualPosition++;
}
this._numberOfGroups = Object.keys(this._groupMap).length;
},
/**
@ -103,17 +120,19 @@ MarkersOverview.prototype = Heritage.extend(AbstractCanvasGraph.prototype, {
// Group markers into separate paint batches. This is necessary to
// draw all markers sharing the same style at once.
for (let marker of markers) {
let markerType = this._paintBatches.get(marker.name);
if (markerType) {
markerType.batch.push(marker);
// Again skip over markers that we're filtering -- we don't want them
// to be labeled as "Unknown"
if (!MarkerUtils.isMarkerValid(marker, this._filter)) {
continue;
}
let markerType = this._paintBatches.get(marker.name) || this._paintBatches.get("UNKNOWN");
markerType.batch.push(marker);
}
// Calculate each row's height, and the time-based scaling.
let totalGroups = this._lastGroup + 1;
let groupHeight = this.rowHeight * this._pixelRatio;
let groupPadding = this.groupPadding * this._pixelRatio;
let headerHeight = this.headerHeight * this._pixelRatio;
@ -132,7 +151,7 @@ MarkersOverview.prototype = Heritage.extend(AbstractCanvasGraph.prototype, {
ctx.fillStyle = this.alternatingBackgroundColor;
ctx.beginPath();
for (let i = 0; i < totalGroups; i += 2) {
for (let i = 0; i < this._numberOfGroups; i += 2) {
let top = headerHeight + i * groupHeight;
ctx.rect(0, top, canvasWidth, groupHeight);
}
@ -172,11 +191,12 @@ MarkersOverview.prototype = Heritage.extend(AbstractCanvasGraph.prototype, {
// Draw the timeline markers.
for (let [, { style, batch }] of this._paintBatches) {
let top = headerHeight + style.group * groupHeight + groupPadding / 2;
for (let [, { definition, batch }] of this._paintBatches) {
let group = this._groupMap[definition.group];
let top = headerHeight + group * groupHeight + groupPadding / 2;
let height = groupHeight - groupPadding;
let color = getColor(style.colorName, this.theme);
let color = getColor(definition.colorName, this.theme);
ctx.fillStyle = color;
ctx.beginPath();

View File

@ -398,16 +398,6 @@ let PerformanceController = {
return null;
},
/**
* Gets the current timeline blueprint without the hidden markers.
* @return object
*/
getTimelineBlueprint: function() {
let blueprint = TIMELINE_BLUEPRINT;
let hiddenMarkers = this.getPref("hidden-markers");
return RecordingUtils.getFilteredBlueprint({ blueprint, hiddenMarkers });
},
/**
* Fired from RecordingsView, we listen on the PerformanceController so we can
* set it here and re-emit on the controller, where all views can listen.

View File

@ -13,7 +13,6 @@ support-files =
# that need to be moved over to performance tool
[browser_aaa-run-first-leaktest.js]
[browser_marker-utils.js]
[browser_markers-cycle-collection.js]
[browser_markers-gc.js]
[browser_markers-parse-html.js]
@ -137,7 +136,6 @@ support-files =
[browser_profiler_tree-view-08.js]
[browser_profiler_tree-view-09.js]
[browser_profiler_tree-view-10.js]
[browser_timeline-blueprint.js]
[browser_timeline-filters.js]
[browser_timeline-waterfall-background.js]
[browser_timeline-waterfall-generic.js]

View File

@ -1,70 +0,0 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
/**
* Tests the marker utils methods.
*/
function* spawnTest() {
let { TIMELINE_BLUEPRINT } = devtools.require("devtools/performance/markers");
let Utils = devtools.require("devtools/performance/marker-utils");
Services.prefs.setBoolPref(PLATFORM_DATA_PREF, false);
is(Utils.getMarkerLabel({ name: "DOMEvent" }), "DOM Event",
"getMarkerLabel() returns a simple label");
is(Utils.getMarkerLabel({ name: "Javascript", causeName: "setTimeout handler" }), "setTimeout",
"getMarkerLabel() returns a label defined via function");
ok(Utils.getMarkerFields({ name: "Paint" }).length === 0,
"getMarkerFields() returns an empty array when no fields defined");
let fields = Utils.getMarkerFields({ name: "ConsoleTime", causeName: "snowstorm" });
is(fields[0].label, "Timer Name:", "getMarkerFields() returns an array with proper label");
is(fields[0].value, "snowstorm", "getMarkerFields() returns an array with proper value");
fields = Utils.getMarkerFields({ name: "DOMEvent", type: "mouseclick" });
is(fields.length, 1, "getMarkerFields() ignores fields that are not found on marker");
is(fields[0].label, "Event Type:", "getMarkerFields() returns an array with proper label");
is(fields[0].value, "mouseclick", "getMarkerFields() returns an array with proper value");
fields = Utils.getMarkerFields({ name: "DOMEvent", eventPhase: Ci.nsIDOMEvent.AT_TARGET, type: "mouseclick" });
is(fields.length, 2, "getMarkerFields() returns multiple fields when using a fields function");
is(fields[0].label, "Event Type:", "getMarkerFields() correctly returns fields via function (1)");
is(fields[0].value, "mouseclick", "getMarkerFields() correctly returns fields via function (2)");
is(fields[1].label, "Phase:", "getMarkerFields() correctly returns fields via function (3)");
is(fields[1].value, "Target", "getMarkerFields() correctly returns fields via function (4)");
is(Utils.getMarkerFields({ name: "Javascript", causeName: "Some Platform Field" })[0].value, "(Gecko)",
"Correctly obfuscates JS markers when platform data is off.");
Services.prefs.setBoolPref(PLATFORM_DATA_PREF, true);
is(Utils.getMarkerFields({ name: "Javascript", causeName: "Some Platform Field" })[0].value, "Some Platform Field",
"Correctly deobfuscates JS markers when platform data is on.");
is(Utils.getMarkerClassName("Javascript"), "Function Call",
"getMarkerClassName() returns correct string when defined via function");
is(Utils.getMarkerClassName("GarbageCollection"), "GC Event",
"getMarkerClassName() returns correct string when defined via function");
is(Utils.getMarkerClassName("Reflow"), "Layout",
"getMarkerClassName() returns correct string when defined via string");
TIMELINE_BLUEPRINT["fakemarker"] = { group: 0 };
try {
Utils.getMarkerClassName("fakemarker");
ok(false, "getMarkerClassName() should throw when no label on blueprint.");
} catch (e) {
ok(true, "getMarkerClassName() should throw when no label on blueprint.");
}
TIMELINE_BLUEPRINT["fakemarker"] = { group: 0, label: () => void 0};
try {
Utils.getMarkerClassName("fakemarker");
ok(false, "getMarkerClassName() should throw when label function returnd undefined.");
} catch (e) {
ok(true, "getMarkerClassName() should throw when label function returnd undefined.");
}
delete TIMELINE_BLUEPRINT["fakemarker"];
finish();
}

View File

@ -1,34 +0,0 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
/**
* Tests if the timeline blueprint has a correct structure.
*/
function* spawnTest() {
let { TIMELINE_BLUEPRINT } = devtools.require("devtools/performance/markers");
ok(TIMELINE_BLUEPRINT,
"A timeline blueprint should be available.");
ok(Object.keys(TIMELINE_BLUEPRINT).length,
"The timeline blueprint has at least one entry.");
for (let [key, value] of Iterator(TIMELINE_BLUEPRINT)) {
if (key.startsWith("meta::")) {
ok(!("group" in value),
"No meta entry in the timeline blueprint can contain a `group` key.");
ok("colorName" in value,
"Each meta entry in the timeline blueprint contains a `colorName` key.");
ok("label" in value,
"Each meta entry in the timeline blueprint contains a `label` key.");
} else {
ok("group" in value,
"Each entry in the timeline blueprint contains a `group` key.");
ok("colorName" in value,
"Each entry in the timeline blueprint contains a `colorName` key.");
ok("label" in value,
"Each entry in the timeline blueprint contains a `label` key.");
}
}
}

View File

@ -5,6 +5,8 @@
* Tests markers filtering mechanism.
*/
const EPSILON = 0.00000001;
function* spawnTest() {
let { panel } = yield initPerformance(SIMPLE_URL);
let { $, $$, EVENTS, PerformanceController, OverviewView, WaterfallView } = panel.panelWin;
@ -24,20 +26,34 @@ function* spawnTest() {
yield stopRecording(panel);
// Push some fake markers of a type we do not have a blueprint for
let markers = PerformanceController.getCurrentRecording().getMarkers();
let endTime = markers[markers.length - 1].end;
markers.push({ name: "CustomMarker", start: endTime + EPSILON, end: endTime + (EPSILON * 2) });
markers.push({ name: "CustomMarker", start: endTime + (EPSILON * 3), end: endTime + (EPSILON * 4) });
// Invalidate marker cache
WaterfallView._cache.delete(markers);
// Select everything
OverviewView.setTimeInterval({ startTime: 0, endTime: Number.MAX_VALUE })
let waterfallRendered = WaterfallView.once(EVENTS.WATERFALL_RENDERED);
OverviewView.setTimeInterval({ startTime: 0, endTime: Number.MAX_VALUE });
$("#filter-button").click();
let menuItem1 = $("menuitem[marker-type=Styles]");
let menuItem2 = $("menuitem[marker-type=Reflow]");
let menuItem3 = $("menuitem[marker-type=Paint]");
let menuItem4 = $("menuitem[marker-type=UNKNOWN]");
let overview = OverviewView.graphs.get("timeline");
let originalHeight = overview.fixedHeight;
yield waterfallRendered;
ok($(".waterfall-marker-bar[type=Styles]"), "Found at least one 'Styles' marker (1)");
ok($(".waterfall-marker-bar[type=Reflow]"), "Found at least one 'Reflow' marker (1)");
ok($(".waterfall-marker-bar[type=Paint]"), "Found at least one 'Paint' marker (1)");
ok($(".waterfall-marker-bar[type=CustomMarker]"), "Found at least one 'Unknown' marker (1)");
let heightBefore = overview.fixedHeight;
EventUtils.synthesizeMouseAtCenter(menuItem1, {type: "mouseup"}, panel.panelWin);
@ -47,6 +63,7 @@ function* spawnTest() {
ok(!$(".waterfall-marker-bar[type=Styles]"), "No 'Styles' marker (2)");
ok($(".waterfall-marker-bar[type=Reflow]"), "Found at least one 'Reflow' marker (2)");
ok($(".waterfall-marker-bar[type=Paint]"), "Found at least one 'Paint' marker (2)");
ok($(".waterfall-marker-bar[type=CustomMarker]"), "Found at least one 'Unknown' marker (2)");
heightBefore = overview.fixedHeight;
EventUtils.synthesizeMouseAtCenter(menuItem2, {type: "mouseup"}, panel.panelWin);
@ -56,6 +73,7 @@ function* spawnTest() {
ok(!$(".waterfall-marker-bar[type=Styles]"), "No 'Styles' marker (3)");
ok(!$(".waterfall-marker-bar[type=Reflow]"), "No 'Reflow' marker (3)");
ok($(".waterfall-marker-bar[type=Paint]"), "Found at least one 'Paint' marker (3)");
ok($(".waterfall-marker-bar[type=CustomMarker]"), "Found at least one 'Unknown' marker (3)");
heightBefore = overview.fixedHeight;
EventUtils.synthesizeMouseAtCenter(menuItem3, {type: "mouseup"}, panel.panelWin);
@ -65,15 +83,25 @@ function* spawnTest() {
ok(!$(".waterfall-marker-bar[type=Styles]"), "No 'Styles' marker (4)");
ok(!$(".waterfall-marker-bar[type=Reflow]"), "No 'Reflow' marker (4)");
ok(!$(".waterfall-marker-bar[type=Paint]"), "No 'Paint' marker (4)");
ok($(".waterfall-marker-bar[type=CustomMarker]"), "Found at least one 'Unknown' marker (4)");
EventUtils.synthesizeMouseAtCenter(menuItem4, {type: "mouseup"}, panel.panelWin);
yield waitForOverviewAndCommand(overview, menuItem4);
ok(!$(".waterfall-marker-bar[type=Styles]"), "No 'Styles' marker (5)");
ok(!$(".waterfall-marker-bar[type=Reflow]"), "No 'Reflow' marker (5)");
ok(!$(".waterfall-marker-bar[type=Paint]"), "No 'Paint' marker (5)");
ok(!$(".waterfall-marker-bar[type=CustomMarker]"), "No 'Unknown' marker (5)");
for (let item of [menuItem1, menuItem2, menuItem3]) {
EventUtils.synthesizeMouseAtCenter(item, {type: "mouseup"}, panel.panelWin);
yield waitForOverviewAndCommand(overview, item);
}
ok($(".waterfall-marker-bar[type=Styles]"), "Found at least one 'Styles' marker (5)");
ok($(".waterfall-marker-bar[type=Reflow]"), "Found at least one 'Reflow' marker (5)");
ok($(".waterfall-marker-bar[type=Paint]"), "Found at least one 'Paint' marker (5)");
ok($(".waterfall-marker-bar[type=Styles]"), "Found at least one 'Styles' marker (6)");
ok($(".waterfall-marker-bar[type=Reflow]"), "Found at least one 'Reflow' marker (6)");
ok($(".waterfall-marker-bar[type=Paint]"), "Found at least one 'Paint' marker (6)");
ok(!$(".waterfall-marker-bar[type=CustomMarker]"), "No 'Unknown' marker (6)");
is(overview.fixedHeight, originalHeight, "Overview restored");

View File

@ -61,6 +61,7 @@ let DEFAULT_PREFS = [
"devtools.performance.profiler.buffer-size",
"devtools.performance.profiler.sample-frequency-khz",
"devtools.performance.ui.experimental",
"devtools.performance.timeline.hidden-markers",
].reduce((prefs, pref) => {
prefs[pref] = Preferences.get(pref);
return prefs;

View File

@ -5,8 +5,11 @@
const { classes: Cc, interfaces: Ci, utils: Cu, results: Cr } = Components;
let { devtools } = Cu.import("resource://gre/modules/devtools/Loader.jsm", {});
let { Services } = Cu.import("resource://gre/modules/Services.jsm", {});
const RecordingUtils = devtools.require("devtools/performance/recording-utils");
const PLATFORM_DATA_PREF = "devtools.performance.ui.show-platform-data";
/**
* Get a path in a FrameNode call tree.
*/

View File

@ -0,0 +1,29 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
/**
* Tests if the timeline blueprint has a correct structure.
*/
function run_test() {
run_next_test();
}
add_task(function () {
let { TIMELINE_BLUEPRINT } = devtools.require("devtools/performance/markers");
ok(TIMELINE_BLUEPRINT,
"A timeline blueprint should be available.");
ok(Object.keys(TIMELINE_BLUEPRINT).length,
"The timeline blueprint has at least one entry.");
for (let [key, value] of Iterator(TIMELINE_BLUEPRINT)) {
ok("group" in value,
"Each entry in the timeline blueprint contains a `group` key.");
ok("colorName" in value,
"Each entry in the timeline blueprint contains a `colorName` key.");
ok("label" in value,
"Each entry in the timeline blueprint contains a `label` key.");
}
});

View File

@ -0,0 +1,88 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
/**
* Tests the marker utils methods.
*/
function run_test() {
run_next_test();
}
add_task(function () {
let { TIMELINE_BLUEPRINT } = devtools.require("devtools/performance/markers");
let Utils = devtools.require("devtools/performance/marker-utils");
Services.prefs.setBoolPref(PLATFORM_DATA_PREF, false);
equal(Utils.getMarkerLabel({ name: "DOMEvent" }), "DOM Event",
"getMarkerLabel() returns a simple label");
equal(Utils.getMarkerLabel({ name: "Javascript", causeName: "setTimeout handler" }), "setTimeout",
"getMarkerLabel() returns a label defined via function");
ok(Utils.getMarkerFields({ name: "Paint" }).length === 0,
"getMarkerFields() returns an empty array when no fields defined");
let fields = Utils.getMarkerFields({ name: "ConsoleTime", causeName: "snowstorm" });
equal(fields[0].label, "Timer Name:", "getMarkerFields() returns an array with proper label");
equal(fields[0].value, "snowstorm", "getMarkerFields() returns an array with proper value");
fields = Utils.getMarkerFields({ name: "DOMEvent", type: "mouseclick" });
equal(fields.length, 1, "getMarkerFields() ignores fields that are not found on marker");
equal(fields[0].label, "Event Type:", "getMarkerFields() returns an array with proper label");
equal(fields[0].value, "mouseclick", "getMarkerFields() returns an array with proper value");
fields = Utils.getMarkerFields({ name: "DOMEvent", eventPhase: Ci.nsIDOMEvent.AT_TARGET, type: "mouseclick" });
equal(fields.length, 2, "getMarkerFields() returns multiple fields when using a fields function");
equal(fields[0].label, "Event Type:", "getMarkerFields() correctly returns fields via function (1)");
equal(fields[0].value, "mouseclick", "getMarkerFields() correctly returns fields via function (2)");
equal(fields[1].label, "Phase:", "getMarkerFields() correctly returns fields via function (3)");
equal(fields[1].value, "Target", "getMarkerFields() correctly returns fields via function (4)");
equal(Utils.getMarkerFields({ name: "Javascript", causeName: "Some Platform Field" })[0].value, "(Gecko)",
"Correctly obfuscates JS markers when platform data is off.");
Services.prefs.setBoolPref(PLATFORM_DATA_PREF, true);
equal(Utils.getMarkerFields({ name: "Javascript", causeName: "Some Platform Field" })[0].value, "Some Platform Field",
"Correctly deobfuscates JS markers when platform data is on.");
equal(Utils.getMarkerClassName("Javascript"), "Function Call",
"getMarkerClassName() returns correct string when defined via function");
equal(Utils.getMarkerClassName("GarbageCollection"), "GC Event",
"getMarkerClassName() returns correct string when defined via function");
equal(Utils.getMarkerClassName("Reflow"), "Layout",
"getMarkerClassName() returns correct string when defined via string");
TIMELINE_BLUEPRINT["fakemarker"] = { group: 0 };
try {
Utils.getMarkerClassName("fakemarker");
ok(false, "getMarkerClassName() should throw when no label on blueprint.");
} catch (e) {
ok(true, "getMarkerClassName() should throw when no label on blueprint.");
}
TIMELINE_BLUEPRINT["fakemarker"] = { group: 0, label: () => void 0};
try {
Utils.getMarkerClassName("fakemarker");
ok(false, "getMarkerClassName() should throw when label function returnd undefined.");
} catch (e) {
ok(true, "getMarkerClassName() should throw when label function returnd undefined.");
}
delete TIMELINE_BLUEPRINT["fakemarker"];
let customBlueprint = {
UNKNOWN: {
group: 1,
label: "MyDefault"
},
custom: {
group: 0,
label: "MyCustom"
}
};
equal(Utils.getBlueprintFor({ name: "Reflow" }).label, "Layout",
"Utils.getBlueprintFor() should return marker def for passed in marker.");
equal(Utils.getBlueprintFor({ name: "Not sure!" }).label(), "Unknown",
"Utils.getBlueprintFor() should return a default marker def if the marker is undefined.");
});

View File

@ -5,9 +5,11 @@ tail =
firefox-appdir = browser
skip-if = toolkit == 'android' || toolkit == 'gonk'
[test_profiler-categories.js]
[test_frame-utils-01.js]
[test_frame-utils-02.js]
[test_marker-blueprint.js]
[test_marker-utils.js]
[test_profiler-categories.js]
[test_tree-model-01.js]
[test_tree-model-02.js]
[test_tree-model-03.js]

View File

@ -32,6 +32,7 @@ let WaterfallView = Heritage.extend(DetailsSubview, {
this._onMarkerSelected = this._onMarkerSelected.bind(this);
this._onResize = this._onResize.bind(this);
this._onViewSource = this._onViewSource.bind(this);
this._hiddenMarkers = PerformanceController.getPref("hidden-markers");
this.headerContainer = $("#waterfall-header");
this.breakdownContainer = $("#waterfall-breakdown");
@ -111,8 +112,7 @@ let WaterfallView = Heritage.extend(DetailsSubview, {
* Called whenever an observed pref is changed.
*/
_onObservedPrefChange: function(_, prefName) {
let blueprint = PerformanceController.getTimelineBlueprint();
this._markersRoot.blueprint = blueprint;
this._hiddenMarkers = PerformanceController.getPref("hidden-markers");
},
/**
@ -136,7 +136,7 @@ let WaterfallView = Heritage.extend(DetailsSubview, {
WaterfallUtils.collapseMarkersIntoNode({
markerNode: rootMarkerNode,
markersList: markers
markersList: markers,
});
this._cache.set(markers, rootMarkerNode);
@ -160,8 +160,7 @@ let WaterfallView = Heritage.extend(DetailsSubview, {
this._markersRoot = root;
this._waterfallHeader = header;
let blueprint = PerformanceController.getTimelineBlueprint();
root.blueprint = blueprint;
root.filter = this._hiddenMarkers;
root.interval = interval;
root.on("selected", this._onMarkerSelected);
root.on("unselected", this._onMarkerSelected);

View File

@ -42,7 +42,7 @@ let OverviewView = {
initialize: function () {
this.graphs = new GraphsController({
root: $("#overview-pane"),
getBlueprint: () => PerformanceController.getTimelineBlueprint(),
getFilter: () => PerformanceController.getPref("hidden-markers"),
getTheme: () => PerformanceController.getTheme(),
});
@ -331,8 +331,8 @@ let OverviewView = {
case "hidden-markers": {
let graph;
if (graph = yield this.graphs.isAvailable("timeline")) {
let blueprint = PerformanceController.getTimelineBlueprint();
graph.setBlueprint(blueprint);
let filter = PerformanceController.getPref("hidden-markers");
graph.setFilter(filter);
graph.refresh({ force: true });
}
break;

View File

@ -52,3 +52,9 @@ player.timeLabel=%Ss
# drop-down list items that can be used to change the rate at which the
# animation runs (1x being the default, 2x being twice as fast).
player.playbackRateLabel=%Sx
# LOCALIZATION NOTE (timeline.timeGraduationLabel):
# This string is displayed at the top of the animation panel, next to each time
# graduation, to indicate what duration (in milliseconds) this graduation
# corresponds to.
timeline.timeGraduationLabel=%Sms

View File

@ -46,6 +46,7 @@ timeline.label.domevent=DOM Event
timeline.label.consoleTime=Console
timeline.label.garbageCollection=GC Event
timeline.label.timestamp=Timestamp
timeline.label.unknown=Unknown
# LOCALIZATION NOTE (graphs.memory):
# This string is displayed in the memory graph of the Performance tool,

View File

@ -1,3 +1,17 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
/* Animation-inspector specific theme variables */
.theme-dark {
--even-animation-timeline-background-color: rgba(255,255,255,0.03);
}
.theme-light {
--even-animation-timeline-background-color: rgba(128,128,128,0.03);
}
html {
height: 100%;
}
@ -32,6 +46,13 @@ body {
min-height: 20px;
}
/* The main animations container */
#players {
height: calc(100% - 20px);
overflow: auto;
}
/* The error message, shown when an invalid/unanimated element is selected */
#error-message {
@ -44,12 +65,6 @@ body {
display: none;
}
/* The animation players container */
#players {
flex: 1;
overflow: auto;
}
/* Element picker and toggle-all buttons */
@ -99,6 +114,156 @@ body {
}
}
/* Animation timeline component */
.animation-timeline {
height: 100%;
overflow: hidden;
/* The timeline gets its background-image from a canvas element created in
/browser/devtools/animationinspector/utils.js drawGraphElementBackground
thanks to document.mozSetImageElement("time-graduations", canvas)
This is done so that the background can be built dynamically from script */
background-image: -moz-element(#time-graduations);
background-repeat: repeat-y;
/* The animations are drawn 150px from the left edge so that animated nodes
can be displayed in a sidebar */
background-position: 150px 0;
display: flex;
flex-direction: column;
}
.animation-timeline .time-header {
margin-left: 150px;
height: 20px;
overflow: hidden;
position: relative;
border-bottom: 1px solid var(--theme-splitter-color);
}
.animation-timeline .time-header .time-tick {
position: absolute;
top: 3px;
}
.animation-timeline .animations {
width: 100%;
overflow-y: auto;
overflow-x: hidden;
margin: 0;
padding: 0;
list-style-type: none;
}
/* Animation block widgets */
.animation-timeline .animation {
margin: 4px 0;
height: 20px;
position: relative;
}
.animation-timeline .animation:nth-child(2n) {
background-color: var(--even-animation-timeline-background-color);
}
.animation-timeline .animation .target {
width: 150px;
overflow: hidden;
height: 100%;
}
.animation-timeline .animation-target {
background-color: transparent;
}
.animation-timeline .animation .time-block {
position: absolute;
top: 0;
left: 150px;
right: 0;
height: 100%;
}
/* Animation iterations */
.animation-timeline .animation .iterations {
position: relative;
height: 100%;
border: 1px solid var(--theme-highlight-lightorange);
box-sizing: border-box;
background: var(--theme-contrast-background);
/* Iterations are displayed with a repeating linear-gradient which size is
dynamically changed from JS */
background-image:
linear-gradient(to right,
var(--theme-highlight-lightorange) 0,
var(--theme-highlight-lightorange) 1px,
transparent 1px,
transparent 2px);
background-repeat: repeat-x;
background-position: -1px 0;
}
.animation-timeline .animation .iterations.infinite {
border-right-width: 0;
}
.animation-timeline .animation .iterations.infinite::before,
.animation-timeline .animation .iterations.infinite::after {
content: "";
position: absolute;
top: 0;
right: 0;
width: 0;
height: 0;
border-right: 4px solid var(--theme-body-background);
border-top: 4px solid transparent;
border-bottom: 4px solid transparent;
}
.animation-timeline .animation .iterations.infinite::after {
bottom: 0;
top: unset;
}
.animation-timeline .animation .animation-title {
height: 1.5em;
width: 100%;
box-sizing: border-box;
overflow: hidden;
}
.animation-timeline .animation .delay {
position: absolute;
top: 0;
height: 100%;
background-image: linear-gradient(to bottom,
transparent,
transparent 9px,
var(--theme-highlight-lightorange) 9px,
var(--theme-highlight-lightorange) 11px,
transparent 11px,
transparent);
}
.animation-timeline .animation .delay::before {
position: absolute;
content: "";
left: 0;
width: 2px;
height: 8px;
top: 50%;
margin-top: -4px;
background: var(--theme-highlight-lightorange);
}
.animation-timeline .animation .name {
position: absolute;
z-index: 1;
padding: 2px;
white-space: nowrap;
}
/* Animation target node gutter, contains a preview of the dom node */
.animation-target {
@ -253,4 +418,4 @@ body {
width: 50px;
border-left: 1px solid var(--theme-splitter-color);
background: var(--theme-toolbar-background);
}
}

View File

@ -1502,6 +1502,13 @@ richlistitem[type~="action"][actiontype="searchengine"] > .ac-title-box > .ac-si
}
}
@media (-moz-os-version: windows-win10) and (-moz-windows-default-theme) {
.ac-url-text:not([selected="true"]),
.ac-action-text:not([selected="true"]) {
color: Highlight;
}
}
richlistitem[type~="action"][actiontype="switchtab"] > .ac-url-box > .ac-action-icon {
list-style-image: url("chrome://browser/skin/actionicon-tab.png");
-moz-image-region: rect(0, 16px, 11px, 0);

View File

@ -123,6 +123,18 @@ extern bool gBluetoothDebugFlag;
array.AppendElement(name); \
} while(0) \
/**
* Convert an enum value to string then append it to a fallible array.
*/
#define BT_APPEND_ENUM_STRING_FALLIBLE(array, enumType, enumValue) \
do { \
uint32_t index = uint32_t(enumValue); \
nsAutoString name; \
name.AssignASCII(enumType##Values::strings[index].value, \
enumType##Values::strings[index].length); \
array.AppendElement(name, mozilla::fallible); \
} while(0) \
/**
* Resolve |promise| with |ret| if |x| is false.
*/

View File

@ -27,7 +27,7 @@ BluetoothDaemonA2dpModule::SetNotificationHandler(
}
nsresult
BluetoothDaemonA2dpModule::Send(BluetoothDaemonPDU* aPDU,
BluetoothDaemonA2dpModule::Send(DaemonSocketPDU* aPDU,
BluetoothA2dpResultHandler* aRes)
{
aRes->AddRef(); // Keep reference for response
@ -35,11 +35,11 @@ BluetoothDaemonA2dpModule::Send(BluetoothDaemonPDU* aPDU,
}
void
BluetoothDaemonA2dpModule::HandleSvc(const BluetoothDaemonPDUHeader& aHeader,
BluetoothDaemonPDU& aPDU, void* aUserData)
BluetoothDaemonA2dpModule::HandleSvc(const DaemonSocketPDUHeader& aHeader,
DaemonSocketPDU& aPDU, void* aUserData)
{
static void (BluetoothDaemonA2dpModule::* const HandleOp[])(
const BluetoothDaemonPDUHeader&, BluetoothDaemonPDU&, void*) = {
const DaemonSocketPDUHeader&, DaemonSocketPDU&, void*) = {
INIT_ARRAY_AT(0, &BluetoothDaemonA2dpModule::HandleRsp),
INIT_ARRAY_AT(1, &BluetoothDaemonA2dpModule::HandleNtf),
};
@ -61,7 +61,7 @@ BluetoothDaemonA2dpModule::ConnectCmd(
{
MOZ_ASSERT(NS_IsMainThread());
nsAutoPtr<BluetoothDaemonPDU> pdu(new BluetoothDaemonPDU(SERVICE_ID,
nsAutoPtr<DaemonSocketPDU> pdu(new DaemonSocketPDU(SERVICE_ID,
OPCODE_CONNECT,
6)); // Address
nsresult rv = PackPDU(
@ -83,7 +83,7 @@ BluetoothDaemonA2dpModule::DisconnectCmd(
{
MOZ_ASSERT(NS_IsMainThread());
nsAutoPtr<BluetoothDaemonPDU> pdu(new BluetoothDaemonPDU(SERVICE_ID,
nsAutoPtr<DaemonSocketPDU> pdu(new DaemonSocketPDU(SERVICE_ID,
OPCODE_DISCONNECT,
6)); // Address
nsresult rv = PackPDU(
@ -104,8 +104,8 @@ BluetoothDaemonA2dpModule::DisconnectCmd(
void
BluetoothDaemonA2dpModule::ErrorRsp(
const BluetoothDaemonPDUHeader& aHeader,
BluetoothDaemonPDU& aPDU, BluetoothA2dpResultHandler* aRes)
const DaemonSocketPDUHeader& aHeader,
DaemonSocketPDU& aPDU, BluetoothA2dpResultHandler* aRes)
{
ErrorRunnable::Dispatch(
aRes, &BluetoothA2dpResultHandler::OnError, UnpackPDUInitOp(aPDU));
@ -113,7 +113,7 @@ BluetoothDaemonA2dpModule::ErrorRsp(
void
BluetoothDaemonA2dpModule::ConnectRsp(
const BluetoothDaemonPDUHeader& aHeader, BluetoothDaemonPDU& aPDU,
const DaemonSocketPDUHeader& aHeader, DaemonSocketPDU& aPDU,
BluetoothA2dpResultHandler* aRes)
{
ResultRunnable::Dispatch(
@ -122,7 +122,7 @@ BluetoothDaemonA2dpModule::ConnectRsp(
void
BluetoothDaemonA2dpModule::DisconnectRsp(
const BluetoothDaemonPDUHeader& aHeader, BluetoothDaemonPDU& aPDU,
const DaemonSocketPDUHeader& aHeader, DaemonSocketPDU& aPDU,
BluetoothA2dpResultHandler* aRes)
{
ResultRunnable::Dispatch(
@ -131,12 +131,12 @@ BluetoothDaemonA2dpModule::DisconnectRsp(
void
BluetoothDaemonA2dpModule::HandleRsp(
const BluetoothDaemonPDUHeader& aHeader, BluetoothDaemonPDU& aPDU,
const DaemonSocketPDUHeader& aHeader, DaemonSocketPDU& aPDU,
void* aUserData)
{
static void (BluetoothDaemonA2dpModule::* const HandleRsp[])(
const BluetoothDaemonPDUHeader&,
BluetoothDaemonPDU&,
const DaemonSocketPDUHeader&,
DaemonSocketPDU&,
BluetoothA2dpResultHandler*) = {
INIT_ARRAY_AT(OPCODE_ERROR,
&BluetoothDaemonA2dpModule::ErrorRsp),
@ -186,14 +186,14 @@ class BluetoothDaemonA2dpModule::ConnectionStateInitOp final
: private PDUInitOp
{
public:
ConnectionStateInitOp(BluetoothDaemonPDU& aPDU)
ConnectionStateInitOp(DaemonSocketPDU& aPDU)
: PDUInitOp(aPDU)
{ }
nsresult
operator () (BluetoothA2dpConnectionState& aArg1, nsString& aArg2) const
{
BluetoothDaemonPDU& pdu = GetPDU();
DaemonSocketPDU& pdu = GetPDU();
/* Read state */
nsresult rv = UnpackPDU(pdu, aArg1);
@ -214,7 +214,7 @@ public:
void
BluetoothDaemonA2dpModule::ConnectionStateNtf(
const BluetoothDaemonPDUHeader& aHeader, BluetoothDaemonPDU& aPDU)
const DaemonSocketPDUHeader& aHeader, DaemonSocketPDU& aPDU)
{
ConnectionStateNotification::Dispatch(
&BluetoothA2dpNotificationHandler::ConnectionStateNotification,
@ -226,7 +226,7 @@ class BluetoothDaemonA2dpModule::AudioStateInitOp final
: private PDUInitOp
{
public:
AudioStateInitOp(BluetoothDaemonPDU& aPDU)
AudioStateInitOp(DaemonSocketPDU& aPDU)
: PDUInitOp(aPDU)
{ }
@ -234,7 +234,7 @@ public:
operator () (BluetoothA2dpAudioState& aArg1,
nsString& aArg2) const
{
BluetoothDaemonPDU& pdu = GetPDU();
DaemonSocketPDU& pdu = GetPDU();
/* Read state */
nsresult rv = UnpackPDU(pdu, aArg1);
@ -255,7 +255,7 @@ public:
void
BluetoothDaemonA2dpModule::AudioStateNtf(
const BluetoothDaemonPDUHeader& aHeader, BluetoothDaemonPDU& aPDU)
const DaemonSocketPDUHeader& aHeader, DaemonSocketPDU& aPDU)
{
AudioStateNotification::Dispatch(
&BluetoothA2dpNotificationHandler::AudioStateNotification,
@ -267,14 +267,14 @@ class BluetoothDaemonA2dpModule::AudioConfigInitOp final
: private PDUInitOp
{
public:
AudioConfigInitOp(BluetoothDaemonPDU& aPDU)
AudioConfigInitOp(DaemonSocketPDU& aPDU)
: PDUInitOp(aPDU)
{ }
nsresult
operator () (nsString& aArg1, uint32_t aArg2, uint8_t aArg3) const
{
BluetoothDaemonPDU& pdu = GetPDU();
DaemonSocketPDU& pdu = GetPDU();
/* Read address */
nsresult rv = UnpackPDU(
@ -301,7 +301,7 @@ public:
void
BluetoothDaemonA2dpModule::AudioConfigNtf(
const BluetoothDaemonPDUHeader& aHeader, BluetoothDaemonPDU& aPDU)
const DaemonSocketPDUHeader& aHeader, DaemonSocketPDU& aPDU)
{
AudioConfigNotification::Dispatch(
&BluetoothA2dpNotificationHandler::AudioConfigNotification,
@ -310,11 +310,11 @@ BluetoothDaemonA2dpModule::AudioConfigNtf(
void
BluetoothDaemonA2dpModule::HandleNtf(
const BluetoothDaemonPDUHeader& aHeader, BluetoothDaemonPDU& aPDU,
const DaemonSocketPDUHeader& aHeader, DaemonSocketPDU& aPDU,
void* aUserData)
{
static void (BluetoothDaemonA2dpModule::* const HandleNtf[])(
const BluetoothDaemonPDUHeader&, BluetoothDaemonPDU&) = {
const DaemonSocketPDUHeader&, DaemonSocketPDU&) = {
INIT_ARRAY_AT(0, &BluetoothDaemonA2dpModule::ConnectionStateNtf),
INIT_ARRAY_AT(1, &BluetoothDaemonA2dpModule::AudioStateNtf),
#if ANDROID_VERSION >= 21

View File

@ -30,7 +30,7 @@ public:
static const int MAX_NUM_CLIENTS;
virtual nsresult Send(BluetoothDaemonPDU* aPDU, void* aUserData) = 0;
virtual nsresult Send(DaemonSocketPDU* aPDU, void* aUserData) = 0;
virtual nsresult RegisterModule(uint8_t aId, uint8_t aMode,
uint32_t aMaxNumClients,
@ -52,11 +52,11 @@ public:
BluetoothA2dpResultHandler* aRes);
protected:
nsresult Send(BluetoothDaemonPDU* aPDU,
nsresult Send(DaemonSocketPDU* aPDU,
BluetoothA2dpResultHandler* aRes);
void HandleSvc(const BluetoothDaemonPDUHeader& aHeader,
BluetoothDaemonPDU& aPDU, void* aUserData);
void HandleSvc(const DaemonSocketPDUHeader& aHeader,
DaemonSocketPDU& aPDU, void* aUserData);
//
// Responses
@ -69,20 +69,20 @@ protected:
BluetoothStatus, BluetoothStatus>
ErrorRunnable;
void ErrorRsp(const BluetoothDaemonPDUHeader& aHeader,
BluetoothDaemonPDU& aPDU,
void ErrorRsp(const DaemonSocketPDUHeader& aHeader,
DaemonSocketPDU& aPDU,
BluetoothA2dpResultHandler* aRes);
void ConnectRsp(const BluetoothDaemonPDUHeader& aHeader,
BluetoothDaemonPDU& aPDU,
void ConnectRsp(const DaemonSocketPDUHeader& aHeader,
DaemonSocketPDU& aPDU,
BluetoothA2dpResultHandler* aRes);
void DisconnectRsp(const BluetoothDaemonPDUHeader& aHeader,
BluetoothDaemonPDU& aPDU,
void DisconnectRsp(const DaemonSocketPDUHeader& aHeader,
DaemonSocketPDU& aPDU,
BluetoothA2dpResultHandler* aRes);
void HandleRsp(const BluetoothDaemonPDUHeader& aHeader,
BluetoothDaemonPDU& aPDU,
void HandleRsp(const DaemonSocketPDUHeader& aHeader,
DaemonSocketPDU& aPDU,
void* aUserData);
//
@ -114,17 +114,17 @@ protected:
class AudioStateInitOp;
class AudioConfigInitOp;
void ConnectionStateNtf(const BluetoothDaemonPDUHeader& aHeader,
BluetoothDaemonPDU& aPDU);
void ConnectionStateNtf(const DaemonSocketPDUHeader& aHeader,
DaemonSocketPDU& aPDU);
void AudioStateNtf(const BluetoothDaemonPDUHeader& aHeader,
BluetoothDaemonPDU& aPDU);
void AudioStateNtf(const DaemonSocketPDUHeader& aHeader,
DaemonSocketPDU& aPDU);
void AudioConfigNtf(const BluetoothDaemonPDUHeader& aHeader,
BluetoothDaemonPDU& aPDU);
void AudioConfigNtf(const DaemonSocketPDUHeader& aHeader,
DaemonSocketPDU& aPDU);
void HandleNtf(const BluetoothDaemonPDUHeader& aHeader,
BluetoothDaemonPDU& aPDU,
void HandleNtf(const DaemonSocketPDUHeader& aHeader,
DaemonSocketPDU& aPDU,
void* aUserData);
static BluetoothA2dpNotificationHandler* sNotificationHandler;

View File

@ -27,7 +27,7 @@ BluetoothDaemonAvrcpModule::SetNotificationHandler(
}
nsresult
BluetoothDaemonAvrcpModule::Send(BluetoothDaemonPDU* aPDU,
BluetoothDaemonAvrcpModule::Send(DaemonSocketPDU* aPDU,
BluetoothAvrcpResultHandler* aRes)
{
if (aRes) {
@ -37,11 +37,11 @@ BluetoothDaemonAvrcpModule::Send(BluetoothDaemonPDU* aPDU,
}
void
BluetoothDaemonAvrcpModule::HandleSvc(const BluetoothDaemonPDUHeader& aHeader,
BluetoothDaemonPDU& aPDU, void* aUserData)
BluetoothDaemonAvrcpModule::HandleSvc(const DaemonSocketPDUHeader& aHeader,
DaemonSocketPDU& aPDU, void* aUserData)
{
static void (BluetoothDaemonAvrcpModule::* const HandleOp[])(
const BluetoothDaemonPDUHeader&, BluetoothDaemonPDU&, void*) = {
const DaemonSocketPDUHeader&, DaemonSocketPDU&, void*) = {
INIT_ARRAY_AT(0, &BluetoothDaemonAvrcpModule::HandleRsp),
INIT_ARRAY_AT(1, &BluetoothDaemonAvrcpModule::HandleNtf),
};
@ -63,8 +63,8 @@ BluetoothDaemonAvrcpModule::GetPlayStatusRspCmd(
{
MOZ_ASSERT(NS_IsMainThread());
nsAutoPtr<BluetoothDaemonPDU> pdu(
new BluetoothDaemonPDU(SERVICE_ID, OPCODE_GET_PLAY_STATUS_RSP,
nsAutoPtr<DaemonSocketPDU> pdu(
new DaemonSocketPDU(SERVICE_ID, OPCODE_GET_PLAY_STATUS_RSP,
1 + // Play status
4 + // Duration
4)); // Position
@ -88,8 +88,8 @@ BluetoothDaemonAvrcpModule::ListPlayerAppAttrRspCmd(
{
MOZ_ASSERT(NS_IsMainThread());
nsAutoPtr<BluetoothDaemonPDU> pdu(
new BluetoothDaemonPDU(SERVICE_ID, OPCODE_LIST_PLAYER_APP_ATTR_RSP,
nsAutoPtr<DaemonSocketPDU> pdu(
new DaemonSocketPDU(SERVICE_ID, OPCODE_LIST_PLAYER_APP_ATTR_RSP,
1 + // # Attributes
aNumAttr)); // Player attributes
@ -113,8 +113,8 @@ BluetoothDaemonAvrcpModule::ListPlayerAppValueRspCmd(
{
MOZ_ASSERT(NS_IsMainThread());
nsAutoPtr<BluetoothDaemonPDU> pdu(
new BluetoothDaemonPDU(SERVICE_ID, OPCODE_LIST_PLAYER_APP_VALUE_RSP,
nsAutoPtr<DaemonSocketPDU> pdu(
new DaemonSocketPDU(SERVICE_ID, OPCODE_LIST_PLAYER_APP_VALUE_RSP,
1 + // # Values
aNumVal)); // Player values
@ -138,8 +138,8 @@ BluetoothDaemonAvrcpModule::GetPlayerAppValueRspCmd(
{
MOZ_ASSERT(NS_IsMainThread());
nsAutoPtr<BluetoothDaemonPDU> pdu(
new BluetoothDaemonPDU(SERVICE_ID, OPCODE_GET_PLAYER_APP_VALUE_RSP,
nsAutoPtr<DaemonSocketPDU> pdu(
new DaemonSocketPDU(SERVICE_ID, OPCODE_GET_PLAYER_APP_VALUE_RSP,
1 + // # Pairs
2 * aNumAttrs)); // Attribute-value pairs
nsresult rv = PackPDU(
@ -163,8 +163,8 @@ BluetoothDaemonAvrcpModule::GetPlayerAppAttrTextRspCmd(
{
MOZ_ASSERT(NS_IsMainThread());
nsAutoPtr<BluetoothDaemonPDU> pdu(
new BluetoothDaemonPDU(SERVICE_ID, OPCODE_GET_PLAYER_APP_ATTR_TEXT_RSP,
nsAutoPtr<DaemonSocketPDU> pdu(
new DaemonSocketPDU(SERVICE_ID, OPCODE_GET_PLAYER_APP_ATTR_TEXT_RSP,
0)); // Dynamically allocated
nsresult rv = PackPDU(
PackConversion<int, uint8_t>(aNumAttr),
@ -187,8 +187,8 @@ BluetoothDaemonAvrcpModule::GetPlayerAppValueTextRspCmd(
{
MOZ_ASSERT(NS_IsMainThread());
nsAutoPtr<BluetoothDaemonPDU> pdu(
new BluetoothDaemonPDU(SERVICE_ID, OPCODE_GET_PLAYER_APP_VALUE_TEXT_RSP,
nsAutoPtr<DaemonSocketPDU> pdu(
new DaemonSocketPDU(SERVICE_ID, OPCODE_GET_PLAYER_APP_VALUE_TEXT_RSP,
0)); // Dynamically allocated
nsresult rv = PackPDU(
PackConversion<int, uint8_t>(aNumVal),
@ -211,8 +211,8 @@ BluetoothDaemonAvrcpModule::GetElementAttrRspCmd(
{
MOZ_ASSERT(NS_IsMainThread());
nsAutoPtr<BluetoothDaemonPDU> pdu(
new BluetoothDaemonPDU(SERVICE_ID, OPCODE_GET_ELEMENT_ATTR_RSP,
nsAutoPtr<DaemonSocketPDU> pdu(
new DaemonSocketPDU(SERVICE_ID, OPCODE_GET_ELEMENT_ATTR_RSP,
0)); // Dynamically allocated
nsresult rv = PackPDU(
aNumAttr,
@ -234,8 +234,8 @@ BluetoothDaemonAvrcpModule::SetPlayerAppValueRspCmd(
{
MOZ_ASSERT(NS_IsMainThread());
nsAutoPtr<BluetoothDaemonPDU> pdu(
new BluetoothDaemonPDU(SERVICE_ID, OPCODE_SET_PLAYER_APP_VALUE_RSP,
nsAutoPtr<DaemonSocketPDU> pdu(
new DaemonSocketPDU(SERVICE_ID, OPCODE_SET_PLAYER_APP_VALUE_RSP,
1)); // Status code
nsresult rv = PackPDU(aRspStatus, *pdu);
@ -258,8 +258,8 @@ BluetoothDaemonAvrcpModule::RegisterNotificationRspCmd(
{
MOZ_ASSERT(NS_IsMainThread());
nsAutoPtr<BluetoothDaemonPDU> pdu(
new BluetoothDaemonPDU(SERVICE_ID, OPCODE_REGISTER_NOTIFICATION_RSP,
nsAutoPtr<DaemonSocketPDU> pdu(
new DaemonSocketPDU(SERVICE_ID, OPCODE_REGISTER_NOTIFICATION_RSP,
1 + // Event
1 + // Type
1 + // Data length
@ -285,8 +285,8 @@ BluetoothDaemonAvrcpModule::SetVolumeCmd(uint8_t aVolume,
{
MOZ_ASSERT(NS_IsMainThread());
nsAutoPtr<BluetoothDaemonPDU> pdu(
new BluetoothDaemonPDU(SERVICE_ID, OPCODE_SET_VOLUME,
nsAutoPtr<DaemonSocketPDU> pdu(
new DaemonSocketPDU(SERVICE_ID, OPCODE_SET_VOLUME,
1)); // Volume
nsresult rv = PackPDU(aVolume, *pdu);
@ -306,8 +306,8 @@ BluetoothDaemonAvrcpModule::SetVolumeCmd(uint8_t aVolume,
void
BluetoothDaemonAvrcpModule::ErrorRsp(
const BluetoothDaemonPDUHeader& aHeader,
BluetoothDaemonPDU& aPDU, BluetoothAvrcpResultHandler* aRes)
const DaemonSocketPDUHeader& aHeader,
DaemonSocketPDU& aPDU, BluetoothAvrcpResultHandler* aRes)
{
ErrorRunnable::Dispatch(
aRes, &BluetoothAvrcpResultHandler::OnError, UnpackPDUInitOp(aPDU));
@ -315,8 +315,8 @@ BluetoothDaemonAvrcpModule::ErrorRsp(
void
BluetoothDaemonAvrcpModule::GetPlayStatusRspRsp(
const BluetoothDaemonPDUHeader& aHeader,
BluetoothDaemonPDU& aPDU, BluetoothAvrcpResultHandler* aRes)
const DaemonSocketPDUHeader& aHeader,
DaemonSocketPDU& aPDU, BluetoothAvrcpResultHandler* aRes)
{
ResultRunnable::Dispatch(
aRes, &BluetoothAvrcpResultHandler::GetPlayStatusRsp,
@ -325,8 +325,8 @@ BluetoothDaemonAvrcpModule::GetPlayStatusRspRsp(
void
BluetoothDaemonAvrcpModule::ListPlayerAppAttrRspRsp(
const BluetoothDaemonPDUHeader& aHeader,
BluetoothDaemonPDU& aPDU, BluetoothAvrcpResultHandler* aRes)
const DaemonSocketPDUHeader& aHeader,
DaemonSocketPDU& aPDU, BluetoothAvrcpResultHandler* aRes)
{
ResultRunnable::Dispatch(
aRes, &BluetoothAvrcpResultHandler::ListPlayerAppAttrRsp,
@ -335,8 +335,8 @@ BluetoothDaemonAvrcpModule::ListPlayerAppAttrRspRsp(
void
BluetoothDaemonAvrcpModule::ListPlayerAppValueRspRsp(
const BluetoothDaemonPDUHeader& aHeader,
BluetoothDaemonPDU& aPDU, BluetoothAvrcpResultHandler* aRes)
const DaemonSocketPDUHeader& aHeader,
DaemonSocketPDU& aPDU, BluetoothAvrcpResultHandler* aRes)
{
ResultRunnable::Dispatch(
aRes, &BluetoothAvrcpResultHandler::ListPlayerAppValueRsp,
@ -345,8 +345,8 @@ BluetoothDaemonAvrcpModule::ListPlayerAppValueRspRsp(
void
BluetoothDaemonAvrcpModule::GetPlayerAppValueRspRsp(
const BluetoothDaemonPDUHeader& aHeader,
BluetoothDaemonPDU& aPDU, BluetoothAvrcpResultHandler* aRes)
const DaemonSocketPDUHeader& aHeader,
DaemonSocketPDU& aPDU, BluetoothAvrcpResultHandler* aRes)
{
ResultRunnable::Dispatch(
aRes, &BluetoothAvrcpResultHandler::GetPlayerAppValueRsp,
@ -355,8 +355,8 @@ BluetoothDaemonAvrcpModule::GetPlayerAppValueRspRsp(
void
BluetoothDaemonAvrcpModule::GetPlayerAppAttrTextRspRsp(
const BluetoothDaemonPDUHeader& aHeader,
BluetoothDaemonPDU& aPDU, BluetoothAvrcpResultHandler* aRes)
const DaemonSocketPDUHeader& aHeader,
DaemonSocketPDU& aPDU, BluetoothAvrcpResultHandler* aRes)
{
ResultRunnable::Dispatch(
aRes, &BluetoothAvrcpResultHandler::GetPlayerAppAttrTextRsp,
@ -365,8 +365,8 @@ BluetoothDaemonAvrcpModule::GetPlayerAppAttrTextRspRsp(
void
BluetoothDaemonAvrcpModule::GetPlayerAppValueTextRspRsp(
const BluetoothDaemonPDUHeader& aHeader,
BluetoothDaemonPDU& aPDU, BluetoothAvrcpResultHandler* aRes)
const DaemonSocketPDUHeader& aHeader,
DaemonSocketPDU& aPDU, BluetoothAvrcpResultHandler* aRes)
{
ResultRunnable::Dispatch(
aRes, &BluetoothAvrcpResultHandler::GetPlayerAppValueTextRsp,
@ -375,8 +375,8 @@ BluetoothDaemonAvrcpModule::GetPlayerAppValueTextRspRsp(
void
BluetoothDaemonAvrcpModule::GetElementAttrRspRsp(
const BluetoothDaemonPDUHeader& aHeader,
BluetoothDaemonPDU& aPDU, BluetoothAvrcpResultHandler* aRes)
const DaemonSocketPDUHeader& aHeader,
DaemonSocketPDU& aPDU, BluetoothAvrcpResultHandler* aRes)
{
ResultRunnable::Dispatch(
aRes, &BluetoothAvrcpResultHandler::GetElementAttrRsp,
@ -385,8 +385,8 @@ BluetoothDaemonAvrcpModule::GetElementAttrRspRsp(
void
BluetoothDaemonAvrcpModule::SetPlayerAppValueRspRsp(
const BluetoothDaemonPDUHeader& aHeader,
BluetoothDaemonPDU& aPDU, BluetoothAvrcpResultHandler* aRes)
const DaemonSocketPDUHeader& aHeader,
DaemonSocketPDU& aPDU, BluetoothAvrcpResultHandler* aRes)
{
ResultRunnable::Dispatch(
aRes, &BluetoothAvrcpResultHandler::SetPlayerAppValueRsp,
@ -395,8 +395,8 @@ BluetoothDaemonAvrcpModule::SetPlayerAppValueRspRsp(
void
BluetoothDaemonAvrcpModule::RegisterNotificationRspRsp(
const BluetoothDaemonPDUHeader& aHeader,
BluetoothDaemonPDU& aPDU, BluetoothAvrcpResultHandler* aRes)
const DaemonSocketPDUHeader& aHeader,
DaemonSocketPDU& aPDU, BluetoothAvrcpResultHandler* aRes)
{
ResultRunnable::Dispatch(
aRes, &BluetoothAvrcpResultHandler::RegisterNotificationRsp,
@ -405,8 +405,8 @@ BluetoothDaemonAvrcpModule::RegisterNotificationRspRsp(
void
BluetoothDaemonAvrcpModule::SetVolumeRsp(
const BluetoothDaemonPDUHeader& aHeader,
BluetoothDaemonPDU& aPDU, BluetoothAvrcpResultHandler* aRes)
const DaemonSocketPDUHeader& aHeader,
DaemonSocketPDU& aPDU, BluetoothAvrcpResultHandler* aRes)
{
ResultRunnable::Dispatch(
aRes, &BluetoothAvrcpResultHandler::SetVolume,
@ -415,12 +415,12 @@ BluetoothDaemonAvrcpModule::SetVolumeRsp(
void
BluetoothDaemonAvrcpModule::HandleRsp(
const BluetoothDaemonPDUHeader& aHeader, BluetoothDaemonPDU& aPDU,
const DaemonSocketPDUHeader& aHeader, DaemonSocketPDU& aPDU,
void* aUserData)
{
static void (BluetoothDaemonAvrcpModule::* const HandleRsp[])(
const BluetoothDaemonPDUHeader&,
BluetoothDaemonPDU&,
const DaemonSocketPDUHeader&,
DaemonSocketPDU&,
BluetoothAvrcpResultHandler*) = {
INIT_ARRAY_AT(OPCODE_ERROR,
&BluetoothDaemonAvrcpModule::ErrorRsp),
@ -486,14 +486,14 @@ class BluetoothDaemonAvrcpModule::RemoteFeatureInitOp final
: private PDUInitOp
{
public:
RemoteFeatureInitOp(BluetoothDaemonPDU& aPDU)
RemoteFeatureInitOp(DaemonSocketPDU& aPDU)
: PDUInitOp(aPDU)
{ }
nsresult
operator () (nsString& aArg1, unsigned long& aArg2) const
{
BluetoothDaemonPDU& pdu = GetPDU();
DaemonSocketPDU& pdu = GetPDU();
/* Read address */
nsresult rv = UnpackPDU(
@ -516,7 +516,7 @@ public:
void
BluetoothDaemonAvrcpModule::RemoteFeatureNtf(
const BluetoothDaemonPDUHeader& aHeader, BluetoothDaemonPDU& aPDU)
const DaemonSocketPDUHeader& aHeader, DaemonSocketPDU& aPDU)
{
RemoteFeatureNotification::Dispatch(
&BluetoothAvrcpNotificationHandler::RemoteFeatureNotification,
@ -525,7 +525,7 @@ BluetoothDaemonAvrcpModule::RemoteFeatureNtf(
void
BluetoothDaemonAvrcpModule::GetPlayStatusNtf(
const BluetoothDaemonPDUHeader& aHeader, BluetoothDaemonPDU& aPDU)
const DaemonSocketPDUHeader& aHeader, DaemonSocketPDU& aPDU)
{
GetPlayStatusNotification::Dispatch(
&BluetoothAvrcpNotificationHandler::GetPlayStatusNotification,
@ -534,7 +534,7 @@ BluetoothDaemonAvrcpModule::GetPlayStatusNtf(
void
BluetoothDaemonAvrcpModule::ListPlayerAppAttrNtf(
const BluetoothDaemonPDUHeader& aHeader, BluetoothDaemonPDU& aPDU)
const DaemonSocketPDUHeader& aHeader, DaemonSocketPDU& aPDU)
{
ListPlayerAppAttrNotification::Dispatch(
&BluetoothAvrcpNotificationHandler::ListPlayerAppAttrNotification,
@ -543,7 +543,7 @@ BluetoothDaemonAvrcpModule::ListPlayerAppAttrNtf(
void
BluetoothDaemonAvrcpModule::ListPlayerAppValuesNtf(
const BluetoothDaemonPDUHeader& aHeader, BluetoothDaemonPDU& aPDU)
const DaemonSocketPDUHeader& aHeader, DaemonSocketPDU& aPDU)
{
ListPlayerAppValuesNotification::Dispatch(
&BluetoothAvrcpNotificationHandler::ListPlayerAppValuesNotification,
@ -555,7 +555,7 @@ class BluetoothDaemonAvrcpModule::GetPlayerAppValueInitOp final
: private PDUInitOp
{
public:
GetPlayerAppValueInitOp(BluetoothDaemonPDU& aPDU)
GetPlayerAppValueInitOp(DaemonSocketPDU& aPDU)
: PDUInitOp(aPDU)
{ }
@ -563,7 +563,7 @@ public:
operator () (uint8_t& aArg1,
nsAutoArrayPtr<BluetoothAvrcpPlayerAttribute>& aArg2) const
{
BluetoothDaemonPDU& pdu = GetPDU();
DaemonSocketPDU& pdu = GetPDU();
/* Read number of attributes */
nsresult rv = UnpackPDU(pdu, aArg1);
@ -584,7 +584,7 @@ public:
void
BluetoothDaemonAvrcpModule::GetPlayerAppValueNtf(
const BluetoothDaemonPDUHeader& aHeader, BluetoothDaemonPDU& aPDU)
const DaemonSocketPDUHeader& aHeader, DaemonSocketPDU& aPDU)
{
GetPlayerAppValueNotification::Dispatch(
&BluetoothAvrcpNotificationHandler::GetPlayerAppValueNotification,
@ -596,7 +596,7 @@ class BluetoothDaemonAvrcpModule::GetPlayerAppAttrsTextInitOp final
: private PDUInitOp
{
public:
GetPlayerAppAttrsTextInitOp(BluetoothDaemonPDU& aPDU)
GetPlayerAppAttrsTextInitOp(DaemonSocketPDU& aPDU)
: PDUInitOp(aPDU)
{ }
@ -604,7 +604,7 @@ public:
operator () (uint8_t& aArg1,
nsAutoArrayPtr<BluetoothAvrcpPlayerAttribute>& aArg2) const
{
BluetoothDaemonPDU& pdu = GetPDU();
DaemonSocketPDU& pdu = GetPDU();
/* Read number of attributes */
nsresult rv = UnpackPDU(pdu, aArg1);
@ -625,7 +625,7 @@ public:
void
BluetoothDaemonAvrcpModule::GetPlayerAppAttrsTextNtf(
const BluetoothDaemonPDUHeader& aHeader, BluetoothDaemonPDU& aPDU)
const DaemonSocketPDUHeader& aHeader, DaemonSocketPDU& aPDU)
{
GetPlayerAppAttrsTextNotification::Dispatch(
&BluetoothAvrcpNotificationHandler::GetPlayerAppAttrsTextNotification,
@ -637,7 +637,7 @@ class BluetoothDaemonAvrcpModule::GetPlayerAppValuesTextInitOp final
: private PDUInitOp
{
public:
GetPlayerAppValuesTextInitOp(BluetoothDaemonPDU& aPDU)
GetPlayerAppValuesTextInitOp(DaemonSocketPDU& aPDU)
: PDUInitOp(aPDU)
{ }
@ -645,7 +645,7 @@ public:
operator () (uint8_t& aArg1, uint8_t& aArg2,
nsAutoArrayPtr<uint8_t>& aArg3) const
{
BluetoothDaemonPDU& pdu = GetPDU();
DaemonSocketPDU& pdu = GetPDU();
/* Read attribute */
nsresult rv = UnpackPDU(pdu, aArg1);
@ -671,7 +671,7 @@ public:
void
BluetoothDaemonAvrcpModule::GetPlayerAppValuesTextNtf(
const BluetoothDaemonPDUHeader& aHeader, BluetoothDaemonPDU& aPDU)
const DaemonSocketPDUHeader& aHeader, DaemonSocketPDU& aPDU)
{
GetPlayerAppValuesTextNotification::Dispatch(
&BluetoothAvrcpNotificationHandler::GetPlayerAppValuesTextNotification,
@ -680,7 +680,7 @@ BluetoothDaemonAvrcpModule::GetPlayerAppValuesTextNtf(
void
BluetoothDaemonAvrcpModule::SetPlayerAppValueNtf(
const BluetoothDaemonPDUHeader& aHeader, BluetoothDaemonPDU& aPDU)
const DaemonSocketPDUHeader& aHeader, DaemonSocketPDU& aPDU)
{
SetPlayerAppValueNotification::Dispatch(
&BluetoothAvrcpNotificationHandler::SetPlayerAppValueNotification,
@ -692,7 +692,7 @@ class BluetoothDaemonAvrcpModule::GetElementAttrInitOp final
: private PDUInitOp
{
public:
GetElementAttrInitOp(BluetoothDaemonPDU& aPDU)
GetElementAttrInitOp(DaemonSocketPDU& aPDU)
: PDUInitOp(aPDU)
{ }
@ -700,7 +700,7 @@ public:
operator () (uint8_t& aArg1,
nsAutoArrayPtr<BluetoothAvrcpMediaAttribute>& aArg2) const
{
BluetoothDaemonPDU& pdu = GetPDU();
DaemonSocketPDU& pdu = GetPDU();
/* Read number of attributes */
nsresult rv = UnpackPDU(pdu, aArg1);
@ -721,7 +721,7 @@ public:
void
BluetoothDaemonAvrcpModule::GetElementAttrNtf(
const BluetoothDaemonPDUHeader& aHeader, BluetoothDaemonPDU& aPDU)
const DaemonSocketPDUHeader& aHeader, DaemonSocketPDU& aPDU)
{
GetElementAttrNotification::Dispatch(
&BluetoothAvrcpNotificationHandler::GetElementAttrNotification,
@ -730,7 +730,7 @@ BluetoothDaemonAvrcpModule::GetElementAttrNtf(
void
BluetoothDaemonAvrcpModule::RegisterNotificationNtf(
const BluetoothDaemonPDUHeader& aHeader, BluetoothDaemonPDU& aPDU)
const DaemonSocketPDUHeader& aHeader, DaemonSocketPDU& aPDU)
{
RegisterNotificationNotification::Dispatch(
&BluetoothAvrcpNotificationHandler::RegisterNotificationNotification,
@ -740,7 +740,7 @@ BluetoothDaemonAvrcpModule::RegisterNotificationNtf(
#if ANDROID_VERSION >= 19
void
BluetoothDaemonAvrcpModule::VolumeChangeNtf(
const BluetoothDaemonPDUHeader& aHeader, BluetoothDaemonPDU& aPDU)
const DaemonSocketPDUHeader& aHeader, DaemonSocketPDU& aPDU)
{
VolumeChangeNotification::Dispatch(
&BluetoothAvrcpNotificationHandler::VolumeChangeNotification,
@ -752,14 +752,14 @@ class BluetoothDaemonAvrcpModule::PassthroughCmdInitOp final
: private PDUInitOp
{
public:
PassthroughCmdInitOp(BluetoothDaemonPDU& aPDU)
PassthroughCmdInitOp(DaemonSocketPDU& aPDU)
: PDUInitOp(aPDU)
{ }
nsresult
operator () (int& aArg1, int& aArg2) const
{
BluetoothDaemonPDU& pdu = GetPDU();
DaemonSocketPDU& pdu = GetPDU();
nsresult rv = UnpackPDU(pdu, UnpackConversion<uint8_t, int>(aArg1));
if (NS_FAILED(rv)) {
@ -776,7 +776,7 @@ public:
void
BluetoothDaemonAvrcpModule::PassthroughCmdNtf(
const BluetoothDaemonPDUHeader& aHeader, BluetoothDaemonPDU& aPDU)
const DaemonSocketPDUHeader& aHeader, DaemonSocketPDU& aPDU)
{
PassthroughCmdNotification::Dispatch(
&BluetoothAvrcpNotificationHandler::PassthroughCmdNotification,
@ -786,11 +786,11 @@ BluetoothDaemonAvrcpModule::PassthroughCmdNtf(
void
BluetoothDaemonAvrcpModule::HandleNtf(
const BluetoothDaemonPDUHeader& aHeader, BluetoothDaemonPDU& aPDU,
const DaemonSocketPDUHeader& aHeader, DaemonSocketPDU& aPDU,
void* aUserData)
{
static void (BluetoothDaemonAvrcpModule::* const HandleNtf[])(
const BluetoothDaemonPDUHeader&, BluetoothDaemonPDU&) = {
const DaemonSocketPDUHeader&, DaemonSocketPDU&) = {
#if ANDROID_VERSION >= 19
INIT_ARRAY_AT(0, &BluetoothDaemonAvrcpModule::RemoteFeatureNtf),
INIT_ARRAY_AT(1, &BluetoothDaemonAvrcpModule::GetPlayStatusNtf),

View File

@ -62,7 +62,7 @@ public:
static const int MAX_NUM_CLIENTS;
virtual nsresult Send(BluetoothDaemonPDU* aPDU, void* aUserData) = 0;
virtual nsresult Send(DaemonSocketPDU* aPDU, void* aUserData) = 0;
virtual nsresult RegisterModule(uint8_t aId, uint8_t aMode,
uint32_t aMaxNumClients,
@ -116,11 +116,11 @@ public:
nsresult SetVolumeCmd(uint8_t aVolume, BluetoothAvrcpResultHandler* aRes);
protected:
nsresult Send(BluetoothDaemonPDU* aPDU,
nsresult Send(DaemonSocketPDU* aPDU,
BluetoothAvrcpResultHandler* aRes);
void HandleSvc(const BluetoothDaemonPDUHeader& aHeader,
BluetoothDaemonPDU& aPDU, void* aUserData);
void HandleSvc(const DaemonSocketPDUHeader& aHeader,
DaemonSocketPDU& aPDU, void* aUserData);
//
// Responses
@ -133,52 +133,52 @@ protected:
BluetoothStatus, BluetoothStatus>
ErrorRunnable;
void ErrorRsp(const BluetoothDaemonPDUHeader& aHeader,
BluetoothDaemonPDU& aPDU,
void ErrorRsp(const DaemonSocketPDUHeader& aHeader,
DaemonSocketPDU& aPDU,
BluetoothAvrcpResultHandler* aRes);
void GetPlayStatusRspRsp(const BluetoothDaemonPDUHeader& aHeader,
BluetoothDaemonPDU& aPDU,
void GetPlayStatusRspRsp(const DaemonSocketPDUHeader& aHeader,
DaemonSocketPDU& aPDU,
BluetoothAvrcpResultHandler* aRes);
void ListPlayerAppAttrRspRsp(const BluetoothDaemonPDUHeader& aHeader,
BluetoothDaemonPDU& aPDU,
void ListPlayerAppAttrRspRsp(const DaemonSocketPDUHeader& aHeader,
DaemonSocketPDU& aPDU,
BluetoothAvrcpResultHandler* aRes);
void ListPlayerAppValueRspRsp(const BluetoothDaemonPDUHeader& aHeader,
BluetoothDaemonPDU& aPDU,
void ListPlayerAppValueRspRsp(const DaemonSocketPDUHeader& aHeader,
DaemonSocketPDU& aPDU,
BluetoothAvrcpResultHandler* aRes);
void GetPlayerAppValueRspRsp(const BluetoothDaemonPDUHeader& aHeader,
BluetoothDaemonPDU& aPDU,
void GetPlayerAppValueRspRsp(const DaemonSocketPDUHeader& aHeader,
DaemonSocketPDU& aPDU,
BluetoothAvrcpResultHandler* aRes);
void GetPlayerAppAttrTextRspRsp(const BluetoothDaemonPDUHeader& aHeader,
BluetoothDaemonPDU& aPDU,
void GetPlayerAppAttrTextRspRsp(const DaemonSocketPDUHeader& aHeader,
DaemonSocketPDU& aPDU,
BluetoothAvrcpResultHandler* aRes);
void GetPlayerAppValueTextRspRsp(const BluetoothDaemonPDUHeader& aHeader,
BluetoothDaemonPDU& aPDU,
void GetPlayerAppValueTextRspRsp(const DaemonSocketPDUHeader& aHeader,
DaemonSocketPDU& aPDU,
BluetoothAvrcpResultHandler* aRes);
void GetElementAttrRspRsp(const BluetoothDaemonPDUHeader& aHeader,
BluetoothDaemonPDU& aPDU,
void GetElementAttrRspRsp(const DaemonSocketPDUHeader& aHeader,
DaemonSocketPDU& aPDU,
BluetoothAvrcpResultHandler* aRes);
void SetPlayerAppValueRspRsp(const BluetoothDaemonPDUHeader& aHeader,
BluetoothDaemonPDU& aPDU,
void SetPlayerAppValueRspRsp(const DaemonSocketPDUHeader& aHeader,
DaemonSocketPDU& aPDU,
BluetoothAvrcpResultHandler* aRes);
void RegisterNotificationRspRsp(const BluetoothDaemonPDUHeader& aHeader,
BluetoothDaemonPDU& aPDU,
void RegisterNotificationRspRsp(const DaemonSocketPDUHeader& aHeader,
DaemonSocketPDU& aPDU,
BluetoothAvrcpResultHandler* aRes);
void SetVolumeRsp(const BluetoothDaemonPDUHeader& aHeader,
BluetoothDaemonPDU& aPDU,
void SetVolumeRsp(const DaemonSocketPDUHeader& aHeader,
DaemonSocketPDU& aPDU,
BluetoothAvrcpResultHandler* aRes);
void HandleRsp(const BluetoothDaemonPDUHeader& aHeader,
BluetoothDaemonPDU& aPDU,
void HandleRsp(const DaemonSocketPDUHeader& aHeader,
DaemonSocketPDU& aPDU,
void* aUserData);
//
@ -247,44 +247,44 @@ protected:
class PassthroughCmdInitOp;
class RemoteFeatureInitOp;
void RemoteFeatureNtf(const BluetoothDaemonPDUHeader& aHeader,
BluetoothDaemonPDU& aPDU);
void RemoteFeatureNtf(const DaemonSocketPDUHeader& aHeader,
DaemonSocketPDU& aPDU);
void GetPlayStatusNtf(const BluetoothDaemonPDUHeader& aHeader,
BluetoothDaemonPDU& aPDU);
void GetPlayStatusNtf(const DaemonSocketPDUHeader& aHeader,
DaemonSocketPDU& aPDU);
void ListPlayerAppAttrNtf(const BluetoothDaemonPDUHeader& aHeader,
BluetoothDaemonPDU& aPDU);
void ListPlayerAppAttrNtf(const DaemonSocketPDUHeader& aHeader,
DaemonSocketPDU& aPDU);
void ListPlayerAppValuesNtf(const BluetoothDaemonPDUHeader& aHeader,
BluetoothDaemonPDU& aPDU);
void ListPlayerAppValuesNtf(const DaemonSocketPDUHeader& aHeader,
DaemonSocketPDU& aPDU);
void GetPlayerAppValueNtf(const BluetoothDaemonPDUHeader& aHeader,
BluetoothDaemonPDU& aPDU);
void GetPlayerAppValueNtf(const DaemonSocketPDUHeader& aHeader,
DaemonSocketPDU& aPDU);
void GetPlayerAppAttrsTextNtf(const BluetoothDaemonPDUHeader& aHeader,
BluetoothDaemonPDU& aPDU);
void GetPlayerAppAttrsTextNtf(const DaemonSocketPDUHeader& aHeader,
DaemonSocketPDU& aPDU);
void GetPlayerAppValuesTextNtf(const BluetoothDaemonPDUHeader& aHeader,
BluetoothDaemonPDU& aPDU);
void GetPlayerAppValuesTextNtf(const DaemonSocketPDUHeader& aHeader,
DaemonSocketPDU& aPDU);
void SetPlayerAppValueNtf(const BluetoothDaemonPDUHeader& aHeader,
BluetoothDaemonPDU& aPDU);
void SetPlayerAppValueNtf(const DaemonSocketPDUHeader& aHeader,
DaemonSocketPDU& aPDU);
void GetElementAttrNtf(const BluetoothDaemonPDUHeader& aHeader,
BluetoothDaemonPDU& aPDU);
void GetElementAttrNtf(const DaemonSocketPDUHeader& aHeader,
DaemonSocketPDU& aPDU);
void RegisterNotificationNtf(const BluetoothDaemonPDUHeader& aHeader,
BluetoothDaemonPDU& aPDU);
void RegisterNotificationNtf(const DaemonSocketPDUHeader& aHeader,
DaemonSocketPDU& aPDU);
void VolumeChangeNtf(const BluetoothDaemonPDUHeader& aHeader,
BluetoothDaemonPDU& aPDU);
void VolumeChangeNtf(const DaemonSocketPDUHeader& aHeader,
DaemonSocketPDU& aPDU);
void PassthroughCmdNtf(const BluetoothDaemonPDUHeader& aHeader,
BluetoothDaemonPDU& aPDU);
void PassthroughCmdNtf(const DaemonSocketPDUHeader& aHeader,
DaemonSocketPDU& aPDU);
void HandleNtf(const BluetoothDaemonPDUHeader& aHeader,
BluetoothDaemonPDU& aPDU,
void HandleNtf(const DaemonSocketPDUHeader& aHeader,
DaemonSocketPDU& aPDU,
void* aUserData);
static BluetoothAvrcpNotificationHandler* sNotificationHandler;

View File

@ -27,7 +27,7 @@ BluetoothDaemonGattModule::SetNotificationHandler(
}
nsresult
BluetoothDaemonGattModule::Send(BluetoothDaemonPDU* aPDU,
BluetoothDaemonGattModule::Send(DaemonSocketPDU* aPDU,
BluetoothGattResultHandler* aRes)
{
if (aRes) {
@ -37,7 +37,7 @@ BluetoothDaemonGattModule::Send(BluetoothDaemonPDU* aPDU,
}
nsresult
BluetoothDaemonGattModule::Send(BluetoothDaemonPDU* aPDU,
BluetoothDaemonGattModule::Send(DaemonSocketPDU* aPDU,
BluetoothGattClientResultHandler* aRes)
{
if (aRes) {
@ -47,11 +47,11 @@ BluetoothDaemonGattModule::Send(BluetoothDaemonPDU* aPDU,
}
void
BluetoothDaemonGattModule::HandleSvc(const BluetoothDaemonPDUHeader& aHeader,
BluetoothDaemonPDU& aPDU, void* aUserData)
BluetoothDaemonGattModule::HandleSvc(const DaemonSocketPDUHeader& aHeader,
DaemonSocketPDU& aPDU, void* aUserData)
{
static void (BluetoothDaemonGattModule::* const HandleOp[])(
const BluetoothDaemonPDUHeader&, BluetoothDaemonPDU&, void*) = {
const DaemonSocketPDUHeader&, DaemonSocketPDU&, void*) = {
INIT_ARRAY_AT(0, &BluetoothDaemonGattModule::HandleRsp),
INIT_ARRAY_AT(1, &BluetoothDaemonGattModule::HandleNtf),
};
@ -73,8 +73,8 @@ BluetoothDaemonGattModule::ClientRegisterCmd(
{
MOZ_ASSERT(NS_IsMainThread());
nsAutoPtr<BluetoothDaemonPDU> pdu(
new BluetoothDaemonPDU(SERVICE_ID, OPCODE_CLIENT_REGISTER,
nsAutoPtr<DaemonSocketPDU> pdu(
new DaemonSocketPDU(SERVICE_ID, OPCODE_CLIENT_REGISTER,
16)); // Service UUID
nsresult rv = PackPDU(aUuid, *pdu);
@ -96,8 +96,8 @@ BluetoothDaemonGattModule::ClientUnregisterCmd(
{
MOZ_ASSERT(NS_IsMainThread());
nsAutoPtr<BluetoothDaemonPDU> pdu(
new BluetoothDaemonPDU(SERVICE_ID, OPCODE_CLIENT_UNREGISTER,
nsAutoPtr<DaemonSocketPDU> pdu(
new DaemonSocketPDU(SERVICE_ID, OPCODE_CLIENT_UNREGISTER,
4)); // Client Interface
nsresult rv = PackPDU(aClientIf, *pdu);
@ -118,8 +118,8 @@ BluetoothDaemonGattModule::ClientScanCmd(
{
MOZ_ASSERT(NS_IsMainThread());
nsAutoPtr<BluetoothDaemonPDU> pdu(
new BluetoothDaemonPDU(SERVICE_ID, OPCODE_CLIENT_SCAN,
nsAutoPtr<DaemonSocketPDU> pdu(
new DaemonSocketPDU(SERVICE_ID, OPCODE_CLIENT_SCAN,
4 + // Client Interface
1)); // Start
@ -143,8 +143,8 @@ BluetoothDaemonGattModule::ClientConnectCmd(
{
MOZ_ASSERT(NS_IsMainThread());
nsAutoPtr<BluetoothDaemonPDU> pdu(
new BluetoothDaemonPDU(SERVICE_ID, OPCODE_CLIENT_CONNECT,
nsAutoPtr<DaemonSocketPDU> pdu(
new DaemonSocketPDU(SERVICE_ID, OPCODE_CLIENT_CONNECT,
4 + // Client Interface
6 + // Remote Address
1 + // Is Direct
@ -173,8 +173,8 @@ BluetoothDaemonGattModule::ClientDisconnectCmd(
{
MOZ_ASSERT(NS_IsMainThread());
nsAutoPtr<BluetoothDaemonPDU> pdu(
new BluetoothDaemonPDU(SERVICE_ID, OPCODE_CLIENT_DISCONNECT,
nsAutoPtr<DaemonSocketPDU> pdu(
new DaemonSocketPDU(SERVICE_ID, OPCODE_CLIENT_DISCONNECT,
4 + // Client Interface
6 + // Remote Address
4)); // Connection ID
@ -200,8 +200,8 @@ BluetoothDaemonGattModule::ClientListenCmd(
{
MOZ_ASSERT(NS_IsMainThread());
nsAutoPtr<BluetoothDaemonPDU> pdu(
new BluetoothDaemonPDU(SERVICE_ID, OPCODE_CLIENT_LISTEN,
nsAutoPtr<DaemonSocketPDU> pdu(
new DaemonSocketPDU(SERVICE_ID, OPCODE_CLIENT_LISTEN,
4 + // Client Interface
1)); // Start
@ -226,8 +226,8 @@ BluetoothDaemonGattModule::ClientRefreshCmd(
{
MOZ_ASSERT(NS_IsMainThread());
nsAutoPtr<BluetoothDaemonPDU> pdu(
new BluetoothDaemonPDU(SERVICE_ID, OPCODE_CLIENT_REFRESH,
nsAutoPtr<DaemonSocketPDU> pdu(
new DaemonSocketPDU(SERVICE_ID, OPCODE_CLIENT_REFRESH,
4 + // Client Interface
6)); // Remote Address
@ -252,11 +252,11 @@ BluetoothDaemonGattModule::ClientSearchServiceCmd(
{
MOZ_ASSERT(NS_IsMainThread());
nsAutoPtr<BluetoothDaemonPDU> pdu(
new BluetoothDaemonPDU(SERVICE_ID, OPCODE_CLIENT_SEARCH_SERVICE,
4 + // Connection ID
1 + // Filtered
16)); // UUID
nsAutoPtr<DaemonSocketPDU> pdu(
new DaemonSocketPDU(SERVICE_ID, OPCODE_CLIENT_SEARCH_SERVICE,
4 + // Connection ID
1 + // Filtered
16)); // UUID
nsresult rv = PackPDU(PackConversion<int, int32_t>(aConnId),
PackConversion<bool, uint8_t>(aFiltered),
@ -281,8 +281,8 @@ BluetoothDaemonGattModule::ClientGetIncludedServiceCmd(
{
MOZ_ASSERT(NS_IsMainThread());
nsAutoPtr<BluetoothDaemonPDU> pdu(
new BluetoothDaemonPDU(SERVICE_ID, OPCODE_CLIENT_GET_INCLUDED_SERVICE,
nsAutoPtr<DaemonSocketPDU> pdu(
new DaemonSocketPDU(SERVICE_ID, OPCODE_CLIENT_GET_INCLUDED_SERVICE,
4 + // Connection ID
18 + // Service ID
1 + // Continuation
@ -310,8 +310,8 @@ BluetoothDaemonGattModule::ClientGetCharacteristicCmd(
{
MOZ_ASSERT(NS_IsMainThread());
nsAutoPtr<BluetoothDaemonPDU> pdu(
new BluetoothDaemonPDU(SERVICE_ID, OPCODE_CLIENT_GET_CHARACTERISTIC,
nsAutoPtr<DaemonSocketPDU> pdu(
new DaemonSocketPDU(SERVICE_ID, OPCODE_CLIENT_GET_CHARACTERISTIC,
4 + // Connection ID
18 + // Service ID
1 + // Continuation
@ -341,8 +341,8 @@ BluetoothDaemonGattModule::ClientGetDescriptorCmd(
{
MOZ_ASSERT(NS_IsMainThread());
nsAutoPtr<BluetoothDaemonPDU> pdu(
new BluetoothDaemonPDU(SERVICE_ID, OPCODE_CLIENT_GET_DESCRIPTOR,
nsAutoPtr<DaemonSocketPDU> pdu(
new DaemonSocketPDU(SERVICE_ID, OPCODE_CLIENT_GET_DESCRIPTOR,
4 + // Connection ID
18 + // Service ID
17 + // Characteristic ID
@ -372,8 +372,8 @@ BluetoothDaemonGattModule::ClientReadCharacteristicCmd(
{
MOZ_ASSERT(NS_IsMainThread());
nsAutoPtr<BluetoothDaemonPDU> pdu(
new BluetoothDaemonPDU(SERVICE_ID, OPCODE_CLIENT_READ_CHARACTERISTIC,
nsAutoPtr<DaemonSocketPDU> pdu(
new DaemonSocketPDU(SERVICE_ID, OPCODE_CLIENT_READ_CHARACTERISTIC,
4 + // Connection ID
18 + // Service ID
17 + // Characteristic ID
@ -401,8 +401,8 @@ BluetoothDaemonGattModule::ClientWriteCharacteristicCmd(
{
MOZ_ASSERT(NS_IsMainThread());
nsAutoPtr<BluetoothDaemonPDU> pdu(
new BluetoothDaemonPDU(SERVICE_ID, OPCODE_CLIENT_WRITE_CHARACTERISTIC, 0));
nsAutoPtr<DaemonSocketPDU> pdu(
new DaemonSocketPDU(SERVICE_ID, OPCODE_CLIENT_WRITE_CHARACTERISTIC, 0));
nsresult rv = PackPDU(PackConversion<int, int32_t>(aConnId), aServiceId,
aCharId, aWriteType,
@ -427,8 +427,8 @@ BluetoothDaemonGattModule::ClientReadDescriptorCmd(
{
MOZ_ASSERT(NS_IsMainThread());
nsAutoPtr<BluetoothDaemonPDU> pdu(
new BluetoothDaemonPDU(SERVICE_ID, OPCODE_CLIENT_READ_DESCRIPTOR,
nsAutoPtr<DaemonSocketPDU> pdu(
new DaemonSocketPDU(SERVICE_ID, OPCODE_CLIENT_READ_DESCRIPTOR,
4 + // Connection ID
18 + // Service ID
17 + // Characteristic ID
@ -458,8 +458,8 @@ BluetoothDaemonGattModule::ClientWriteDescriptorCmd(
{
MOZ_ASSERT(NS_IsMainThread());
nsAutoPtr<BluetoothDaemonPDU> pdu(
new BluetoothDaemonPDU(SERVICE_ID, OPCODE_CLIENT_WRITE_DESCRIPTOR, 0));
nsAutoPtr<DaemonSocketPDU> pdu(
new DaemonSocketPDU(SERVICE_ID, OPCODE_CLIENT_WRITE_DESCRIPTOR, 0));
nsresult rv = PackPDU(PackConversion<int, int32_t>(aConnId), aServiceId,
aCharId, aDescriptorId, aWriteType,
@ -482,8 +482,8 @@ BluetoothDaemonGattModule::ClientExecuteWriteCmd(
{
MOZ_ASSERT(NS_IsMainThread());
nsAutoPtr<BluetoothDaemonPDU> pdu(
new BluetoothDaemonPDU(SERVICE_ID, OPCODE_CLIENT_EXECUTE_WRITE,
nsAutoPtr<DaemonSocketPDU> pdu(
new DaemonSocketPDU(SERVICE_ID, OPCODE_CLIENT_EXECUTE_WRITE,
4 + // Connection ID
4)); // Execute
@ -508,8 +508,8 @@ BluetoothDaemonGattModule::ClientRegisterNotificationCmd(
{
MOZ_ASSERT(NS_IsMainThread());
nsAutoPtr<BluetoothDaemonPDU> pdu(
new BluetoothDaemonPDU(SERVICE_ID, OPCODE_CLIENT_REGISTER_NOTIFICATION,
nsAutoPtr<DaemonSocketPDU> pdu(
new DaemonSocketPDU(SERVICE_ID, OPCODE_CLIENT_REGISTER_NOTIFICATION,
4 + // Client Interface
6 + // Remote Address
18 + // Service ID
@ -537,8 +537,8 @@ BluetoothDaemonGattModule::ClientDeregisterNotificationCmd(
{
MOZ_ASSERT(NS_IsMainThread());
nsAutoPtr<BluetoothDaemonPDU> pdu(
new BluetoothDaemonPDU(SERVICE_ID, OPCODE_CLIENT_DEREGISTER_NOTIFICATION,
nsAutoPtr<DaemonSocketPDU> pdu(
new DaemonSocketPDU(SERVICE_ID, OPCODE_CLIENT_DEREGISTER_NOTIFICATION,
4 + // Client Interface
6 + // Remote Address
18 + // Service ID
@ -565,8 +565,8 @@ BluetoothDaemonGattModule::ClientReadRemoteRssiCmd(
{
MOZ_ASSERT(NS_IsMainThread());
nsAutoPtr<BluetoothDaemonPDU> pdu(
new BluetoothDaemonPDU(SERVICE_ID, OPCODE_CLIENT_READ_REMOTE_RSSI,
nsAutoPtr<DaemonSocketPDU> pdu(
new DaemonSocketPDU(SERVICE_ID, OPCODE_CLIENT_READ_REMOTE_RSSI,
4 + // Client Interface
6)); // Remote Address
@ -590,8 +590,8 @@ BluetoothDaemonGattModule::ClientGetDeviceTypeCmd(
{
MOZ_ASSERT(NS_IsMainThread());
nsAutoPtr<BluetoothDaemonPDU> pdu(
new BluetoothDaemonPDU(SERVICE_ID, OPCODE_CLIENT_GET_DEVICE_TYPE,
nsAutoPtr<DaemonSocketPDU> pdu(
new DaemonSocketPDU(SERVICE_ID, OPCODE_CLIENT_GET_DEVICE_TYPE,
6)); // Remote Address
nsresult rv = PackPDU(
@ -618,8 +618,8 @@ BluetoothDaemonGattModule::ClientSetAdvDataCmd(
{
MOZ_ASSERT(NS_IsMainThread());
nsAutoPtr<BluetoothDaemonPDU> pdu(
new BluetoothDaemonPDU(SERVICE_ID, OPCODE_CLIENT_SET_ADV_DATA, 0));
nsAutoPtr<DaemonSocketPDU> pdu(
new DaemonSocketPDU(SERVICE_ID, OPCODE_CLIENT_SET_ADV_DATA, 0));
nsresult rv = PackPDU(
PackConversion<int, int32_t>(aServerIf),
@ -650,8 +650,8 @@ BluetoothDaemonGattModule::ClientTestCommandCmd(
{
MOZ_ASSERT(NS_IsMainThread());
nsAutoPtr<BluetoothDaemonPDU> pdu(
new BluetoothDaemonPDU(SERVICE_ID, OPCODE_CLIENT_TEST_COMMAND,
nsAutoPtr<DaemonSocketPDU> pdu(
new DaemonSocketPDU(SERVICE_ID, OPCODE_CLIENT_TEST_COMMAND,
4 + // Command
6 + // Address
16 + // UUID
@ -682,8 +682,8 @@ BluetoothDaemonGattModule::ClientTestCommandCmd(
void
BluetoothDaemonGattModule::ErrorRsp(
const BluetoothDaemonPDUHeader& aHeader,
BluetoothDaemonPDU& aPDU, BluetoothGattResultHandler* aRes)
const DaemonSocketPDUHeader& aHeader,
DaemonSocketPDU& aPDU, BluetoothGattResultHandler* aRes)
{
ErrorRunnable::Dispatch(
aRes, &BluetoothGattResultHandler::OnError, UnpackPDUInitOp(aPDU));
@ -691,7 +691,7 @@ BluetoothDaemonGattModule::ErrorRsp(
void
BluetoothDaemonGattModule::ClientRegisterRsp(
const BluetoothDaemonPDUHeader& aHeader, BluetoothDaemonPDU& aPDU,
const DaemonSocketPDUHeader& aHeader, DaemonSocketPDU& aPDU,
BluetoothGattClientResultHandler* aRes)
{
ClientResultRunnable::Dispatch(
@ -701,7 +701,7 @@ BluetoothDaemonGattModule::ClientRegisterRsp(
void
BluetoothDaemonGattModule::ClientUnregisterRsp(
const BluetoothDaemonPDUHeader& aHeader, BluetoothDaemonPDU& aPDU,
const DaemonSocketPDUHeader& aHeader, DaemonSocketPDU& aPDU,
BluetoothGattClientResultHandler* aRes)
{
ClientResultRunnable::Dispatch(
@ -711,7 +711,7 @@ BluetoothDaemonGattModule::ClientUnregisterRsp(
void
BluetoothDaemonGattModule::ClientScanRsp(
const BluetoothDaemonPDUHeader& aHeader, BluetoothDaemonPDU& aPDU,
const DaemonSocketPDUHeader& aHeader, DaemonSocketPDU& aPDU,
BluetoothGattClientResultHandler* aRes)
{
ClientResultRunnable::Dispatch(
@ -720,7 +720,7 @@ BluetoothDaemonGattModule::ClientScanRsp(
void
BluetoothDaemonGattModule::ClientConnectRsp(
const BluetoothDaemonPDUHeader& aHeader, BluetoothDaemonPDU& aPDU,
const DaemonSocketPDUHeader& aHeader, DaemonSocketPDU& aPDU,
BluetoothGattClientResultHandler* aRes)
{
ClientResultRunnable::Dispatch(
@ -729,7 +729,7 @@ BluetoothDaemonGattModule::ClientConnectRsp(
void
BluetoothDaemonGattModule::ClientDisconnectRsp(
const BluetoothDaemonPDUHeader& aHeader, BluetoothDaemonPDU& aPDU,
const DaemonSocketPDUHeader& aHeader, DaemonSocketPDU& aPDU,
BluetoothGattClientResultHandler* aRes)
{
ClientResultRunnable::Dispatch(
@ -739,7 +739,7 @@ BluetoothDaemonGattModule::ClientDisconnectRsp(
void
BluetoothDaemonGattModule::ClientListenRsp(
const BluetoothDaemonPDUHeader& aHeader, BluetoothDaemonPDU& aPDU,
const DaemonSocketPDUHeader& aHeader, DaemonSocketPDU& aPDU,
BluetoothGattClientResultHandler* aRes)
{
ClientResultRunnable::Dispatch(
@ -748,7 +748,7 @@ BluetoothDaemonGattModule::ClientListenRsp(
void
BluetoothDaemonGattModule::ClientRefreshRsp(
const BluetoothDaemonPDUHeader& aHeader, BluetoothDaemonPDU& aPDU,
const DaemonSocketPDUHeader& aHeader, DaemonSocketPDU& aPDU,
BluetoothGattClientResultHandler* aRes)
{
ClientResultRunnable::Dispatch(
@ -757,7 +757,7 @@ BluetoothDaemonGattModule::ClientRefreshRsp(
void
BluetoothDaemonGattModule::ClientSearchServiceRsp(
const BluetoothDaemonPDUHeader& aHeader, BluetoothDaemonPDU& aPDU,
const DaemonSocketPDUHeader& aHeader, DaemonSocketPDU& aPDU,
BluetoothGattClientResultHandler* aRes)
{
ClientResultRunnable::Dispatch(
@ -767,7 +767,7 @@ BluetoothDaemonGattModule::ClientSearchServiceRsp(
void
BluetoothDaemonGattModule::ClientGetIncludedServiceRsp(
const BluetoothDaemonPDUHeader& aHeader, BluetoothDaemonPDU& aPDU,
const DaemonSocketPDUHeader& aHeader, DaemonSocketPDU& aPDU,
BluetoothGattClientResultHandler* aRes)
{
ClientResultRunnable::Dispatch(
@ -777,7 +777,7 @@ BluetoothDaemonGattModule::ClientGetIncludedServiceRsp(
void
BluetoothDaemonGattModule::ClientGetCharacteristicRsp(
const BluetoothDaemonPDUHeader& aHeader, BluetoothDaemonPDU& aPDU,
const DaemonSocketPDUHeader& aHeader, DaemonSocketPDU& aPDU,
BluetoothGattClientResultHandler* aRes)
{
ClientResultRunnable::Dispatch(
@ -787,7 +787,7 @@ BluetoothDaemonGattModule::ClientGetCharacteristicRsp(
void
BluetoothDaemonGattModule::ClientGetDescriptorRsp(
const BluetoothDaemonPDUHeader& aHeader, BluetoothDaemonPDU& aPDU,
const DaemonSocketPDUHeader& aHeader, DaemonSocketPDU& aPDU,
BluetoothGattClientResultHandler* aRes)
{
ClientResultRunnable::Dispatch(
@ -797,7 +797,7 @@ BluetoothDaemonGattModule::ClientGetDescriptorRsp(
void
BluetoothDaemonGattModule::ClientReadCharacteristicRsp(
const BluetoothDaemonPDUHeader& aHeader, BluetoothDaemonPDU& aPDU,
const DaemonSocketPDUHeader& aHeader, DaemonSocketPDU& aPDU,
BluetoothGattClientResultHandler* aRes)
{
ClientResultRunnable::Dispatch(
@ -807,7 +807,7 @@ BluetoothDaemonGattModule::ClientReadCharacteristicRsp(
void
BluetoothDaemonGattModule::ClientWriteCharacteristicRsp(
const BluetoothDaemonPDUHeader& aHeader, BluetoothDaemonPDU& aPDU,
const DaemonSocketPDUHeader& aHeader, DaemonSocketPDU& aPDU,
BluetoothGattClientResultHandler* aRes)
{
ClientResultRunnable::Dispatch(
@ -817,7 +817,7 @@ BluetoothDaemonGattModule::ClientWriteCharacteristicRsp(
void
BluetoothDaemonGattModule::ClientReadDescriptorRsp(
const BluetoothDaemonPDUHeader& aHeader, BluetoothDaemonPDU& aPDU,
const DaemonSocketPDUHeader& aHeader, DaemonSocketPDU& aPDU,
BluetoothGattClientResultHandler* aRes)
{
ClientResultRunnable::Dispatch(
@ -827,7 +827,7 @@ BluetoothDaemonGattModule::ClientReadDescriptorRsp(
void
BluetoothDaemonGattModule::ClientWriteDescriptorRsp(
const BluetoothDaemonPDUHeader& aHeader, BluetoothDaemonPDU& aPDU,
const DaemonSocketPDUHeader& aHeader, DaemonSocketPDU& aPDU,
BluetoothGattClientResultHandler* aRes)
{
ClientResultRunnable::Dispatch(
@ -837,7 +837,7 @@ BluetoothDaemonGattModule::ClientWriteDescriptorRsp(
void
BluetoothDaemonGattModule::ClientExecuteWriteRsp(
const BluetoothDaemonPDUHeader& aHeader, BluetoothDaemonPDU& aPDU,
const DaemonSocketPDUHeader& aHeader, DaemonSocketPDU& aPDU,
BluetoothGattClientResultHandler* aRes)
{
ClientResultRunnable::Dispatch(
@ -847,7 +847,7 @@ BluetoothDaemonGattModule::ClientExecuteWriteRsp(
void
BluetoothDaemonGattModule::ClientRegisterNotificationRsp(
const BluetoothDaemonPDUHeader& aHeader, BluetoothDaemonPDU& aPDU,
const DaemonSocketPDUHeader& aHeader, DaemonSocketPDU& aPDU,
BluetoothGattClientResultHandler* aRes)
{
ClientResultRunnable::Dispatch(
@ -857,7 +857,7 @@ BluetoothDaemonGattModule::ClientRegisterNotificationRsp(
void
BluetoothDaemonGattModule::ClientDeregisterNotificationRsp(
const BluetoothDaemonPDUHeader& aHeader, BluetoothDaemonPDU& aPDU,
const DaemonSocketPDUHeader& aHeader, DaemonSocketPDU& aPDU,
BluetoothGattClientResultHandler* aRes)
{
ClientResultRunnable::Dispatch(
@ -867,7 +867,7 @@ BluetoothDaemonGattModule::ClientDeregisterNotificationRsp(
void
BluetoothDaemonGattModule::ClientReadRemoteRssiRsp(
const BluetoothDaemonPDUHeader& aHeader, BluetoothDaemonPDU& aPDU,
const DaemonSocketPDUHeader& aHeader, DaemonSocketPDU& aPDU,
BluetoothGattClientResultHandler* aRes)
{
ClientResultRunnable::Dispatch(
@ -877,7 +877,7 @@ BluetoothDaemonGattModule::ClientReadRemoteRssiRsp(
void
BluetoothDaemonGattModule::ClientGetDeviceTypeRsp(
const BluetoothDaemonPDUHeader& aHeader, BluetoothDaemonPDU& aPDU,
const DaemonSocketPDUHeader& aHeader, DaemonSocketPDU& aPDU,
BluetoothGattClientResultHandler* aRes)
{
ClientResultRunnable::Dispatch(
@ -887,7 +887,7 @@ BluetoothDaemonGattModule::ClientGetDeviceTypeRsp(
void
BluetoothDaemonGattModule::ClientSetAdvDataRsp(
const BluetoothDaemonPDUHeader& aHeader, BluetoothDaemonPDU& aPDU,
const DaemonSocketPDUHeader& aHeader, DaemonSocketPDU& aPDU,
BluetoothGattClientResultHandler* aRes)
{
ClientResultRunnable::Dispatch(
@ -897,7 +897,7 @@ BluetoothDaemonGattModule::ClientSetAdvDataRsp(
void
BluetoothDaemonGattModule::ClientTestCommandRsp(
const BluetoothDaemonPDUHeader& aHeader, BluetoothDaemonPDU& aPDU,
const DaemonSocketPDUHeader& aHeader, DaemonSocketPDU& aPDU,
BluetoothGattClientResultHandler* aRes)
{
ClientResultRunnable::Dispatch(
@ -907,20 +907,20 @@ BluetoothDaemonGattModule::ClientTestCommandRsp(
void
BluetoothDaemonGattModule::HandleRsp(
const BluetoothDaemonPDUHeader& aHeader, BluetoothDaemonPDU& aPDU,
const DaemonSocketPDUHeader& aHeader, DaemonSocketPDU& aPDU,
void* aUserData)
{
static void (BluetoothDaemonGattModule::* const HandleRsp[])(
const BluetoothDaemonPDUHeader&,
BluetoothDaemonPDU&,
const DaemonSocketPDUHeader&,
DaemonSocketPDU&,
BluetoothGattResultHandler*) = {
INIT_ARRAY_AT(OPCODE_ERROR,
&BluetoothDaemonGattModule::ErrorRsp)
};
static void (BluetoothDaemonGattModule::* const HandleClientRsp[])(
const BluetoothDaemonPDUHeader&,
BluetoothDaemonPDU&,
const DaemonSocketPDUHeader&,
DaemonSocketPDU&,
BluetoothGattClientResultHandler*) = {
INIT_ARRAY_AT(0, nullptr),
INIT_ARRAY_AT(OPCODE_CLIENT_REGISTER,
@ -1032,7 +1032,7 @@ public:
void
BluetoothDaemonGattModule::ClientRegisterNtf(
const BluetoothDaemonPDUHeader& aHeader, BluetoothDaemonPDU& aPDU)
const DaemonSocketPDUHeader& aHeader, DaemonSocketPDU& aPDU)
{
ClientRegisterNotification::Dispatch(
&BluetoothGattClientNotificationHandler::RegisterClientNotification,
@ -1044,7 +1044,7 @@ class BluetoothDaemonGattModule::ClientScanResultInitOp final
: private PDUInitOp
{
public:
ClientScanResultInitOp(BluetoothDaemonPDU& aPDU)
ClientScanResultInitOp(DaemonSocketPDU& aPDU)
: PDUInitOp(aPDU)
{ }
@ -1053,7 +1053,7 @@ public:
int& aArg2,
BluetoothGattAdvData& aArg3) const
{
BluetoothDaemonPDU& pdu = GetPDU();
DaemonSocketPDU& pdu = GetPDU();
/* Read address */
nsresult rv = UnpackPDU(
@ -1085,7 +1085,7 @@ public:
void
BluetoothDaemonGattModule::ClientScanResultNtf(
const BluetoothDaemonPDUHeader& aHeader, BluetoothDaemonPDU& aPDU)
const DaemonSocketPDUHeader& aHeader, DaemonSocketPDU& aPDU)
{
ClientScanResultNotification::Dispatch(
&BluetoothGattClientNotificationHandler::ScanResultNotification,
@ -1097,7 +1097,7 @@ class BluetoothDaemonGattModule::ClientConnectDisconnectInitOp final
: private PDUInitOp
{
public:
ClientConnectDisconnectInitOp(BluetoothDaemonPDU& aPDU)
ClientConnectDisconnectInitOp(DaemonSocketPDU& aPDU)
: PDUInitOp(aPDU)
{ }
@ -1107,7 +1107,7 @@ public:
int& aArg3,
nsString& aArg4) const
{
BluetoothDaemonPDU& pdu = GetPDU();
DaemonSocketPDU& pdu = GetPDU();
/* Read connection ID */
nsresult rv = UnpackPDU(pdu, aArg1);
@ -1138,7 +1138,7 @@ public:
void
BluetoothDaemonGattModule::ClientConnectNtf(
const BluetoothDaemonPDUHeader& aHeader, BluetoothDaemonPDU& aPDU)
const DaemonSocketPDUHeader& aHeader, DaemonSocketPDU& aPDU)
{
ClientConnectNotification::Dispatch(
&BluetoothGattClientNotificationHandler::ConnectNotification,
@ -1147,7 +1147,7 @@ BluetoothDaemonGattModule::ClientConnectNtf(
void
BluetoothDaemonGattModule::ClientDisconnectNtf(
const BluetoothDaemonPDUHeader& aHeader, BluetoothDaemonPDU& aPDU)
const DaemonSocketPDUHeader& aHeader, DaemonSocketPDU& aPDU)
{
ClientDisconnectNotification::Dispatch(
&BluetoothGattClientNotificationHandler::DisconnectNotification,
@ -1156,7 +1156,7 @@ BluetoothDaemonGattModule::ClientDisconnectNtf(
void
BluetoothDaemonGattModule::ClientSearchCompleteNtf(
const BluetoothDaemonPDUHeader& aHeader, BluetoothDaemonPDU& aPDU)
const DaemonSocketPDUHeader& aHeader, DaemonSocketPDU& aPDU)
{
ClientSearchCompleteNotification::Dispatch(
&BluetoothGattClientNotificationHandler::SearchCompleteNotification,
@ -1165,7 +1165,7 @@ BluetoothDaemonGattModule::ClientSearchCompleteNtf(
void
BluetoothDaemonGattModule::ClientSearchResultNtf(
const BluetoothDaemonPDUHeader& aHeader, BluetoothDaemonPDU& aPDU)
const DaemonSocketPDUHeader& aHeader, DaemonSocketPDU& aPDU)
{
ClientSearchResultNotification::Dispatch(
&BluetoothGattClientNotificationHandler::SearchResultNotification,
@ -1174,7 +1174,7 @@ BluetoothDaemonGattModule::ClientSearchResultNtf(
void
BluetoothDaemonGattModule::ClientGetCharacteristicNtf(
const BluetoothDaemonPDUHeader& aHeader, BluetoothDaemonPDU& aPDU)
const DaemonSocketPDUHeader& aHeader, DaemonSocketPDU& aPDU)
{
ClientGetCharacteristicNotification::Dispatch(
&BluetoothGattClientNotificationHandler::GetCharacteristicNotification,
@ -1183,7 +1183,7 @@ BluetoothDaemonGattModule::ClientGetCharacteristicNtf(
void
BluetoothDaemonGattModule::ClientGetDescriptorNtf(
const BluetoothDaemonPDUHeader& aHeader, BluetoothDaemonPDU& aPDU)
const DaemonSocketPDUHeader& aHeader, DaemonSocketPDU& aPDU)
{
ClientGetDescriptorNotification::Dispatch(
&BluetoothGattClientNotificationHandler::GetDescriptorNotification,
@ -1192,7 +1192,7 @@ BluetoothDaemonGattModule::ClientGetDescriptorNtf(
void
BluetoothDaemonGattModule::ClientGetIncludedServiceNtf(
const BluetoothDaemonPDUHeader& aHeader, BluetoothDaemonPDU& aPDU)
const DaemonSocketPDUHeader& aHeader, DaemonSocketPDU& aPDU)
{
ClientGetIncludedServiceNotification::Dispatch(
&BluetoothGattClientNotificationHandler::GetIncludedServiceNotification,
@ -1201,7 +1201,7 @@ BluetoothDaemonGattModule::ClientGetIncludedServiceNtf(
void
BluetoothDaemonGattModule::ClientRegisterNotificationNtf(
const BluetoothDaemonPDUHeader& aHeader, BluetoothDaemonPDU& aPDU)
const DaemonSocketPDUHeader& aHeader, DaemonSocketPDU& aPDU)
{
ClientRegisterNotificationNotification::Dispatch(
&BluetoothGattClientNotificationHandler::RegisterNotificationNotification,
@ -1210,7 +1210,7 @@ BluetoothDaemonGattModule::ClientRegisterNotificationNtf(
void
BluetoothDaemonGattModule::ClientNotifyNtf(
const BluetoothDaemonPDUHeader& aHeader, BluetoothDaemonPDU& aPDU)
const DaemonSocketPDUHeader& aHeader, DaemonSocketPDU& aPDU)
{
ClientNotifyNotification::Dispatch(
&BluetoothGattClientNotificationHandler::NotifyNotification,
@ -1219,7 +1219,7 @@ BluetoothDaemonGattModule::ClientNotifyNtf(
void
BluetoothDaemonGattModule::ClientReadCharacteristicNtf(
const BluetoothDaemonPDUHeader& aHeader, BluetoothDaemonPDU& aPDU)
const DaemonSocketPDUHeader& aHeader, DaemonSocketPDU& aPDU)
{
ClientReadCharacteristicNotification::Dispatch(
&BluetoothGattClientNotificationHandler::ReadCharacteristicNotification,
@ -1228,7 +1228,7 @@ BluetoothDaemonGattModule::ClientReadCharacteristicNtf(
void
BluetoothDaemonGattModule::ClientWriteCharacteristicNtf(
const BluetoothDaemonPDUHeader& aHeader, BluetoothDaemonPDU& aPDU)
const DaemonSocketPDUHeader& aHeader, DaemonSocketPDU& aPDU)
{
ClientWriteCharacteristicNotification::Dispatch(
&BluetoothGattClientNotificationHandler::WriteCharacteristicNotification,
@ -1237,7 +1237,7 @@ BluetoothDaemonGattModule::ClientWriteCharacteristicNtf(
void
BluetoothDaemonGattModule::ClientReadDescriptorNtf(
const BluetoothDaemonPDUHeader& aHeader, BluetoothDaemonPDU& aPDU)
const DaemonSocketPDUHeader& aHeader, DaemonSocketPDU& aPDU)
{
ClientReadDescriptorNotification::Dispatch(
&BluetoothGattClientNotificationHandler::ReadDescriptorNotification,
@ -1246,7 +1246,7 @@ BluetoothDaemonGattModule::ClientReadDescriptorNtf(
void
BluetoothDaemonGattModule::ClientWriteDescriptorNtf(
const BluetoothDaemonPDUHeader& aHeader, BluetoothDaemonPDU& aPDU)
const DaemonSocketPDUHeader& aHeader, DaemonSocketPDU& aPDU)
{
ClientWriteDescriptorNotification::Dispatch(
&BluetoothGattClientNotificationHandler::WriteDescriptorNotification,
@ -1255,7 +1255,7 @@ BluetoothDaemonGattModule::ClientWriteDescriptorNtf(
void
BluetoothDaemonGattModule::ClientExecuteWriteNtf(
const BluetoothDaemonPDUHeader& aHeader, BluetoothDaemonPDU& aPDU)
const DaemonSocketPDUHeader& aHeader, DaemonSocketPDU& aPDU)
{
ClientExecuteWriteNotification::Dispatch(
&BluetoothGattClientNotificationHandler::ExecuteWriteNotification,
@ -1267,7 +1267,7 @@ class BluetoothDaemonGattModule::ClientReadRemoteRssiInitOp final
: private PDUInitOp
{
public:
ClientReadRemoteRssiInitOp(BluetoothDaemonPDU& aPDU)
ClientReadRemoteRssiInitOp(DaemonSocketPDU& aPDU)
: PDUInitOp(aPDU)
{ }
@ -1277,7 +1277,7 @@ public:
int& aArg3,
BluetoothGattStatus& aArg4) const
{
BluetoothDaemonPDU& pdu = GetPDU();
DaemonSocketPDU& pdu = GetPDU();
/* Read client interface */
nsresult rv = UnpackPDU(pdu, aArg1);
@ -1307,7 +1307,7 @@ public:
void
BluetoothDaemonGattModule::ClientReadRemoteRssiNtf(
const BluetoothDaemonPDUHeader& aHeader, BluetoothDaemonPDU& aPDU)
const DaemonSocketPDUHeader& aHeader, DaemonSocketPDU& aPDU)
{
ClientReadRemoteRssiNotification::Dispatch(
&BluetoothGattClientNotificationHandler::ReadRemoteRssiNotification,
@ -1316,7 +1316,7 @@ BluetoothDaemonGattModule::ClientReadRemoteRssiNtf(
void
BluetoothDaemonGattModule::ClientListenNtf(
const BluetoothDaemonPDUHeader& aHeader, BluetoothDaemonPDU& aPDU)
const DaemonSocketPDUHeader& aHeader, DaemonSocketPDU& aPDU)
{
ClientListenNotification::Dispatch(
&BluetoothGattClientNotificationHandler::ListenNotification,
@ -1325,11 +1325,11 @@ BluetoothDaemonGattModule::ClientListenNtf(
void
BluetoothDaemonGattModule::HandleNtf(
const BluetoothDaemonPDUHeader& aHeader, BluetoothDaemonPDU& aPDU,
const DaemonSocketPDUHeader& aHeader, DaemonSocketPDU& aPDU,
void* aUserData)
{
static void (BluetoothDaemonGattModule::* const HandleNtf[])(
const BluetoothDaemonPDUHeader&, BluetoothDaemonPDU&) = {
const DaemonSocketPDUHeader&, DaemonSocketPDU&) = {
INIT_ARRAY_AT(0, &BluetoothDaemonGattModule::ClientRegisterNtf),
INIT_ARRAY_AT(1, &BluetoothDaemonGattModule::ClientScanResultNtf),
INIT_ARRAY_AT(2, &BluetoothDaemonGattModule::ClientConnectNtf),

View File

@ -51,7 +51,7 @@ public:
static const int MAX_NUM_CLIENTS;
virtual nsresult Send(BluetoothDaemonPDU* aPDU, void* aUserData) = 0;
virtual nsresult Send(DaemonSocketPDU* aPDU, void* aUserData) = 0;
virtual nsresult RegisterModule(uint8_t aId, uint8_t aMode,
uint32_t aMaxNumClients,
@ -211,14 +211,14 @@ public:
// TODO: Add server commands
protected:
nsresult Send(BluetoothDaemonPDU* aPDU,
nsresult Send(DaemonSocketPDU* aPDU,
BluetoothGattResultHandler* aRes);
nsresult Send(BluetoothDaemonPDU* aPDU,
nsresult Send(DaemonSocketPDU* aPDU,
BluetoothGattClientResultHandler* aRes);
void HandleSvc(const BluetoothDaemonPDUHeader& aHeader,
BluetoothDaemonPDU& aPDU, void* aUserData);
void HandleSvc(const DaemonSocketPDUHeader& aHeader,
DaemonSocketPDU& aPDU, void* aUserData);
//
// Responses
@ -234,100 +234,100 @@ protected:
BluetoothStatus, BluetoothStatus>
ErrorRunnable;
void ErrorRsp(const BluetoothDaemonPDUHeader& aHeader,
BluetoothDaemonPDU& aPDU,
void ErrorRsp(const DaemonSocketPDUHeader& aHeader,
DaemonSocketPDU& aPDU,
BluetoothGattResultHandler* aRes);
void ClientRegisterRsp(const BluetoothDaemonPDUHeader& aHeader,
BluetoothDaemonPDU& aPDU,
void ClientRegisterRsp(const DaemonSocketPDUHeader& aHeader,
DaemonSocketPDU& aPDU,
BluetoothGattClientResultHandler* aRes);
void ClientUnregisterRsp(const BluetoothDaemonPDUHeader& aHeader,
BluetoothDaemonPDU& aPDU,
void ClientUnregisterRsp(const DaemonSocketPDUHeader& aHeader,
DaemonSocketPDU& aPDU,
BluetoothGattClientResultHandler* aRes);
void ClientScanRsp(const BluetoothDaemonPDUHeader& aHeader,
BluetoothDaemonPDU& aPDU,
void ClientScanRsp(const DaemonSocketPDUHeader& aHeader,
DaemonSocketPDU& aPDU,
BluetoothGattClientResultHandler* aRes);
void ClientConnectRsp(const BluetoothDaemonPDUHeader& aHeader,
BluetoothDaemonPDU& aPDU,
void ClientConnectRsp(const DaemonSocketPDUHeader& aHeader,
DaemonSocketPDU& aPDU,
BluetoothGattClientResultHandler* aRes);
void ClientDisconnectRsp(const BluetoothDaemonPDUHeader& aHeader,
BluetoothDaemonPDU& aPDU,
void ClientDisconnectRsp(const DaemonSocketPDUHeader& aHeader,
DaemonSocketPDU& aPDU,
BluetoothGattClientResultHandler* aRes);
void ClientListenRsp(const BluetoothDaemonPDUHeader& aHeader,
BluetoothDaemonPDU& aPDU,
void ClientListenRsp(const DaemonSocketPDUHeader& aHeader,
DaemonSocketPDU& aPDU,
BluetoothGattClientResultHandler* aRes);
void ClientRefreshRsp(const BluetoothDaemonPDUHeader& aHeader,
BluetoothDaemonPDU& aPDU,
void ClientRefreshRsp(const DaemonSocketPDUHeader& aHeader,
DaemonSocketPDU& aPDU,
BluetoothGattClientResultHandler* aRes);
void ClientSearchServiceRsp(const BluetoothDaemonPDUHeader& aHeader,
BluetoothDaemonPDU& aPDU,
void ClientSearchServiceRsp(const DaemonSocketPDUHeader& aHeader,
DaemonSocketPDU& aPDU,
BluetoothGattClientResultHandler* aRes);
void ClientGetIncludedServiceRsp(const BluetoothDaemonPDUHeader& aHeader,
BluetoothDaemonPDU& aPDU,
void ClientGetIncludedServiceRsp(const DaemonSocketPDUHeader& aHeader,
DaemonSocketPDU& aPDU,
BluetoothGattClientResultHandler* aRes);
void ClientGetCharacteristicRsp(const BluetoothDaemonPDUHeader& aHeader,
BluetoothDaemonPDU& aPDU,
void ClientGetCharacteristicRsp(const DaemonSocketPDUHeader& aHeader,
DaemonSocketPDU& aPDU,
BluetoothGattClientResultHandler* aRes);
void ClientGetDescriptorRsp(const BluetoothDaemonPDUHeader& aHeader,
BluetoothDaemonPDU& aPDU,
void ClientGetDescriptorRsp(const DaemonSocketPDUHeader& aHeader,
DaemonSocketPDU& aPDU,
BluetoothGattClientResultHandler* aRes);
void ClientReadCharacteristicRsp(const BluetoothDaemonPDUHeader& aHeader,
BluetoothDaemonPDU& aPDU,
void ClientReadCharacteristicRsp(const DaemonSocketPDUHeader& aHeader,
DaemonSocketPDU& aPDU,
BluetoothGattClientResultHandler* aRes);
void ClientWriteCharacteristicRsp(const BluetoothDaemonPDUHeader& aHeader,
BluetoothDaemonPDU& aPDU,
void ClientWriteCharacteristicRsp(const DaemonSocketPDUHeader& aHeader,
DaemonSocketPDU& aPDU,
BluetoothGattClientResultHandler* aRes);
void ClientReadDescriptorRsp(const BluetoothDaemonPDUHeader& aHeader,
BluetoothDaemonPDU& aPDU,
void ClientReadDescriptorRsp(const DaemonSocketPDUHeader& aHeader,
DaemonSocketPDU& aPDU,
BluetoothGattClientResultHandler* aRes);
void ClientWriteDescriptorRsp(const BluetoothDaemonPDUHeader& aHeader,
BluetoothDaemonPDU& aPDU,
void ClientWriteDescriptorRsp(const DaemonSocketPDUHeader& aHeader,
DaemonSocketPDU& aPDU,
BluetoothGattClientResultHandler* aRes);
void ClientExecuteWriteRsp(const BluetoothDaemonPDUHeader& aHeader,
BluetoothDaemonPDU& aPDU,
void ClientExecuteWriteRsp(const DaemonSocketPDUHeader& aHeader,
DaemonSocketPDU& aPDU,
BluetoothGattClientResultHandler* aRes);
void ClientRegisterNotificationRsp(const BluetoothDaemonPDUHeader& aHeader,
BluetoothDaemonPDU& aPDU,
void ClientRegisterNotificationRsp(const DaemonSocketPDUHeader& aHeader,
DaemonSocketPDU& aPDU,
BluetoothGattClientResultHandler* aRes);
void ClientDeregisterNotificationRsp(const BluetoothDaemonPDUHeader& aHeader,
BluetoothDaemonPDU& aPDU,
void ClientDeregisterNotificationRsp(const DaemonSocketPDUHeader& aHeader,
DaemonSocketPDU& aPDU,
BluetoothGattClientResultHandler* aRes);
void ClientReadRemoteRssiRsp(const BluetoothDaemonPDUHeader& aHeader,
BluetoothDaemonPDU& aPDU,
void ClientReadRemoteRssiRsp(const DaemonSocketPDUHeader& aHeader,
DaemonSocketPDU& aPDU,
BluetoothGattClientResultHandler* aRes);
void ClientGetDeviceTypeRsp(const BluetoothDaemonPDUHeader& aHeader,
BluetoothDaemonPDU& aPDU,
void ClientGetDeviceTypeRsp(const DaemonSocketPDUHeader& aHeader,
DaemonSocketPDU& aPDU,
BluetoothGattClientResultHandler* aRes);
void ClientSetAdvDataRsp(const BluetoothDaemonPDUHeader& aHeader,
BluetoothDaemonPDU& aPDU,
void ClientSetAdvDataRsp(const DaemonSocketPDUHeader& aHeader,
DaemonSocketPDU& aPDU,
BluetoothGattClientResultHandler* aRes);
void ClientTestCommandRsp(const BluetoothDaemonPDUHeader& aHeader,
BluetoothDaemonPDU& aPDU,
void ClientTestCommandRsp(const DaemonSocketPDUHeader& aHeader,
DaemonSocketPDU& aPDU,
BluetoothGattClientResultHandler* aRes);
void HandleRsp(const BluetoothDaemonPDUHeader& aHeader,
BluetoothDaemonPDU& aPDU,
void HandleRsp(const DaemonSocketPDUHeader& aHeader,
DaemonSocketPDU& aPDU,
void* aUserData);
// TODO: Add Server responses
@ -456,62 +456,62 @@ protected:
class ClientConnectDisconnectInitOp;
class ClientReadRemoteRssiInitOp;
void ClientRegisterNtf(const BluetoothDaemonPDUHeader& aHeader,
BluetoothDaemonPDU& aPDU);
void ClientRegisterNtf(const DaemonSocketPDUHeader& aHeader,
DaemonSocketPDU& aPDU);
void ClientScanResultNtf(const BluetoothDaemonPDUHeader& aHeader,
BluetoothDaemonPDU& aPDU);
void ClientScanResultNtf(const DaemonSocketPDUHeader& aHeader,
DaemonSocketPDU& aPDU);
void ClientConnectNtf(const BluetoothDaemonPDUHeader& aHeader,
BluetoothDaemonPDU& aPDU);
void ClientConnectNtf(const DaemonSocketPDUHeader& aHeader,
DaemonSocketPDU& aPDU);
void ClientDisconnectNtf(const BluetoothDaemonPDUHeader& aHeader,
BluetoothDaemonPDU& aPDU);
void ClientDisconnectNtf(const DaemonSocketPDUHeader& aHeader,
DaemonSocketPDU& aPDU);
void ClientSearchCompleteNtf(const BluetoothDaemonPDUHeader& aHeader,
BluetoothDaemonPDU& aPDU);
void ClientSearchCompleteNtf(const DaemonSocketPDUHeader& aHeader,
DaemonSocketPDU& aPDU);
void ClientSearchResultNtf(const BluetoothDaemonPDUHeader& aHeader,
BluetoothDaemonPDU& aPDU);
void ClientSearchResultNtf(const DaemonSocketPDUHeader& aHeader,
DaemonSocketPDU& aPDU);
void ClientGetCharacteristicNtf(const BluetoothDaemonPDUHeader& aHeader,
BluetoothDaemonPDU& aPDU);
void ClientGetCharacteristicNtf(const DaemonSocketPDUHeader& aHeader,
DaemonSocketPDU& aPDU);
void ClientGetDescriptorNtf(const BluetoothDaemonPDUHeader& aHeader,
BluetoothDaemonPDU& aPDU);
void ClientGetDescriptorNtf(const DaemonSocketPDUHeader& aHeader,
DaemonSocketPDU& aPDU);
void ClientGetIncludedServiceNtf(const BluetoothDaemonPDUHeader& aHeader,
BluetoothDaemonPDU& aPDU);
void ClientGetIncludedServiceNtf(const DaemonSocketPDUHeader& aHeader,
DaemonSocketPDU& aPDU);
void ClientRegisterNotificationNtf(const BluetoothDaemonPDUHeader& aHeader,
BluetoothDaemonPDU& aPDU);
void ClientRegisterNotificationNtf(const DaemonSocketPDUHeader& aHeader,
DaemonSocketPDU& aPDU);
void ClientNotifyNtf(const BluetoothDaemonPDUHeader& aHeader,
BluetoothDaemonPDU& aPDU);
void ClientNotifyNtf(const DaemonSocketPDUHeader& aHeader,
DaemonSocketPDU& aPDU);
void ClientReadCharacteristicNtf(const BluetoothDaemonPDUHeader& aHeader,
BluetoothDaemonPDU& aPDU);
void ClientReadCharacteristicNtf(const DaemonSocketPDUHeader& aHeader,
DaemonSocketPDU& aPDU);
void ClientWriteCharacteristicNtf(const BluetoothDaemonPDUHeader& aHeader,
BluetoothDaemonPDU& aPDU);
void ClientWriteCharacteristicNtf(const DaemonSocketPDUHeader& aHeader,
DaemonSocketPDU& aPDU);
void ClientReadDescriptorNtf(const BluetoothDaemonPDUHeader& aHeader,
BluetoothDaemonPDU& aPDU);
void ClientReadDescriptorNtf(const DaemonSocketPDUHeader& aHeader,
DaemonSocketPDU& aPDU);
void ClientWriteDescriptorNtf(const BluetoothDaemonPDUHeader& aHeader,
BluetoothDaemonPDU& aPDU);
void ClientWriteDescriptorNtf(const DaemonSocketPDUHeader& aHeader,
DaemonSocketPDU& aPDU);
void ClientExecuteWriteNtf(const BluetoothDaemonPDUHeader& aHeader,
BluetoothDaemonPDU& aPDU);
void ClientExecuteWriteNtf(const DaemonSocketPDUHeader& aHeader,
DaemonSocketPDU& aPDU);
void ClientReadRemoteRssiNtf(const BluetoothDaemonPDUHeader& aHeader,
BluetoothDaemonPDU& aPDU);
void ClientReadRemoteRssiNtf(const DaemonSocketPDUHeader& aHeader,
DaemonSocketPDU& aPDU);
void ClientListenNtf(const BluetoothDaemonPDUHeader& aHeader,
BluetoothDaemonPDU& aPDU);
void ClientListenNtf(const DaemonSocketPDUHeader& aHeader,
DaemonSocketPDU& aPDU);
void HandleNtf(const BluetoothDaemonPDUHeader& aHeader,
BluetoothDaemonPDU& aPDU,
void HandleNtf(const DaemonSocketPDUHeader& aHeader,
DaemonSocketPDU& aPDU,
void* aUserData);
static BluetoothGattNotificationHandler* sNotificationHandler;

View File

@ -30,7 +30,7 @@ BluetoothDaemonHandsfreeModule::SetNotificationHandler(
}
nsresult
BluetoothDaemonHandsfreeModule::Send(BluetoothDaemonPDU* aPDU,
BluetoothDaemonHandsfreeModule::Send(DaemonSocketPDU* aPDU,
BluetoothHandsfreeResultHandler* aRes)
{
aRes->AddRef(); // Keep reference for response
@ -38,11 +38,11 @@ BluetoothDaemonHandsfreeModule::Send(BluetoothDaemonPDU* aPDU,
}
void
BluetoothDaemonHandsfreeModule::HandleSvc(const BluetoothDaemonPDUHeader& aHeader,
BluetoothDaemonPDU& aPDU, void* aUserData)
BluetoothDaemonHandsfreeModule::HandleSvc(const DaemonSocketPDUHeader& aHeader,
DaemonSocketPDU& aPDU, void* aUserData)
{
static void (BluetoothDaemonHandsfreeModule::* const HandleOp[])(
const BluetoothDaemonPDUHeader&, BluetoothDaemonPDU&, void*) = {
const DaemonSocketPDUHeader&, DaemonSocketPDU&, void*) = {
INIT_ARRAY_AT(0, &BluetoothDaemonHandsfreeModule::HandleRsp),
INIT_ARRAY_AT(1, &BluetoothDaemonHandsfreeModule::HandleNtf),
};
@ -64,8 +64,8 @@ BluetoothDaemonHandsfreeModule::ConnectCmd(
{
MOZ_ASSERT(NS_IsMainThread());
nsAutoPtr<BluetoothDaemonPDU> pdu(
new BluetoothDaemonPDU(SERVICE_ID, OPCODE_CONNECT,
nsAutoPtr<DaemonSocketPDU> pdu(
new DaemonSocketPDU(SERVICE_ID, OPCODE_CONNECT,
6)); // Address
nsresult rv = PackPDU(
@ -87,8 +87,8 @@ BluetoothDaemonHandsfreeModule::DisconnectCmd(
{
MOZ_ASSERT(NS_IsMainThread());
nsAutoPtr<BluetoothDaemonPDU> pdu(
new BluetoothDaemonPDU(SERVICE_ID, OPCODE_DISCONNECT,
nsAutoPtr<DaemonSocketPDU> pdu(
new DaemonSocketPDU(SERVICE_ID, OPCODE_DISCONNECT,
6)); // Address
nsresult rv = PackPDU(
@ -110,8 +110,8 @@ BluetoothDaemonHandsfreeModule::ConnectAudioCmd(
{
MOZ_ASSERT(NS_IsMainThread());
nsAutoPtr<BluetoothDaemonPDU> pdu(
new BluetoothDaemonPDU(SERVICE_ID, OPCODE_CONNECT_AUDIO,
nsAutoPtr<DaemonSocketPDU> pdu(
new DaemonSocketPDU(SERVICE_ID, OPCODE_CONNECT_AUDIO,
6)); // Address
nsresult rv = PackPDU(
@ -133,8 +133,8 @@ BluetoothDaemonHandsfreeModule::DisconnectAudioCmd(
{
MOZ_ASSERT(NS_IsMainThread());
nsAutoPtr<BluetoothDaemonPDU> pdu(
new BluetoothDaemonPDU(SERVICE_ID, OPCODE_DISCONNECT_AUDIO,
nsAutoPtr<DaemonSocketPDU> pdu(
new DaemonSocketPDU(SERVICE_ID, OPCODE_DISCONNECT_AUDIO,
6)); // Address
nsresult rv = PackPDU(
@ -156,8 +156,8 @@ BluetoothDaemonHandsfreeModule::StartVoiceRecognitionCmd(
{
MOZ_ASSERT(NS_IsMainThread());
nsAutoPtr<BluetoothDaemonPDU> pdu(
new BluetoothDaemonPDU(SERVICE_ID, OPCODE_START_VOICE_RECOGNITION,
nsAutoPtr<DaemonSocketPDU> pdu(
new DaemonSocketPDU(SERVICE_ID, OPCODE_START_VOICE_RECOGNITION,
6)); // Address (BlueZ 5.25)
nsresult rv;
@ -182,8 +182,8 @@ BluetoothDaemonHandsfreeModule::StopVoiceRecognitionCmd(
{
MOZ_ASSERT(NS_IsMainThread());
nsAutoPtr<BluetoothDaemonPDU> pdu(
new BluetoothDaemonPDU(SERVICE_ID, OPCODE_STOP_VOICE_RECOGNITION,
nsAutoPtr<DaemonSocketPDU> pdu(
new DaemonSocketPDU(SERVICE_ID, OPCODE_STOP_VOICE_RECOGNITION,
6)); // Address (BlueZ 5.25)
nsresult rv;
@ -209,8 +209,8 @@ BluetoothDaemonHandsfreeModule::VolumeControlCmd(
{
MOZ_ASSERT(NS_IsMainThread());
nsAutoPtr<BluetoothDaemonPDU> pdu(
new BluetoothDaemonPDU(SERVICE_ID, OPCODE_VOLUME_CONTROL,
nsAutoPtr<DaemonSocketPDU> pdu(
new DaemonSocketPDU(SERVICE_ID, OPCODE_VOLUME_CONTROL,
1 + // Volume type
1 + // Volume
6)); // Address (BlueZ 5.25)
@ -241,8 +241,8 @@ BluetoothDaemonHandsfreeModule::DeviceStatusNotificationCmd(
{
MOZ_ASSERT(NS_IsMainThread());
nsAutoPtr<BluetoothDaemonPDU> pdu(
new BluetoothDaemonPDU(SERVICE_ID, OPCODE_DEVICE_STATUS_NOTIFICATION,
nsAutoPtr<DaemonSocketPDU> pdu(
new DaemonSocketPDU(SERVICE_ID, OPCODE_DEVICE_STATUS_NOTIFICATION,
1 + // Network state
1 + // Service type
1 + // Signal strength
@ -269,8 +269,8 @@ BluetoothDaemonHandsfreeModule::CopsResponseCmd(
{
MOZ_ASSERT(NS_IsMainThread());
nsAutoPtr<BluetoothDaemonPDU> pdu(
new BluetoothDaemonPDU(SERVICE_ID, OPCODE_COPS_RESPONSE,
nsAutoPtr<DaemonSocketPDU> pdu(
new DaemonSocketPDU(SERVICE_ID, OPCODE_COPS_RESPONSE,
0 + // Dynamically allocated
6)); // Address (BlueZ 5.25)
@ -302,8 +302,8 @@ BluetoothDaemonHandsfreeModule::CindResponseCmd(
{
MOZ_ASSERT(NS_IsMainThread());
nsAutoPtr<BluetoothDaemonPDU> pdu(
new BluetoothDaemonPDU(SERVICE_ID, OPCODE_CIND_RESPONSE,
nsAutoPtr<DaemonSocketPDU> pdu(
new DaemonSocketPDU(SERVICE_ID, OPCODE_CIND_RESPONSE,
1 + // Service
1 + // # Active
1 + // # Held
@ -350,8 +350,8 @@ BluetoothDaemonHandsfreeModule::FormattedAtResponseCmd(
{
MOZ_ASSERT(NS_IsMainThread());
nsAutoPtr<BluetoothDaemonPDU> pdu(
new BluetoothDaemonPDU(SERVICE_ID, OPCODE_FORMATTED_AT_RESPONSE,
nsAutoPtr<DaemonSocketPDU> pdu(
new DaemonSocketPDU(SERVICE_ID, OPCODE_FORMATTED_AT_RESPONSE,
0 + // Dynamically allocated
6)); // Address (BlueZ 5.25)
@ -380,8 +380,8 @@ BluetoothDaemonHandsfreeModule::AtResponseCmd(
{
MOZ_ASSERT(NS_IsMainThread());
nsAutoPtr<BluetoothDaemonPDU> pdu(
new BluetoothDaemonPDU(SERVICE_ID, OPCODE_AT_RESPONSE,
nsAutoPtr<DaemonSocketPDU> pdu(
new DaemonSocketPDU(SERVICE_ID, OPCODE_AT_RESPONSE,
1 + // AT Response code
1 + // Error code
6)); // Address (BlueZ 5.25)
@ -417,8 +417,8 @@ BluetoothDaemonHandsfreeModule::ClccResponseCmd(
NS_ConvertUTF16toUTF8 number(aNumber);
nsAutoPtr<BluetoothDaemonPDU> pdu(
new BluetoothDaemonPDU(SERVICE_ID, OPCODE_CLCC_RESPONSE,
nsAutoPtr<DaemonSocketPDU> pdu(
new DaemonSocketPDU(SERVICE_ID, OPCODE_CLCC_RESPONSE,
1 + // Call index
1 + // Call direction
1 + // Call state
@ -460,8 +460,8 @@ BluetoothDaemonHandsfreeModule::PhoneStateChangeCmd(
NS_ConvertUTF16toUTF8 number(aNumber);
nsAutoPtr<BluetoothDaemonPDU> pdu(
new BluetoothDaemonPDU(SERVICE_ID, OPCODE_PHONE_STATE_CHANGE,
nsAutoPtr<DaemonSocketPDU> pdu(
new DaemonSocketPDU(SERVICE_ID, OPCODE_PHONE_STATE_CHANGE,
1 + // # Active
1 + // # Held
1 + // Call state
@ -491,8 +491,8 @@ BluetoothDaemonHandsfreeModule::ConfigureWbsCmd(
{
MOZ_ASSERT(NS_IsMainThread());
nsAutoPtr<BluetoothDaemonPDU> pdu(
new BluetoothDaemonPDU(SERVICE_ID, OPCODE_CONFIGURE_WBS,
nsAutoPtr<DaemonSocketPDU> pdu(
new DaemonSocketPDU(SERVICE_ID, OPCODE_CONFIGURE_WBS,
6 + // Address
1)); // Config
@ -514,8 +514,8 @@ BluetoothDaemonHandsfreeModule::ConfigureWbsCmd(
void
BluetoothDaemonHandsfreeModule::ErrorRsp(
const BluetoothDaemonPDUHeader& aHeader,
BluetoothDaemonPDU& aPDU, BluetoothHandsfreeResultHandler* aRes)
const DaemonSocketPDUHeader& aHeader,
DaemonSocketPDU& aPDU, BluetoothHandsfreeResultHandler* aRes)
{
ErrorRunnable::Dispatch(
aRes, &BluetoothHandsfreeResultHandler::OnError, UnpackPDUInitOp(aPDU));
@ -523,7 +523,7 @@ BluetoothDaemonHandsfreeModule::ErrorRsp(
void
BluetoothDaemonHandsfreeModule::ConnectRsp(
const BluetoothDaemonPDUHeader& aHeader, BluetoothDaemonPDU& aPDU,
const DaemonSocketPDUHeader& aHeader, DaemonSocketPDU& aPDU,
BluetoothHandsfreeResultHandler* aRes)
{
ResultRunnable::Dispatch(
@ -532,7 +532,7 @@ BluetoothDaemonHandsfreeModule::ConnectRsp(
void
BluetoothDaemonHandsfreeModule::DisconnectRsp(
const BluetoothDaemonPDUHeader& aHeader, BluetoothDaemonPDU& aPDU,
const DaemonSocketPDUHeader& aHeader, DaemonSocketPDU& aPDU,
BluetoothHandsfreeResultHandler* aRes)
{
ResultRunnable::Dispatch(
@ -541,7 +541,7 @@ BluetoothDaemonHandsfreeModule::DisconnectRsp(
void
BluetoothDaemonHandsfreeModule::ConnectAudioRsp(
const BluetoothDaemonPDUHeader& aHeader, BluetoothDaemonPDU& aPDU,
const DaemonSocketPDUHeader& aHeader, DaemonSocketPDU& aPDU,
BluetoothHandsfreeResultHandler* aRes)
{
ResultRunnable::Dispatch(
@ -551,7 +551,7 @@ BluetoothDaemonHandsfreeModule::ConnectAudioRsp(
void
BluetoothDaemonHandsfreeModule::DisconnectAudioRsp(
const BluetoothDaemonPDUHeader& aHeader, BluetoothDaemonPDU& aPDU,
const DaemonSocketPDUHeader& aHeader, DaemonSocketPDU& aPDU,
BluetoothHandsfreeResultHandler* aRes)
{
ResultRunnable::Dispatch(
@ -561,7 +561,7 @@ BluetoothDaemonHandsfreeModule::DisconnectAudioRsp(
void
BluetoothDaemonHandsfreeModule::StartVoiceRecognitionRsp(
const BluetoothDaemonPDUHeader& aHeader, BluetoothDaemonPDU& aPDU,
const DaemonSocketPDUHeader& aHeader, DaemonSocketPDU& aPDU,
BluetoothHandsfreeResultHandler* aRes)
{
ResultRunnable::Dispatch(
@ -571,7 +571,7 @@ BluetoothDaemonHandsfreeModule::StartVoiceRecognitionRsp(
void
BluetoothDaemonHandsfreeModule::StopVoiceRecognitionRsp(
const BluetoothDaemonPDUHeader& aHeader, BluetoothDaemonPDU& aPDU,
const DaemonSocketPDUHeader& aHeader, DaemonSocketPDU& aPDU,
BluetoothHandsfreeResultHandler* aRes)
{
ResultRunnable::Dispatch(
@ -581,7 +581,7 @@ BluetoothDaemonHandsfreeModule::StopVoiceRecognitionRsp(
void
BluetoothDaemonHandsfreeModule::VolumeControlRsp(
const BluetoothDaemonPDUHeader& aHeader, BluetoothDaemonPDU& aPDU,
const DaemonSocketPDUHeader& aHeader, DaemonSocketPDU& aPDU,
BluetoothHandsfreeResultHandler* aRes)
{
ResultRunnable::Dispatch(
@ -591,7 +591,7 @@ BluetoothDaemonHandsfreeModule::VolumeControlRsp(
void
BluetoothDaemonHandsfreeModule::DeviceStatusNotificationRsp(
const BluetoothDaemonPDUHeader& aHeader, BluetoothDaemonPDU& aPDU,
const DaemonSocketPDUHeader& aHeader, DaemonSocketPDU& aPDU,
BluetoothHandsfreeResultHandler* aRes)
{
ResultRunnable::Dispatch(
@ -601,7 +601,7 @@ BluetoothDaemonHandsfreeModule::DeviceStatusNotificationRsp(
void
BluetoothDaemonHandsfreeModule::CopsResponseRsp(
const BluetoothDaemonPDUHeader& aHeader, BluetoothDaemonPDU& aPDU,
const DaemonSocketPDUHeader& aHeader, DaemonSocketPDU& aPDU,
BluetoothHandsfreeResultHandler* aRes)
{
ResultRunnable::Dispatch(
@ -611,7 +611,7 @@ BluetoothDaemonHandsfreeModule::CopsResponseRsp(
void
BluetoothDaemonHandsfreeModule::CindResponseRsp(
const BluetoothDaemonPDUHeader& aHeader, BluetoothDaemonPDU& aPDU,
const DaemonSocketPDUHeader& aHeader, DaemonSocketPDU& aPDU,
BluetoothHandsfreeResultHandler* aRes)
{
ResultRunnable::Dispatch(
@ -621,7 +621,7 @@ BluetoothDaemonHandsfreeModule::CindResponseRsp(
void
BluetoothDaemonHandsfreeModule::FormattedAtResponseRsp(
const BluetoothDaemonPDUHeader& aHeader, BluetoothDaemonPDU& aPDU,
const DaemonSocketPDUHeader& aHeader, DaemonSocketPDU& aPDU,
BluetoothHandsfreeResultHandler* aRes)
{
ResultRunnable::Dispatch(
@ -631,7 +631,7 @@ BluetoothDaemonHandsfreeModule::FormattedAtResponseRsp(
void
BluetoothDaemonHandsfreeModule::AtResponseRsp(
const BluetoothDaemonPDUHeader& aHeader, BluetoothDaemonPDU& aPDU,
const DaemonSocketPDUHeader& aHeader, DaemonSocketPDU& aPDU,
BluetoothHandsfreeResultHandler* aRes)
{
ResultRunnable::Dispatch(
@ -641,7 +641,7 @@ BluetoothDaemonHandsfreeModule::AtResponseRsp(
void
BluetoothDaemonHandsfreeModule::ClccResponseRsp(
const BluetoothDaemonPDUHeader& aHeader, BluetoothDaemonPDU& aPDU,
const DaemonSocketPDUHeader& aHeader, DaemonSocketPDU& aPDU,
BluetoothHandsfreeResultHandler* aRes)
{
ResultRunnable::Dispatch(
@ -651,7 +651,7 @@ BluetoothDaemonHandsfreeModule::ClccResponseRsp(
void
BluetoothDaemonHandsfreeModule::PhoneStateChangeRsp(
const BluetoothDaemonPDUHeader& aHeader, BluetoothDaemonPDU& aPDU,
const DaemonSocketPDUHeader& aHeader, DaemonSocketPDU& aPDU,
BluetoothHandsfreeResultHandler* aRes)
{
ResultRunnable::Dispatch(
@ -661,7 +661,7 @@ BluetoothDaemonHandsfreeModule::PhoneStateChangeRsp(
void
BluetoothDaemonHandsfreeModule::ConfigureWbsRsp(
const BluetoothDaemonPDUHeader& aHeader, BluetoothDaemonPDU& aPDU,
const DaemonSocketPDUHeader& aHeader, DaemonSocketPDU& aPDU,
BluetoothHandsfreeResultHandler* aRes)
{
ResultRunnable::Dispatch(
@ -671,12 +671,12 @@ BluetoothDaemonHandsfreeModule::ConfigureWbsRsp(
void
BluetoothDaemonHandsfreeModule::HandleRsp(
const BluetoothDaemonPDUHeader& aHeader, BluetoothDaemonPDU& aPDU,
const DaemonSocketPDUHeader& aHeader, DaemonSocketPDU& aPDU,
void* aUserData)
{
static void (BluetoothDaemonHandsfreeModule::* const HandleRsp[])(
const BluetoothDaemonPDUHeader&,
BluetoothDaemonPDU&,
const DaemonSocketPDUHeader&,
DaemonSocketPDU&,
BluetoothHandsfreeResultHandler*) = {
INIT_ARRAY_AT(OPCODE_ERROR,
&BluetoothDaemonHandsfreeModule::ErrorRsp),
@ -752,7 +752,7 @@ class BluetoothDaemonHandsfreeModule::ConnectionStateInitOp final
: private PDUInitOp
{
public:
ConnectionStateInitOp(BluetoothDaemonPDU& aPDU)
ConnectionStateInitOp(DaemonSocketPDU& aPDU)
: PDUInitOp(aPDU)
{ }
@ -760,7 +760,7 @@ public:
operator () (BluetoothHandsfreeConnectionState& aArg1,
nsString& aArg2) const
{
BluetoothDaemonPDU& pdu = GetPDU();
DaemonSocketPDU& pdu = GetPDU();
/* Read state */
nsresult rv = UnpackPDU(pdu, aArg1);
@ -789,7 +789,7 @@ public:
void
BluetoothDaemonHandsfreeModule::ConnectionStateNtf(
const BluetoothDaemonPDUHeader& aHeader, BluetoothDaemonPDU& aPDU)
const DaemonSocketPDUHeader& aHeader, DaemonSocketPDU& aPDU)
{
ConnectionStateNotification::Dispatch(
&BluetoothHandsfreeNotificationHandler::ConnectionStateNotification,
@ -801,14 +801,14 @@ class BluetoothDaemonHandsfreeModule::AudioStateInitOp final
: private PDUInitOp
{
public:
AudioStateInitOp(BluetoothDaemonPDU& aPDU)
AudioStateInitOp(DaemonSocketPDU& aPDU)
: PDUInitOp(aPDU)
{ }
nsresult
operator () (BluetoothHandsfreeAudioState& aArg1, nsString& aArg2) const
{
BluetoothDaemonPDU& pdu = GetPDU();
DaemonSocketPDU& pdu = GetPDU();
/* Read state */
nsresult rv = UnpackPDU(pdu, aArg1);
@ -829,7 +829,7 @@ public:
void
BluetoothDaemonHandsfreeModule::AudioStateNtf(
const BluetoothDaemonPDUHeader& aHeader, BluetoothDaemonPDU& aPDU)
const DaemonSocketPDUHeader& aHeader, DaemonSocketPDU& aPDU)
{
AudioStateNotification::Dispatch(
&BluetoothHandsfreeNotificationHandler::AudioStateNotification,
@ -841,7 +841,7 @@ class BluetoothDaemonHandsfreeModule::VoiceRecognitionInitOp final
: private PDUInitOp
{
public:
VoiceRecognitionInitOp(BluetoothDaemonPDU& aPDU)
VoiceRecognitionInitOp(DaemonSocketPDU& aPDU)
: PDUInitOp(aPDU)
{ }
@ -849,7 +849,7 @@ public:
operator () (BluetoothHandsfreeVoiceRecognitionState& aArg1,
nsString& aArg2) const
{
BluetoothDaemonPDU& pdu = GetPDU();
DaemonSocketPDU& pdu = GetPDU();
/* Read state */
nsresult rv = UnpackPDU(pdu, aArg1);
@ -874,7 +874,7 @@ public:
void
BluetoothDaemonHandsfreeModule::VoiceRecognitionNtf(
const BluetoothDaemonPDUHeader& aHeader, BluetoothDaemonPDU& aPDU)
const DaemonSocketPDUHeader& aHeader, DaemonSocketPDU& aPDU)
{
VoiceRecognitionNotification::Dispatch(
&BluetoothHandsfreeNotificationHandler::VoiceRecognitionNotification,
@ -886,7 +886,7 @@ class BluetoothDaemonHandsfreeModule::AnswerCallInitOp final
: private PDUInitOp
{
public:
AnswerCallInitOp(BluetoothDaemonPDU& aPDU)
AnswerCallInitOp(DaemonSocketPDU& aPDU)
: PDUInitOp(aPDU)
{ }
@ -910,7 +910,7 @@ public:
void
BluetoothDaemonHandsfreeModule::AnswerCallNtf(
const BluetoothDaemonPDUHeader& aHeader, BluetoothDaemonPDU& aPDU)
const DaemonSocketPDUHeader& aHeader, DaemonSocketPDU& aPDU)
{
AnswerCallNotification::Dispatch(
&BluetoothHandsfreeNotificationHandler::AnswerCallNotification,
@ -922,7 +922,7 @@ class BluetoothDaemonHandsfreeModule::HangupCallInitOp final
: private PDUInitOp
{
public:
HangupCallInitOp(BluetoothDaemonPDU& aPDU)
HangupCallInitOp(DaemonSocketPDU& aPDU)
: PDUInitOp(aPDU)
{ }
@ -946,7 +946,7 @@ public:
void
BluetoothDaemonHandsfreeModule::HangupCallNtf(
const BluetoothDaemonPDUHeader& aHeader, BluetoothDaemonPDU& aPDU)
const DaemonSocketPDUHeader& aHeader, DaemonSocketPDU& aPDU)
{
HangupCallNotification::Dispatch(
&BluetoothHandsfreeNotificationHandler::HangupCallNotification,
@ -958,7 +958,7 @@ class BluetoothDaemonHandsfreeModule::VolumeInitOp final
: private PDUInitOp
{
public:
VolumeInitOp(BluetoothDaemonPDU& aPDU)
VolumeInitOp(DaemonSocketPDU& aPDU)
: PDUInitOp(aPDU)
{ }
@ -966,7 +966,7 @@ public:
operator () (BluetoothHandsfreeVolumeType& aArg1, int& aArg2,
nsString& aArg3) const
{
BluetoothDaemonPDU& pdu = GetPDU();
DaemonSocketPDU& pdu = GetPDU();
/* Read volume type */
nsresult rv = UnpackPDU(pdu, aArg1);
@ -997,7 +997,7 @@ public:
void
BluetoothDaemonHandsfreeModule::VolumeNtf(
const BluetoothDaemonPDUHeader& aHeader, BluetoothDaemonPDU& aPDU)
const DaemonSocketPDUHeader& aHeader, DaemonSocketPDU& aPDU)
{
VolumeNotification::Dispatch(
&BluetoothHandsfreeNotificationHandler::VolumeNotification,
@ -1009,14 +1009,14 @@ class BluetoothDaemonHandsfreeModule::DialCallInitOp final
: private PDUInitOp
{
public:
DialCallInitOp(BluetoothDaemonPDU& aPDU)
DialCallInitOp(DaemonSocketPDU& aPDU)
: PDUInitOp(aPDU)
{ }
nsresult
operator () (nsString& aArg1, nsString& aArg2) const
{
BluetoothDaemonPDU& pdu = GetPDU();
DaemonSocketPDU& pdu = GetPDU();
nsresult rv;
/* Read address
@ -1045,7 +1045,7 @@ public:
void
BluetoothDaemonHandsfreeModule::DialCallNtf(
const BluetoothDaemonPDUHeader& aHeader, BluetoothDaemonPDU& aPDU)
const DaemonSocketPDUHeader& aHeader, DaemonSocketPDU& aPDU)
{
DialCallNotification::Dispatch(
&BluetoothHandsfreeNotificationHandler::DialCallNotification,
@ -1057,14 +1057,14 @@ class BluetoothDaemonHandsfreeModule::DtmfInitOp final
: private PDUInitOp
{
public:
DtmfInitOp(BluetoothDaemonPDU& aPDU)
DtmfInitOp(DaemonSocketPDU& aPDU)
: PDUInitOp(aPDU)
{ }
nsresult
operator () (char& aArg1, nsString& aArg2) const
{
BluetoothDaemonPDU& pdu = GetPDU();
DaemonSocketPDU& pdu = GetPDU();
/* Read tone */
nsresult rv = UnpackPDU(pdu, aArg1);
@ -1089,7 +1089,7 @@ public:
void
BluetoothDaemonHandsfreeModule::DtmfNtf(
const BluetoothDaemonPDUHeader& aHeader, BluetoothDaemonPDU& aPDU)
const DaemonSocketPDUHeader& aHeader, DaemonSocketPDU& aPDU)
{
DtmfNotification::Dispatch(
&BluetoothHandsfreeNotificationHandler::DtmfNotification,
@ -1101,14 +1101,14 @@ class BluetoothDaemonHandsfreeModule::NRECInitOp final
: private PDUInitOp
{
public:
NRECInitOp(BluetoothDaemonPDU& aPDU)
NRECInitOp(DaemonSocketPDU& aPDU)
: PDUInitOp(aPDU)
{ }
nsresult
operator () (BluetoothHandsfreeNRECState& aArg1, nsString& aArg2) const
{
BluetoothDaemonPDU& pdu = GetPDU();
DaemonSocketPDU& pdu = GetPDU();
/* Read state */
nsresult rv = UnpackPDU(pdu, aArg1);
@ -1133,7 +1133,7 @@ public:
void
BluetoothDaemonHandsfreeModule::NRECNtf(
const BluetoothDaemonPDUHeader& aHeader, BluetoothDaemonPDU& aPDU)
const DaemonSocketPDUHeader& aHeader, DaemonSocketPDU& aPDU)
{
NRECNotification::Dispatch(
&BluetoothHandsfreeNotificationHandler::NRECNotification,
@ -1145,14 +1145,14 @@ class BluetoothDaemonHandsfreeModule::CallHoldInitOp final
: private PDUInitOp
{
public:
CallHoldInitOp(BluetoothDaemonPDU& aPDU)
CallHoldInitOp(DaemonSocketPDU& aPDU)
: PDUInitOp(aPDU)
{ }
nsresult
operator () (BluetoothHandsfreeCallHoldType& aArg1, nsString& aArg2) const
{
BluetoothDaemonPDU& pdu = GetPDU();
DaemonSocketPDU& pdu = GetPDU();
/* Read type */
nsresult rv = UnpackPDU(pdu, aArg1);
@ -1177,7 +1177,7 @@ public:
void
BluetoothDaemonHandsfreeModule::CallHoldNtf(
const BluetoothDaemonPDUHeader& aHeader, BluetoothDaemonPDU& aPDU)
const DaemonSocketPDUHeader& aHeader, DaemonSocketPDU& aPDU)
{
CallHoldNotification::Dispatch(
&BluetoothHandsfreeNotificationHandler::CallHoldNotification,
@ -1189,7 +1189,7 @@ class BluetoothDaemonHandsfreeModule::CnumInitOp final
: private PDUInitOp
{
public:
CnumInitOp(BluetoothDaemonPDU& aPDU)
CnumInitOp(DaemonSocketPDU& aPDU)
: PDUInitOp(aPDU)
{ }
@ -1213,7 +1213,7 @@ public:
void
BluetoothDaemonHandsfreeModule::CnumNtf(
const BluetoothDaemonPDUHeader& aHeader, BluetoothDaemonPDU& aPDU)
const DaemonSocketPDUHeader& aHeader, DaemonSocketPDU& aPDU)
{
CnumNotification::Dispatch(
&BluetoothHandsfreeNotificationHandler::CnumNotification,
@ -1225,7 +1225,7 @@ class BluetoothDaemonHandsfreeModule::CindInitOp final
: private PDUInitOp
{
public:
CindInitOp(BluetoothDaemonPDU& aPDU)
CindInitOp(DaemonSocketPDU& aPDU)
: PDUInitOp(aPDU)
{ }
@ -1249,7 +1249,7 @@ public:
void
BluetoothDaemonHandsfreeModule::CindNtf(
const BluetoothDaemonPDUHeader& aHeader, BluetoothDaemonPDU& aPDU)
const DaemonSocketPDUHeader& aHeader, DaemonSocketPDU& aPDU)
{
CindNotification::Dispatch(
&BluetoothHandsfreeNotificationHandler::CindNotification,
@ -1261,7 +1261,7 @@ class BluetoothDaemonHandsfreeModule::CopsInitOp final
: private PDUInitOp
{
public:
CopsInitOp(BluetoothDaemonPDU& aPDU)
CopsInitOp(DaemonSocketPDU& aPDU)
: PDUInitOp(aPDU)
{ }
@ -1285,7 +1285,7 @@ public:
void
BluetoothDaemonHandsfreeModule::CopsNtf(
const BluetoothDaemonPDUHeader& aHeader, BluetoothDaemonPDU& aPDU)
const DaemonSocketPDUHeader& aHeader, DaemonSocketPDU& aPDU)
{
CopsNotification::Dispatch(
&BluetoothHandsfreeNotificationHandler::CopsNotification,
@ -1297,7 +1297,7 @@ class BluetoothDaemonHandsfreeModule::ClccInitOp final
: private PDUInitOp
{
public:
ClccInitOp(BluetoothDaemonPDU& aPDU)
ClccInitOp(DaemonSocketPDU& aPDU)
: PDUInitOp(aPDU)
{ }
@ -1321,7 +1321,7 @@ public:
void
BluetoothDaemonHandsfreeModule::ClccNtf(
const BluetoothDaemonPDUHeader& aHeader, BluetoothDaemonPDU& aPDU)
const DaemonSocketPDUHeader& aHeader, DaemonSocketPDU& aPDU)
{
ClccNotification::Dispatch(
&BluetoothHandsfreeNotificationHandler::ClccNotification,
@ -1333,14 +1333,14 @@ class BluetoothDaemonHandsfreeModule::UnknownAtInitOp final
: private PDUInitOp
{
public:
UnknownAtInitOp(BluetoothDaemonPDU& aPDU)
UnknownAtInitOp(DaemonSocketPDU& aPDU)
: PDUInitOp(aPDU)
{ }
nsresult
operator () (nsCString& aArg1, nsString& aArg2) const
{
BluetoothDaemonPDU& pdu = GetPDU();
DaemonSocketPDU& pdu = GetPDU();
nsresult rv;
/* Read address
@ -1369,7 +1369,7 @@ public:
void
BluetoothDaemonHandsfreeModule::UnknownAtNtf(
const BluetoothDaemonPDUHeader& aHeader, BluetoothDaemonPDU& aPDU)
const DaemonSocketPDUHeader& aHeader, DaemonSocketPDU& aPDU)
{
UnknownAtNotification::Dispatch(
&BluetoothHandsfreeNotificationHandler::UnknownAtNotification,
@ -1381,7 +1381,7 @@ class BluetoothDaemonHandsfreeModule::KeyPressedInitOp final
: private PDUInitOp
{
public:
KeyPressedInitOp(BluetoothDaemonPDU& aPDU)
KeyPressedInitOp(DaemonSocketPDU& aPDU)
: PDUInitOp(aPDU)
{ }
@ -1405,7 +1405,7 @@ public:
void
BluetoothDaemonHandsfreeModule::KeyPressedNtf(
const BluetoothDaemonPDUHeader& aHeader, BluetoothDaemonPDU& aPDU)
const DaemonSocketPDUHeader& aHeader, DaemonSocketPDU& aPDU)
{
KeyPressedNotification::Dispatch(
&BluetoothHandsfreeNotificationHandler::KeyPressedNotification,
@ -1414,11 +1414,11 @@ BluetoothDaemonHandsfreeModule::KeyPressedNtf(
void
BluetoothDaemonHandsfreeModule::HandleNtf(
const BluetoothDaemonPDUHeader& aHeader, BluetoothDaemonPDU& aPDU,
const DaemonSocketPDUHeader& aHeader, DaemonSocketPDU& aPDU,
void* aUserData)
{
static void (BluetoothDaemonHandsfreeModule::* const HandleNtf[])(
const BluetoothDaemonPDUHeader&, BluetoothDaemonPDU&) = {
const DaemonSocketPDUHeader&, DaemonSocketPDU&) = {
INIT_ARRAY_AT(0, &BluetoothDaemonHandsfreeModule::ConnectionStateNtf),
INIT_ARRAY_AT(1, &BluetoothDaemonHandsfreeModule::AudioStateNtf),
INIT_ARRAY_AT(2, &BluetoothDaemonHandsfreeModule::VoiceRecognitionNtf),

View File

@ -41,7 +41,7 @@ public:
OPCODE_CONFIGURE_WBS = 0x0f
};
virtual nsresult Send(BluetoothDaemonPDU* aPDU, void* aUserData) = 0;
virtual nsresult Send(DaemonSocketPDU* aPDU, void* aUserData) = 0;
virtual nsresult RegisterModule(uint8_t aId, uint8_t aMode,
uint32_t aMaxNumClients,
@ -125,11 +125,11 @@ public:
BluetoothHandsfreeResultHandler* aRes);
protected:
nsresult Send(BluetoothDaemonPDU* aPDU,
nsresult Send(DaemonSocketPDU* aPDU,
BluetoothHandsfreeResultHandler* aRes);
void HandleSvc(const BluetoothDaemonPDUHeader& aHeader,
BluetoothDaemonPDU& aPDU, void* aUserData);
void HandleSvc(const DaemonSocketPDUHeader& aHeader,
DaemonSocketPDU& aPDU, void* aUserData);
//
// Responses
@ -142,72 +142,72 @@ protected:
BluetoothStatus, BluetoothStatus>
ErrorRunnable;
void ErrorRsp(const BluetoothDaemonPDUHeader& aHeader,
BluetoothDaemonPDU& aPDU,
void ErrorRsp(const DaemonSocketPDUHeader& aHeader,
DaemonSocketPDU& aPDU,
BluetoothHandsfreeResultHandler* aRes);
void ConnectRsp(const BluetoothDaemonPDUHeader& aHeader,
BluetoothDaemonPDU& aPDU,
void ConnectRsp(const DaemonSocketPDUHeader& aHeader,
DaemonSocketPDU& aPDU,
BluetoothHandsfreeResultHandler* aRes);
void DisconnectRsp(const BluetoothDaemonPDUHeader& aHeader,
BluetoothDaemonPDU& aPDU,
void DisconnectRsp(const DaemonSocketPDUHeader& aHeader,
DaemonSocketPDU& aPDU,
BluetoothHandsfreeResultHandler* aRes);
void ConnectAudioRsp(const BluetoothDaemonPDUHeader& aHeader,
BluetoothDaemonPDU& aPDU,
void ConnectAudioRsp(const DaemonSocketPDUHeader& aHeader,
DaemonSocketPDU& aPDU,
BluetoothHandsfreeResultHandler* aRes);
void DisconnectAudioRsp(const BluetoothDaemonPDUHeader& aHeader,
BluetoothDaemonPDU& aPDU,
void DisconnectAudioRsp(const DaemonSocketPDUHeader& aHeader,
DaemonSocketPDU& aPDU,
BluetoothHandsfreeResultHandler* aRes);
void StartVoiceRecognitionRsp(const BluetoothDaemonPDUHeader& aHeader,
BluetoothDaemonPDU& aPDU,
void StartVoiceRecognitionRsp(const DaemonSocketPDUHeader& aHeader,
DaemonSocketPDU& aPDU,
BluetoothHandsfreeResultHandler* aRes);
void StopVoiceRecognitionRsp(const BluetoothDaemonPDUHeader& aHeader,
BluetoothDaemonPDU& aPDU,
void StopVoiceRecognitionRsp(const DaemonSocketPDUHeader& aHeader,
DaemonSocketPDU& aPDU,
BluetoothHandsfreeResultHandler* aRes);
void VolumeControlRsp(const BluetoothDaemonPDUHeader& aHeader,
BluetoothDaemonPDU& aPDU,
void VolumeControlRsp(const DaemonSocketPDUHeader& aHeader,
DaemonSocketPDU& aPDU,
BluetoothHandsfreeResultHandler* aRes);
void DeviceStatusNotificationRsp(const BluetoothDaemonPDUHeader& aHeader,
BluetoothDaemonPDU& aPDU,
void DeviceStatusNotificationRsp(const DaemonSocketPDUHeader& aHeader,
DaemonSocketPDU& aPDU,
BluetoothHandsfreeResultHandler* aRes);
void CopsResponseRsp(const BluetoothDaemonPDUHeader& aHeader,
BluetoothDaemonPDU& aPDU,
void CopsResponseRsp(const DaemonSocketPDUHeader& aHeader,
DaemonSocketPDU& aPDU,
BluetoothHandsfreeResultHandler* aRes);
void CindResponseRsp(const BluetoothDaemonPDUHeader& aHeader,
BluetoothDaemonPDU& aPDU,
void CindResponseRsp(const DaemonSocketPDUHeader& aHeader,
DaemonSocketPDU& aPDU,
BluetoothHandsfreeResultHandler* aRes);
void FormattedAtResponseRsp(const BluetoothDaemonPDUHeader& aHeader,
BluetoothDaemonPDU& aPDU,
void FormattedAtResponseRsp(const DaemonSocketPDUHeader& aHeader,
DaemonSocketPDU& aPDU,
BluetoothHandsfreeResultHandler* aRes);
void AtResponseRsp(const BluetoothDaemonPDUHeader& aHeader,
BluetoothDaemonPDU& aPDU,
void AtResponseRsp(const DaemonSocketPDUHeader& aHeader,
DaemonSocketPDU& aPDU,
BluetoothHandsfreeResultHandler* aRes);
void ClccResponseRsp(const BluetoothDaemonPDUHeader& aHeader,
BluetoothDaemonPDU& aPDU,
void ClccResponseRsp(const DaemonSocketPDUHeader& aHeader,
DaemonSocketPDU& aPDU,
BluetoothHandsfreeResultHandler* aRes);
void PhoneStateChangeRsp(const BluetoothDaemonPDUHeader& aHeader,
BluetoothDaemonPDU& aPDU,
void PhoneStateChangeRsp(const DaemonSocketPDUHeader& aHeader,
DaemonSocketPDU& aPDU,
BluetoothHandsfreeResultHandler* aRes);
void ConfigureWbsRsp(const BluetoothDaemonPDUHeader& aHeader,
BluetoothDaemonPDU& aPDU,
void ConfigureWbsRsp(const DaemonSocketPDUHeader& aHeader,
DaemonSocketPDU& aPDU,
BluetoothHandsfreeResultHandler* aRes);
void HandleRsp(const BluetoothDaemonPDUHeader& aHeader,
BluetoothDaemonPDU& aPDU,
void HandleRsp(const DaemonSocketPDUHeader& aHeader,
DaemonSocketPDU& aPDU,
void* aUserData);
//
@ -318,56 +318,56 @@ protected:
class UnknownAtInitOp;
class KeyPressedInitOp;
void ConnectionStateNtf(const BluetoothDaemonPDUHeader& aHeader,
BluetoothDaemonPDU& aPDU);
void ConnectionStateNtf(const DaemonSocketPDUHeader& aHeader,
DaemonSocketPDU& aPDU);
void AudioStateNtf(const BluetoothDaemonPDUHeader& aHeader,
BluetoothDaemonPDU& aPDU);
void AudioStateNtf(const DaemonSocketPDUHeader& aHeader,
DaemonSocketPDU& aPDU);
void VoiceRecognitionNtf(const BluetoothDaemonPDUHeader& aHeader,
BluetoothDaemonPDU& aPDU);
void VoiceRecognitionNtf(const DaemonSocketPDUHeader& aHeader,
DaemonSocketPDU& aPDU);
void AnswerCallNtf(const BluetoothDaemonPDUHeader& aHeader,
BluetoothDaemonPDU& aPDU);
void AnswerCallNtf(const DaemonSocketPDUHeader& aHeader,
DaemonSocketPDU& aPDU);
void HangupCallNtf(const BluetoothDaemonPDUHeader& aHeader,
BluetoothDaemonPDU& aPDU);
void HangupCallNtf(const DaemonSocketPDUHeader& aHeader,
DaemonSocketPDU& aPDU);
void VolumeNtf(const BluetoothDaemonPDUHeader& aHeader,
BluetoothDaemonPDU& aPDU);
void VolumeNtf(const DaemonSocketPDUHeader& aHeader,
DaemonSocketPDU& aPDU);
void DialCallNtf(const BluetoothDaemonPDUHeader& aHeader,
BluetoothDaemonPDU& aPDU);
void DialCallNtf(const DaemonSocketPDUHeader& aHeader,
DaemonSocketPDU& aPDU);
void DtmfNtf(const BluetoothDaemonPDUHeader& aHeader,
BluetoothDaemonPDU& aPDU);
void DtmfNtf(const DaemonSocketPDUHeader& aHeader,
DaemonSocketPDU& aPDU);
void NRECNtf(const BluetoothDaemonPDUHeader& aHeader,
BluetoothDaemonPDU& aPDU);
void NRECNtf(const DaemonSocketPDUHeader& aHeader,
DaemonSocketPDU& aPDU);
void CallHoldNtf(const BluetoothDaemonPDUHeader& aHeader,
BluetoothDaemonPDU& aPDU);
void CallHoldNtf(const DaemonSocketPDUHeader& aHeader,
DaemonSocketPDU& aPDU);
void CnumNtf(const BluetoothDaemonPDUHeader& aHeader,
BluetoothDaemonPDU& aPDU);
void CnumNtf(const DaemonSocketPDUHeader& aHeader,
DaemonSocketPDU& aPDU);
void CindNtf(const BluetoothDaemonPDUHeader& aHeader,
BluetoothDaemonPDU& aPDU);
void CindNtf(const DaemonSocketPDUHeader& aHeader,
DaemonSocketPDU& aPDU);
void CopsNtf(const BluetoothDaemonPDUHeader& aHeader,
BluetoothDaemonPDU& aPDU);
void CopsNtf(const DaemonSocketPDUHeader& aHeader,
DaemonSocketPDU& aPDU);
void ClccNtf(const BluetoothDaemonPDUHeader& aHeader,
BluetoothDaemonPDU& aPDU);
void ClccNtf(const DaemonSocketPDUHeader& aHeader,
DaemonSocketPDU& aPDU);
void UnknownAtNtf(const BluetoothDaemonPDUHeader& aHeader,
BluetoothDaemonPDU& aPDU);
void UnknownAtNtf(const DaemonSocketPDUHeader& aHeader,
DaemonSocketPDU& aPDU);
void KeyPressedNtf(const BluetoothDaemonPDUHeader& aHeader,
BluetoothDaemonPDU& aPDU);
void KeyPressedNtf(const DaemonSocketPDUHeader& aHeader,
DaemonSocketPDU& aPDU);
void HandleNtf(const BluetoothDaemonPDUHeader& aHeader,
BluetoothDaemonPDU& aPDU,
void HandleNtf(const DaemonSocketPDUHeader& aHeader,
DaemonSocketPDU& aPDU,
void* aUserData);
static BluetoothHandsfreeNotificationHandler* sNotificationHandler;

View File

@ -1070,20 +1070,20 @@ Convert(const ConvertArray<Tin>& aIn, Tout& aOut)
//
nsresult
PackPDU(bool aIn, BluetoothDaemonPDU& aPDU)
PackPDU(bool aIn, DaemonSocketPDU& aPDU)
{
return PackPDU(PackConversion<bool, uint8_t>(aIn), aPDU);
}
nsresult
PackPDU(const BluetoothAddress& aIn, BluetoothDaemonPDU& aPDU)
PackPDU(const BluetoothAddress& aIn, DaemonSocketPDU& aPDU)
{
return PackPDU(PackArray<uint8_t>(aIn.mAddr, sizeof(aIn.mAddr)), aPDU);
}
nsresult
PackPDU(const BluetoothAvrcpAttributeTextPairs& aIn,
BluetoothDaemonPDU& aPDU)
DaemonSocketPDU& aPDU)
{
size_t i;
@ -1119,7 +1119,7 @@ PackPDU(const BluetoothAvrcpAttributeTextPairs& aIn,
nsresult
PackPDU(const BluetoothAvrcpAttributeValuePairs& aIn,
BluetoothDaemonPDU& aPDU)
DaemonSocketPDU& aPDU)
{
size_t i;
@ -1137,7 +1137,7 @@ PackPDU(const BluetoothAvrcpAttributeValuePairs& aIn,
}
nsresult
PackPDU(const BluetoothAvrcpElementAttribute& aIn, BluetoothDaemonPDU& aPDU)
PackPDU(const BluetoothAvrcpElementAttribute& aIn, DaemonSocketPDU& aPDU)
{
nsresult rv = PackPDU(PackConversion<uint32_t, uint8_t>(aIn.mId), aPDU);
if (NS_FAILED(rv)) {
@ -1163,13 +1163,13 @@ PackPDU(const BluetoothAvrcpElementAttribute& aIn, BluetoothDaemonPDU& aPDU)
}
nsresult
PackPDU(BluetoothAvrcpEvent aIn, BluetoothDaemonPDU& aPDU)
PackPDU(BluetoothAvrcpEvent aIn, DaemonSocketPDU& aPDU)
{
return PackPDU(PackConversion<BluetoothAvrcpEvent, uint8_t>(aIn), aPDU);
}
nsresult
PackPDU(const BluetoothAvrcpEventParamPair& aIn, BluetoothDaemonPDU& aPDU)
PackPDU(const BluetoothAvrcpEventParamPair& aIn, DaemonSocketPDU& aPDU)
{
nsresult rv;
@ -1211,110 +1211,110 @@ PackPDU(const BluetoothAvrcpEventParamPair& aIn, BluetoothDaemonPDU& aPDU)
}
nsresult
PackPDU(BluetoothAvrcpNotification aIn, BluetoothDaemonPDU& aPDU)
PackPDU(BluetoothAvrcpNotification aIn, DaemonSocketPDU& aPDU)
{
return PackPDU(
PackConversion<BluetoothAvrcpNotification, uint8_t>(aIn), aPDU);
}
nsresult
PackPDU(BluetoothAvrcpPlayerAttribute aIn, BluetoothDaemonPDU& aPDU)
PackPDU(BluetoothAvrcpPlayerAttribute aIn, DaemonSocketPDU& aPDU)
{
return PackPDU(
PackConversion<BluetoothAvrcpPlayerAttribute, uint8_t>(aIn), aPDU);
}
nsresult
PackPDU(BluetoothAvrcpStatus aIn, BluetoothDaemonPDU& aPDU)
PackPDU(BluetoothAvrcpStatus aIn, DaemonSocketPDU& aPDU)
{
return PackPDU(PackConversion<BluetoothAvrcpStatus, uint8_t>(aIn), aPDU);
}
nsresult
PackPDU(const BluetoothConfigurationParameter& aIn, BluetoothDaemonPDU& aPDU)
PackPDU(const BluetoothConfigurationParameter& aIn, DaemonSocketPDU& aPDU)
{
return PackPDU(aIn.mType, aIn.mLength,
PackArray<uint8_t>(aIn.mValue.get(), aIn.mLength), aPDU);
}
nsresult
PackPDU(const BluetoothDaemonPDUHeader& aIn, BluetoothDaemonPDU& aPDU)
PackPDU(const DaemonSocketPDUHeader& aIn, DaemonSocketPDU& aPDU)
{
return PackPDU(aIn.mService, aIn.mOpcode, aIn.mLength, aPDU);
}
nsresult
PackPDU(const BluetoothHandsfreeAtResponse& aIn, BluetoothDaemonPDU& aPDU)
PackPDU(const BluetoothHandsfreeAtResponse& aIn, DaemonSocketPDU& aPDU)
{
return PackPDU(
PackConversion<BluetoothHandsfreeAtResponse, uint8_t>(aIn), aPDU);
}
nsresult
PackPDU(const BluetoothHandsfreeCallAddressType& aIn, BluetoothDaemonPDU& aPDU)
PackPDU(const BluetoothHandsfreeCallAddressType& aIn, DaemonSocketPDU& aPDU)
{
return PackPDU(
PackConversion<BluetoothHandsfreeCallAddressType, uint8_t>(aIn), aPDU);
}
nsresult
PackPDU(const BluetoothHandsfreeCallDirection& aIn, BluetoothDaemonPDU& aPDU)
PackPDU(const BluetoothHandsfreeCallDirection& aIn, DaemonSocketPDU& aPDU)
{
return PackPDU(
PackConversion<BluetoothHandsfreeCallDirection, uint8_t>(aIn), aPDU);
}
nsresult
PackPDU(const BluetoothHandsfreeCallMode& aIn, BluetoothDaemonPDU& aPDU)
PackPDU(const BluetoothHandsfreeCallMode& aIn, DaemonSocketPDU& aPDU)
{
return PackPDU(
PackConversion<BluetoothHandsfreeCallMode, uint8_t>(aIn), aPDU);
}
nsresult
PackPDU(const BluetoothHandsfreeCallMptyType& aIn, BluetoothDaemonPDU& aPDU)
PackPDU(const BluetoothHandsfreeCallMptyType& aIn, DaemonSocketPDU& aPDU)
{
return PackPDU(
PackConversion<BluetoothHandsfreeCallMptyType, uint8_t>(aIn), aPDU);
}
nsresult
PackPDU(const BluetoothHandsfreeCallState& aIn, BluetoothDaemonPDU& aPDU)
PackPDU(const BluetoothHandsfreeCallState& aIn, DaemonSocketPDU& aPDU)
{
return PackPDU(
PackConversion<BluetoothHandsfreeCallState, uint8_t>(aIn), aPDU);
}
nsresult
PackPDU(const BluetoothHandsfreeNetworkState& aIn, BluetoothDaemonPDU& aPDU)
PackPDU(const BluetoothHandsfreeNetworkState& aIn, DaemonSocketPDU& aPDU)
{
return PackPDU(
PackConversion<BluetoothHandsfreeNetworkState, uint8_t>(aIn), aPDU);
}
nsresult
PackPDU(const BluetoothHandsfreeServiceType& aIn, BluetoothDaemonPDU& aPDU)
PackPDU(const BluetoothHandsfreeServiceType& aIn, DaemonSocketPDU& aPDU)
{
return PackPDU(
PackConversion<BluetoothHandsfreeServiceType, uint8_t>(aIn), aPDU);
}
nsresult
PackPDU(const BluetoothHandsfreeVolumeType& aIn, BluetoothDaemonPDU& aPDU)
PackPDU(const BluetoothHandsfreeVolumeType& aIn, DaemonSocketPDU& aPDU)
{
return PackPDU(
PackConversion<BluetoothHandsfreeVolumeType, uint8_t>(aIn), aPDU);
}
nsresult
PackPDU(const BluetoothHandsfreeWbsConfig& aIn, BluetoothDaemonPDU& aPDU)
PackPDU(const BluetoothHandsfreeWbsConfig& aIn, DaemonSocketPDU& aPDU)
{
return PackPDU(
PackConversion<BluetoothHandsfreeWbsConfig, uint8_t>(aIn), aPDU);
}
nsresult
PackPDU(const BluetoothNamedValue& aIn, BluetoothDaemonPDU& aPDU)
PackPDU(const BluetoothNamedValue& aIn, DaemonSocketPDU& aPDU)
{
nsresult rv = PackPDU(
PackConversion<nsString, BluetoothPropertyType>(aIn.name()), aPDU);
@ -1350,7 +1350,7 @@ PackPDU(const BluetoothNamedValue& aIn, BluetoothDaemonPDU& aPDU)
}
nsresult
PackPDU(const BluetoothPinCode& aIn, BluetoothDaemonPDU& aPDU)
PackPDU(const BluetoothPinCode& aIn, DaemonSocketPDU& aPDU)
{
return PackPDU(aIn.mLength,
PackArray<uint8_t>(aIn.mPinCode, sizeof(aIn.mPinCode)),
@ -1358,56 +1358,56 @@ PackPDU(const BluetoothPinCode& aIn, BluetoothDaemonPDU& aPDU)
}
nsresult
PackPDU(BluetoothPropertyType aIn, BluetoothDaemonPDU& aPDU)
PackPDU(BluetoothPropertyType aIn, DaemonSocketPDU& aPDU)
{
return PackPDU(PackConversion<BluetoothPropertyType, uint8_t>(aIn), aPDU);
}
nsresult
PackPDU(BluetoothSspVariant aIn, BluetoothDaemonPDU& aPDU)
PackPDU(BluetoothSspVariant aIn, DaemonSocketPDU& aPDU)
{
return PackPDU(PackConversion<BluetoothSspVariant, uint8_t>(aIn), aPDU);
}
nsresult
PackPDU(BluetoothScanMode aIn, BluetoothDaemonPDU& aPDU)
PackPDU(BluetoothScanMode aIn, DaemonSocketPDU& aPDU)
{
return PackPDU(PackConversion<BluetoothScanMode, int32_t>(aIn), aPDU);
}
nsresult
PackPDU(const BluetoothServiceName& aIn, BluetoothDaemonPDU& aPDU)
PackPDU(const BluetoothServiceName& aIn, DaemonSocketPDU& aPDU)
{
return PackPDU(PackArray<uint8_t>(aIn.mName, sizeof(aIn.mName)), aPDU);
}
nsresult
PackPDU(BluetoothSocketType aIn, BluetoothDaemonPDU& aPDU)
PackPDU(BluetoothSocketType aIn, DaemonSocketPDU& aPDU)
{
return PackPDU(PackConversion<BluetoothSocketType, uint8_t>(aIn), aPDU);
}
nsresult
PackPDU(ControlPlayStatus aIn, BluetoothDaemonPDU& aPDU)
PackPDU(ControlPlayStatus aIn, DaemonSocketPDU& aPDU)
{
return PackPDU(PackConversion<ControlPlayStatus, uint8_t>(aIn), aPDU);
}
nsresult
PackPDU(BluetoothTransport aIn, BluetoothDaemonPDU& aPDU)
PackPDU(BluetoothTransport aIn, DaemonSocketPDU& aPDU)
{
return PackPDU(PackConversion<BluetoothTransport, uint8_t>(aIn), aPDU);
}
nsresult
PackPDU(const BluetoothUuid& aIn, BluetoothDaemonPDU& aPDU)
PackPDU(const BluetoothUuid& aIn, DaemonSocketPDU& aPDU)
{
return PackPDU(
PackArray<uint8_t>(aIn.mUuid, sizeof(aIn.mUuid)), aPDU);
}
nsresult
PackPDU(const BluetoothGattId& aIn, BluetoothDaemonPDU& aPDU)
PackPDU(const BluetoothGattId& aIn, DaemonSocketPDU& aPDU)
{
nsresult rv = PackPDU(PackReversed<BluetoothUuid>(aIn.mUuid), aPDU);
if (NS_FAILED(rv)) {
@ -1417,7 +1417,7 @@ PackPDU(const BluetoothGattId& aIn, BluetoothDaemonPDU& aPDU)
}
nsresult
PackPDU(const BluetoothGattServiceId& aIn, BluetoothDaemonPDU& aPDU)
PackPDU(const BluetoothGattServiceId& aIn, DaemonSocketPDU& aPDU)
{
nsresult rv = PackPDU(aIn.mId, aPDU);
if (NS_FAILED(rv)) {
@ -1427,13 +1427,13 @@ PackPDU(const BluetoothGattServiceId& aIn, BluetoothDaemonPDU& aPDU)
}
nsresult
PackPDU(BluetoothGattAuthReq aIn, BluetoothDaemonPDU& aPDU)
PackPDU(BluetoothGattAuthReq aIn, DaemonSocketPDU& aPDU)
{
return PackPDU(PackConversion<BluetoothGattAuthReq, int32_t>(aIn), aPDU);
}
nsresult
PackPDU(BluetoothGattWriteType aIn, BluetoothDaemonPDU& aPDU)
PackPDU(BluetoothGattWriteType aIn, DaemonSocketPDU& aPDU)
{
return PackPDU(PackConversion<BluetoothGattWriteType, int32_t>(aIn), aPDU);
}
@ -1443,60 +1443,60 @@ PackPDU(BluetoothGattWriteType aIn, BluetoothDaemonPDU& aPDU)
//
nsresult
UnpackPDU(BluetoothDaemonPDU& aPDU, bool& aOut)
UnpackPDU(DaemonSocketPDU& aPDU, bool& aOut)
{
return UnpackPDU(aPDU, UnpackConversion<uint8_t, bool>(aOut));
}
nsresult
UnpackPDU(BluetoothDaemonPDU& aPDU, char& aOut)
UnpackPDU(DaemonSocketPDU& aPDU, char& aOut)
{
return UnpackPDU(aPDU, UnpackConversion<uint8_t, char>(aOut));
}
nsresult
UnpackPDU(BluetoothDaemonPDU& aPDU, BluetoothA2dpAudioState& aOut)
UnpackPDU(DaemonSocketPDU& aPDU, BluetoothA2dpAudioState& aOut)
{
return UnpackPDU(
aPDU, UnpackConversion<uint8_t, BluetoothA2dpAudioState>(aOut));
}
nsresult
UnpackPDU(BluetoothDaemonPDU& aPDU, BluetoothA2dpConnectionState& aOut)
UnpackPDU(DaemonSocketPDU& aPDU, BluetoothA2dpConnectionState& aOut)
{
return UnpackPDU(
aPDU, UnpackConversion<uint8_t, BluetoothA2dpConnectionState>(aOut));
}
nsresult
UnpackPDU(BluetoothDaemonPDU& aPDU, BluetoothAclState& aOut)
UnpackPDU(DaemonSocketPDU& aPDU, BluetoothAclState& aOut)
{
return UnpackPDU(aPDU, UnpackConversion<uint8_t, BluetoothAclState>(aOut));
}
nsresult
UnpackPDU(BluetoothDaemonPDU& aPDU, BluetoothAvrcpEvent& aOut)
UnpackPDU(DaemonSocketPDU& aPDU, BluetoothAvrcpEvent& aOut)
{
return UnpackPDU(
aPDU, UnpackConversion<uint8_t, BluetoothAvrcpEvent>(aOut));
}
nsresult
UnpackPDU(BluetoothDaemonPDU& aPDU, BluetoothAvrcpMediaAttribute& aOut)
UnpackPDU(DaemonSocketPDU& aPDU, BluetoothAvrcpMediaAttribute& aOut)
{
return UnpackPDU(
aPDU, UnpackConversion<uint8_t, BluetoothAvrcpMediaAttribute>(aOut));
}
nsresult
UnpackPDU(BluetoothDaemonPDU& aPDU, BluetoothAvrcpPlayerAttribute& aOut)
UnpackPDU(DaemonSocketPDU& aPDU, BluetoothAvrcpPlayerAttribute& aOut)
{
return UnpackPDU(
aPDU, UnpackConversion<uint8_t, BluetoothAvrcpPlayerAttribute>(aOut));
}
nsresult
UnpackPDU(BluetoothDaemonPDU& aPDU, BluetoothAvrcpPlayerSettings& aOut)
UnpackPDU(DaemonSocketPDU& aPDU, BluetoothAvrcpPlayerSettings& aOut)
{
/* Read number of attribute-value pairs */
nsresult rv = UnpackPDU(aPDU, aOut.mNumAttr);
@ -1518,55 +1518,55 @@ UnpackPDU(BluetoothDaemonPDU& aPDU, BluetoothAvrcpPlayerSettings& aOut)
}
nsresult
UnpackPDU(BluetoothDaemonPDU& aPDU, BluetoothAvrcpRemoteFeature& aOut)
UnpackPDU(DaemonSocketPDU& aPDU, BluetoothAvrcpRemoteFeature& aOut)
{
return UnpackPDU(
aPDU, UnpackConversion<uint8_t, BluetoothAvrcpRemoteFeature>(aOut));
}
nsresult
UnpackPDU(BluetoothDaemonPDU& aPDU, BluetoothBondState& aOut)
UnpackPDU(DaemonSocketPDU& aPDU, BluetoothBondState& aOut)
{
return UnpackPDU(aPDU, UnpackConversion<uint8_t, BluetoothBondState>(aOut));
}
nsresult
UnpackPDU(BluetoothDaemonPDU& aPDU, BluetoothTypeOfDevice& aOut)
UnpackPDU(DaemonSocketPDU& aPDU, BluetoothTypeOfDevice& aOut)
{
return UnpackPDU(
aPDU, UnpackConversion<int32_t, BluetoothTypeOfDevice>(aOut));
}
nsresult
UnpackPDU(BluetoothDaemonPDU& aPDU, BluetoothHandsfreeAudioState& aOut)
UnpackPDU(DaemonSocketPDU& aPDU, BluetoothHandsfreeAudioState& aOut)
{
return UnpackPDU(
aPDU, UnpackConversion<uint8_t, BluetoothHandsfreeAudioState>(aOut));
}
nsresult
UnpackPDU(BluetoothDaemonPDU& aPDU, BluetoothHandsfreeCallHoldType& aOut)
UnpackPDU(DaemonSocketPDU& aPDU, BluetoothHandsfreeCallHoldType& aOut)
{
return UnpackPDU(
aPDU, UnpackConversion<uint8_t, BluetoothHandsfreeCallHoldType>(aOut));
}
nsresult
UnpackPDU(BluetoothDaemonPDU& aPDU, BluetoothHandsfreeConnectionState& aOut)
UnpackPDU(DaemonSocketPDU& aPDU, BluetoothHandsfreeConnectionState& aOut)
{
return UnpackPDU(
aPDU, UnpackConversion<uint8_t, BluetoothHandsfreeConnectionState>(aOut));
}
nsresult
UnpackPDU(BluetoothDaemonPDU& aPDU, BluetoothHandsfreeNRECState& aOut)
UnpackPDU(DaemonSocketPDU& aPDU, BluetoothHandsfreeNRECState& aOut)
{
return UnpackPDU(
aPDU, UnpackConversion<uint8_t, BluetoothHandsfreeNRECState>(aOut));
}
nsresult
UnpackPDU(BluetoothDaemonPDU& aPDU,
UnpackPDU(DaemonSocketPDU& aPDU,
BluetoothHandsfreeVoiceRecognitionState& aOut)
{
return UnpackPDU(
@ -1575,14 +1575,14 @@ UnpackPDU(BluetoothDaemonPDU& aPDU,
}
nsresult
UnpackPDU(BluetoothDaemonPDU& aPDU, BluetoothHandsfreeVolumeType& aOut)
UnpackPDU(DaemonSocketPDU& aPDU, BluetoothHandsfreeVolumeType& aOut)
{
return UnpackPDU(
aPDU, UnpackConversion<uint8_t, BluetoothHandsfreeVolumeType>(aOut));
}
nsresult
UnpackPDU(BluetoothDaemonPDU& aPDU, BluetoothProperty& aOut)
UnpackPDU(DaemonSocketPDU& aPDU, BluetoothProperty& aOut)
{
nsresult rv = UnpackPDU(aPDU, aOut.mType);
if (NS_FAILED(rv)) {
@ -1667,14 +1667,14 @@ UnpackPDU(BluetoothDaemonPDU& aPDU, BluetoothProperty& aOut)
}
nsresult
UnpackPDU(BluetoothDaemonPDU& aPDU, BluetoothPropertyType& aOut)
UnpackPDU(DaemonSocketPDU& aPDU, BluetoothPropertyType& aOut)
{
return UnpackPDU(
aPDU, UnpackConversion<uint8_t, BluetoothPropertyType>(aOut));
}
nsresult
UnpackPDU(BluetoothDaemonPDU& aPDU, BluetoothRemoteInfo& aOut)
UnpackPDU(DaemonSocketPDU& aPDU, BluetoothRemoteInfo& aOut)
{
nsresult rv = UnpackPDU(aPDU,
UnpackConversion<uint32_t, int>(aOut.mVerMajor));
@ -1689,13 +1689,13 @@ UnpackPDU(BluetoothDaemonPDU& aPDU, BluetoothRemoteInfo& aOut)
}
nsresult
UnpackPDU(BluetoothDaemonPDU& aPDU, BluetoothScanMode& aOut)
UnpackPDU(DaemonSocketPDU& aPDU, BluetoothScanMode& aOut)
{
return UnpackPDU(aPDU, UnpackConversion<int32_t, BluetoothScanMode>(aOut));
}
nsresult
UnpackPDU(BluetoothDaemonPDU& aPDU, BluetoothServiceRecord& aOut)
UnpackPDU(DaemonSocketPDU& aPDU, BluetoothServiceRecord& aOut)
{
/* unpack UUID */
nsresult rv = UnpackPDU(aPDU, aOut.mUuid);
@ -1712,26 +1712,26 @@ UnpackPDU(BluetoothDaemonPDU& aPDU, BluetoothServiceRecord& aOut)
}
nsresult
UnpackPDU(BluetoothDaemonPDU& aPDU, BluetoothSspVariant& aOut)
UnpackPDU(DaemonSocketPDU& aPDU, BluetoothSspVariant& aOut)
{
return UnpackPDU(
aPDU, UnpackConversion<uint8_t, BluetoothSspVariant>(aOut));
}
nsresult
UnpackPDU(BluetoothDaemonPDU& aPDU, BluetoothStatus& aOut)
UnpackPDU(DaemonSocketPDU& aPDU, BluetoothStatus& aOut)
{
return UnpackPDU(aPDU, UnpackConversion<uint8_t, BluetoothStatus>(aOut));
}
nsresult
UnpackPDU(BluetoothDaemonPDU& aPDU, BluetoothGattStatus& aOut)
UnpackPDU(DaemonSocketPDU& aPDU, BluetoothGattStatus& aOut)
{
return UnpackPDU(aPDU, UnpackConversion<int32_t, BluetoothGattStatus>(aOut));
}
nsresult
UnpackPDU(BluetoothDaemonPDU& aPDU, BluetoothGattId& aOut)
UnpackPDU(DaemonSocketPDU& aPDU, BluetoothGattId& aOut)
{
/* unpack UUID */
nsresult rv = UnpackPDU(aPDU, UnpackReversed<BluetoothUuid>(aOut.mUuid));
@ -1743,7 +1743,7 @@ UnpackPDU(BluetoothDaemonPDU& aPDU, BluetoothGattId& aOut)
}
nsresult
UnpackPDU(BluetoothDaemonPDU& aPDU, BluetoothGattServiceId& aOut)
UnpackPDU(DaemonSocketPDU& aPDU, BluetoothGattServiceId& aOut)
{
/* unpack id */
nsresult rv = UnpackPDU(aPDU, aOut.mId);
@ -1755,7 +1755,7 @@ UnpackPDU(BluetoothDaemonPDU& aPDU, BluetoothGattServiceId& aOut)
}
nsresult
UnpackPDU(BluetoothDaemonPDU& aPDU, BluetoothGattReadParam& aOut)
UnpackPDU(DaemonSocketPDU& aPDU, BluetoothGattReadParam& aOut)
{
/* unpack service id */
nsresult rv = UnpackPDU(aPDU, aOut.mServiceId);
@ -1792,7 +1792,7 @@ UnpackPDU(BluetoothDaemonPDU& aPDU, BluetoothGattReadParam& aOut)
}
nsresult
UnpackPDU(BluetoothDaemonPDU& aPDU, BluetoothGattWriteParam& aOut)
UnpackPDU(DaemonSocketPDU& aPDU, BluetoothGattWriteParam& aOut)
{
/* unpack service id */
nsresult rv = UnpackPDU(aPDU, aOut.mServiceId);
@ -1814,7 +1814,7 @@ UnpackPDU(BluetoothDaemonPDU& aPDU, BluetoothGattWriteParam& aOut)
}
nsresult
UnpackPDU(BluetoothDaemonPDU& aPDU, BluetoothGattNotifyParam& aOut)
UnpackPDU(DaemonSocketPDU& aPDU, BluetoothGattNotifyParam& aOut)
{
/* unpack address and convert to nsString */
@ -1851,7 +1851,7 @@ UnpackPDU(BluetoothDaemonPDU& aPDU, BluetoothGattNotifyParam& aOut)
return aPDU.Read(aOut.mValue, aOut.mLength);
}
nsresult
UnpackPDU(BluetoothDaemonPDU& aPDU, nsDependentCString& aOut)
UnpackPDU(DaemonSocketPDU& aPDU, nsDependentCString& aOut)
{
// We get a pointer to the first character in the PDU, a length
// of 1 ensures we consume the \0 byte. With 'str' pointing to
@ -1881,7 +1881,7 @@ UnpackPDU(BluetoothDaemonPDU& aPDU, nsDependentCString& aOut)
}
nsresult
UnpackPDU(BluetoothDaemonPDU& aPDU, const UnpackCString0& aOut)
UnpackPDU(DaemonSocketPDU& aPDU, const UnpackCString0& aOut)
{
nsDependentCString cstring;
@ -1896,7 +1896,7 @@ UnpackPDU(BluetoothDaemonPDU& aPDU, const UnpackCString0& aOut)
}
nsresult
UnpackPDU(BluetoothDaemonPDU& aPDU, const UnpackString0& aOut)
UnpackPDU(DaemonSocketPDU& aPDU, const UnpackString0& aOut)
{
nsDependentCString cstring;

View File

@ -10,7 +10,7 @@
#include "BluetoothCommon.h"
#include "mozilla/ArrayUtils.h"
#include "mozilla/dom/bluetooth/BluetoothTypes.h"
#include "mozilla/ipc/BluetoothDaemonConnection.h"
#include "mozilla/ipc/DaemonSocketPDU.h"
#include "nsThreadUtils.h"
using namespace mozilla::ipc;
@ -106,14 +106,14 @@ struct BluetoothConfigurationParameter {
nsAutoArrayPtr<uint8_t> mValue;
};
struct BluetoothDaemonPDUHeader {
BluetoothDaemonPDUHeader()
struct DaemonSocketPDUHeader {
DaemonSocketPDUHeader()
: mService(0x00)
, mOpcode(0x00)
, mLength(0x00)
{ }
BluetoothDaemonPDUHeader(uint8_t aService, uint8_t aOpcode, uint8_t aLength)
DaemonSocketPDUHeader(uint8_t aService, uint8_t aOpcode, uint8_t aLength)
: mService(aService)
, mOpcode(aOpcode)
, mLength(aLength)
@ -346,141 +346,141 @@ Convert(BluetoothGattWriteType aIn, int32_t& aOut);
// introduce link errors on non-handled data types
template <typename T>
nsresult
PackPDU(T aIn, BluetoothDaemonPDU& aPDU);
PackPDU(T aIn, DaemonSocketPDU& aPDU);
nsresult
PackPDU(bool aIn, BluetoothDaemonPDU& aPDU);
PackPDU(bool aIn, DaemonSocketPDU& aPDU);
inline nsresult
PackPDU(uint8_t aIn, BluetoothDaemonPDU& aPDU)
PackPDU(uint8_t aIn, DaemonSocketPDU& aPDU)
{
return aPDU.Write(aIn);
}
inline nsresult
PackPDU(uint16_t aIn, BluetoothDaemonPDU& aPDU)
PackPDU(uint16_t aIn, DaemonSocketPDU& aPDU)
{
return aPDU.Write(aIn);
}
inline nsresult
PackPDU(int32_t aIn, BluetoothDaemonPDU& aPDU)
PackPDU(int32_t aIn, DaemonSocketPDU& aPDU)
{
return aPDU.Write(aIn);
}
inline nsresult
PackPDU(uint32_t aIn, BluetoothDaemonPDU& aPDU)
PackPDU(uint32_t aIn, DaemonSocketPDU& aPDU)
{
return aPDU.Write(aIn);
}
nsresult
PackPDU(const BluetoothAddress& aIn, BluetoothDaemonPDU& aPDU);
PackPDU(const BluetoothAddress& aIn, DaemonSocketPDU& aPDU);
nsresult
PackPDU(const BluetoothAvrcpAttributeTextPairs& aIn,
BluetoothDaemonPDU& aPDU);
DaemonSocketPDU& aPDU);
nsresult
PackPDU(const BluetoothAvrcpAttributeValuePairs& aIn,
BluetoothDaemonPDU& aPDU);
DaemonSocketPDU& aPDU);
nsresult
PackPDU(const BluetoothAvrcpElementAttribute& aIn, BluetoothDaemonPDU& aPDU);
PackPDU(const BluetoothAvrcpElementAttribute& aIn, DaemonSocketPDU& aPDU);
nsresult
PackPDU(BluetoothAvrcpEvent aIn, BluetoothDaemonPDU& aPDU);
PackPDU(BluetoothAvrcpEvent aIn, DaemonSocketPDU& aPDU);
nsresult
PackPDU(const BluetoothAvrcpEventParamPair& aIn, BluetoothDaemonPDU& aPDU);
PackPDU(const BluetoothAvrcpEventParamPair& aIn, DaemonSocketPDU& aPDU);
nsresult
PackPDU(BluetoothAvrcpNotification aIn, BluetoothDaemonPDU& aPDU);
PackPDU(BluetoothAvrcpNotification aIn, DaemonSocketPDU& aPDU);
nsresult
PackPDU(BluetoothAvrcpPlayerAttribute aIn, BluetoothDaemonPDU& aPDU);
PackPDU(BluetoothAvrcpPlayerAttribute aIn, DaemonSocketPDU& aPDU);
nsresult
PackPDU(BluetoothAvrcpStatus aIn, BluetoothDaemonPDU& aPDU);
PackPDU(BluetoothAvrcpStatus aIn, DaemonSocketPDU& aPDU);
nsresult
PackPDU(const BluetoothConfigurationParameter& aIn, BluetoothDaemonPDU& aPDU);
PackPDU(const BluetoothConfigurationParameter& aIn, DaemonSocketPDU& aPDU);
nsresult
PackPDU(const BluetoothDaemonPDUHeader& aIn, BluetoothDaemonPDU& aPDU);
PackPDU(const DaemonSocketPDUHeader& aIn, DaemonSocketPDU& aPDU);
nsresult
PackPDU(const BluetoothHandsfreeAtResponse& aIn, BluetoothDaemonPDU& aPDU);
PackPDU(const BluetoothHandsfreeAtResponse& aIn, DaemonSocketPDU& aPDU);
nsresult
PackPDU(const BluetoothHandsfreeCallAddressType& aIn, BluetoothDaemonPDU& aPDU);
PackPDU(const BluetoothHandsfreeCallAddressType& aIn, DaemonSocketPDU& aPDU);
nsresult
PackPDU(const BluetoothHandsfreeCallDirection& aIn, BluetoothDaemonPDU& aPDU);
PackPDU(const BluetoothHandsfreeCallDirection& aIn, DaemonSocketPDU& aPDU);
nsresult
PackPDU(const BluetoothHandsfreeCallMode& aIn, BluetoothDaemonPDU& aPDU);
PackPDU(const BluetoothHandsfreeCallMode& aIn, DaemonSocketPDU& aPDU);
nsresult
PackPDU(const BluetoothHandsfreeCallMptyType& aIn, BluetoothDaemonPDU& aPDU);
PackPDU(const BluetoothHandsfreeCallMptyType& aIn, DaemonSocketPDU& aPDU);
nsresult
PackPDU(const BluetoothHandsfreeCallState& aIn, BluetoothDaemonPDU& aPDU);
PackPDU(const BluetoothHandsfreeCallState& aIn, DaemonSocketPDU& aPDU);
nsresult
PackPDU(const BluetoothHandsfreeNetworkState& aIn, BluetoothDaemonPDU& aPDU);
PackPDU(const BluetoothHandsfreeNetworkState& aIn, DaemonSocketPDU& aPDU);
nsresult
PackPDU(const BluetoothHandsfreeServiceType& aIn, BluetoothDaemonPDU& aPDU);
PackPDU(const BluetoothHandsfreeServiceType& aIn, DaemonSocketPDU& aPDU);
nsresult
PackPDU(const BluetoothHandsfreeVolumeType& aIn, BluetoothDaemonPDU& aPDU);
PackPDU(const BluetoothHandsfreeVolumeType& aIn, DaemonSocketPDU& aPDU);
nsresult
PackPDU(const BluetoothHandsfreeWbsConfig& aIn, BluetoothDaemonPDU& aPDU);
PackPDU(const BluetoothHandsfreeWbsConfig& aIn, DaemonSocketPDU& aPDU);
nsresult
PackPDU(const BluetoothNamedValue& aIn, BluetoothDaemonPDU& aPDU);
PackPDU(const BluetoothNamedValue& aIn, DaemonSocketPDU& aPDU);
nsresult
PackPDU(const BluetoothPinCode& aIn, BluetoothDaemonPDU& aPDU);
PackPDU(const BluetoothPinCode& aIn, DaemonSocketPDU& aPDU);
nsresult
PackPDU(BluetoothPropertyType aIn, BluetoothDaemonPDU& aPDU);
PackPDU(BluetoothPropertyType aIn, DaemonSocketPDU& aPDU);
nsresult
PackPDU(const BluetoothServiceName& aIn, BluetoothDaemonPDU& aPDU);
PackPDU(const BluetoothServiceName& aIn, DaemonSocketPDU& aPDU);
nsresult
PackPDU(BluetoothSocketType aIn, BluetoothDaemonPDU& aPDU);
PackPDU(BluetoothSocketType aIn, DaemonSocketPDU& aPDU);
nsresult
PackPDU(BluetoothSspVariant aIn, BluetoothDaemonPDU& aPDU);
PackPDU(BluetoothSspVariant aIn, DaemonSocketPDU& aPDU);
nsresult
PackPDU(BluetoothScanMode aIn, BluetoothDaemonPDU& aPDU);
PackPDU(BluetoothScanMode aIn, DaemonSocketPDU& aPDU);
nsresult
PackPDU(ControlPlayStatus aIn, BluetoothDaemonPDU& aPDU);
PackPDU(ControlPlayStatus aIn, DaemonSocketPDU& aPDU);
nsresult
PackPDU(const BluetoothUuid& aIn, BluetoothDaemonPDU& aPDU);
PackPDU(const BluetoothUuid& aIn, DaemonSocketPDU& aPDU);
nsresult
PackPDU(const BluetoothGattId& aIn, BluetoothDaemonPDU& aPDU);
PackPDU(const BluetoothGattId& aIn, DaemonSocketPDU& aPDU);
nsresult
PackPDU(const BluetoothGattServiceId& aIn, BluetoothDaemonPDU& aPDU);
PackPDU(const BluetoothGattServiceId& aIn, DaemonSocketPDU& aPDU);
nsresult
PackPDU(BluetoothGattAuthReq aIn, BluetoothDaemonPDU& aPDU);
PackPDU(BluetoothGattAuthReq aIn, DaemonSocketPDU& aPDU);
nsresult
PackPDU(BluetoothGattWriteType aIn, BluetoothDaemonPDU& aPDU);
PackPDU(BluetoothGattWriteType aIn, DaemonSocketPDU& aPDU);
nsresult
PackPDU(BluetoothTransport aIn, BluetoothDaemonPDU& aPDU);
PackPDU(BluetoothTransport aIn, DaemonSocketPDU& aPDU);
/* |PackConversion| is a helper for packing converted values. Pass
* an instance of this structure to |PackPDU| to convert a value from
@ -497,7 +497,7 @@ struct PackConversion {
template<typename Tin, typename Tout>
inline nsresult
PackPDU(const PackConversion<Tin, Tout>& aIn, BluetoothDaemonPDU& aPDU)
PackPDU(const PackConversion<Tin, Tout>& aIn, DaemonSocketPDU& aPDU)
{
Tout out;
@ -529,7 +529,7 @@ struct PackArray
*/
template<typename T>
inline nsresult
PackPDU(const PackArray<T>& aIn, BluetoothDaemonPDU& aPDU)
PackPDU(const PackArray<T>& aIn, DaemonSocketPDU& aPDU)
{
for (size_t i = 0; i < aIn.mLength; ++i) {
nsresult rv = PackPDU(aIn.mData[i], aPDU);
@ -542,7 +542,7 @@ PackPDU(const PackArray<T>& aIn, BluetoothDaemonPDU& aPDU)
template<>
inline nsresult
PackPDU<uint8_t>(const PackArray<uint8_t>& aIn, BluetoothDaemonPDU& aPDU)
PackPDU<uint8_t>(const PackArray<uint8_t>& aIn, DaemonSocketPDU& aPDU)
{
/* Write raw bytes in one pass */
return aPDU.Write(aIn.mData, aIn.mLength);
@ -550,7 +550,7 @@ PackPDU<uint8_t>(const PackArray<uint8_t>& aIn, BluetoothDaemonPDU& aPDU)
template<>
inline nsresult
PackPDU<char>(const PackArray<char>& aIn, BluetoothDaemonPDU& aPDU)
PackPDU<char>(const PackArray<char>& aIn, DaemonSocketPDU& aPDU)
{
/* Write raw bytes in one pass */
return aPDU.Write(aIn.mData, aIn.mLength);
@ -572,7 +572,7 @@ struct PackCString0
/* This implementation of |PackPDU| packs a 0-terminated C string.
*/
inline nsresult
PackPDU(const PackCString0& aIn, BluetoothDaemonPDU& aPDU)
PackPDU(const PackCString0& aIn, DaemonSocketPDU& aPDU)
{
return PackPDU(
PackArray<uint8_t>(reinterpret_cast<const uint8_t*>(aIn.mString.get()),
@ -598,14 +598,14 @@ struct PackReversed
*/
template<typename T>
nsresult
PackPDU(const PackReversed<T>& aIn, BluetoothDaemonPDU& aPDU);
PackPDU(const PackReversed<T>& aIn, DaemonSocketPDU& aPDU);
/* This implementation of |PackPDU| packs elements in |PackArray| in reversed
* order. (ex. reversed GATT UUID, see bug 1171866)
*/
template<typename U>
inline nsresult
PackPDU(const PackReversed<PackArray<U>>& aIn, BluetoothDaemonPDU& aPDU)
PackPDU(const PackReversed<PackArray<U>>& aIn, DaemonSocketPDU& aPDU)
{
for (size_t i = 0; i < aIn.mValue.mLength; ++i) {
nsresult rv = PackPDU(aIn.mValue.mData[aIn.mValue.mLength - i - 1], aPDU);
@ -622,7 +622,7 @@ PackPDU(const PackReversed<PackArray<U>>& aIn, BluetoothDaemonPDU& aPDU)
template <>
inline nsresult
PackPDU<BluetoothUuid>(const PackReversed<BluetoothUuid>& aIn,
BluetoothDaemonPDU& aPDU)
DaemonSocketPDU& aPDU)
{
return PackPDU(
PackReversed<PackArray<uint8_t>>(
@ -632,7 +632,7 @@ PackPDU<BluetoothUuid>(const PackReversed<BluetoothUuid>& aIn,
template <typename T1, typename T2>
inline nsresult
PackPDU(const T1& aIn1, const T2& aIn2, BluetoothDaemonPDU& aPDU)
PackPDU(const T1& aIn1, const T2& aIn2, DaemonSocketPDU& aPDU)
{
nsresult rv = PackPDU(aIn1, aPDU);
if (NS_FAILED(rv)) {
@ -644,7 +644,7 @@ PackPDU(const T1& aIn1, const T2& aIn2, BluetoothDaemonPDU& aPDU)
template <typename T1, typename T2, typename T3>
inline nsresult
PackPDU(const T1& aIn1, const T2& aIn2, const T3& aIn3,
BluetoothDaemonPDU& aPDU)
DaemonSocketPDU& aPDU)
{
nsresult rv = PackPDU(aIn1, aPDU);
if (NS_FAILED(rv)) {
@ -660,7 +660,7 @@ PackPDU(const T1& aIn1, const T2& aIn2, const T3& aIn3,
template <typename T1, typename T2, typename T3, typename T4>
inline nsresult
PackPDU(const T1& aIn1, const T2& aIn2, const T3& aIn3, const T4& aIn4,
BluetoothDaemonPDU& aPDU)
DaemonSocketPDU& aPDU)
{
nsresult rv = PackPDU(aIn1, aPDU);
if (NS_FAILED(rv)) {
@ -682,7 +682,7 @@ template <typename T1, typename T2, typename T3,
inline nsresult
PackPDU(const T1& aIn1, const T2& aIn2, const T3& aIn3,
const T4& aIn4, const T5& aIn5,
BluetoothDaemonPDU& aPDU)
DaemonSocketPDU& aPDU)
{
nsresult rv = PackPDU(aIn1, aPDU);
if (NS_FAILED(rv)) {
@ -709,7 +709,7 @@ template <typename T1, typename T2, typename T3,
inline nsresult
PackPDU(const T1& aIn1, const T2& aIn2, const T3& aIn3,
const T4& aIn4, const T5& aIn5, const T6& aIn6,
const T7& aIn7, BluetoothDaemonPDU& aPDU)
const T7& aIn7, DaemonSocketPDU& aPDU)
{
nsresult rv = PackPDU(aIn1, aPDU);
if (NS_FAILED(rv)) {
@ -744,7 +744,7 @@ template <typename T1, typename T2, typename T3,
inline nsresult
PackPDU(const T1& aIn1, const T2& aIn2, const T3& aIn3,
const T4& aIn4, const T5& aIn5, const T6& aIn6,
const T7& aIn7, const T8& aIn8, BluetoothDaemonPDU& aPDU)
const T7& aIn7, const T8& aIn8, DaemonSocketPDU& aPDU)
{
nsresult rv = PackPDU(aIn1, aPDU);
if (NS_FAILED(rv)) {
@ -787,7 +787,7 @@ PackPDU(const T1& aIn1, const T2& aIn2, const T3& aIn3,
const T4& aIn4, const T5& aIn5, const T6& aIn6,
const T7& aIn7, const T8& aIn8, const T9& aIn9,
const T10& aIn10, const T11& aIn11, const T12& aIn12,
const T13& aIn13, BluetoothDaemonPDU& aPDU)
const T13& aIn13, DaemonSocketPDU& aPDU)
{
nsresult rv = PackPDU(aIn1, aPDU);
if (NS_FAILED(rv)) {
@ -847,79 +847,79 @@ PackPDU(const T1& aIn1, const T2& aIn2, const T3& aIn3,
// introduce link errors on non-handled data types
template <typename T>
nsresult
UnpackPDU(BluetoothDaemonPDU& aPDU, T& aOut);
UnpackPDU(DaemonSocketPDU& aPDU, T& aOut);
inline nsresult
UnpackPDU(BluetoothDaemonPDU& aPDU, int8_t& aOut)
UnpackPDU(DaemonSocketPDU& aPDU, int8_t& aOut)
{
return aPDU.Read(aOut);
}
inline nsresult
UnpackPDU(BluetoothDaemonPDU& aPDU, uint8_t& aOut)
UnpackPDU(DaemonSocketPDU& aPDU, uint8_t& aOut)
{
return aPDU.Read(aOut);
}
inline nsresult
UnpackPDU(BluetoothDaemonPDU& aPDU, uint16_t& aOut)
UnpackPDU(DaemonSocketPDU& aPDU, uint16_t& aOut)
{
return aPDU.Read(aOut);
}
inline nsresult
UnpackPDU(BluetoothDaemonPDU& aPDU, int32_t& aOut)
UnpackPDU(DaemonSocketPDU& aPDU, int32_t& aOut)
{
return aPDU.Read(aOut);
}
inline nsresult
UnpackPDU(BluetoothDaemonPDU& aPDU, uint32_t& aOut)
UnpackPDU(DaemonSocketPDU& aPDU, uint32_t& aOut)
{
return aPDU.Read(aOut);
}
nsresult
UnpackPDU(BluetoothDaemonPDU& aPDU, bool& aOut);
UnpackPDU(DaemonSocketPDU& aPDU, bool& aOut);
nsresult
UnpackPDU(BluetoothDaemonPDU& aPDU, char& aOut);
UnpackPDU(DaemonSocketPDU& aPDU, char& aOut);
nsresult
UnpackPDU(BluetoothDaemonPDU& aPDU, BluetoothA2dpAudioState& aOut);
UnpackPDU(DaemonSocketPDU& aPDU, BluetoothA2dpAudioState& aOut);
nsresult
UnpackPDU(BluetoothDaemonPDU& aPDU, BluetoothA2dpConnectionState& aOut);
UnpackPDU(DaemonSocketPDU& aPDU, BluetoothA2dpConnectionState& aOut);
nsresult
UnpackPDU(BluetoothDaemonPDU& aPDU, BluetoothAclState& aOut);
UnpackPDU(DaemonSocketPDU& aPDU, BluetoothAclState& aOut);
inline nsresult
UnpackPDU(BluetoothDaemonPDU& aPDU, BluetoothAddress& aOut)
UnpackPDU(DaemonSocketPDU& aPDU, BluetoothAddress& aOut)
{
return aPDU.Read(aOut.mAddr, sizeof(aOut.mAddr));
}
nsresult
UnpackPDU(BluetoothDaemonPDU& aPDU, BluetoothAvrcpEvent& aOut);
UnpackPDU(DaemonSocketPDU& aPDU, BluetoothAvrcpEvent& aOut);
nsresult
UnpackPDU(BluetoothDaemonPDU& aPDU, BluetoothAvrcpMediaAttribute& aOut);
UnpackPDU(DaemonSocketPDU& aPDU, BluetoothAvrcpMediaAttribute& aOut);
nsresult
UnpackPDU(BluetoothDaemonPDU& aPDU, BluetoothAvrcpPlayerAttribute& aOut);
UnpackPDU(DaemonSocketPDU& aPDU, BluetoothAvrcpPlayerAttribute& aOut);
nsresult
UnpackPDU(BluetoothDaemonPDU& aPDU, BluetoothAvrcpPlayerSettings& aOut);
UnpackPDU(DaemonSocketPDU& aPDU, BluetoothAvrcpPlayerSettings& aOut);
nsresult
UnpackPDU(BluetoothDaemonPDU& aPDU, BluetoothAvrcpRemoteFeature& aOut);
UnpackPDU(DaemonSocketPDU& aPDU, BluetoothAvrcpRemoteFeature& aOut);
nsresult
UnpackPDU(BluetoothDaemonPDU& aPDU, BluetoothBondState& aOut);
UnpackPDU(DaemonSocketPDU& aPDU, BluetoothBondState& aOut);
inline nsresult
UnpackPDU(BluetoothDaemonPDU& aPDU, BluetoothDaemonPDUHeader& aOut)
UnpackPDU(DaemonSocketPDU& aPDU, DaemonSocketPDUHeader& aOut)
{
nsresult rv = UnpackPDU(aPDU, aOut.mService);
if (NS_FAILED(rv)) {
@ -933,80 +933,80 @@ UnpackPDU(BluetoothDaemonPDU& aPDU, BluetoothDaemonPDUHeader& aOut)
}
nsresult
UnpackPDU(BluetoothDaemonPDU& aPDU, BluetoothTypeOfDevice& aOut);
UnpackPDU(DaemonSocketPDU& aPDU, BluetoothTypeOfDevice& aOut);
nsresult
UnpackPDU(BluetoothDaemonPDU& aPDU, BluetoothHandsfreeAudioState& aOut);
UnpackPDU(DaemonSocketPDU& aPDU, BluetoothHandsfreeAudioState& aOut);
nsresult
UnpackPDU(BluetoothDaemonPDU& aPDU, BluetoothHandsfreeCallHoldType& aOut);
UnpackPDU(DaemonSocketPDU& aPDU, BluetoothHandsfreeCallHoldType& aOut);
nsresult
UnpackPDU(BluetoothDaemonPDU& aPDU, BluetoothHandsfreeConnectionState& aOut);
UnpackPDU(DaemonSocketPDU& aPDU, BluetoothHandsfreeConnectionState& aOut);
nsresult
UnpackPDU(BluetoothDaemonPDU& aPDU, BluetoothHandsfreeNRECState& aOut);
UnpackPDU(DaemonSocketPDU& aPDU, BluetoothHandsfreeNRECState& aOut);
nsresult
UnpackPDU(BluetoothDaemonPDU& aPDU,
UnpackPDU(DaemonSocketPDU& aPDU,
BluetoothHandsfreeVoiceRecognitionState& aOut);
nsresult
UnpackPDU(BluetoothDaemonPDU& aPDU, BluetoothHandsfreeVolumeType& aOut);
UnpackPDU(DaemonSocketPDU& aPDU, BluetoothHandsfreeVolumeType& aOut);
nsresult
UnpackPDU(BluetoothDaemonPDU& aPDU, BluetoothRemoteInfo& aOut);
UnpackPDU(DaemonSocketPDU& aPDU, BluetoothRemoteInfo& aOut);
inline nsresult
UnpackPDU(BluetoothDaemonPDU& aPDU, BluetoothRemoteName& aOut)
UnpackPDU(DaemonSocketPDU& aPDU, BluetoothRemoteName& aOut)
{
return aPDU.Read(aOut.mName, sizeof(aOut.mName));
}
nsresult
UnpackPDU(BluetoothDaemonPDU& aPDU, BluetoothProperty& aOut);
UnpackPDU(DaemonSocketPDU& aPDU, BluetoothProperty& aOut);
nsresult
UnpackPDU(BluetoothDaemonPDU& aPDU, BluetoothPropertyType& aOut);
UnpackPDU(DaemonSocketPDU& aPDU, BluetoothPropertyType& aOut);
nsresult
UnpackPDU(BluetoothDaemonPDU& aPDU, BluetoothScanMode& aOut);
UnpackPDU(DaemonSocketPDU& aPDU, BluetoothScanMode& aOut);
nsresult
UnpackPDU(BluetoothDaemonPDU& aPDU, BluetoothServiceRecord& aOut);
UnpackPDU(DaemonSocketPDU& aPDU, BluetoothServiceRecord& aOut);
nsresult
UnpackPDU(BluetoothDaemonPDU& aPDU, BluetoothSspVariant& aOut);
UnpackPDU(DaemonSocketPDU& aPDU, BluetoothSspVariant& aOut);
nsresult
UnpackPDU(BluetoothDaemonPDU& aPDU, BluetoothStatus& aOut);
UnpackPDU(DaemonSocketPDU& aPDU, BluetoothStatus& aOut);
nsresult
UnpackPDU(BluetoothDaemonPDU& aPDU, BluetoothGattStatus& aOut);
UnpackPDU(DaemonSocketPDU& aPDU, BluetoothGattStatus& aOut);
inline nsresult
UnpackPDU(BluetoothDaemonPDU& aPDU, BluetoothUuid& aOut)
UnpackPDU(DaemonSocketPDU& aPDU, BluetoothUuid& aOut)
{
return aPDU.Read(aOut.mUuid, sizeof(aOut.mUuid));
}
nsresult
UnpackPDU(BluetoothDaemonPDU& aPDU, BluetoothGattId& aOut);
UnpackPDU(DaemonSocketPDU& aPDU, BluetoothGattId& aOut);
nsresult
UnpackPDU(BluetoothDaemonPDU& aPDU, BluetoothGattServiceId& aOut);
UnpackPDU(DaemonSocketPDU& aPDU, BluetoothGattServiceId& aOut);
nsresult
UnpackPDU(BluetoothDaemonPDU& aPDU, BluetoothGattReadParam& aOut);
UnpackPDU(DaemonSocketPDU& aPDU, BluetoothGattReadParam& aOut);
nsresult
UnpackPDU(BluetoothDaemonPDU& aPDU, BluetoothGattWriteParam& aOut);
UnpackPDU(DaemonSocketPDU& aPDU, BluetoothGattWriteParam& aOut);
nsresult
UnpackPDU(BluetoothDaemonPDU& aPDU, BluetoothGattNotifyParam& aOut);
UnpackPDU(DaemonSocketPDU& aPDU, BluetoothGattNotifyParam& aOut);
nsresult
UnpackPDU(BluetoothDaemonPDU& aPDU, nsDependentCString& aOut);
UnpackPDU(DaemonSocketPDU& aPDU, nsDependentCString& aOut);
/* |UnpackConversion| is a helper for convering unpacked values. Pass
* an instance of this structure to |UnpackPDU| to read a value from
@ -1023,7 +1023,7 @@ struct UnpackConversion {
template<typename Tin, typename Tout>
inline nsresult
UnpackPDU(BluetoothDaemonPDU& aPDU, const UnpackConversion<Tin, Tout>& aOut)
UnpackPDU(DaemonSocketPDU& aPDU, const UnpackConversion<Tin, Tout>& aOut)
{
Tin in;
nsresult rv = UnpackPDU(aPDU, in);
@ -1067,7 +1067,7 @@ struct UnpackArray
template<typename T>
inline nsresult
UnpackPDU(BluetoothDaemonPDU& aPDU, const UnpackArray<T>& aOut)
UnpackPDU(DaemonSocketPDU& aPDU, const UnpackArray<T>& aOut)
{
for (size_t i = 0; i < aOut.mLength; ++i) {
nsresult rv = UnpackPDU(aPDU, aOut.mData[i]);
@ -1080,7 +1080,7 @@ UnpackPDU(BluetoothDaemonPDU& aPDU, const UnpackArray<T>& aOut)
template<typename T>
inline nsresult
UnpackPDU(BluetoothDaemonPDU& aPDU, UnpackArray<T>& aOut)
UnpackPDU(DaemonSocketPDU& aPDU, UnpackArray<T>& aOut)
{
for (size_t i = 0; i < aOut.mLength; ++i) {
nsresult rv = UnpackPDU(aPDU, aOut.mData[i]);
@ -1093,7 +1093,7 @@ UnpackPDU(BluetoothDaemonPDU& aPDU, UnpackArray<T>& aOut)
template<>
inline nsresult
UnpackPDU<uint8_t>(BluetoothDaemonPDU& aPDU, const UnpackArray<uint8_t>& aOut)
UnpackPDU<uint8_t>(DaemonSocketPDU& aPDU, const UnpackArray<uint8_t>& aOut)
{
/* Read raw bytes in one pass */
return aPDU.Read(aOut.mData, aOut.mLength);
@ -1101,7 +1101,7 @@ UnpackPDU<uint8_t>(BluetoothDaemonPDU& aPDU, const UnpackArray<uint8_t>& aOut)
template<typename T>
inline nsresult
UnpackPDU(BluetoothDaemonPDU& aPDU, nsTArray<T>& aOut)
UnpackPDU(DaemonSocketPDU& aPDU, nsTArray<T>& aOut)
{
for (typename nsTArray<T>::size_type i = 0; i < aOut.Length(); ++i) {
nsresult rv = UnpackPDU(aPDU, aOut[i]);
@ -1128,7 +1128,7 @@ struct UnpackCString0
/* This implementation of |UnpackPDU| unpacks a 0-terminated C string.
*/
nsresult
UnpackPDU(BluetoothDaemonPDU& aPDU, const UnpackCString0& aOut);
UnpackPDU(DaemonSocketPDU& aPDU, const UnpackCString0& aOut);
/* |UnpackString0| is a helper for unpacking 0-terminated C string,
* including the \0 character. Pass an instance of this structure
@ -1148,7 +1148,7 @@ struct UnpackString0
* and converts it to wide-character encoding.
*/
nsresult
UnpackPDU(BluetoothDaemonPDU& aPDU, const UnpackString0& aOut);
UnpackPDU(DaemonSocketPDU& aPDU, const UnpackString0& aOut);
/* |UnpackReversed| is a helper for unpacking data in reversed order. Pass an
* instance of this structure as the second argument to |UnpackPDU| to unpack
@ -1173,11 +1173,11 @@ struct UnpackReversed
*/
template<typename T>
nsresult
UnpackPDU(BluetoothDaemonPDU& aPDU, const UnpackReversed<T>& aOut);
UnpackPDU(DaemonSocketPDU& aPDU, const UnpackReversed<T>& aOut);
template<typename U>
inline nsresult
UnpackPDU(BluetoothDaemonPDU& aPDU, const UnpackReversed<UnpackArray<U>>& aOut)
UnpackPDU(DaemonSocketPDU& aPDU, const UnpackReversed<UnpackArray<U>>& aOut)
{
for (size_t i = 0; i < aOut.mValue->mLength; ++i) {
nsresult rv = UnpackPDU(aPDU,
@ -1194,7 +1194,7 @@ UnpackPDU(BluetoothDaemonPDU& aPDU, const UnpackReversed<UnpackArray<U>>& aOut)
*/
template<>
inline nsresult
UnpackPDU<BluetoothUuid>(BluetoothDaemonPDU& aPDU,
UnpackPDU<BluetoothUuid>(DaemonSocketPDU& aPDU,
const UnpackReversed<BluetoothUuid>& aOut)
{
return UnpackPDU(
@ -1211,11 +1211,11 @@ UnpackPDU<BluetoothUuid>(BluetoothDaemonPDU& aPDU,
class PDUInitOp
{
protected:
PDUInitOp(BluetoothDaemonPDU& aPDU)
PDUInitOp(DaemonSocketPDU& aPDU)
: mPDU(&aPDU)
{ }
BluetoothDaemonPDU& GetPDU() const
DaemonSocketPDU& GetPDU() const
{
return *mPDU; // cannot be nullptr
}
@ -1237,7 +1237,7 @@ protected:
}
private:
BluetoothDaemonPDU* mPDU; // Hold pointer to allow for constant instances
DaemonSocketPDU* mPDU; // Hold pointer to allow for constant instances
};
// |UnpackPDUInitOp| is a general-purpose init operator for all variants
@ -1247,7 +1247,7 @@ private:
class UnpackPDUInitOp final : private PDUInitOp
{
public:
UnpackPDUInitOp(BluetoothDaemonPDU& aPDU)
UnpackPDUInitOp(DaemonSocketPDU& aPDU)
: PDUInitOp(aPDU)
{ }
@ -1271,7 +1271,7 @@ public:
template<typename T1, typename T2>
nsresult operator () (T1& aArg1, T2& aArg2) const
{
BluetoothDaemonPDU& pdu = GetPDU();
DaemonSocketPDU& pdu = GetPDU();
nsresult rv = UnpackPDU(pdu, aArg1);
if (NS_FAILED(rv)) {
@ -1288,7 +1288,7 @@ public:
template<typename T1, typename T2, typename T3>
nsresult operator () (T1& aArg1, T2& aArg2, T3& aArg3) const
{
BluetoothDaemonPDU& pdu = GetPDU();
DaemonSocketPDU& pdu = GetPDU();
nsresult rv = UnpackPDU(pdu, aArg1);
if (NS_FAILED(rv)) {
@ -1309,7 +1309,7 @@ public:
template<typename T1, typename T2, typename T3, typename T4>
nsresult operator () (T1& aArg1, T2& aArg2, T3& aArg3, T4& aArg4) const
{
BluetoothDaemonPDU& pdu = GetPDU();
DaemonSocketPDU& pdu = GetPDU();
nsresult rv = UnpackPDU(pdu, aArg1);
if (NS_FAILED(rv)) {
@ -1335,7 +1335,7 @@ public:
nsresult operator () (T1& aArg1, T2& aArg2, T3& aArg3, T4& aArg4,
T5& aArg5) const
{
BluetoothDaemonPDU& pdu = GetPDU();
DaemonSocketPDU& pdu = GetPDU();
nsresult rv = UnpackPDU(pdu, aArg1);
if (NS_FAILED(rv)) {

View File

@ -17,6 +17,7 @@
#include "BluetoothDaemonSetupInterface.h"
#include "BluetoothDaemonSocketInterface.h"
#include "BluetoothInterfaceHelpers.h"
#include "mozilla/ipc/DaemonSocket.h"
#include "mozilla/ipc/ListenSocket.h"
#include "mozilla/unused.h"
#include "prrng.h"
@ -34,7 +35,7 @@ static const int sRetryInterval = 100; // ms
class BluetoothDaemonSetupModule
{
public:
virtual nsresult Send(BluetoothDaemonPDU* aPDU, void* aUserData) = 0;
virtual nsresult Send(DaemonSocketPDU* aPDU, void* aUserData) = 0;
// Commands
//
@ -45,7 +46,7 @@ public:
{
MOZ_ASSERT(NS_IsMainThread());
nsAutoPtr<BluetoothDaemonPDU> pdu(new BluetoothDaemonPDU(0x00, 0x01, 0));
nsAutoPtr<DaemonSocketPDU> pdu(new DaemonSocketPDU(0x00, 0x01, 0));
#if ANDROID_VERSION >= 21
nsresult rv = PackPDU(aId, aMode, aMaxNumClients, *pdu);
@ -68,7 +69,7 @@ public:
{
MOZ_ASSERT(NS_IsMainThread());
nsAutoPtr<BluetoothDaemonPDU> pdu(new BluetoothDaemonPDU(0x00, 0x02, 0));
nsAutoPtr<DaemonSocketPDU> pdu(new DaemonSocketPDU(0x00, 0x02, 0));
nsresult rv = PackPDU(aId, *pdu);
if (NS_FAILED(rv)) {
@ -87,7 +88,7 @@ public:
{
MOZ_ASSERT(NS_IsMainThread());
nsAutoPtr<BluetoothDaemonPDU> pdu(new BluetoothDaemonPDU(0x00, 0x03, 0));
nsAutoPtr<DaemonSocketPDU> pdu(new DaemonSocketPDU(0x00, 0x03, 0));
nsresult rv = PackPDU(
aLen, PackArray<BluetoothConfigurationParameter>(aParam, aLen), *pdu);
@ -106,12 +107,12 @@ protected:
// Called to handle PDUs with Service field equal to 0x00, which
// contains internal operations for setup and configuration.
void HandleSvc(const BluetoothDaemonPDUHeader& aHeader,
BluetoothDaemonPDU& aPDU, void* aUserData)
void HandleSvc(const DaemonSocketPDUHeader& aHeader,
DaemonSocketPDU& aPDU, void* aUserData)
{
static void (BluetoothDaemonSetupModule::* const HandleRsp[])(
const BluetoothDaemonPDUHeader&,
BluetoothDaemonPDU&,
const DaemonSocketPDUHeader&,
DaemonSocketPDU&,
BluetoothSetupResultHandler*) = {
INIT_ARRAY_AT(0x00, &BluetoothDaemonSetupModule::ErrorRsp),
INIT_ARRAY_AT(0x01, &BluetoothDaemonSetupModule::RegisterModuleRsp),
@ -135,7 +136,7 @@ protected:
(this->*(HandleRsp[aHeader.mOpcode]))(aHeader, aPDU, res);
}
nsresult Send(BluetoothDaemonPDU* aPDU, BluetoothSetupResultHandler* aRes)
nsresult Send(DaemonSocketPDU* aPDU, BluetoothSetupResultHandler* aRes)
{
aRes->AddRef(); // Keep reference for response
return Send(aPDU, static_cast<void*>(aRes));
@ -154,8 +155,8 @@ private:
ErrorRunnable;
void
ErrorRsp(const BluetoothDaemonPDUHeader& aHeader,
BluetoothDaemonPDU& aPDU,
ErrorRsp(const DaemonSocketPDUHeader& aHeader,
DaemonSocketPDU& aPDU,
BluetoothSetupResultHandler* aRes)
{
ErrorRunnable::Dispatch(
@ -163,8 +164,8 @@ private:
}
void
RegisterModuleRsp(const BluetoothDaemonPDUHeader& aHeader,
BluetoothDaemonPDU& aPDU,
RegisterModuleRsp(const DaemonSocketPDUHeader& aHeader,
DaemonSocketPDU& aPDU,
BluetoothSetupResultHandler* aRes)
{
ResultRunnable::Dispatch(
@ -173,8 +174,8 @@ private:
}
void
UnregisterModuleRsp(const BluetoothDaemonPDUHeader& aHeader,
BluetoothDaemonPDU& aPDU,
UnregisterModuleRsp(const DaemonSocketPDUHeader& aHeader,
DaemonSocketPDU& aPDU,
BluetoothSetupResultHandler* aRes)
{
ResultRunnable::Dispatch(
@ -183,8 +184,8 @@ private:
}
void
ConfigurationRsp(const BluetoothDaemonPDUHeader& aHeader,
BluetoothDaemonPDU& aPDU,
ConfigurationRsp(const DaemonSocketPDUHeader& aHeader,
DaemonSocketPDU& aPDU,
BluetoothSetupResultHandler* aRes)
{
ResultRunnable::Dispatch(
@ -205,13 +206,13 @@ public:
static const int MAX_NUM_CLIENTS;
virtual nsresult Send(BluetoothDaemonPDU* aPDU, void* aUserData) = 0;
virtual nsresult Send(DaemonSocketPDU* aPDU, void* aUserData) = 0;
nsresult EnableCmd(BluetoothResultHandler* aRes)
{
MOZ_ASSERT(NS_IsMainThread());
nsAutoPtr<BluetoothDaemonPDU> pdu(new BluetoothDaemonPDU(0x01, 0x01, 0));
nsAutoPtr<DaemonSocketPDU> pdu(new DaemonSocketPDU(0x01, 0x01, 0));
nsresult rv = Send(pdu, aRes);
if (NS_FAILED(rv)) {
@ -225,7 +226,7 @@ public:
{
MOZ_ASSERT(NS_IsMainThread());
nsAutoPtr<BluetoothDaemonPDU> pdu(new BluetoothDaemonPDU(0x01, 0x02, 0));
nsAutoPtr<DaemonSocketPDU> pdu(new DaemonSocketPDU(0x01, 0x02, 0));
nsresult rv = Send(pdu, aRes);
if (NS_FAILED(rv)) {
@ -239,7 +240,7 @@ public:
{
MOZ_ASSERT(NS_IsMainThread());
nsAutoPtr<BluetoothDaemonPDU> pdu(new BluetoothDaemonPDU(0x01, 0x03, 0));
nsAutoPtr<DaemonSocketPDU> pdu(new DaemonSocketPDU(0x01, 0x03, 0));
nsresult rv = Send(pdu, aRes);
if (NS_FAILED(rv)) {
@ -254,7 +255,7 @@ public:
{
MOZ_ASSERT(NS_IsMainThread());
nsAutoPtr<BluetoothDaemonPDU> pdu(new BluetoothDaemonPDU(0x01, 0x04, 0));
nsAutoPtr<DaemonSocketPDU> pdu(new DaemonSocketPDU(0x01, 0x04, 0));
nsresult rv = PackPDU(
PackConversion<const nsAString, BluetoothPropertyType>(aName), *pdu);
@ -274,7 +275,7 @@ public:
{
MOZ_ASSERT(NS_IsMainThread());
nsAutoPtr<BluetoothDaemonPDU> pdu(new BluetoothDaemonPDU(0x01, 0x05, 0));
nsAutoPtr<DaemonSocketPDU> pdu(new DaemonSocketPDU(0x01, 0x05, 0));
nsresult rv = PackPDU(aProperty, *pdu);
if (NS_FAILED(rv)) {
@ -293,7 +294,7 @@ public:
{
MOZ_ASSERT(NS_IsMainThread());
nsAutoPtr<BluetoothDaemonPDU> pdu(new BluetoothDaemonPDU(0x01, 0x06, 0));
nsAutoPtr<DaemonSocketPDU> pdu(new DaemonSocketPDU(0x01, 0x06, 0));
nsresult rv = PackPDU(
PackConversion<nsAString, BluetoothAddress>(aRemoteAddr), *pdu);
@ -314,7 +315,7 @@ public:
{
MOZ_ASSERT(NS_IsMainThread());
nsAutoPtr<BluetoothDaemonPDU> pdu(new BluetoothDaemonPDU(0x01, 0x07, 0));
nsAutoPtr<DaemonSocketPDU> pdu(new DaemonSocketPDU(0x01, 0x07, 0));
nsresult rv = PackPDU(
PackConversion<nsAString, BluetoothAddress>(aRemoteAddr),
@ -336,7 +337,7 @@ public:
{
MOZ_ASSERT(NS_IsMainThread());
nsAutoPtr<BluetoothDaemonPDU> pdu(new BluetoothDaemonPDU(0x01, 0x08, 0));
nsAutoPtr<DaemonSocketPDU> pdu(new DaemonSocketPDU(0x01, 0x08, 0));
nsresult rv = PackPDU(
PackConversion<nsAString, BluetoothAddress>(aRemoteAddr),
@ -358,7 +359,7 @@ public:
{
MOZ_ASSERT(NS_IsMainThread());
nsAutoPtr<BluetoothDaemonPDU> pdu(new BluetoothDaemonPDU(0x01, 0x09, 0));
nsAutoPtr<DaemonSocketPDU> pdu(new DaemonSocketPDU(0x01, 0x09, 0));
nsresult rv = PackPDU(
PackConversion<nsAString, BluetoothAddress>(aRemoteAddr),
@ -379,7 +380,7 @@ public:
{
MOZ_ASSERT(NS_IsMainThread());
nsAutoPtr<BluetoothDaemonPDU> pdu(new BluetoothDaemonPDU(0x01, 0x0a, 0));
nsAutoPtr<DaemonSocketPDU> pdu(new DaemonSocketPDU(0x01, 0x0a, 0));
nsresult rv = PackPDU(
PackConversion<nsAString, BluetoothAddress>(aRemoteAddr), *pdu);
@ -398,7 +399,7 @@ public:
{
MOZ_ASSERT(NS_IsMainThread());
nsAutoPtr<BluetoothDaemonPDU> pdu(new BluetoothDaemonPDU(0x01, 0x0b, 0));
nsAutoPtr<DaemonSocketPDU> pdu(new DaemonSocketPDU(0x01, 0x0b, 0));
nsresult rv = Send(pdu, aRes);
if (NS_FAILED(rv)) {
@ -412,7 +413,7 @@ public:
{
MOZ_ASSERT(NS_IsMainThread());
nsAutoPtr<BluetoothDaemonPDU> pdu(new BluetoothDaemonPDU(0x01, 0x0c, 0));
nsAutoPtr<DaemonSocketPDU> pdu(new DaemonSocketPDU(0x01, 0x0c, 0));
nsresult rv = Send(pdu, aRes);
if (NS_FAILED(rv)) {
@ -428,7 +429,7 @@ public:
{
MOZ_ASSERT(NS_IsMainThread());
nsAutoPtr<BluetoothDaemonPDU> pdu(new BluetoothDaemonPDU(0x01, 0x0d, 0));
nsAutoPtr<DaemonSocketPDU> pdu(new DaemonSocketPDU(0x01, 0x0d, 0));
#if ANDROID_VERSION >= 21
nsresult rv = PackPDU(
@ -453,7 +454,7 @@ public:
{
MOZ_ASSERT(NS_IsMainThread());
nsAutoPtr<BluetoothDaemonPDU> pdu(new BluetoothDaemonPDU(0x01, 0x0e, 0));
nsAutoPtr<DaemonSocketPDU> pdu(new DaemonSocketPDU(0x01, 0x0e, 0));
nsresult rv = PackPDU(
PackConversion<nsAString, BluetoothAddress>(aBdAddr), *pdu);
@ -473,7 +474,7 @@ public:
{
MOZ_ASSERT(NS_IsMainThread());
nsAutoPtr<BluetoothDaemonPDU> pdu(new BluetoothDaemonPDU(0x01, 0x0f, 0));
nsAutoPtr<DaemonSocketPDU> pdu(new DaemonSocketPDU(0x01, 0x0f, 0));
nsresult rv = PackPDU(
PackConversion<nsAString, BluetoothAddress>(aBdAddr), *pdu);
@ -494,7 +495,7 @@ public:
{
MOZ_ASSERT(NS_IsMainThread());
nsAutoPtr<BluetoothDaemonPDU> pdu(new BluetoothDaemonPDU(0x01, 0x10, 0));
nsAutoPtr<DaemonSocketPDU> pdu(new DaemonSocketPDU(0x01, 0x10, 0));
nsresult rv = PackPDU(
PackConversion<nsAString, BluetoothAddress>(aBdAddr),
@ -517,7 +518,7 @@ public:
{
MOZ_ASSERT(NS_IsMainThread());
nsAutoPtr<BluetoothDaemonPDU> pdu(new BluetoothDaemonPDU(0x01, 0x11, 0));
nsAutoPtr<DaemonSocketPDU> pdu(new DaemonSocketPDU(0x01, 0x11, 0));
nsresult rv = PackPDU(
PackConversion<nsAString, BluetoothAddress>(aBdAddr),
@ -537,7 +538,7 @@ public:
{
MOZ_ASSERT(NS_IsMainThread());
nsAutoPtr<BluetoothDaemonPDU> pdu(new BluetoothDaemonPDU(0x01, 0x12, 0));
nsAutoPtr<DaemonSocketPDU> pdu(new DaemonSocketPDU(0x01, 0x12, 0));
nsresult rv = PackPDU(aEnable, *pdu);
if (NS_FAILED(rv)) {
@ -556,7 +557,7 @@ public:
{
MOZ_ASSERT(NS_IsMainThread());
nsAutoPtr<BluetoothDaemonPDU> pdu(new BluetoothDaemonPDU(0x01, 0x13, 0));
nsAutoPtr<DaemonSocketPDU> pdu(new DaemonSocketPDU(0x01, 0x13, 0));
nsresult rv = PackPDU(aOpcode, aLen, PackArray<uint8_t>(aBuf, aLen),
*pdu);
@ -576,7 +577,7 @@ public:
{
MOZ_ASSERT(NS_IsMainThread());
nsAutoPtr<BluetoothDaemonPDU> pdu(new BluetoothDaemonPDU(0x01, 0x14, 0));
nsAutoPtr<DaemonSocketPDU> pdu(new DaemonSocketPDU(0x01, 0x14, 0));
nsresult rv = PackPDU(aOpcode, aLen, PackArray<uint8_t>(aBuf, aLen),
*pdu);
@ -593,11 +594,11 @@ public:
protected:
void HandleSvc(const BluetoothDaemonPDUHeader& aHeader,
BluetoothDaemonPDU& aPDU, void* aUserData)
void HandleSvc(const DaemonSocketPDUHeader& aHeader,
DaemonSocketPDU& aPDU, void* aUserData)
{
static void (BluetoothDaemonCoreModule::* const HandleOp[])(
const BluetoothDaemonPDUHeader&, BluetoothDaemonPDU&, void*) = {
const DaemonSocketPDUHeader&, DaemonSocketPDU&, void*) = {
INIT_ARRAY_AT(0, &BluetoothDaemonCoreModule::HandleRsp),
INIT_ARRAY_AT(1, &BluetoothDaemonCoreModule::HandleNtf),
};
@ -607,7 +608,7 @@ protected:
(this->*(HandleOp[!!(aHeader.mOpcode & 0x80)]))(aHeader, aPDU, aUserData);
}
nsresult Send(BluetoothDaemonPDU* aPDU, BluetoothResultHandler* aRes)
nsresult Send(DaemonSocketPDU* aPDU, BluetoothResultHandler* aRes)
{
aRes->AddRef(); // Keep reference for response
return Send(aPDU, static_cast<void*>(aRes));
@ -625,32 +626,32 @@ private:
BluetoothStatus, BluetoothStatus>
ErrorRunnable;
void ErrorRsp(const BluetoothDaemonPDUHeader& aHeader,
BluetoothDaemonPDU& aPDU,
void ErrorRsp(const DaemonSocketPDUHeader& aHeader,
DaemonSocketPDU& aPDU,
BluetoothResultHandler* aRes)
{
ErrorRunnable::Dispatch(
aRes, &BluetoothResultHandler::OnError, UnpackPDUInitOp(aPDU));
}
void EnableRsp(const BluetoothDaemonPDUHeader& aHeader,
BluetoothDaemonPDU& aPDU,
void EnableRsp(const DaemonSocketPDUHeader& aHeader,
DaemonSocketPDU& aPDU,
BluetoothResultHandler* aRes)
{
ResultRunnable::Dispatch(
aRes, &BluetoothResultHandler::Enable, UnpackPDUInitOp(aPDU));
}
void DisableRsp(const BluetoothDaemonPDUHeader& aHeader,
BluetoothDaemonPDU& aPDU,
void DisableRsp(const DaemonSocketPDUHeader& aHeader,
DaemonSocketPDU& aPDU,
BluetoothResultHandler* aRes)
{
ResultRunnable::Dispatch(
aRes, &BluetoothResultHandler::Disable, UnpackPDUInitOp(aPDU));
}
void GetAdapterPropertiesRsp(const BluetoothDaemonPDUHeader& aHeader,
BluetoothDaemonPDU& aPDU,
void GetAdapterPropertiesRsp(const DaemonSocketPDUHeader& aHeader,
DaemonSocketPDU& aPDU,
BluetoothResultHandler* aRes)
{
ResultRunnable::Dispatch(
@ -658,8 +659,8 @@ private:
UnpackPDUInitOp(aPDU));
}
void GetAdapterPropertyRsp(const BluetoothDaemonPDUHeader& aHeader,
BluetoothDaemonPDU& aPDU,
void GetAdapterPropertyRsp(const DaemonSocketPDUHeader& aHeader,
DaemonSocketPDU& aPDU,
BluetoothResultHandler* aRes)
{
ResultRunnable::Dispatch(
@ -667,8 +668,8 @@ private:
UnpackPDUInitOp(aPDU));
}
void SetAdapterPropertyRsp(const BluetoothDaemonPDUHeader& aHeader,
BluetoothDaemonPDU& aPDU,
void SetAdapterPropertyRsp(const DaemonSocketPDUHeader& aHeader,
DaemonSocketPDU& aPDU,
BluetoothResultHandler* aRes)
{
ResultRunnable::Dispatch(
@ -676,8 +677,8 @@ private:
UnpackPDUInitOp(aPDU));
}
void GetRemoteDevicePropertiesRsp(const BluetoothDaemonPDUHeader& aHeader,
BluetoothDaemonPDU& aPDU,
void GetRemoteDevicePropertiesRsp(const DaemonSocketPDUHeader& aHeader,
DaemonSocketPDU& aPDU,
BluetoothResultHandler* aRes)
{
ResultRunnable::Dispatch(
@ -686,8 +687,8 @@ private:
}
void
GetRemoteDevicePropertyRsp(const BluetoothDaemonPDUHeader& aHeader,
BluetoothDaemonPDU& aPDU,
GetRemoteDevicePropertyRsp(const DaemonSocketPDUHeader& aHeader,
DaemonSocketPDU& aPDU,
BluetoothResultHandler* aRes)
{
ResultRunnable::Dispatch(
@ -695,8 +696,8 @@ private:
UnpackPDUInitOp(aPDU));
}
void SetRemoteDevicePropertyRsp(const BluetoothDaemonPDUHeader& aHeader,
BluetoothDaemonPDU& aPDU,
void SetRemoteDevicePropertyRsp(const DaemonSocketPDUHeader& aHeader,
DaemonSocketPDU& aPDU,
BluetoothResultHandler* aRes)
{
ResultRunnable::Dispatch(
@ -704,8 +705,8 @@ private:
UnpackPDUInitOp(aPDU));
}
void GetRemoteServiceRecordRsp(const BluetoothDaemonPDUHeader& aHeader,
BluetoothDaemonPDU& aPDU,
void GetRemoteServiceRecordRsp(const DaemonSocketPDUHeader& aHeader,
DaemonSocketPDU& aPDU,
BluetoothResultHandler* aRes)
{
ResultRunnable::Dispatch(
@ -713,8 +714,8 @@ private:
UnpackPDUInitOp(aPDU));
}
void GetRemoteServicesRsp(const BluetoothDaemonPDUHeader& aHeader,
BluetoothDaemonPDU& aPDU,
void GetRemoteServicesRsp(const DaemonSocketPDUHeader& aHeader,
DaemonSocketPDU& aPDU,
BluetoothResultHandler* aRes)
{
ResultRunnable::Dispatch(
@ -722,8 +723,8 @@ private:
UnpackPDUInitOp(aPDU));
}
void StartDiscoveryRsp(const BluetoothDaemonPDUHeader& aHeader,
BluetoothDaemonPDU& aPDU,
void StartDiscoveryRsp(const DaemonSocketPDUHeader& aHeader,
DaemonSocketPDU& aPDU,
BluetoothResultHandler* aRes)
{
ResultRunnable::Dispatch(
@ -731,8 +732,8 @@ private:
UnpackPDUInitOp(aPDU));
}
void CancelDiscoveryRsp(const BluetoothDaemonPDUHeader& aHeader,
BluetoothDaemonPDU& aPDU,
void CancelDiscoveryRsp(const DaemonSocketPDUHeader& aHeader,
DaemonSocketPDU& aPDU,
BluetoothResultHandler* aRes)
{
ResultRunnable::Dispatch(
@ -740,8 +741,8 @@ private:
UnpackPDUInitOp(aPDU));
}
void CreateBondRsp(const BluetoothDaemonPDUHeader& aHeader,
BluetoothDaemonPDU& aPDU,
void CreateBondRsp(const DaemonSocketPDUHeader& aHeader,
DaemonSocketPDU& aPDU,
BluetoothResultHandler* aRes)
{
ResultRunnable::Dispatch(
@ -749,8 +750,8 @@ private:
UnpackPDUInitOp(aPDU));
}
void RemoveBondRsp(const BluetoothDaemonPDUHeader& aHeader,
BluetoothDaemonPDU& aPDU,
void RemoveBondRsp(const DaemonSocketPDUHeader& aHeader,
DaemonSocketPDU& aPDU,
BluetoothResultHandler* aRes)
{
ResultRunnable::Dispatch(
@ -758,8 +759,8 @@ private:
UnpackPDUInitOp(aPDU));
}
void CancelBondRsp(const BluetoothDaemonPDUHeader& aHeader,
BluetoothDaemonPDU& aPDU,
void CancelBondRsp(const DaemonSocketPDUHeader& aHeader,
DaemonSocketPDU& aPDU,
BluetoothResultHandler* aRes)
{
ResultRunnable::Dispatch(
@ -767,8 +768,8 @@ private:
UnpackPDUInitOp(aPDU));
}
void PinReplyRsp(const BluetoothDaemonPDUHeader& aHeader,
BluetoothDaemonPDU& aPDU,
void PinReplyRsp(const DaemonSocketPDUHeader& aHeader,
DaemonSocketPDU& aPDU,
BluetoothResultHandler* aRes)
{
ResultRunnable::Dispatch(
@ -776,8 +777,8 @@ private:
UnpackPDUInitOp(aPDU));
}
void SspReplyRsp(const BluetoothDaemonPDUHeader& aHeader,
BluetoothDaemonPDU& aPDU,
void SspReplyRsp(const DaemonSocketPDUHeader& aHeader,
DaemonSocketPDU& aPDU,
BluetoothResultHandler* aRes)
{
ResultRunnable::Dispatch(
@ -785,8 +786,8 @@ private:
UnpackPDUInitOp(aPDU));
}
void DutModeConfigureRsp(const BluetoothDaemonPDUHeader& aHeader,
BluetoothDaemonPDU& aPDU,
void DutModeConfigureRsp(const DaemonSocketPDUHeader& aHeader,
DaemonSocketPDU& aPDU,
BluetoothResultHandler* aRes)
{
ResultRunnable::Dispatch(
@ -794,8 +795,8 @@ private:
UnpackPDUInitOp(aPDU));
}
void DutModeSendRsp(const BluetoothDaemonPDUHeader& aHeader,
BluetoothDaemonPDU& aPDU,
void DutModeSendRsp(const DaemonSocketPDUHeader& aHeader,
DaemonSocketPDU& aPDU,
BluetoothResultHandler* aRes)
{
ResultRunnable::Dispatch(
@ -803,8 +804,8 @@ private:
UnpackPDUInitOp(aPDU));
}
void LeTestModeRsp(const BluetoothDaemonPDUHeader& aHeader,
BluetoothDaemonPDU& aPDU,
void LeTestModeRsp(const DaemonSocketPDUHeader& aHeader,
DaemonSocketPDU& aPDU,
BluetoothResultHandler* aRes)
{
ResultRunnable::Dispatch(
@ -812,12 +813,12 @@ private:
UnpackPDUInitOp(aPDU));
}
void HandleRsp(const BluetoothDaemonPDUHeader& aHeader,
BluetoothDaemonPDU& aPDU, void* aUserData)
void HandleRsp(const DaemonSocketPDUHeader& aHeader,
DaemonSocketPDU& aPDU, void* aUserData)
{
static void (BluetoothDaemonCoreModule::* const HandleRsp[])(
const BluetoothDaemonPDUHeader&,
BluetoothDaemonPDU&,
const DaemonSocketPDUHeader&,
DaemonSocketPDU&,
BluetoothResultHandler*) = {
INIT_ARRAY_AT(0x00, &BluetoothDaemonCoreModule::ErrorRsp),
INIT_ARRAY_AT(0x01, &BluetoothDaemonCoreModule::EnableRsp),
@ -939,8 +940,8 @@ private:
BluetoothStatus, uint16_t>
LeTestModeNotification;
void AdapterStateChangedNtf(const BluetoothDaemonPDUHeader& aHeader,
BluetoothDaemonPDU& aPDU)
void AdapterStateChangedNtf(const DaemonSocketPDUHeader& aHeader,
DaemonSocketPDU& aPDU)
{
AdapterStateChangedNotification::Dispatch(
&BluetoothNotificationHandler::AdapterStateChangedNotification,
@ -951,7 +952,7 @@ private:
class AdapterPropertiesInitOp final : private PDUInitOp
{
public:
AdapterPropertiesInitOp(BluetoothDaemonPDU& aPDU)
AdapterPropertiesInitOp(DaemonSocketPDU& aPDU)
: PDUInitOp(aPDU)
{ }
@ -959,7 +960,7 @@ private:
operator () (BluetoothStatus& aArg1, int& aArg2,
nsAutoArrayPtr<BluetoothProperty>& aArg3) const
{
BluetoothDaemonPDU& pdu = GetPDU();
DaemonSocketPDU& pdu = GetPDU();
/* Read status */
nsresult rv = UnpackPDU(pdu, aArg1);
@ -986,8 +987,8 @@ private:
}
};
void AdapterPropertiesNtf(const BluetoothDaemonPDUHeader& aHeader,
BluetoothDaemonPDU& aPDU)
void AdapterPropertiesNtf(const DaemonSocketPDUHeader& aHeader,
DaemonSocketPDU& aPDU)
{
AdapterPropertiesNotification::Dispatch(
&BluetoothNotificationHandler::AdapterPropertiesNotification,
@ -998,7 +999,7 @@ private:
class RemoteDevicePropertiesInitOp final : private PDUInitOp
{
public:
RemoteDevicePropertiesInitOp(BluetoothDaemonPDU& aPDU)
RemoteDevicePropertiesInitOp(DaemonSocketPDU& aPDU)
: PDUInitOp(aPDU)
{ }
@ -1006,7 +1007,7 @@ private:
operator () (BluetoothStatus& aArg1, nsString& aArg2, int& aArg3,
nsAutoArrayPtr<BluetoothProperty>& aArg4) const
{
BluetoothDaemonPDU& pdu = GetPDU();
DaemonSocketPDU& pdu = GetPDU();
/* Read status */
nsresult rv = UnpackPDU(pdu, aArg1);
@ -1040,8 +1041,8 @@ private:
}
};
void RemoteDevicePropertiesNtf(const BluetoothDaemonPDUHeader& aHeader,
BluetoothDaemonPDU& aPDU)
void RemoteDevicePropertiesNtf(const DaemonSocketPDUHeader& aHeader,
DaemonSocketPDU& aPDU)
{
RemoteDevicePropertiesNotification::Dispatch(
&BluetoothNotificationHandler::RemoteDevicePropertiesNotification,
@ -1052,14 +1053,14 @@ private:
class DeviceFoundInitOp final : private PDUInitOp
{
public:
DeviceFoundInitOp(BluetoothDaemonPDU& aPDU)
DeviceFoundInitOp(DaemonSocketPDU& aPDU)
: PDUInitOp(aPDU)
{ }
nsresult
operator () (int& aArg1, nsAutoArrayPtr<BluetoothProperty>& aArg2) const
{
BluetoothDaemonPDU& pdu = GetPDU();
DaemonSocketPDU& pdu = GetPDU();
/* Read number of properties */
uint8_t numProperties;
@ -1080,16 +1081,16 @@ private:
}
};
void DeviceFoundNtf(const BluetoothDaemonPDUHeader& aHeader,
BluetoothDaemonPDU& aPDU)
void DeviceFoundNtf(const DaemonSocketPDUHeader& aHeader,
DaemonSocketPDU& aPDU)
{
DeviceFoundNotification::Dispatch(
&BluetoothNotificationHandler::DeviceFoundNotification,
DeviceFoundInitOp(aPDU));
}
void DiscoveryStateChangedNtf(const BluetoothDaemonPDUHeader& aHeader,
BluetoothDaemonPDU& aPDU)
void DiscoveryStateChangedNtf(const DaemonSocketPDUHeader& aHeader,
DaemonSocketPDU& aPDU)
{
DiscoveryStateChangedNotification::Dispatch(
&BluetoothNotificationHandler::DiscoveryStateChangedNotification,
@ -1100,14 +1101,14 @@ private:
class PinRequestInitOp final : private PDUInitOp
{
public:
PinRequestInitOp(BluetoothDaemonPDU& aPDU)
PinRequestInitOp(DaemonSocketPDU& aPDU)
: PDUInitOp(aPDU)
{ }
nsresult
operator () (nsString& aArg1, nsString& aArg2, uint32_t& aArg3) const
{
BluetoothDaemonPDU& pdu = GetPDU();
DaemonSocketPDU& pdu = GetPDU();
/* Read remote address */
nsresult rv = UnpackPDU(
@ -1133,8 +1134,8 @@ private:
}
};
void PinRequestNtf(const BluetoothDaemonPDUHeader& aHeader,
BluetoothDaemonPDU& aPDU)
void PinRequestNtf(const DaemonSocketPDUHeader& aHeader,
DaemonSocketPDU& aPDU)
{
PinRequestNotification::Dispatch(
&BluetoothNotificationHandler::PinRequestNotification,
@ -1145,7 +1146,7 @@ private:
class SspRequestInitOp final : private PDUInitOp
{
public:
SspRequestInitOp(BluetoothDaemonPDU& aPDU)
SspRequestInitOp(DaemonSocketPDU& aPDU)
: PDUInitOp(aPDU)
{ }
@ -1153,7 +1154,7 @@ private:
operator () (nsString& aArg1, nsString& aArg2, uint32_t& aArg3,
BluetoothSspVariant& aArg4, uint32_t& aArg5) const
{
BluetoothDaemonPDU& pdu = GetPDU();
DaemonSocketPDU& pdu = GetPDU();
/* Read remote address */
nsresult rv = UnpackPDU(
@ -1191,8 +1192,8 @@ private:
}
};
void SspRequestNtf(const BluetoothDaemonPDUHeader& aHeader,
BluetoothDaemonPDU& aPDU)
void SspRequestNtf(const DaemonSocketPDUHeader& aHeader,
DaemonSocketPDU& aPDU)
{
SspRequestNotification::Dispatch(
&BluetoothNotificationHandler::SspRequestNotification,
@ -1203,7 +1204,7 @@ private:
class BondStateChangedInitOp final : private PDUInitOp
{
public:
BondStateChangedInitOp(BluetoothDaemonPDU& aPDU)
BondStateChangedInitOp(DaemonSocketPDU& aPDU)
: PDUInitOp(aPDU)
{ }
@ -1211,7 +1212,7 @@ private:
operator () (BluetoothStatus& aArg1, nsString& aArg2,
BluetoothBondState& aArg3) const
{
BluetoothDaemonPDU& pdu = GetPDU();
DaemonSocketPDU& pdu = GetPDU();
/* Read status */
nsresult rv = UnpackPDU(pdu, aArg1);
@ -1236,8 +1237,8 @@ private:
}
};
void BondStateChangedNtf(const BluetoothDaemonPDUHeader& aHeader,
BluetoothDaemonPDU& aPDU)
void BondStateChangedNtf(const DaemonSocketPDUHeader& aHeader,
DaemonSocketPDU& aPDU)
{
BondStateChangedNotification::Dispatch(
&BluetoothNotificationHandler::BondStateChangedNotification,
@ -1248,14 +1249,14 @@ private:
class AclStateChangedInitOp final : private PDUInitOp
{
public:
AclStateChangedInitOp(BluetoothDaemonPDU& aPDU)
AclStateChangedInitOp(DaemonSocketPDU& aPDU)
: PDUInitOp(aPDU)
{ }
nsresult
operator () (BluetoothStatus& aArg1, nsString& aArg2, bool& aArg3) const
{
BluetoothDaemonPDU& pdu = GetPDU();
DaemonSocketPDU& pdu = GetPDU();
/* Read status */
nsresult rv = UnpackPDU(pdu, aArg1);
@ -1281,8 +1282,8 @@ private:
}
};
void AclStateChangedNtf(const BluetoothDaemonPDUHeader& aHeader,
BluetoothDaemonPDU& aPDU)
void AclStateChangedNtf(const DaemonSocketPDUHeader& aHeader,
DaemonSocketPDU& aPDU)
{
AclStateChangedNotification::Dispatch(
&BluetoothNotificationHandler::AclStateChangedNotification,
@ -1293,7 +1294,7 @@ private:
class DutModeRecvInitOp final : private PDUInitOp
{
public:
DutModeRecvInitOp(BluetoothDaemonPDU& aPDU)
DutModeRecvInitOp(DaemonSocketPDU& aPDU)
: PDUInitOp(aPDU)
{ }
@ -1301,7 +1302,7 @@ private:
operator () (uint16_t& aArg1, nsAutoArrayPtr<uint8_t>& aArg2,
uint8_t& aArg3) const
{
BluetoothDaemonPDU& pdu = GetPDU();
DaemonSocketPDU& pdu = GetPDU();
/* Read opcode */
nsresult rv = UnpackPDU(pdu, aArg1);
@ -1325,27 +1326,27 @@ private:
}
};
void DutModeRecvNtf(const BluetoothDaemonPDUHeader& aHeader,
BluetoothDaemonPDU& aPDU)
void DutModeRecvNtf(const DaemonSocketPDUHeader& aHeader,
DaemonSocketPDU& aPDU)
{
DutModeRecvNotification::Dispatch(
&BluetoothNotificationHandler::DutModeRecvNotification,
DutModeRecvInitOp(aPDU));
}
void LeTestModeNtf(const BluetoothDaemonPDUHeader& aHeader,
BluetoothDaemonPDU& aPDU)
void LeTestModeNtf(const DaemonSocketPDUHeader& aHeader,
DaemonSocketPDU& aPDU)
{
LeTestModeNotification::Dispatch(
&BluetoothNotificationHandler::LeTestModeNotification,
UnpackPDUInitOp(aPDU));
}
void HandleNtf(const BluetoothDaemonPDUHeader& aHeader,
BluetoothDaemonPDU& aPDU, void* aUserData)
void HandleNtf(const DaemonSocketPDUHeader& aHeader,
DaemonSocketPDU& aPDU, void* aUserData)
{
static void (BluetoothDaemonCoreModule::* const HandleNtf[])(
const BluetoothDaemonPDUHeader&, BluetoothDaemonPDU&) = {
const DaemonSocketPDUHeader&, DaemonSocketPDU&) = {
INIT_ARRAY_AT(0, &BluetoothDaemonCoreModule::AdapterStateChangedNtf),
INIT_ARRAY_AT(1, &BluetoothDaemonCoreModule::AdapterPropertiesNtf),
INIT_ARRAY_AT(2, &BluetoothDaemonCoreModule::RemoteDevicePropertiesNtf),
@ -1404,8 +1405,8 @@ const int BluetoothDaemonCoreModule::MAX_NUM_CLIENTS = 1;
// |UnregisterModule| works like |RegisterModule|, but for cleanups.
//
// |BluetoothDaemonProtocol| also handles PDU receiving. It implements
// the method |Handle| from |BluetoothDaemonPDUConsumer|. The socket
// connections of type |BluetoothDaemonConnection| invoke this method
// the method |Handle| from |DaemonSocketIOConsumer|. The socket
// connections of type |DaemonSocket| invoke this method
// to forward received PDUs for processing by higher layers. The
// implementation of |Handle| checks the service id of the PDU and
// forwards it to the correct module class using the module's method
@ -1427,7 +1428,7 @@ const int BluetoothDaemonCoreModule::MAX_NUM_CLIENTS = 1;
// PDUs into a module.
//
class BluetoothDaemonProtocol final
: public BluetoothDaemonPDUConsumer
: public DaemonSocketIOConsumer
, public BluetoothDaemonSetupModule
, public BluetoothDaemonCoreModule
, public BluetoothDaemonSocketModule
@ -1439,7 +1440,7 @@ class BluetoothDaemonProtocol final
public:
BluetoothDaemonProtocol();
void SetConnection(BluetoothDaemonConnection* aConnection);
void SetConnection(DaemonSocket* aConnection);
nsresult RegisterModule(uint8_t aId, uint8_t aMode, uint32_t aMaxNumClients,
BluetoothSetupResultHandler* aRes) override;
@ -1450,34 +1451,34 @@ public:
// Outgoing PDUs
//
nsresult Send(BluetoothDaemonPDU* aPDU, void* aUserData) override;
nsresult Send(DaemonSocketPDU* aPDU, void* aUserData) override;
void StoreUserData(const BluetoothDaemonPDU& aPDU) override;
void StoreUserData(const DaemonSocketPDU& aPDU) override;
// Incoming PUDs
//
void Handle(BluetoothDaemonPDU& aPDU) override;
void Handle(DaemonSocketPDU& aPDU) override;
void* FetchUserData(const BluetoothDaemonPDUHeader& aHeader);
void* FetchUserData(const DaemonSocketPDUHeader& aHeader);
private:
void HandleSetupSvc(const BluetoothDaemonPDUHeader& aHeader,
BluetoothDaemonPDU& aPDU, void* aUserData);
void HandleCoreSvc(const BluetoothDaemonPDUHeader& aHeader,
BluetoothDaemonPDU& aPDU, void* aUserData);
void HandleSocketSvc(const BluetoothDaemonPDUHeader& aHeader,
BluetoothDaemonPDU& aPDU, void* aUserData);
void HandleHandsfreeSvc(const BluetoothDaemonPDUHeader& aHeader,
BluetoothDaemonPDU& aPDU, void* aUserData);
void HandleA2dpSvc(const BluetoothDaemonPDUHeader& aHeader,
BluetoothDaemonPDU& aPDU, void* aUserData);
void HandleAvrcpSvc(const BluetoothDaemonPDUHeader& aHeader,
BluetoothDaemonPDU& aPDU, void* aUserData);
void HandleGattSvc(const BluetoothDaemonPDUHeader& aHeader,
BluetoothDaemonPDU& aPDU, void* aUserData);
void HandleSetupSvc(const DaemonSocketPDUHeader& aHeader,
DaemonSocketPDU& aPDU, void* aUserData);
void HandleCoreSvc(const DaemonSocketPDUHeader& aHeader,
DaemonSocketPDU& aPDU, void* aUserData);
void HandleSocketSvc(const DaemonSocketPDUHeader& aHeader,
DaemonSocketPDU& aPDU, void* aUserData);
void HandleHandsfreeSvc(const DaemonSocketPDUHeader& aHeader,
DaemonSocketPDU& aPDU, void* aUserData);
void HandleA2dpSvc(const DaemonSocketPDUHeader& aHeader,
DaemonSocketPDU& aPDU, void* aUserData);
void HandleAvrcpSvc(const DaemonSocketPDUHeader& aHeader,
DaemonSocketPDU& aPDU, void* aUserData);
void HandleGattSvc(const DaemonSocketPDUHeader& aHeader,
DaemonSocketPDU& aPDU, void* aUserData);
BluetoothDaemonConnection* mConnection;
DaemonSocket* mConnection;
nsTArray<void*> mUserDataQ;
};
@ -1485,7 +1486,7 @@ BluetoothDaemonProtocol::BluetoothDaemonProtocol()
{ }
void
BluetoothDaemonProtocol::SetConnection(BluetoothDaemonConnection* aConnection)
BluetoothDaemonProtocol::SetConnection(DaemonSocket* aConnection)
{
mConnection = aConnection;
}
@ -1507,7 +1508,7 @@ BluetoothDaemonProtocol::UnregisterModule(uint8_t aId,
}
nsresult
BluetoothDaemonProtocol::Send(BluetoothDaemonPDU* aPDU, void* aUserData)
BluetoothDaemonProtocol::Send(DaemonSocketPDU* aPDU, void* aUserData)
{
MOZ_ASSERT(mConnection);
MOZ_ASSERT(aPDU);
@ -1528,7 +1529,7 @@ BluetoothDaemonProtocol::Send(BluetoothDaemonPDU* aPDU, void* aUserData)
void
BluetoothDaemonProtocol::HandleSetupSvc(
const BluetoothDaemonPDUHeader& aHeader, BluetoothDaemonPDU& aPDU,
const DaemonSocketPDUHeader& aHeader, DaemonSocketPDU& aPDU,
void* aUserData)
{
BluetoothDaemonSetupModule::HandleSvc(aHeader, aPDU, aUserData);
@ -1536,7 +1537,7 @@ BluetoothDaemonProtocol::HandleSetupSvc(
void
BluetoothDaemonProtocol::HandleCoreSvc(
const BluetoothDaemonPDUHeader& aHeader, BluetoothDaemonPDU& aPDU,
const DaemonSocketPDUHeader& aHeader, DaemonSocketPDU& aPDU,
void* aUserData)
{
BluetoothDaemonCoreModule::HandleSvc(aHeader, aPDU, aUserData);
@ -1544,7 +1545,7 @@ BluetoothDaemonProtocol::HandleCoreSvc(
void
BluetoothDaemonProtocol::HandleSocketSvc(
const BluetoothDaemonPDUHeader& aHeader, BluetoothDaemonPDU& aPDU,
const DaemonSocketPDUHeader& aHeader, DaemonSocketPDU& aPDU,
void* aUserData)
{
BluetoothDaemonSocketModule::HandleSvc(aHeader, aPDU, aUserData);
@ -1552,7 +1553,7 @@ BluetoothDaemonProtocol::HandleSocketSvc(
void
BluetoothDaemonProtocol::HandleHandsfreeSvc(
const BluetoothDaemonPDUHeader& aHeader, BluetoothDaemonPDU& aPDU,
const DaemonSocketPDUHeader& aHeader, DaemonSocketPDU& aPDU,
void* aUserData)
{
BluetoothDaemonHandsfreeModule::HandleSvc(aHeader, aPDU, aUserData);
@ -1560,7 +1561,7 @@ BluetoothDaemonProtocol::HandleHandsfreeSvc(
void
BluetoothDaemonProtocol::HandleA2dpSvc(
const BluetoothDaemonPDUHeader& aHeader, BluetoothDaemonPDU& aPDU,
const DaemonSocketPDUHeader& aHeader, DaemonSocketPDU& aPDU,
void* aUserData)
{
BluetoothDaemonA2dpModule::HandleSvc(aHeader, aPDU, aUserData);
@ -1568,7 +1569,7 @@ BluetoothDaemonProtocol::HandleA2dpSvc(
void
BluetoothDaemonProtocol::HandleAvrcpSvc(
const BluetoothDaemonPDUHeader& aHeader, BluetoothDaemonPDU& aPDU,
const DaemonSocketPDUHeader& aHeader, DaemonSocketPDU& aPDU,
void* aUserData)
{
BluetoothDaemonAvrcpModule::HandleSvc(aHeader, aPDU, aUserData);
@ -1576,17 +1577,17 @@ BluetoothDaemonProtocol::HandleAvrcpSvc(
void
BluetoothDaemonProtocol::HandleGattSvc(
const BluetoothDaemonPDUHeader& aHeader, BluetoothDaemonPDU& aPDU,
const DaemonSocketPDUHeader& aHeader, DaemonSocketPDU& aPDU,
void* aUserData)
{
BluetoothDaemonGattModule::HandleSvc(aHeader, aPDU, aUserData);
}
void
BluetoothDaemonProtocol::Handle(BluetoothDaemonPDU& aPDU)
BluetoothDaemonProtocol::Handle(DaemonSocketPDU& aPDU)
{
static void (BluetoothDaemonProtocol::* const HandleSvc[])(
const BluetoothDaemonPDUHeader&, BluetoothDaemonPDU&, void*) = {
const DaemonSocketPDUHeader&, DaemonSocketPDU&, void*) = {
INIT_ARRAY_AT(0x00, &BluetoothDaemonProtocol::HandleSetupSvc),
INIT_ARRAY_AT(0x01, &BluetoothDaemonProtocol::HandleCoreSvc),
INIT_ARRAY_AT(0x02, &BluetoothDaemonProtocol::HandleSocketSvc),
@ -1603,7 +1604,7 @@ BluetoothDaemonProtocol::Handle(BluetoothDaemonPDU& aPDU)
&BluetoothDaemonProtocol::HandleGattSvc)
};
BluetoothDaemonPDUHeader header;
DaemonSocketPDUHeader header;
if (NS_FAILED(UnpackPDU(aPDU, header)) ||
NS_WARN_IF(!(header.mService < MOZ_ARRAY_LENGTH(HandleSvc))) ||
@ -1615,7 +1616,7 @@ BluetoothDaemonProtocol::Handle(BluetoothDaemonPDU& aPDU)
}
void
BluetoothDaemonProtocol::StoreUserData(const BluetoothDaemonPDU& aPDU)
BluetoothDaemonProtocol::StoreUserData(const DaemonSocketPDU& aPDU)
{
MOZ_ASSERT(!NS_IsMainThread());
@ -1623,7 +1624,7 @@ BluetoothDaemonProtocol::StoreUserData(const BluetoothDaemonPDU& aPDU)
}
void*
BluetoothDaemonProtocol::FetchUserData(const BluetoothDaemonPDUHeader& aHeader)
BluetoothDaemonProtocol::FetchUserData(const DaemonSocketPDUHeader& aHeader)
{
MOZ_ASSERT(!NS_IsMainThread());
@ -1863,7 +1864,7 @@ BluetoothDaemonInterface::Init(
// Init, step 1: Listen for command channel... */
if (!mCmdChannel) {
mCmdChannel = new BluetoothDaemonConnection(mProtocol, this, CMD_CHANNEL);
mCmdChannel = new DaemonSocket(mProtocol, this, CMD_CHANNEL);
} else if (
NS_WARN_IF(mCmdChannel->GetConnectionStatus() == SOCKET_CONNECTED)) {
// Command channel should not be open; let's close it.
@ -2321,7 +2322,7 @@ BluetoothDaemonInterface::GetBluetoothGattInterface()
return mGattInterface;
}
// |BluetoothDaemonConnectionConsumer|, |ListenSocketConsumer|
// |DaemonSocketConsumer|, |ListenSocketConsumer|
void
BluetoothDaemonInterface::OnConnectSuccess(int aIndex)
@ -2355,7 +2356,7 @@ BluetoothDaemonInterface::OnConnectSuccess(int aIndex)
case CMD_CHANNEL:
// Init, step 3: Listen for notification channel...
if (!mNtfChannel) {
mNtfChannel = new BluetoothDaemonConnection(mProtocol, this, NTF_CHANNEL);
mNtfChannel = new DaemonSocket(mProtocol, this, NTF_CHANNEL);
} else if (
NS_WARN_IF(mNtfChannel->GetConnectionStatus() == SOCKET_CONNECTED)) {
/* Notification channel should not be open; let's close it. */

View File

@ -8,13 +8,13 @@
#define mozilla_dom_bluetooth_bluedroid_bluetoothdaemoninterface_h__
#include "BluetoothInterface.h"
#include "mozilla/ipc/BluetoothDaemonConnectionConsumer.h"
#include "mozilla/ipc/DaemonSocketConsumer.h"
#include "mozilla/ipc/ListenSocketConsumer.h"
namespace mozilla {
namespace ipc {
class BluetoothDaemonConnection;
class DaemonSocket;
class ListenSocket;
}
@ -31,7 +31,7 @@ class BluetoothDaemonSocketInterface;
class BluetoothDaemonInterface final
: public BluetoothInterface
, public mozilla::ipc::BluetoothDaemonConnectionConsumer
, public mozilla::ipc::DaemonSocketConsumer
, public mozilla::ipc::ListenSocketConsumer
{
public:
@ -143,7 +143,7 @@ protected:
unsigned long aPostfixLength,
nsACString& aAddress);
// Methods for |BluetoothDaemonConnectionConsumer| and |ListenSocketConsumer|
// Methods for |DaemonSocketConsumer| and |ListenSocketConsumer|
//
void OnConnectSuccess(int aIndex) override;
@ -156,8 +156,8 @@ private:
nsCString mListenSocketName;
nsRefPtr<mozilla::ipc::ListenSocket> mListenSocket;
nsRefPtr<mozilla::ipc::BluetoothDaemonConnection> mCmdChannel;
nsRefPtr<mozilla::ipc::BluetoothDaemonConnection> mNtfChannel;
nsRefPtr<mozilla::ipc::DaemonSocket> mCmdChannel;
nsRefPtr<mozilla::ipc::DaemonSocket> mNtfChannel;
nsAutoPtr<BluetoothDaemonProtocol> mProtocol;
nsTArray<nsRefPtr<BluetoothResultHandler> > mResultHandlerQ;

View File

@ -30,7 +30,7 @@ BluetoothDaemonSocketModule::ListenCmd(BluetoothSocketType aType,
{
MOZ_ASSERT(NS_IsMainThread());
nsAutoPtr<BluetoothDaemonPDU> pdu(new BluetoothDaemonPDU(0x02, 0x01, 0));
nsAutoPtr<DaemonSocketPDU> pdu(new DaemonSocketPDU(0x02, 0x01, 0));
nsresult rv = PackPDU(
aType,
@ -59,7 +59,7 @@ BluetoothDaemonSocketModule::ConnectCmd(const nsAString& aBdAddr,
{
MOZ_ASSERT(NS_IsMainThread());
nsAutoPtr<BluetoothDaemonPDU> pdu(new BluetoothDaemonPDU(0x02, 0x02, 0));
nsAutoPtr<DaemonSocketPDU> pdu(new DaemonSocketPDU(0x02, 0x02, 0));
nsresult rv = PackPDU(
PackConversion<nsAString, BluetoothAddress>(aBdAddr),
@ -156,13 +156,13 @@ BluetoothDaemonSocketModule::CloseCmd(BluetoothSocketResultHandler* aRes)
}
void
BluetoothDaemonSocketModule::HandleSvc(const BluetoothDaemonPDUHeader& aHeader,
BluetoothDaemonPDU& aPDU,
BluetoothDaemonSocketModule::HandleSvc(const DaemonSocketPDUHeader& aHeader,
DaemonSocketPDU& aPDU,
void* aUserData)
{
static void (BluetoothDaemonSocketModule::* const HandleRsp[])(
const BluetoothDaemonPDUHeader&,
BluetoothDaemonPDU&,
const DaemonSocketPDUHeader&,
DaemonSocketPDU&,
BluetoothSocketResultHandler*) = {
INIT_ARRAY_AT(0x00, &BluetoothDaemonSocketModule::ErrorRsp),
INIT_ARRAY_AT(0x01, &BluetoothDaemonSocketModule::ListenRsp),
@ -186,7 +186,7 @@ BluetoothDaemonSocketModule::HandleSvc(const BluetoothDaemonPDUHeader& aHeader,
}
nsresult
BluetoothDaemonSocketModule::Send(BluetoothDaemonPDU* aPDU,
BluetoothDaemonSocketModule::Send(DaemonSocketPDU* aPDU,
BluetoothSocketResultHandler* aRes)
{
aRes->AddRef(); // Keep reference for response
@ -203,8 +203,8 @@ BluetoothDaemonSocketModule::SocketFlags(bool aEncrypt, bool aAuth)
//
void
BluetoothDaemonSocketModule::ErrorRsp(const BluetoothDaemonPDUHeader& aHeader,
BluetoothDaemonPDU& aPDU,
BluetoothDaemonSocketModule::ErrorRsp(const DaemonSocketPDUHeader& aHeader,
DaemonSocketPDU& aPDU,
BluetoothSocketResultHandler* aRes)
{
ErrorRunnable::Dispatch(
@ -214,14 +214,14 @@ BluetoothDaemonSocketModule::ErrorRsp(const BluetoothDaemonPDUHeader& aHeader,
class BluetoothDaemonSocketModule::ListenInitOp final : private PDUInitOp
{
public:
ListenInitOp(BluetoothDaemonPDU& aPDU)
ListenInitOp(DaemonSocketPDU& aPDU)
: PDUInitOp(aPDU)
{ }
nsresult
operator () (int& aArg1) const
{
BluetoothDaemonPDU& pdu = GetPDU();
DaemonSocketPDU& pdu = GetPDU();
aArg1 = pdu.AcquireFd();
@ -234,8 +234,8 @@ public:
};
void
BluetoothDaemonSocketModule::ListenRsp(const BluetoothDaemonPDUHeader& aHeader,
BluetoothDaemonPDU& aPDU,
BluetoothDaemonSocketModule::ListenRsp(const DaemonSocketPDUHeader& aHeader,
DaemonSocketPDU& aPDU,
BluetoothSocketResultHandler* aRes)
{
IntResultRunnable::Dispatch(
@ -274,8 +274,8 @@ public:
};
void
BluetoothDaemonSocketModule::ConnectRsp(const BluetoothDaemonPDUHeader& aHeader,
BluetoothDaemonPDU& aPDU,
BluetoothDaemonSocketModule::ConnectRsp(const DaemonSocketPDUHeader& aHeader,
DaemonSocketPDU& aPDU,
BluetoothSocketResultHandler* aRes)
{
/* the file descriptor is attached in the PDU's ancillary data */

View File

@ -20,7 +20,7 @@ class BluetoothDaemonSocketModule
public:
static const int MAX_NUM_CLIENTS;
virtual nsresult Send(BluetoothDaemonPDU* aPDU, void* aUserData) = 0;
virtual nsresult Send(DaemonSocketPDU* aPDU, void* aUserData) = 0;
// Commands
//
@ -43,10 +43,10 @@ public:
protected:
void HandleSvc(const BluetoothDaemonPDUHeader& aHeader,
BluetoothDaemonPDU& aPDU, void* aUserData);
void HandleSvc(const DaemonSocketPDUHeader& aHeader,
DaemonSocketPDU& aPDU, void* aUserData);
nsresult Send(BluetoothDaemonPDU* aPDU, BluetoothSocketResultHandler* aRes);
nsresult Send(DaemonSocketPDU* aPDU, BluetoothSocketResultHandler* aRes);
private:
class AcceptWatcher;
@ -74,16 +74,16 @@ private:
int, const nsAString_internal&, int>
IntStringIntResultRunnable;
void ErrorRsp(const BluetoothDaemonPDUHeader& aHeader,
BluetoothDaemonPDU& aPDU,
void ErrorRsp(const DaemonSocketPDUHeader& aHeader,
DaemonSocketPDU& aPDU,
BluetoothSocketResultHandler* aRes);
void ListenRsp(const BluetoothDaemonPDUHeader& aHeader,
BluetoothDaemonPDU& aPDU,
void ListenRsp(const DaemonSocketPDUHeader& aHeader,
DaemonSocketPDU& aPDU,
BluetoothSocketResultHandler* aRes);
void ConnectRsp(const BluetoothDaemonPDUHeader& aHeader,
BluetoothDaemonPDU& aPDU,
void ConnectRsp(const DaemonSocketPDUHeader& aHeader,
DaemonSocketPDU& aPDU,
BluetoothSocketResultHandler* aRes);
};

View File

@ -1019,9 +1019,9 @@ BluetoothAdapter::SetAdapterState(BluetoothAdapterState aState)
// Fire BluetoothAttributeEvent for changed adapter state
Sequence<nsString> types;
BT_APPEND_ENUM_STRING(types,
BluetoothAdapterAttribute,
BluetoothAdapterAttribute::State);
BT_APPEND_ENUM_STRING_FALLIBLE(types,
BluetoothAdapterAttribute,
BluetoothAdapterAttribute::State);
DispatchAttributeEvent(types);
}
@ -1047,7 +1047,7 @@ BluetoothAdapter::HandlePropertyChanged(const BluetoothValue& aValue)
// BluetoothAdapterAttribute properties
if (IsAdapterAttributeChanged(type, arr[i].value())) {
SetPropertyByValue(arr[i]);
BT_APPEND_ENUM_STRING(types, BluetoothAdapterAttribute, type);
BT_APPEND_ENUM_STRING_FALLIBLE(types, BluetoothAdapterAttribute, type);
}
}

View File

@ -292,7 +292,7 @@ BluetoothDevice::HandlePropertyChanged(const BluetoothValue& aValue)
// BluetoothDeviceAttribute properties
if (IsDeviceAttributeChanged(type, arr[i].value())) {
SetPropertyByValue(arr[i]);
BT_APPEND_ENUM_STRING(types, BluetoothDeviceAttribute, type);
BT_APPEND_ENUM_STRING_FALLIBLE(types, BluetoothDeviceAttribute, type);
}
}

View File

@ -92,13 +92,16 @@ BluetoothLeDeviceEvent::Constructor(
e->mDevice = aEventInitDict.mDevice;
e->mRssi = aEventInitDict.mRssi;
aEventInitDict.mScanRecord.ComputeLengthAndData();
const uint8_t* data = aEventInitDict.mScanRecord.Data();
size_t length = aEventInitDict.mScanRecord.Length();
e->mScanRecord = ArrayBuffer::Create(aGlobal.Context(), length, data);
if (!e->mScanRecord) {
aRv.Throw(NS_ERROR_OUT_OF_MEMORY);
return nullptr;
if (!aEventInitDict.mScanRecord.IsNull()) {
const auto& scanRecord = aEventInitDict.mScanRecord.Value();
scanRecord.ComputeLengthAndData();
e->mScanRecord = ArrayBuffer::Create(aGlobal.Context(),
scanRecord.Length(),
scanRecord.Data());
if (!e->mScanRecord) {
aRv.Throw(NS_ERROR_OUT_OF_MEMORY);
return nullptr;
}
}
e->SetTrusted(trusted);
@ -106,7 +109,7 @@ BluetoothLeDeviceEvent::Constructor(
}
BluetoothDevice*
BluetoothLeDeviceEvent::Device() const
BluetoothLeDeviceEvent::GetDevice() const
{
return mDevice;
}

View File

@ -47,7 +47,7 @@ public:
const BluetoothLeDeviceEventInit& aEventInitDict,
ErrorResult& aRv);
BluetoothDevice* Device() const;
BluetoothDevice* GetDevice() const;
int16_t Rssi() const;

View File

@ -255,9 +255,9 @@ BluetoothManager::DispatchAttributeEvent()
BT_API2_LOGR();
Sequence<nsString> types;
BT_APPEND_ENUM_STRING(types,
BluetoothManagerAttribute,
BluetoothManagerAttribute::DefaultAdapter);
BT_APPEND_ENUM_STRING_FALLIBLE(types,
BluetoothManagerAttribute,
BluetoothManagerAttribute::DefaultAdapter);
// Notify application of default adapter change
BluetoothAttributeEventInit init;

View File

@ -76,17 +76,17 @@ XPCOMUtils.defineLazyGetter(this, "gWAP", function() {
return ns;
});
XPCOMUtils.defineLazyGetter(this, "gSmsSendingSchedulars", function() {
XPCOMUtils.defineLazyGetter(this, "gSmsSendingSchedulers", function() {
return {
_schedulars: [],
getSchedularByServiceId: function(aServiceId) {
let schedular = this._schedulars[aServiceId];
if (!schedular) {
schedular = this._schedulars[aServiceId] =
new SmsSendingSchedular(aServiceId);
_schedulers: [],
getSchedulerByServiceId: function(aServiceId) {
let scheduler = this._schedulers[aServiceId];
if (!scheduler) {
scheduler = this._schedulers[aServiceId] =
new SmsSendingScheduler(aServiceId);
}
return schedular;
return scheduler;
}
};
});
@ -334,11 +334,14 @@ SmsService.prototype = {
* Schedule the sending request.
*/
_scheduleSending: function(aServiceId, aDomMessage, aSilent, aOptions, aRequest) {
gSmsSendingSchedulars.getSchedularByServiceId(aServiceId)
gSmsSendingSchedulers.getSchedulerByServiceId(aServiceId)
.schedule({
messageId: aDomMessage.id,
onSend: () => {
if (DEBUG) debug("onSend: " + aDomMessage.id);
if (DEBUG) {
debug("onSend: messageId=" + aDomMessage.id +
", serviceId=" + aServiceId);
}
this._sendToTheAir(aServiceId,
aDomMessage,
aSilent,
@ -1193,14 +1196,14 @@ function getEnabledGsmTableTuplesFromMcc() {
return tuples;
};
function SmsSendingSchedular(aServiceId) {
function SmsSendingScheduler(aServiceId) {
this._serviceId = aServiceId;
this._queue = [];
Services.obs.addObserver(this, kSmsDeletedObserverTopic, false);
Services.obs.addObserver(this, NS_XPCOM_SHUTDOWN_OBSERVER_ID, false);
}
SmsSendingSchedular.prototype = {
SmsSendingScheduler.prototype = {
QueryInterface: XPCOMUtils.generateQI([Ci.nsIMobileConnectionListener]),
_serviceId: 0,
@ -1250,6 +1253,10 @@ SmsSendingSchedular.prototype = {
*/
schedule: function(aSendingRequest) {
if (aSendingRequest) {
if (DEBUG) {
debug("scheduling message: messageId=" + aSendingRequest.messageId +
", serviceId=" + this._serviceId);
}
this._ensureMoboConnObserverRegistration();
this._queue.push(aSendingRequest)
@ -1268,7 +1275,7 @@ SmsSendingSchedular.prototype = {
*/
send: function() {
let connection =
gMobileConnectionService.getItemByServiceId(this._servicdeId);
gMobileConnectionService.getItemByServiceId(this._serviceId);
// If the voice connection is temporarily unavailable, pend the request.
let voiceInfo = connection && connection.voice;

View File

@ -127,10 +127,56 @@ function turnOnVoiceDeleteMessagesAndVerify(aMessageIdsToDelete,
return Promise.all(promises);
}
/**
* Send messages on the second SIM and verify success while voice connection
* on first SIM is disabled.
*
* @return an array of message IDs.
*/
function sendMessagesOnSecondSIM() {
return new Promise(function(resolve, reject) {
try {
let eventCount = 0;
let now = Date.now();
let messageIds = [];
manager.addEventListener("sent", function onevent(aEvent) {
log("onsent event received.");
let message = aEvent.message;
let expectedBody = MESSAGES[eventCount++];
messageIds.push(message.id);
is(message.delivery, "sent", "message.delivery");
is(message.receiver, RECEIVER, "message.receiver");
is(message.body, expectedBody, "message.body: expected '" + expectedBody
+ "'' but got '" + message.body + "'");
// timestamp is in seconds.
ok(Math.floor(message.timestamp / 1000) >= Math.floor(now / 1000),
"expected " + message.timestamp + " >= " + now);
// resolve when all messages are appeared "sent"
if (eventCount == MESSAGES.length) {
manager.removeEventListener("sent", onevent);
resolve(messageIds);
}
});
// send messages
for (let body of MESSAGES) {
manager.send(RECEIVER, body, { serviceId: 1 });
}
} catch (err) {
log("Error: " + err);
reject(err);
}
});
}
startTestCommon(function testCaseMain() {
return pushPrefEnv({ set: [['dom.sms.requestStatusReport', true]] })
.then(() => ensureMobileConnection())
.then(() => setEmulatorVoiceStateAndWait("unregistered"))
.then(() => runIfMultiSIM(() => sendMessagesOnSecondSIM()))
.then(() => sendMessagesAndVerifySending())
// Delete the first message and wait for result.
.then((aMessageIds) => turnOnVoiceDeleteMessagesAndVerify([aMessageIds[0]],

View File

@ -28,7 +28,7 @@ static const mozilla::Module::ContractIDEntry kPresentationDeviceProviderContrac
};
static const mozilla::Module::CategoryEntry kPresentationDeviceProviderCategories[] = {
#if defined(MOZ_WIDGET_GONK) && ANDROID_VERSION >= 16
#if 0 // defined(MOZ_WIDGET_GONK) && ANDROID_VERSION >= 16
{ PRESENTATION_DEVICE_PROVIDER_CATEGORY, "MulticastDNSDeviceProvider", MULTICAST_DNS_PROVIDER_CONTRACT_ID},
#endif
{ nullptr }

View File

@ -97,6 +97,7 @@ function run_test()
function stop_high_accuracy_watch() {
geolocation.clearWatch(watchID2);
check_results();
do_test_finished();
}
function check_results()

View File

@ -15,5 +15,5 @@ interface BluetoothAttributeEvent : Event
dictionary BluetoothAttributeEventInit : EventInit
{
required sequence<DOMString> attrs;
sequence<DOMString> attrs = [];
};

View File

@ -9,10 +9,10 @@
optional BluetoothGattCharacteristicEventInit eventInitDict)]
interface BluetoothGattCharacteristicEvent : Event
{
readonly attribute BluetoothGattCharacteristic characteristic;
readonly attribute BluetoothGattCharacteristic? characteristic;
};
dictionary BluetoothGattCharacteristicEventInit : EventInit
{
required BluetoothGattCharacteristic characteristic;
BluetoothGattCharacteristic? characteristic = null;
};

Some files were not shown because too many files have changed in this diff Show More