Created
January 30, 2012 01:02
-
-
Save benbahrenburg/1701720 to your computer and use it in GitHub Desktop.
Referencing the bencoding.network module
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var benCodingNetwork = require('bencoding.network'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Ti.API.info("Create a new Carrier Info Object"); | |
var carrierInfo = benCodingNetwork.createCarrierInfo(); | |
Ti.API.info("Get carrier name => " + carrierInfo.carrierName); | |
Ti.API.info("Get mobile country code => " + carrierInfo.mobileCountryCode); | |
Ti.API.info("Get mobile network code => " + carrierInfo.mobileNetworkCode); | |
Ti.API.info("Get ISO country code for cellular service provider => " + carrierInfo.isoCountryCode); | |
Ti.API.info("Mobile service provider supports VOIP => " + carrierInfo.allowsVOIP); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Ti.API.info("Create a new Current Network Info Object"); | |
var currentNetwork = benCodingNetwork.createCurrentNetwork(); | |
Ti.API.info("Get SSID => " + currentNetwork.SSID); | |
Ti.API.info("Get BSSID => " + currentNetwork.BSSID); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Ti.API.info("Create a new Reachability Object"); | |
var reachability = benCodingNetwork.createReachability(); | |
Ti.API.info("Get reachabilityWithHostName => " + reachability.reachabilityWithHostName("www.apple.com")); | |
Ti.API.info("Get reachabilityForLocalWiFi => " + reachability.reachabilityForLocalWiFi()); | |
var hostReachableByType = reachability.hostNameReachableBy("www.apple.com"); | |
function getReachableType(findType){ | |
var results = "Oops something went wrong"; | |
if(findType==reachability.NETWORK_STATUS_NOT_REACHABLE){ | |
results="Not Reachable"; | |
} | |
if(findType==reachability.NETWORK_STATUS_WIFI){ | |
results="WiFi Network"; | |
} | |
if(findType==reachability.NEWORK_STATUS_WWAN){ | |
results="Mobile Network"; | |
} | |
return results; | |
}; | |
var reachableType=getReachableType(hostReachableByType); | |
Ti.API.info("Reachable via => " + reachableType); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
same thing here. I recompiled it from the sources but the problem above is still there.