You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by st...@apache.org on 2013/05/17 19:53:32 UTC

[14/26] js commit: [Tizen, Tizen SDK 2.0 (Magnolia)]

[Tizen, Tizen SDK 2.0 (Magnolia)]

Adapt to new SDK

Cordova Connection manager

Constants where change to majuscule
plus cleaning, renaming etc...


Project: http://git-wip-us.apache.org/repos/asf/cordova-js/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-js/commit/a26b43df
Tree: http://git-wip-us.apache.org/repos/asf/cordova-js/tree/a26b43df
Diff: http://git-wip-us.apache.org/repos/asf/cordova-js/diff/a26b43df

Branch: refs/heads/3.0.0
Commit: a26b43dfe6ff6d9ed30868301d39e23cc2bbc9b7
Parents: 4ad9875
Author: pplaquette <pp...@apache.org>
Authored: Wed Apr 17 11:34:34 2013 +0200
Committer: pplaquette <pp...@apache.org>
Committed: Fri Apr 19 11:07:14 2013 +0200

----------------------------------------------------------------------
 lib/tizen/plugin/tizen/NetworkStatus.js |   39 +++++++++++++++++--------
 1 files changed, 26 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-js/blob/a26b43df/lib/tizen/plugin/tizen/NetworkStatus.js
----------------------------------------------------------------------
diff --git a/lib/tizen/plugin/tizen/NetworkStatus.js b/lib/tizen/plugin/tizen/NetworkStatus.js
index 46abe05..d2d0d93 100644
--- a/lib/tizen/plugin/tizen/NetworkStatus.js
+++ b/lib/tizen/plugin/tizen/NetworkStatus.js
@@ -24,38 +24,51 @@ var Connection = require('cordova/plugin/Connection');
 
 module.exports = {
     getConnectionInfo: function (successCallback, errorCallback) {
+
         var cncType = Connection.NONE;
         var infoCount = 0;
+        var deviceCapabilities = null;
+
 
-        function infoCB() {
+        function connectionCB() {
             infoCount++;
-            if (infoCount > 1)
-               successCallback(cncType);
+
+            if (infoCount > 1) {
+                if (successCallback) {
+                    successCallback(cncType);
+                }
+            }
         }
 
         function errorCB(error) {
-           console.log("Error: " + error.code + "," + error.name + "," + error.message);
-           infoCB();
+            console.log("Error: " + error.code + "," + error.name + "," + error.message);
+
+            if (errorCallback) {
+                errorCallback();
+            }
         }
 
         function wifiSuccessCB(wifi) {
-            if ((wifi.status === "ON")  && (wifi.ipAddress.length !== 0))
+            if ((wifi.status === "ON")  && (wifi.ipAddress.length !== 0)) {
                 cncType = Connection.WIFI;
-            infoCB();
+            }
+            connectionCB();
         }
 
         function cellularSuccessCB(cell) {
-            if ((cncType === Connection.NONE) && (cell.status === "ON") && (cell.ipAddress.length !== 0))
+            if ((cncType === Connection.NONE) && (cell.status === "ON") && (cell.ipAddress.length !== 0)) {
                 cncType = Connection.CELL_2G;
-            infoCB();
+            }
+            connectionCB();
         }
 
-        if (tizen.systeminfo.isSupported('WifiNetwork')) {
-            tizen.systeminfo.getPropertyValue('WifiNetwork', wifiSuccessCB, errorCB);
+
+        if (tizen.systeminfo.isSupported("WIFI_NETWORK")) {
+            tizen.systeminfo.getPropertyValue("WIFI_NETWORK", wifiSuccessCB, errorCB);
         }
 
-        if (tizen.systeminfo.isSupported('CellularNetwork')) {
-            tizen.systeminfo.getPropertyValue('CellularNetwork', cellularSuccessCB, errorCB);
+        if (tizen.systeminfo.isSupported("CELLULAR_NETWORK")) {
+            tizen.systeminfo.getPropertyValue("CELLULAR_NETWORK", cellularSuccessCB, errorCB);
         }
     }
 };