Publish Vulpes Preview 15 sources for desktop, Android and Tundra
Share Gaia assets and adapters, keep private profiles and development documents local, and update both public READMEs.
This commit is contained in:
parent
93e3a48004
commit
b38dea0597
25901 changed files with 9982925 additions and 369 deletions
37
gaia/dev_apps/uitest/js/HW/wifi.js
Executable file
37
gaia/dev_apps/uitest/js/HW/wifi.js
Executable file
|
|
@ -0,0 +1,37 @@
|
|||
'use strict';
|
||||
|
||||
function wifiTest() {
|
||||
var WiFiMACText = document.getElementById('address');
|
||||
var WiFiStateText = document.getElementById('state');
|
||||
var switchButton = document.getElementById('switch');
|
||||
|
||||
var settings = window.navigator.mozSettings;
|
||||
var wifiManager;
|
||||
function update() {
|
||||
switchButton.checked = wifiManager.enabled;
|
||||
if (wifiManager.enabled) {
|
||||
WiFiStateText.textContent = 'On';
|
||||
WiFiMACText.textContent = wifiManager.macAddress;
|
||||
}
|
||||
else {
|
||||
WiFiStateText.textContent = 'Off';
|
||||
WiFiMACText.textContent = 'Not available';
|
||||
}
|
||||
}
|
||||
if ('mozWifiManager' in navigator) {
|
||||
wifiManager = navigator.mozWifiManager;
|
||||
// navigator.mozWifiManager does not have addEventListener()
|
||||
wifiManager.onenabled = update.bind(this);
|
||||
wifiManager.ondisabled = update.bind(this);
|
||||
update();
|
||||
}
|
||||
// Click on switch will only update settings and
|
||||
// it takes some time for hardware to turns on.
|
||||
// That's why we should listen to enabled/disabled event of wifi
|
||||
function wifiSwitch() {
|
||||
settings.createLock().set({'wifi.enabled': switchButton.checked});
|
||||
}
|
||||
switchButton.addEventListener('click', wifiSwitch);
|
||||
}
|
||||
|
||||
window.addEventListener('load', wifiTest);
|
||||
Loading…
Reference in a new issue