diff options
| author | Jules Laplace <julescarbon@gmail.com> | 2017-11-05 20:24:49 +0100 |
|---|---|---|
| committer | Jules Laplace <julescarbon@gmail.com> | 2017-11-05 20:24:49 +0100 |
| commit | f828ce6d0c308c2c5d67c71ee3141b015807fd62 (patch) | |
| tree | 4f5a819afe988158902b907f4f7582448819a594 /StoneIsland/plugins/cordova-plugin-sim/src/wp/Sim.cs | |
| parent | 1f38892c1729572fa98801692dc20c60931d7377 (diff) | |
cordova-plugin-sim
Diffstat (limited to 'StoneIsland/plugins/cordova-plugin-sim/src/wp/Sim.cs')
| -rw-r--r-- | StoneIsland/plugins/cordova-plugin-sim/src/wp/Sim.cs | 74 |
1 files changed, 74 insertions, 0 deletions
diff --git a/StoneIsland/plugins/cordova-plugin-sim/src/wp/Sim.cs b/StoneIsland/plugins/cordova-plugin-sim/src/wp/Sim.cs new file mode 100644 index 00000000..d6e5c9db --- /dev/null +++ b/StoneIsland/plugins/cordova-plugin-sim/src/wp/Sim.cs @@ -0,0 +1,74 @@ +// DeviceNetworkInformation +// https://msdn.microsoft.com/en-us/library/windows/apps/microsoft.phone.net.networkinformation.devicenetworkinformation(v=vs.105).aspx +// +// TODO http://stackoverflow.com/a/21879531 + +using System; +using Microsoft.Phone.Net.NetworkInformation; + +namespace WPCordovaClassLib.Cordova.Commands +{ + public class Sim : BaseCommand + { + public void getSimInfo(string notused) + { + + string res = String.Format("\"carrierName\":\"{0}\",\"countryCode\":\"\",\"mcc\":\"\",\"mnc\":\"\",\"isCellularDataEnabled\":\"{1}\",\"isCellularDataRoamingEnabled\":\"{2}\",\"isNetworkAvailable\":\"{3}\",\"isWiFiEnabled\":\"{4}\"", + this.CellularMobileOperator, + this.IsCellularDataEnabled, + this.IsCellularDataRoamingEnabled, + this.IsNetworkAvailable, + this.IsWiFiEnabled); + + res = "{" + res + "}"; + + DispatchCommandResult(new PluginResult(PluginResult.Status.OK, res)); + } + + // Gets the name of the cellular mobile operator. + public string CellularMobileOperator + { + get + { + return DeviceNetworkInformation.CellularMobileOperator; + } + } + + // Gets a value indicating whether the network is cellular data enabled. + public bool IsCellularDataEnabled + { + get + { + return DeviceNetworkInformation.IsCellularDataEnabled; + } + } + + // Gets a value indicating whether the network allows data roaming. + public bool IsCellularDataRoamingEnabled + { + get + { + return DeviceNetworkInformation.IsCellularDataRoamingEnabled; + } + } + + // Gets a value indicating whether the network is available. + public bool IsNetworkAvailable + { + get + { + return DeviceNetworkInformation.IsNetworkAvailable; + } + } + + // Gets a value indicating whether the network is Wi-Fi enabled. + public bool IsWiFiEnabled + { + get + { + return DeviceNetworkInformation.IsWiFiEnabled; + } + } + + } +} |
