cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From purplecabb...@apache.org
Subject [1/4] cordova-plugin-network-information git commit: CB-8384 Add Windows section to Network Information plugin
Date Fri, 30 Jan 2015 19:49:20 GMT
Repository: cordova-plugin-network-information
Updated Branches:
  refs/heads/master 928efea0d -> 9710603fe


CB-8384 Add Windows section to Network Information plugin


Project: http://git-wip-us.apache.org/repos/asf/cordova-plugin-network-information/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-plugin-network-information/commit/fb608698
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugin-network-information/tree/fb608698
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugin-network-information/diff/fb608698

Branch: refs/heads/master
Commit: fb608698e5c97e18da8bb1d6f73621bb3676ebfe
Parents: 928efea
Author: sgrebnov <v-segreb@microsoft.com>
Authored: Fri Jan 30 14:57:10 2015 +0300
Committer: sgrebnov <v-segreb@microsoft.com>
Committed: Fri Jan 30 14:57:10 2015 +0300

----------------------------------------------------------------------
 plugin.xml                       |  9 +++-
 src/windows/NetworkInfoProxy.js  | 88 +++++++++++++++++++++++++++++++++++
 src/windows8/NetworkInfoProxy.js | 87 ----------------------------------
 3 files changed, 96 insertions(+), 88 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-plugin-network-information/blob/fb608698/plugin.xml
----------------------------------------------------------------------
diff --git a/plugin.xml b/plugin.xml
index e87783a..34fc4c6 100644
--- a/plugin.xml
+++ b/plugin.xml
@@ -145,7 +145,14 @@ xmlns:android="http://schemas.android.com/apk/res/android"
 
     <!-- windows8 -->
     <platform name="windows8">
-        <js-module src="src/windows8/NetworkInfoProxy.js" name="NetworkInfoProxy">
+        <js-module src="src/windows/NetworkInfoProxy.js" name="NetworkInfoProxy">
+            <merges target="" />
+        </js-module>
+    </platform>
+
+    <!-- windows -->
+    <platform name="windows">
+        <js-module src="src/windows/NetworkInfoProxy.js" name="NetworkInfoProxy">
             <merges target="" />
         </js-module>
     </platform>

http://git-wip-us.apache.org/repos/asf/cordova-plugin-network-information/blob/fb608698/src/windows/NetworkInfoProxy.js
----------------------------------------------------------------------
diff --git a/src/windows/NetworkInfoProxy.js b/src/windows/NetworkInfoProxy.js
new file mode 100644
index 0000000..1f11aad
--- /dev/null
+++ b/src/windows/NetworkInfoProxy.js
@@ -0,0 +1,88 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.
+ *
+*/
+
+/*global Windows:true */
+
+var cordova = require('cordova');
+var Connection = require('./Connection');
+
+module.exports = {
+
+    getConnectionInfo:function(win,fail,args)
+    {
+        console.log("NetworkStatusProxy::getConnectionInfo");
+        var winNetConn = Windows.Networking.Connectivity;
+        var networkInfo = winNetConn.NetworkInformation;
+        var networkCostInfo = winNetConn.NetworkCostType;
+        var networkConnectivityInfo = winNetConn.NetworkConnectivityLevel;
+        var networkAuthenticationInfo = winNetConn.NetworkAuthenticationType;
+        var networkEncryptionInfo = winNetConn.NetworkEncryptionType;
+
+        var connectionType;
+
+        var profile = Windows.Networking.Connectivity.NetworkInformation.getInternetConnectionProfile();
+        if(profile) {
+            var conLevel = profile.getNetworkConnectivityLevel();
+            var interfaceType = profile.networkAdapter.ianaInterfaceType;
+
+            if (conLevel == Windows.Networking.Connectivity.NetworkConnectivityLevel.none)
{
+                connectionType = Connection.NONE;
+            }
+            else {
+                // https://msdn.microsoft.com/en-us/library/windows/apps/windows.networking.connectivity.networkadapter.ianainterfacetype
+                switch (interfaceType) {
+                    case 71:
+                        connectionType = Connection.WIFI;
+                        break;
+                    case 6:
+                        connectionType = Connection.ETHERNET;
+                        break;
+                    case 243: // (3GPP WWAN) // Fallthrough is intentional
+                    case 244: // (3GPP2 WWAN)
+                         connectionType = Connection.CELL_3G;
+                         break;
+                    default:
+                        connectionType = Connection.UNKNOWN;
+                        break;
+                }
+            }
+        }
+        // FYI
+        //Connection.UNKNOWN  'Unknown connection';
+        //Connection.ETHERNET 'Ethernet connection';
+        //Connection.WIFI     'WiFi connection';
+        //Connection.CELL_2G  'Cell 2G connection';
+        //Connection.CELL_3G  'Cell 3G connection';
+        //Connection.CELL_4G  'Cell 4G connection';
+        //Connection.NONE     'No network connection';
+
+        setTimeout(function () {
+            if (connectionType) {
+                win(connectionType);
+            } else {
+                win(Connection.NONE);
+            }
+        },0);
+    }
+
+};
+
+require("cordova/exec/proxy").add("NetworkStatus",module.exports);

