/*!
- Ripple Mobile Environment Emulator v0.9.8 :: Built On Mon Mar 24 2014 20:05:21 GMT+0800 (CST)
+ Ripple Mobile Environment Emulator v0.9.8 :: Built On Fri Mar 28 2014 13:51:03 GMT+0800 (CST)
Apache License
Version 2.0, January 2004
var constants = require('ripple/constants'),
utils = require('ripple/utils'),
devices = require('ripple/devices'),
+ deviceSettings = require('ripple/deviceSettings'),
platform = require('ripple/platform'),
db = require('ripple/db');
jQuery("#item_container :nth-child(2)").hide();
jQuery("#item_container :nth-child(3)").hide();
+ _unlockScreen();
//jQuery("#hwkeys-panel").hide();
}
else {
}
}
+function _unlockScreen() {
+ if (!deviceSettings.retrieve("Config.lockScreen"))
+ return;
+
+ if ($("#device-settings-Config-lockScreen").length === 0) {
+ deviceSettings.persist("Config.lockScreen", false);
+ } else {
+ $("#device-settings-Config-lockScreen")[0].click();
+ }
+}
+
function checkResolutionSize(evt) {
var query_str, id_str, len;
query_str = "#resolution-custom-" + evt.data.msg;
});
});
_updatePlatformDeviceSelect(newPlatform, newDevice);
-
});
jQuery("#device-select").bind("focus", function () {
return;
}
db.saveObject(_NFC_PEER, _peerNDEF);
- event.trigger("nfc-peer-sending-ndef", []);
+ event.trigger("nfc-peer-sending-ndef", [_peerNDEF]);
});
// Initialize network bearer selection
btNodes = jQuery("#network-bt-device-select");
btNodes.html("");
- _btBluetoothDB = db.retrieveObject("bt-simulated-devices") || dbinit.Bluetooth;
+ _btBluetoothDB = dbinit.Bluetooth;
utils.forEach(_btBluetoothDB, function (item, index) {
btNodes.append(utils.createElement("option", {
"value": index,
//Default "Tizen Phone" is nearby
//_btSimulatedDevs["00:02:60:00:05:63"] = _btBluetoothDB["00:02:60:00:05:63"];
- for (var address in _btBluetoothDB) {
- _btSimulatedDevs[address] = _btBluetoothDB[address];
- break;
+ _btSimulatedDevs = db.retrieveObject("bt-simulated-devices") || {};
+ if (Object.keys(_btSimulatedDevs).length === 0) {
+ for (var address in _btBluetoothDB) {
+ _btSimulatedDevs[address] = _btBluetoothDB[address];
+ break;
+ }
+
+ db.saveObject("bt-simulated-devices", _btSimulatedDevs);
}
- db.saveObject("bt-simulated-devices", _btSimulatedDevs);
_btRender();
}
};
}
event.on("ReadersClosed", function () {
- var i, reader, prefix, containerId, radioLabelInsert, radioLabelEject;
+ var i, reader, prefix, containerId, radioLabelInsert, radioLabelEject,
+ radioInsert, radioEject;
for (i = 0; _data.dbStorage && i < _data.dbStorage.length; i++) {
reader = _data.dbStorage[i];
containerId = prefix + "-radio";
radioLabelInsert = $("#" + containerId + "1-label");
radioLabelEject = $("#" + containerId + "2-label");
+ radioInsert = $("#" + containerId + "1");
+ radioEject = $("#" + containerId + "2");
+ radioInsert.prop('checked', false);
radioLabelInsert.css({'color': '#bbbbbb'});
- radioLabelEject.css({'color': '#222222'});
+ radioInsert.button("refresh");
+
+ radioEject.prop('checked', true);
+ radioLabelEject.css({'color': '#000000'});
+ radioEject.button("refresh");
}
});
}
};
});
-define('ripple/ui/plugins/nfc', function (require, exports, module) {
-/*
- * Copyright 2012 Intel Corporation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-var db = require('ripple/db'),
- event = require('ripple/event'),
- _NFC_TAG = "tizen1.0-nfc-tag",
- _NFC_PEER = "tizen1.0-nfc-peer",
- _NFC_OUTPUT_MESSAGE = "tizen1.0-nfc-output-message",
- powered = false,
- polling = false,
- isConnected = false,
- _tagNDEF = {
- type: "GENERIC_TARGET",
- isSupportedNDEF: true,
- ndefSize: 2,
- ndefs: [{
- recordCount: 2,
- records: [{
- tnf: 1,
- type: "TypeA",
- id: "ID001",
- payload: "This is 1st payload"
- }, {
- tnf: 1,
- type: "TypeA",
- id: "ID002",
- payload: "This is 2nd payload"
- }]
- },
- {
- recordCount: 2,
- records: [{
- tnf: 1,
- type: "TypeA",
- id: "ID001",
- payload: "This is 1st payload"
- }, {
- tnf: 1,
- type: "TypeA",
- id: "ID002",
- payload: "This is 2nd payload"
- }]
- }]
- },
- _tagRaw = {
- type: "GENERIC_TARGET",
- isSupportedNDEF: false,
- rawData : ""
- },
- _peerNDEF = {
- ndef: {
- recordCount: 2,
- records: [{
- tnf: 1,
- type: "TypeA",
- id: "ID001",
- payload: "This is 1st payload"
- }, {
- tnf: 1,
- type: "TypeA",
- id: "ID002",
- payload: "This is 2nd payload"
- }]
- }
- };
-
-function elementEnableDisableSetting(prop) {
- jQuery("#nfc-attach-msg").text("\xa0");
- jQuery("#nfc-peer-send-msg").text("\xa0");
- if (prop && prop.power !== undefined && prop.power !== null) {
- if (prop.power) {
- $("#nfc-polling").removeAttr("disabled");
- $("#nfc-main-container").show();
- } else {
- $("#nfc-polling").attr("disabled", "disabled");
- $("#nfc-type").removeAttr("disabled");
- $("#nfc-main-container").hide();
- }
- }
- if (prop && prop.connectedState !== undefined && prop.connectedState !== null) {
- if (prop.connectedState) {
- $("#nfc-type").attr("disabled", "disabled");
- $("#nfc-tag-type-text").text($("#nfc-tag-type option:selected").text());
- $("#nfc-tag-type").hide();
- $("#nfc-tag-type-text").show();
- $("#nfc-tag-NDEF-support-text").text($("#nfc-tag-NDEF-support option:selected").text());
- $("#nfc-tag-NDEF-support").hide();
- $("#nfc-tag-NDEF-support-text").show();
- $("#nfc-raw-data").attr("disabled", "disabled");
- } else {
- $("#nfc-type").removeAttr("disabled");
- $("#nfc-tag-type").show();
- $("#nfc-tag-type-text").hide();
- $("#nfc-tag-NDEF-support").show();
- $("#nfc-tag-NDEF-support-text").hide();
- $("#nfc-raw-data").removeAttr("disabled");
- }
- }
-}
-
-function _initializeElements() {
-
- jQuery(function () {
- var stop = false,
- isSupportNDEF, type;
-
- jQuery("nfc-tag-ndef-container h3").click(function (event) {
- if (stop) {
- event.stopImmediatePropagation();
- event.preventDefault();
- stop = false;
- }
- });
- jQuery("#nfc-tag-ndef-container").accordion("destroy").accordion({
- header: "> div > h3",
- autoHeight: false
- });
- jQuery("nfc-nfcpeer h3").click(function (event) {
- if (stop) {
- event.stopImmediatePropagation();
- event.preventDefault();
- stop = false;
- }
- });
- jQuery("#nfc-nfcpeer").accordion("destroy").accordion({
- header: "> div > h3",
- autoHeight: false
- });
- jQuery("#nfc-tag-NDEF-support").bind("change", function () {
- isSupportNDEF = jQuery("#nfc-tag-NDEF-support").val();
- if (isSupportNDEF === "Yes") {
- jQuery("#nfc-tag-ndef-container").fadeIn();
- jQuery("#nfc-tag-raw-container").hide();
- } else {
- jQuery("#nfc-tag-ndef-container").hide();
- jQuery("#nfc-tag-raw-container").fadeIn();
- }
- });
- jQuery("#nfc-type").bind("change", function () {
- type = jQuery("#nfc-type").val();
- if (type === "Tag") {
- jQuery("#nfc-nfctag").fadeIn();
- jQuery("#nfc-nfcpeer").hide();
- } else {
- jQuery("#nfc-nfctag").hide();
- jQuery("#nfc-nfcpeer").fadeIn();
- }
- elementEnableDisableSetting();
- });
- jQuery("#nfc-power").bind("change", function () {
- var status;
- status = jQuery("#nfc-power").val() === "On" ? true : false;
- event.trigger("nfc-power-setting", [status]);
- });
- jQuery("#nfc-polling").bind("change", function () {
- var status;
- status = jQuery("#nfc-polling").val() === "On" ? true : false;
- event.trigger("nfc-polling-setting", [status]);
- });
- jQuery("#nfc-attach").bind("click", function () {
- var type, isAttached;
- isAttached = jQuery("#nfc-attach").children().text() === "Attach" ? true : false;
- jQuery("#nfc-attach-msg").text("\xa0");
-
- if (!polling && isAttached) {
- jQuery("#nfc-attach-msg").text("Polling:Off, attach won't work");
- return;
- }
- type = jQuery("#nfc-type").val();
- event.trigger("nfc-attach-setting", [type, isAttached]);
- });
- jQuery("#nfc-peer-send").bind("click", function () {
- jQuery("#nfc-peer-send-msg").text("\xa0");
- if (!isConnected) {
- jQuery("#nfc-peer-send-msg").text("Disconnected. Send won't work");
- return;
- }
- db.saveObject(_NFC_PEER, _peerNDEF);
- event.trigger("nfc-peer-sending-ndef", []);
- });
- });
-}
-
-module.exports = {
- panel: {
- domId: "nfc-container",
- collapsed: true,
- pane: "left",
- titleName: "NFC",
- display: true
- },
- initialize: function () {
- _initializeElements();
- event.on("nfc-power-changed", function (status) {
- powered = status;
- if (powered === true) {
- $("#nfc-power").val("On");
- } else {
- $("#nfc-power").val("Off");
- }
- elementEnableDisableSetting({power: status});
- });
- event.on("nfc-polling-changed", function (status) {
- polling = status;
- if (polling === true) {
- $("#nfc-polling").val("On");
- } else {
- $("#nfc-polling").val("Off");
- }
- elementEnableDisableSetting();
- });
- event.on("nfc-connectedState-changed", function (state) {
- var i, type, isSupportedNDEF, str, bytes = [];
- isConnected = state;
- elementEnableDisableSetting({connectedState: state});
- type = jQuery("#nfc-type").val();
- if (state) {
- jQuery("#nfc-attach").children().text("Detach");
- jQuery("#nfc-tag-connection").text("Connected");
- jQuery("#nfc-peer-connection").text("Connected");
- if (type === "Tag") {
- isSupportedNDEF = jQuery("#nfc-tag-NDEF-support").val() === "Yes" ? true : false;
- if (isSupportedNDEF) {
- _tagNDEF.type = jQuery("#nfc-tag-type").val();
- db.saveObject(_NFC_TAG, _tagNDEF);
- } else {
- _tagRaw.type = jQuery("#nfc-tag-type").val();
- str = jQuery("#nfc-raw-data").val();
- for (i = 0; i < str.length; i++) {
- bytes.push(str.charCodeAt(i));
- }
- _tagRaw.rawData = bytes;
- db.saveObject(_NFC_TAG, _tagRaw);
- }
- event.trigger("nfc-tag-send", [true]);
- } else {
- event.trigger("nfc-peer-send", [true]);
- }
- } else {
- jQuery("#nfc-attach").children().text("Attach");
- jQuery("#nfc-tag-connection").text("Disconnected");
- jQuery("#nfc-peer-connection").text("Disconnected");
- jQuery("#nfc-output").text("");
- jQuery("#nfc-output-table").hide();
- if (type === "Tag") {
- event.trigger("nfc-tag-send", [false]);
- } else {
- event.trigger("nfc-peer-send", [false]);
- }
- }
- });
- event.on("nfc-output-msg", function () {
- var msg;
- msg = db.retrieve(_NFC_OUTPUT_MESSAGE);
- jQuery("#nfc-output").text(msg);
- jQuery("#nfc-output-table").show();
- });
- }
-};
-
-
-});
define('ripple/ui/plugins/settings-dialog', function (require, exports, module) {
/*
* Copyright 2011 Research In Motion Limited.
* limitations under the License.
*/
var utils = require('ripple/utils'),
- event = require('ripple/event'),
db = require('ripple/db'),
tooltip = require('ripple/ui/plugins/tooltip'),
platform = require('ripple/platform'),
$("#overlayBackground").hide("fade", "slow");
}
+function _cancelConfig() {
+ $("#platform-select").val(platform.current().id);
+ $("#platform-select").trigger("change");
+
+ _hideConfigWindow();
+}
function checkResolutionValue(val) {
var ret = false;
$("#content_container").show();
$("#" + items[0].id).show("fast");
-
+
$(".configuration-window-item:eq(0)").css("background-color", "#003399");
$(".configuration-window-item:eq(0)").css("color", "#ffffff");
$(".configuration-window-item").bind("click", function () {
$(".configuration-window-item").css("background-color", "#eeeeee");
$(".configuration-window-item").css("color", "#333333");
-
+
$(this).css("background-color", "#003399");
$(this).css("color", "#ffffff");
$("#configuration-window-close-btn").unbind('click');
$("#configuration-window-close-btn").bind("click", function () {
if ($("#configure-window-popup").is(":visible")) {
- _hideConfigWindow();
+ _cancelConfig();
return;
}
});
db.saveObject(_KEY, _settings);
programs = db.retrieveObject(_DB_APPLICATION_KEY);
db.saveObject(_DB_APPLICATION_SAVE_KEY, programs);
-
});
tooltip.create("#configuration-window-load-btn", "Load Configuration");
$("#configuration-window-load-btn").unbind('click');
$("#configuration-window-load-btn").bind("click", function () {
var platformList,
- programs,
deviceInfo,
_settings,
versionSelect = document.getElementById("version-select");
_setOrientation(layout);
_win.onorientationchange = undefined;
+
+ $(".middle").scroll(function () {
+ if (this.scrollLeft > 0) {
+ this.scrollLeft = 0;
+ }
+ });
},
// TODO: redo/refactor this in general, seems bloated, also devices REQUIRE viewport schemas which they shouldnt
resize: function (device) {
t.Session("getATR", arguments);
- return atr.slice(0);
+ return t.byte(atr.slice(0), "[]");
}
function close() {
if (!command[1])
return [0x67, 0x00];
- response = _data.APDU_COMMANDS[command[1]];
+ response = _data.APDU_COMMANDS[t.octet(command[1])];
if (!response)
return [0x6d, 0x00];
throw new WebAPIException(errorcode.SECURITY_ERR);
}
- t.Channel("transmit", arguments);
+ t.Channel("transmit", arguments, true);
window.setTimeout(function () {
var response;
event.trigger("SETransmitted", [aid, command]);
- successCallback(response);
+ successCallback(t.byte(response, "[]"));
}, 1);
}
}
if (!status) {
updateIsNear(_data.isDetectTag, false);
- _data.listener.onTagDetected = null;
- _data.listener.onPeerDetected = null;
- _data.listener.onNDEFReceived = null;
- _data.listener.onCardEmulationChanged = null;
+ if (_data.listener.onTagDetected) {
+ _data.listener.onTagDetected.ondetach();
+ }
+
+ if (_data.listener.onPeerDetected) {
+ _data.listener.onPeerDetected.ondetach();
+ }
}
powered = status;
updatePollingStatus(status);
t.NFCAdapter("setTagListener", arguments);
//TODO: tagFilter support
- if (!powered) {
- return;
- }
_data.listener.onTagDetected = detectCallback;
}
t.NFCAdapter("setPeerListener", arguments);
- if (!powered) {
- return;
- }
_data.listener.onPeerDetected = detectCallback;
}
throw new WebAPIException(errorcode.SECURITY_ERR);
}
- if (!powered || !_data.listener.onTagDetected) {
+ if (!_data.listener.onTagDetected) {
return;
}
throw new WebAPIException(errorcode.SECURITY_ERR);
}
- if (!powered || !_data.listener.onPeerDetected) {
+ if (!_data.listener.onPeerDetected) {
return;
}