[TIZEN][SDK 2.1 - NECTARINE] fix device , to circumvent an issue accessing the platformversion field of the SystemInfoCapabilities structure as returned by systeminfo getCapabilities() method.
fix network, by setting a timeout handler provide an anwser before the 5 seconds timeout there is whithin Cordova to get Connection information ready (timer is set to 3 sec) Project: http://git-wip-us.apache.org/repos/asf/cordova-js/repo Commit: http://git-wip-us.apache.org/repos/asf/cordova-js/commit/523d9106 Tree: http://git-wip-us.apache.org/repos/asf/cordova-js/tree/523d9106 Diff: http://git-wip-us.apache.org/repos/asf/cordova-js/diff/523d9106 Branch: refs/heads/3.0.0 Commit: 523d9106f9dc1c4cec735893c87081ba3deeb57c Parents: 11bdd38 Author: pplaquette <[email protected]> Authored: Wed Jun 5 16:56:54 2013 +0200 Committer: pplaquette <[email protected]> Committed: Wed Jun 5 16:56:54 2013 +0200 ---------------------------------------------------------------------- lib/tizen/plugin/tizen/Device.js | 11 +++++------ lib/tizen/plugin/tizen/NetworkStatus.js | 22 ++++++++++++++++++++-- 2 files changed, 25 insertions(+), 8 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cordova-js/blob/523d9106/lib/tizen/plugin/tizen/Device.js ---------------------------------------------------------------------- diff --git a/lib/tizen/plugin/tizen/Device.js b/lib/tizen/plugin/tizen/Device.js index 8b88dfb..fb10d9d 100644 --- a/lib/tizen/plugin/tizen/Device.js +++ b/lib/tizen/plugin/tizen/Device.js @@ -29,7 +29,7 @@ var channel = require('cordova/channel'); //channel.waitForInitialization('onCordovaInfoReady'); function Device() { - this.version = null; + this.version = "2.1.0"; // waiting a working solution of the security error see below this.uuid = null; this.name = null; this.model = null; @@ -40,16 +40,15 @@ function Device() { } Device.prototype.getDeviceInfo = function() { - + var deviceCapabilities = tizen.systeminfo.getCapabilities(); - + if (deviceCapabilities) { - - this.version = deviceCapabilities.platformVersion; + // this.version = deviceCapabilities.platformVersion; // this is currently provoking a security Error in SDk 2.1 this.uuid = deviceCapabilities.duid; this.model = deviceCapabilities.platformName; this.name = this.model; - + channel.onCordovaInfoReady.fire(); } else { http://git-wip-us.apache.org/repos/asf/cordova-js/blob/523d9106/lib/tizen/plugin/tizen/NetworkStatus.js ---------------------------------------------------------------------- diff --git a/lib/tizen/plugin/tizen/NetworkStatus.js b/lib/tizen/plugin/tizen/NetworkStatus.js index 4ae75c3..febcbb9 100644 --- a/lib/tizen/plugin/tizen/NetworkStatus.js +++ b/lib/tizen/plugin/tizen/NetworkStatus.js @@ -30,9 +30,17 @@ module.exports = { var cncType = Connection.NONE; var infoCount = 0; var deviceCapabilities = null; + var timerId = 0; + var timeout = 300; function connectionCB() { + + if (timerId !== null) { + clearTimeout(timerId); + timerId = null; + }jake + infoCount++; if (infoCount > 1) { @@ -64,14 +72,24 @@ module.exports = { connectionCB(); } + deviceCapabilities = tizen.systeminfo.getCapabilities(); + + + timerId = setTimeout( function(){ + timerId = null; + infoCount = 1; + connectionCB(); + }, timeout); if (deviceCapabilities.wifi) { tizen.systeminfo.getPropertyValue("WIFI_NETWORK", wifiSuccessCB, errorCB); } - - tizen.systeminfo.getPropertyValue("CELLULAR_NETWORK", cellularSuccessCB, errorCB); + + if (deviceCapabilities.telephony) { + tizen.systeminfo.getPropertyValue("CELLULAR_NETWORK", cellularSuccessCB, errorCB); + } } };