http://git-wip-us.apache.org/repos/asf/cordova-plugin-network-information/blob/fb608698/src/windows8/NetworkInfoProxy.js
----------------------------------------------------------------------
diff --git a/src/windows8/NetworkInfoProxy.js b/src/windows8/NetworkInfoProxy.js
deleted file mode 100644
index b987718..0000000
--- a/src/windows8/NetworkInfoProxy.js
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you 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.
- *
-*/
-
-/*global Windows:true */
-
-var cordova = require('cordova');
-var Connection = require('./Connection');
-
-module.exports = {
-
-    getConnectionInfo:function(win,fail,args)
-    {
-        console.log("NetworkStatusProxy::getConnectionInfo");
-        var winNetConn = Windows.Networking.Connectivity;
-        var networkInfo = winNetConn.NetworkInformation;
-        var networkCostInfo = winNetConn.NetworkCostType;
-        var networkConnectivityInfo = winNetConn.NetworkConnectivityLevel;
-        var networkAuthenticationInfo = winNetConn.NetworkAuthenticationType;
-        var networkEncryptionInfo = winNetConn.NetworkEncryptionType;
-
-        var connectionType;
-
-        var profile = Windows.Networking.Connectivity.NetworkInformation.getInternetConnectionProfile();
-        if(profile) {
-            var conLevel = profile.getNetworkConnectivityLevel();
-            var interfaceType = profile.networkAdapter.ianaInterfaceType;
-
-            if (conLevel == Windows.Networking.Connectivity.NetworkConnectivityLevel.none)
{
-                connectionType = Connection.NONE;
-            }
-            else {
-                switch (interfaceType) {
-                    case 71:
-                        connectionType = Connection.WIFI;
-                        break;
-                    case 6:
-                        connectionType = Connection.ETHERNET;
-                        break;
-                    case 243: // (3GPP WWAN) // Fallthrough is intentional
-                    case 244: // (3GPP2 WWAN)
-                         connectionType = Connection.CELL_3G;
-                         break;
-                    default:
-                        connectionType = Connection.UNKNOWN;
-                        break;
-                }
-            }
-        }
-        // FYI
-        //Connection.UNKNOWN  'Unknown connection';
-        //Connection.ETHERNET 'Ethernet connection';
-        //Connection.WIFI     'WiFi connection';
-        //Connection.CELL_2G  'Cell 2G connection';
-        //Connection.CELL_3G  'Cell 3G connection';
-        //Connection.CELL_4G  'Cell 4G connection';
-        //Connection.NONE     'No network connection';
-
-        setTimeout(function () {
-            if (connectionType) {
-                win(connectionType);
-            } else {
-                win(Connection.NONE);
-            }
-        },0);
-    }
-
-};
-
-require("cordova/exec/proxy").add("NetworkStatus",module.exports);


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org


Mime
View raw message