awesome-cordova-plugins/src/plugins/hotspot.ts

223 lines
6.2 KiB
TypeScript
Raw Normal View History

import {Plugin, Cordova} from './plugin';
2016-05-06 08:57:49 +08:00
import {Network} from './network.model';
import {NetworkConfig} from './network-config.model';
import {ConnectionInfo} from './connection-info.model';
import {HotspotDevice} from './hotspot-device.model';
/**
* @name Hotspot
* @description
* @usage
* ```js
2016-05-06 09:06:33 +08:00
* import {Hotspot, Network} from 'ionic-native';
*
2016-05-06 09:06:33 +08:00
* ...
* Hotspot.scanWifi().then((networks: Array<Network>) => {
* console.log(networks);
* });
* ...
*
* ```
*/
@Plugin({
plugin: 'cordova-plugin-hotspot',
pluginRef: 'cordova.plugins.hotspot',
repo: 'https://github.com/hypery2k/cordova-hotspot-plugin',
platforms: ['Android']
})
export class Hotspot {
@Cordova()
static isAvailable(): Promise<boolean> {return; }
@Cordova()
2016-05-06 08:57:49 +08:00
static toggleWifi(): Promise<boolean> {return; }
/**
* Configures and starts hotspot with SSID and Password
*
* @param {string} SSID - SSID of your new Access Point
* @param {string} mode - encryption mode (Open, WEP, WPA, WPA_PSK)
* @param {string} password - password for your new Access Point
*
* @return {Promise<void>} - Promise to call once hotspot is started, or reject upon failure
*/
@Cordova()
static createHotspot(ssid: string, mode: string, password: string): Promise<void> {return; }
/**
* Turns on Access Point
*
* @return {Promise<boolean>} - true if AP is started
*/
@Cordova()
static startHotspot(): Promise<boolean> {return; }
/**
* Configures hotspot with SSID and Password
*
* @param {string} SSID - SSID of your new Access Point
* @param {string} mode - encryption mode (Open, WEP, WPA, WPA_PSK)
* @param {string} password - password for your new Access Point
*
* @return {Promise<void>} - Promise to call when hotspot is configured, or reject upon failure
*/
@Cordova()
2016-05-06 08:57:49 +08:00
static configureHotspot(ssid: string, mode: string, password: string): Promise<void> {return; }
2016-05-06 08:57:49 +08:00
/**
* Turns off Access Point
*
* @return {Promise<boolean>} - Promise to turn off the hotspot, true on success, false on failure
*/
@Cordova()
2016-05-06 08:57:49 +08:00
static stopHotspot(): Promise<boolean> {return; }
2016-05-06 08:57:49 +08:00
/**
* Checks if hotspot is enabled
*
* @return {Promise<void>} - Promise that hotspot is enabled, rejected if it is not enabled
*/
@Cordova()
2016-05-06 08:57:49 +08:00
static isHotspotEnabled(): Promise<void> {return; }
@Cordova()
2016-05-06 08:57:49 +08:00
static getAllHotspotDevices(): Promise<Array<HotspotDevice>> {return; }
2016-05-06 08:57:49 +08:00
/**
* Connect to a WiFi network
*
* @param {string} ssid
* SSID to connect
* @param {string} password
* password to use
*
* @return {Promise<void>}
* Promise that connection to the WiFi network was successfull, rejected if unsuccessful
*/
@Cordova()
2016-05-06 08:57:49 +08:00
static connectToHotspot(ssid: string, password: string): Promise<void> {return; }
2016-05-06 08:57:49 +08:00
/**
* Connect to a WiFi network
*
* @param {string} ssid
* SSID to connect
* @param {string} password
* Password to use
* @param {string} authentication
* Authentication modes to use (LEAP, SHARED, OPEN)
* @param {string[]} encryption
* Encryption modes to use (CCMP, TKIP, WEP104, WEP40)
*
* @return {Promise<void>}
* Promise that connection to the WiFi network was successfull, rejected if unsuccessful
*/
@Cordova()
2016-05-06 08:57:49 +08:00
static connectToWifiAuthEncrypt(ssid: string, password: string, authentication: string, encryption: Array<string>): Promise<void> {return; }
2016-05-06 08:57:49 +08:00
/**
* Add a WiFi network
*
* @param {string} ssid
* SSID of network
* @param {string} mode
* Authentication mode of (Open, WEP, WPA, WPA_PSK)
* @param {string} password
* Password for network
*
* @return {Promise<void>}
* Promise that adding the WiFi network was successfull, rejected if unsuccessful
*/
@Cordova()
2016-05-06 08:57:49 +08:00
static addWifiNetwork(ssid: string, mode: string, password: string): Promise<void> {return; }
2016-05-06 08:57:49 +08:00
/**
* Remove a WiFi network
*
* @param {string} ssid
* SSID of network
*
* @return {Promise<void>}
* Promise that removing the WiFi network was successfull, rejected if unsuccessful
*/
@Cordova()
2016-05-06 08:57:49 +08:00
static removeWifiNetwork(ssid: string): Promise<void> {return; }
@Cordova()
2016-05-06 08:57:49 +08:00
static isConnectedToInternet(): Promise<boolean> {return; }
@Cordova()
2016-05-06 08:57:49 +08:00
static isConnectedToInternetViaWifi(): Promise<boolean> {return; }
@Cordova()
2016-05-06 08:57:49 +08:00
static isWifiOn(): Promise<boolean> {return; }
@Cordova()
2016-05-06 08:57:49 +08:00
static isWifiSupported(): Promise<boolean> {return; }
@Cordova()
2016-05-06 08:57:49 +08:00
static isWifiDirectSupported(): Promise<boolean> {return; }
@Cordova()
2016-05-06 08:57:49 +08:00
static scanWifi(): Promise<Array<Network>> {return; }
@Cordova()
2016-05-06 08:57:49 +08:00
static scanWifiByLevel(): Promise<Array<Network>> {return; }
@Cordova()
static startPeriodicallyScan(interval: number, duration: number): Promise<any> {return; }
@Cordova()
static stopPeriodicallyScan(): Promise<any> {return; }
@Cordova()
2016-05-06 08:57:49 +08:00
static getNetConfig(): Promise<NetworkConfig> {return; }
@Cordova()
2016-05-06 08:57:49 +08:00
static getConnectionInfo(): Promise<ConnectionInfo> {return; }
@Cordova()
2016-05-06 08:57:49 +08:00
static pingHost(ip: string): Promise<string> {return; }
2016-05-06 08:57:49 +08:00
/**
* Gets MAC Address associated with IP Address from ARP File
*
* @param {string} ip - IP Address that you want the MAC Address of
*
* @return {Promise<string>} - A Promise for the MAC Address
*/
@Cordova()
2016-05-06 08:57:49 +08:00
static getMacAddressOfHost(ip: string): Promise<string> {return; }
2016-05-06 08:57:49 +08:00
/**
* Checks if IP is live using DNS
*
* @param {string} ip - IP Address you want to test
*
* @return {Promise<boolean>} - A Promise for whether the IP Address is reachable
*/
@Cordova()
2016-05-06 08:57:49 +08:00
static isDnsLive(ip: string): Promise<boolean> {return; }
2016-05-06 08:57:49 +08:00
/**
* Checks if IP is live using socket And PORT
*
* @param {string} ip - IP Address you want to test
*
* @return {Promise<boolean>} - A Promise for whether the IP Address is reachable
*/
@Cordova()
2016-05-06 08:57:49 +08:00
static isPortLife(ip: string): Promise<boolean> {return; }
2016-05-06 08:57:49 +08:00
/**
* Checks if device is rooted
*
* @return {Promise<boolean>} - A Promise for whether the device is rooted
*/
@Cordova()
2016-05-06 08:57:49 +08:00
static isRooted(): Promise<boolean> {return; }
}