UNPKG

8.62 kBTypeScriptView Raw
1export interface HotspotConnectionInfo {
2 /**
3 * The service set identifier (SSID) of the current 802.11 network.
4 */
5 SSID: string;
6 /**
7 * The basic service set identifier (BSSID) of the current access point.
8 */
9 BSSID: string;
10 /**
11 * The current link speed in Mbps
12 */
13 linkSpeed: string;
14 /**
15 * The IP Address
16 */
17 IPAddress: string;
18 /**
19 * Each configured network has a unique small integer ID, used to identify the network when performing operations on the supplicant.
20 */
21 networkID: string;
22}
23export interface HotspotNetwork {
24 /**
25 * Human readable network name
26 */
27 SSID: string;
28 /**
29 * MAC Address of the access point
30 */
31 BSSID: string;
32 /**
33 * The primary 20 MHz frequency (in MHz) of the channel over which the client is communicating with the access point.
34 */
35 frequency: number;
36 /**
37 * The detected signal level in dBm, also known as the RSSI.
38 */
39 level: number;
40 /**
41 * Timestamp in microseconds (since boot) when this result was last seen.
42 */
43 timestamp: number;
44 /**
45 * Describes the authentication, key management, and encryption schemes supported by the access point.
46 */
47 capabilities: string;
48}
49export interface HotspotNetworkConfig {
50 /**
51 * Device IP Address
52 */
53 deviceIPAddress: string;
54 /**
55 * Device MAC Address
56 */
57 deviceMacAddress: string;
58 /**
59 * Gateway IP Address
60 */
61 gatewayIPAddress: string;
62 /**
63 * Gateway MAC Address
64 */
65 gatewayMacAddress: string;
66}
67export interface HotspotDevice {
68 /**
69 * ip
70 * Hotspot IP Address
71 */
72 ip: string;
73 /**
74 * mac
75 * Hotspot MAC Address
76 */
77 mac: string;
78}
79/**
80 * @beta
81 * @name Hotspot
82 * @description
83 * @usage
84 * ```typescript
85 * import { Hotspot, Network } from 'ionic-native';
86 *
87 *
88 * Hotspot.scanWifi().then((networks: Array<Network>) => {
89 * console.log(networks);
90 * });
91 *
92 * ```
93 * @interfaces
94 * HotspotConnectionInfo
95 * HotspotNetwork
96 * HotspotNetworkConfig
97 * HotspotDevice
98 */
99export declare class Hotspot {
100 /**
101 * @returns {Promise<boolean>}
102 */
103 static isAvailable(): Promise<boolean>;
104 /**
105 * @returns {Promise<boolean>}
106 */
107 static toggleWifi(): Promise<boolean>;
108 /**
109 * Configures and starts hotspot with SSID and Password
110 *
111 * @param {string} SSID - SSID of your new Access Point
112 * @param {string} mode - encryption mode (Open, WEP, WPA, WPA_PSK)
113 * @param {string} password - password for your new Access Point
114 *
115 * @returns {Promise<void>} - Promise to call once hotspot is started, or reject upon failure
116 */
117 static createHotspot(ssid: string, mode: string, password: string): Promise<void>;
118 /**
119 * Turns on Access Point
120 *
121 * @returns {Promise<boolean>} - true if AP is started
122 */
123 static startHotspot(): Promise<boolean>;
124 /**
125 * Configures hotspot with SSID and Password
126 *
127 * @param {string} SSID - SSID of your new Access Point
128 * @param {string} mode - encryption mode (Open, WEP, WPA, WPA_PSK)
129 * @param {string} password - password for your new Access Point
130 *
131 * @returns {Promise<void>} - Promise to call when hotspot is configured, or reject upon failure
132 */
133 static configureHotspot(ssid: string, mode: string, password: string): Promise<void>;
134 /**
135 * Turns off Access Point
136 *
137 * @returns {Promise<boolean>} - Promise to turn off the hotspot, true on success, false on failure
138 */
139 static stopHotspot(): Promise<boolean>;
140 /**
141 * Checks if hotspot is enabled
142 *
143 * @returns {Promise<void>} - Promise that hotspot is enabled, rejected if it is not enabled
144 */
145 static isHotspotEnabled(): Promise<void>;
146 /**
147 * @returns {Promise<Array<HotspotDevice>>}
148 */
149 static getAllHotspotDevices(): Promise<Array<HotspotDevice>>;
150 /**
151 * Connect to a WiFi network
152 *
153 * @param {string} ssid
154 * SSID to connect
155 * @param {string} password
156 * password to use
157 *
158 * @returns {Promise<void>}
159 * Promise that connection to the WiFi network was successfull, rejected if unsuccessful
160 */
161 static connectToWifi(ssid: string, password: string): Promise<void>;
162 /**
163 * Connect to a WiFi network
164 *
165 * @param {string} ssid
166 * SSID to connect
167 * @param {string} password
168 * Password to use
169 * @param {string} authentication
170 * Authentication modes to use (LEAP, SHARED, OPEN)
171 * @param {string[]} encryption
172 * Encryption modes to use (CCMP, TKIP, WEP104, WEP40)
173 *
174 * @returns {Promise<void>}
175 * Promise that connection to the WiFi network was successfull, rejected if unsuccessful
176 */
177 static connectToWifiAuthEncrypt(ssid: string, password: string, authentication: string, encryption: Array<string>): Promise<void>;
178 /**
179 * Add a WiFi network
180 *
181 * @param {string} ssid
182 * SSID of network
183 * @param {string} mode
184 * Authentication mode of (Open, WEP, WPA, WPA_PSK)
185 * @param {string} password
186 * Password for network
187 *
188 * @returns {Promise<void>}
189 * Promise that adding the WiFi network was successfull, rejected if unsuccessful
190 */
191 static addWifiNetwork(ssid: string, mode: string, password: string): Promise<void>;
192 /**
193 * Remove a WiFi network
194 *
195 * @param {string} ssid
196 * SSID of network
197 *
198 * @returns {Promise<void>}
199 * Promise that removing the WiFi network was successfull, rejected if unsuccessful
200 */
201 static removeWifiNetwork(ssid: string): Promise<void>;
202 /**
203 * @returns {Promise<boolean>}
204 */
205 static isConnectedToInternet(): Promise<boolean>;
206 /**
207 * @returns {Promise<boolean>}
208 */
209 static isConnectedToInternetViaWifi(): Promise<boolean>;
210 /**
211 * @returns {Promise<boolean>}
212 */
213 static isWifiOn(): Promise<boolean>;
214 /**
215 * @returns {Promise<boolean>}
216 */
217 static isWifiSupported(): Promise<boolean>;
218 /**
219 * @returns {Promise<boolean>}
220 */
221 static isWifiDirectSupported(): Promise<boolean>;
222 /**
223 * @returns {Promise<Array<HotspotNetwork>>}
224 */
225 static scanWifi(): Promise<Array<HotspotNetwork>>;
226 /**
227 * @returns {Promise<Array<HotspotNetwork>>}
228 */
229 static scanWifiByLevel(): Promise<Array<HotspotNetwork>>;
230 /**
231 * @returns {Promise<any>}
232 */
233 static startWifiPeriodicallyScan(interval: number, duration: number): Promise<any>;
234 /**
235 * @returns {Promise<any>}
236 */
237 static stopWifiPeriodicallyScan(): Promise<any>;
238 /**
239 * @returns {Promise<HotspotNetworkConfig>}
240 */
241 static getNetConfig(): Promise<HotspotNetworkConfig>;
242 /**
243 * @returns {Promise<HotspotConnectionInfo>}
244 */
245 static getConnectionInfo(): Promise<HotspotConnectionInfo>;
246 /**
247 * @returns {Promise<string>}
248 */
249 static pingHost(ip: string): Promise<string>;
250 /**
251 * Gets MAC Address associated with IP Address from ARP File
252 *
253 * @param {string} ip - IP Address that you want the MAC Address of
254 *
255 * @returns {Promise<string>} - A Promise for the MAC Address
256 */
257 static getMacAddressOfHost(ip: string): Promise<string>;
258 /**
259 * Checks if IP is live using DNS
260 *
261 * @param {string} ip - IP Address you want to test
262 *
263 * @returns {Promise<boolean>} - A Promise for whether the IP Address is reachable
264 */
265 static isDnsLive(ip: string): Promise<boolean>;
266 /**
267 * Checks if IP is live using socket And PORT
268 *
269 * @param {string} ip - IP Address you want to test
270 *
271 * @returns {Promise<boolean>} - A Promise for whether the IP Address is reachable
272 */
273 static isPortLive(ip: string): Promise<boolean>;
274 /**
275 * Checks if device is rooted
276 *
277 * @returns {Promise<boolean>} - A Promise for whether the device is rooted
278 */
279 static isRooted(): Promise<boolean>;
280}