cordova-plugin-hotspot
Advanced tools
Comparing version 0.4.0 to 0.5.0
{ | ||
"name": "cordova-plugin-hotspot", | ||
"version": "0.4.0", | ||
"version": "0.5.0", | ||
"description": "Cordova WiFi Hotspot Plugin", | ||
@@ -5,0 +5,0 @@ "cordova": { |
122
README.md
@@ -27,2 +27,110 @@ # Cordova HotSpot Plugin | ||
### Check if device is connected to internet | ||
```javascript | ||
cordova.plugins.hotspot.isConnectedToInternet( | ||
function () { | ||
// is connected | ||
},function () { | ||
// is not connected | ||
} | ||
); | ||
``` | ||
### Get network configuration | ||
```javascript | ||
cordova.plugins.hotspot.getNetConfig( | ||
function (result) { | ||
// deviceIPAddress | ||
// deviceMacAddress | ||
// gatewayIPAddress | ||
// gatewayMacAddress | ||
},function () { | ||
// error | ||
} | ||
); | ||
``` | ||
### Ping a host | ||
```javascript | ||
cordova.plugins.hotspot.pingHost(ip, | ||
function (result) { | ||
if(result){ | ||
// host is up | ||
} else { | ||
// host is not responsing | ||
} | ||
},function () { | ||
// error | ||
} | ||
); | ||
``` | ||
### Get MAC address of host | ||
```javascript | ||
cordova.plugins.hotspot.getMacAddressOfHost(ip, | ||
function (result) { | ||
if(result){ | ||
// MAC address of host | ||
} else { | ||
// host is not responsing | ||
} | ||
},function () { | ||
// error | ||
} | ||
); | ||
``` | ||
### Check DNS is alive | ||
```javascript | ||
cordova.plugins.hotspot.isDnsLive(ip, | ||
function (live) { | ||
if(live){ | ||
// DNS is live | ||
} else { | ||
// DNS is not live | ||
} | ||
},function () { | ||
// error | ||
} | ||
); | ||
``` | ||
### Check port is alive | ||
```javascript | ||
cordova.plugins.hotspot.isPortLive(ip, | ||
function (live) { | ||
if(live){ | ||
// DNS is live | ||
} else { | ||
// DNS is not live | ||
} | ||
},function () { | ||
// error | ||
} | ||
); | ||
``` | ||
### Check if device is rooted | ||
```javascript | ||
cordova.plugins.hotspot.isRooted( | ||
function (rooted) { | ||
if(rooted){ | ||
// device is rooted | ||
} else { | ||
// device is not rooted | ||
} | ||
},function () { | ||
// error | ||
} | ||
); | ||
``` | ||
### Hotspot functionality | ||
@@ -92,3 +200,3 @@ | ||
); | ||
``` | ||
``` | ||
@@ -107,2 +215,14 @@ #### Check if Wifi is enabled | ||
### Check if device is connected to internet via Wifi | ||
```javascript | ||
cordova.plugins.hotspot.isConnectedToInternetViaWifi( | ||
function () { | ||
// is connected | ||
},function () { | ||
// is not connected | ||
} | ||
); | ||
``` | ||
### Check if Wifi Direct is supported | ||
@@ -109,0 +229,0 @@ |
@@ -160,2 +160,28 @@ /* | ||
/** | ||
* Check if connection to internet is active | ||
* | ||
* @param {Function} successCB | ||
* A callback function to be called when connection is active | ||
* @param {Object} errorCB | ||
* A callback function to be called when not | ||
*/ | ||
isConnectedToInternet: function (successCB, errorCB) { | ||
cordova.exec(successCB, function (err) { | ||
errorCB(err); | ||
}, 'HotSpotPlugin', 'isConnectedToInternet', []); | ||
}, | ||
/** | ||
* Check if connection to internet is active via WiFi | ||
* | ||
* @param {Function} successCB | ||
* A callback function to be called when connection is done via wifi | ||
* @param {Object} errorCB | ||
* A callback function to be called when not | ||
*/ | ||
isConnectedToInternetViaWifi: function (successCB, errorCB) { | ||
cordova.exec(successCB, function (err) { | ||
errorCB(err); | ||
}, 'HotSpotPlugin', 'isConnectedToInternetViaWifi', []); | ||
}, | ||
/** | ||
* Check if WiFi is enabled | ||
@@ -187,2 +213,15 @@ * | ||
/** | ||
* Check if WiFi Direct is supported | ||
* | ||
* @param {Function} successCB | ||
* A callback function to be called when WiFi Direct is supported | ||
* @param {Object} errorCB | ||
* A callback function to be called when WiFi Direct is not supported | ||
*/ | ||
isWifiDirectSupported: function (successCB, errorCB) { | ||
cordova.exec(successCB, function (err) { | ||
errorCB(err); | ||
}, 'HotSpotPlugin', 'isWifiDirectSupported', []); | ||
}, | ||
/** | ||
* Scan wifi | ||
@@ -244,13 +283,100 @@ * | ||
/** | ||
* Check if WiFi Direct is supported | ||
* Get network information, e.g Gateway Ip/Mac Device Mac/Ip etc | ||
* | ||
* @param {Function} successCB | ||
* A callback function to be called when WiFi Direct is supported | ||
* A callback function to be called with all information | ||
* @param {Object} errorCB | ||
* A callback function to be called when WiFi Direct is not supported | ||
* An error callback | ||
*/ | ||
isWifiDirectSupported: function (successCB, errorCB) { | ||
getNetConfig: function (successCB, errorCB) { | ||
cordova.exec(successCB, function (err) { | ||
errorCB(err); | ||
}, 'HotSpotPlugin', 'isWifiDirectSupported', []); | ||
}, 'HotSpotPlugin', 'getNetConfig', []); | ||
}, | ||
/** | ||
* Ping a host | ||
* | ||
* @param {String} ip | ||
* host IP | ||
* @param {Function} successCB | ||
* A callback function to be called with all information | ||
* @param {Object} errorCB | ||
* An error callback | ||
*/ | ||
pingHost: function (ip, successCB, errorCB) { | ||
cordova.exec(successCB, function (err) { | ||
errorCB(err); | ||
}, 'HotSpotPlugin', 'pingHost', [ip]); | ||
}, | ||
/** | ||
* Get MAC address of host | ||
* | ||
* @param {String} ip | ||
* host IP | ||
* @param {Function} successCB | ||
* A callback function to be called with all information | ||
* @param {Object} errorCB | ||
* An error callback | ||
*/ | ||
getMacAddressOfHost: function (ip, successCB, errorCB) { | ||
cordova.exec(successCB, function (err) { | ||
errorCB(err); | ||
}, 'HotSpotPlugin', 'getMacAddressOfHost', [ip]); | ||
}, | ||
/** | ||
* dnsLive | ||
* | ||
* @param {String} ip | ||
* host IP | ||
* @param {Function} successCB | ||
* A callback function to be called with all information | ||
* @param {Object} errorCB | ||
* An error callback | ||
*/ | ||
isDnsLive: function (ip, successCB, errorCB) { | ||
cordova.exec(function (code) { | ||
if (code === 1) { | ||
successCB(true); | ||
} else { | ||
successCB(false); | ||
} | ||
}, function (err) { | ||
errorCB(err); | ||
}, 'HotSpotPlugin', 'dnsLive', [ip]); | ||
}, | ||
/** | ||
* portLive | ||
* | ||
* @param {String} ip | ||
* host IP | ||
* @param {Function} successCB | ||
* A callback function to be called with all information | ||
* @param {Object} errorCB | ||
* An error callback | ||
*/ | ||
isPortLive: function (ip, successCB, errorCB) { | ||
cordova.exec(function (code) { | ||
if (code === 1) { | ||
successCB(true); | ||
} else { | ||
successCB(false); | ||
} | ||
}, errorCB, 'HotSpotPlugin', 'portLive', [ip]); | ||
}, | ||
/** | ||
* Check Device is Rooted | ||
* | ||
* @param {Function} successCB | ||
* A callback function to be called with all information | ||
* @param {Object} errorCB | ||
* An error callback | ||
*/ | ||
isRooted: function (successCB, errorCB) { | ||
cordova.exec(function (code) { | ||
if (code === 1) { | ||
successCB(true); | ||
} else { | ||
successCB(false); | ||
} | ||
}, errorCB, 'HotSpotPlugin', 'checkRoot', []); | ||
} | ||
@@ -257,0 +383,0 @@ } |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
28520383
368
309