/node_modules/ionic-native/dist/plugins/hotspot.d.ts

https://gitlab.com/diegowebd/discovery-basic-ionic2 · TypeScript Typings · 240 lines · 55 code · 0 blank · 185 comment · 0 complexity · 609d3c5ea73b6d1c7cf5061fd656848a MD5 · raw file

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