diff options
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; + } + } + + } +} |
