@capgo/capacitor-wifi 7.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,493 @@
1
+ import type { PluginListenerHandle } from '@capacitor/core';
2
+ /**
3
+ * WiFi plugin for managing device WiFi connectivity
4
+ *
5
+ * @since 7.0.0
6
+ */
7
+ export interface CapacitorWifiPlugin {
8
+ /**
9
+ * Show a system dialog to add a Wi-Fi network to the device.
10
+ * On Android SDK 30+, this opens the system Wi-Fi settings with the network pre-filled.
11
+ * On iOS, this connects to the network directly.
12
+ *
13
+ * @param options - Network configuration options
14
+ * @returns Promise that resolves when the network is added
15
+ * @throws Error if adding the network fails
16
+ * @since 7.0.0
17
+ * @example
18
+ * ```typescript
19
+ * await CapacitorWifi.addNetwork({
20
+ * ssid: 'MyNetwork',
21
+ * password: 'mypassword',
22
+ * isHiddenSsid: false,
23
+ * securityType: NetworkSecurityType.WPA2_PSK
24
+ * });
25
+ * ```
26
+ */
27
+ addNetwork(options: AddNetworkOptions): Promise<void>;
28
+ /**
29
+ * Connect to a Wi-Fi network.
30
+ * On Android, this creates a temporary connection that doesn't route traffic through the network by default.
31
+ * For a persistent connection on Android, use addNetwork() instead.
32
+ * On iOS, this creates a persistent connection.
33
+ *
34
+ * @param options - Connection options
35
+ * @returns Promise that resolves when connected
36
+ * @throws Error if connection fails
37
+ * @since 7.0.0
38
+ * @example
39
+ * ```typescript
40
+ * await CapacitorWifi.connect({
41
+ * ssid: 'MyNetwork',
42
+ * password: 'mypassword'
43
+ * });
44
+ * ```
45
+ */
46
+ connect(options: ConnectOptions): Promise<void>;
47
+ /**
48
+ * Disconnect from the current Wi-Fi network.
49
+ * On iOS, only disconnects from networks that were added via this plugin.
50
+ *
51
+ * @param options - Optional disconnect options
52
+ * @returns Promise that resolves when disconnected
53
+ * @throws Error if disconnection fails
54
+ * @since 7.0.0
55
+ * @example
56
+ * ```typescript
57
+ * await CapacitorWifi.disconnect();
58
+ * ```
59
+ */
60
+ disconnect(options?: DisconnectOptions): Promise<void>;
61
+ /**
62
+ * Get a list of available Wi-Fi networks from the last scan.
63
+ * Only available on Android.
64
+ *
65
+ * @returns Promise that resolves with the list of networks
66
+ * @throws Error if getting networks fails or on unsupported platform
67
+ * @since 7.0.0
68
+ * @example
69
+ * ```typescript
70
+ * const { networks } = await CapacitorWifi.getAvailableNetworks();
71
+ * networks.forEach(network => {
72
+ * console.log(`SSID: ${network.ssid}, Signal: ${network.rssi} dBm`);
73
+ * });
74
+ * ```
75
+ */
76
+ getAvailableNetworks(): Promise<GetAvailableNetworksResult>;
77
+ /**
78
+ * Get the device's current IP address.
79
+ * Available on both Android and iOS.
80
+ *
81
+ * @returns Promise that resolves with the IP address
82
+ * @throws Error if getting IP address fails
83
+ * @since 7.0.0
84
+ * @example
85
+ * ```typescript
86
+ * const { ipAddress } = await CapacitorWifi.getIpAddress();
87
+ * console.log('IP Address:', ipAddress);
88
+ * ```
89
+ */
90
+ getIpAddress(): Promise<GetIpAddressResult>;
91
+ /**
92
+ * Get the received signal strength indicator (RSSI) of the current network in dBm.
93
+ * Only available on Android.
94
+ *
95
+ * @returns Promise that resolves with the RSSI value
96
+ * @throws Error if getting RSSI fails or on unsupported platform
97
+ * @since 7.0.0
98
+ * @example
99
+ * ```typescript
100
+ * const { rssi } = await CapacitorWifi.getRssi();
101
+ * console.log('Signal strength:', rssi, 'dBm');
102
+ * ```
103
+ */
104
+ getRssi(): Promise<GetRssiResult>;
105
+ /**
106
+ * Get the service set identifier (SSID) of the current network.
107
+ * Available on both Android and iOS.
108
+ *
109
+ * @returns Promise that resolves with the SSID
110
+ * @throws Error if getting SSID fails
111
+ * @since 7.0.0
112
+ * @example
113
+ * ```typescript
114
+ * const { ssid } = await CapacitorWifi.getSsid();
115
+ * console.log('Connected to:', ssid);
116
+ * ```
117
+ */
118
+ getSsid(): Promise<GetSsidResult>;
119
+ /**
120
+ * Check if Wi-Fi is enabled on the device.
121
+ * Only available on Android.
122
+ *
123
+ * @returns Promise that resolves with the Wi-Fi enabled status
124
+ * @throws Error if checking status fails or on unsupported platform
125
+ * @since 7.0.0
126
+ * @example
127
+ * ```typescript
128
+ * const { enabled } = await CapacitorWifi.isEnabled();
129
+ * console.log('WiFi is', enabled ? 'enabled' : 'disabled');
130
+ * ```
131
+ */
132
+ isEnabled(): Promise<IsEnabledResult>;
133
+ /**
134
+ * Start scanning for Wi-Fi networks.
135
+ * Only available on Android.
136
+ * Results are delivered via the 'networksScanned' event listener.
137
+ * Note: May fail due to system throttling or hardware issues.
138
+ *
139
+ * @returns Promise that resolves when scan starts
140
+ * @throws Error if scan fails or on unsupported platform
141
+ * @since 7.0.0
142
+ * @example
143
+ * ```typescript
144
+ * await CapacitorWifi.addListener('networksScanned', () => {
145
+ * console.log('Scan completed');
146
+ * });
147
+ * await CapacitorWifi.startScan();
148
+ * ```
149
+ */
150
+ startScan(): Promise<void>;
151
+ /**
152
+ * Check the current permission status for location access.
153
+ * Location permission is required for Wi-Fi operations on both platforms.
154
+ *
155
+ * @returns Promise that resolves with the permission status
156
+ * @throws Error if checking permissions fails
157
+ * @since 7.0.0
158
+ * @example
159
+ * ```typescript
160
+ * const status = await CapacitorWifi.checkPermissions();
161
+ * console.log('Location permission:', status.location);
162
+ * ```
163
+ */
164
+ checkPermissions(): Promise<PermissionStatus>;
165
+ /**
166
+ * Request location permissions from the user.
167
+ * Location permission is required for Wi-Fi operations on both platforms.
168
+ *
169
+ * @param options - Optional permission request options
170
+ * @returns Promise that resolves with the updated permission status
171
+ * @throws Error if requesting permissions fails
172
+ * @since 7.0.0
173
+ * @example
174
+ * ```typescript
175
+ * const status = await CapacitorWifi.requestPermissions();
176
+ * if (status.location === 'granted') {
177
+ * console.log('Permission granted');
178
+ * }
179
+ * ```
180
+ */
181
+ requestPermissions(options?: RequestPermissionsOptions): Promise<PermissionStatus>;
182
+ /**
183
+ * Add a listener for the 'networksScanned' event.
184
+ * Only available on Android.
185
+ * This event is fired when Wi-Fi scan results are available.
186
+ *
187
+ * @param eventName - The event name ('networksScanned')
188
+ * @param listenerFunc - The callback function to execute
189
+ * @returns Promise that resolves with a listener handle
190
+ * @since 7.0.0
191
+ * @example
192
+ * ```typescript
193
+ * const listener = await CapacitorWifi.addListener('networksScanned', async () => {
194
+ * const { networks } = await CapacitorWifi.getAvailableNetworks();
195
+ * console.log('Found networks:', networks);
196
+ * });
197
+ * ```
198
+ */
199
+ addListener(eventName: 'networksScanned', listenerFunc: () => void): Promise<PluginListenerHandle>;
200
+ /**
201
+ * Remove all listeners for this plugin.
202
+ *
203
+ * @returns Promise that resolves when all listeners are removed
204
+ * @since 7.0.0
205
+ * @example
206
+ * ```typescript
207
+ * await CapacitorWifi.removeAllListeners();
208
+ * ```
209
+ */
210
+ removeAllListeners(): Promise<void>;
211
+ /**
212
+ * Get the native plugin version.
213
+ *
214
+ * @returns Promise that resolves with the plugin version
215
+ * @throws Error if getting the version fails
216
+ * @since 7.0.0
217
+ * @example
218
+ * ```typescript
219
+ * const { version } = await CapacitorWifi.getPluginVersion();
220
+ * console.log('Plugin version:', version);
221
+ * ```
222
+ */
223
+ getPluginVersion(): Promise<{
224
+ version: string;
225
+ }>;
226
+ }
227
+ /**
228
+ * Options for adding a network
229
+ *
230
+ * @since 7.0.0
231
+ */
232
+ export interface AddNetworkOptions {
233
+ /**
234
+ * The SSID of the network to add
235
+ *
236
+ * @since 7.0.0
237
+ */
238
+ ssid: string;
239
+ /**
240
+ * The password for the network (optional for open networks)
241
+ *
242
+ * @since 7.0.0
243
+ */
244
+ password?: string;
245
+ /**
246
+ * Whether the network is hidden (Android only)
247
+ *
248
+ * @since 7.0.0
249
+ * @default false
250
+ */
251
+ isHiddenSsid?: boolean;
252
+ /**
253
+ * The security type of the network (Android only)
254
+ *
255
+ * @since 7.0.0
256
+ * @default NetworkSecurityType.WPA2_PSK
257
+ */
258
+ securityType?: NetworkSecurityType;
259
+ }
260
+ /**
261
+ * Options for connecting to a network
262
+ *
263
+ * @since 7.0.0
264
+ */
265
+ export interface ConnectOptions {
266
+ /**
267
+ * The SSID of the network to connect to
268
+ *
269
+ * @since 7.0.0
270
+ */
271
+ ssid: string;
272
+ /**
273
+ * The password for the network (optional for open networks)
274
+ *
275
+ * @since 7.0.0
276
+ */
277
+ password?: string;
278
+ /**
279
+ * Whether the network is hidden (Android only)
280
+ *
281
+ * @since 7.0.0
282
+ * @default false
283
+ */
284
+ isHiddenSsid?: boolean;
285
+ }
286
+ /**
287
+ * Options for disconnecting from a network
288
+ *
289
+ * @since 7.0.0
290
+ */
291
+ export interface DisconnectOptions {
292
+ /**
293
+ * The SSID of the network to disconnect from (optional)
294
+ *
295
+ * @since 7.0.0
296
+ */
297
+ ssid?: string;
298
+ }
299
+ /**
300
+ * Result from getAvailableNetworks()
301
+ *
302
+ * @since 7.0.0
303
+ */
304
+ export interface GetAvailableNetworksResult {
305
+ /**
306
+ * List of available networks
307
+ *
308
+ * @since 7.0.0
309
+ */
310
+ networks: Network[];
311
+ }
312
+ /**
313
+ * Represents a Wi-Fi network
314
+ *
315
+ * @since 7.0.0
316
+ */
317
+ export interface Network {
318
+ /**
319
+ * The SSID of the network
320
+ *
321
+ * @since 7.0.0
322
+ */
323
+ ssid: string;
324
+ /**
325
+ * The signal strength in dBm
326
+ *
327
+ * @since 7.0.0
328
+ */
329
+ rssi: number;
330
+ /**
331
+ * The security types supported by this network (Android SDK 33+ only)
332
+ *
333
+ * @since 7.0.0
334
+ */
335
+ securityTypes?: NetworkSecurityType[];
336
+ }
337
+ /**
338
+ * Result from getIpAddress()
339
+ *
340
+ * @since 7.0.0
341
+ */
342
+ export interface GetIpAddressResult {
343
+ /**
344
+ * The device's IP address
345
+ *
346
+ * @since 7.0.0
347
+ */
348
+ ipAddress: string;
349
+ }
350
+ /**
351
+ * Result from getRssi()
352
+ *
353
+ * @since 7.0.0
354
+ */
355
+ export interface GetRssiResult {
356
+ /**
357
+ * The signal strength in dBm
358
+ *
359
+ * @since 7.0.0
360
+ */
361
+ rssi: number;
362
+ }
363
+ /**
364
+ * Result from getSsid()
365
+ *
366
+ * @since 7.0.0
367
+ */
368
+ export interface GetSsidResult {
369
+ /**
370
+ * The SSID of the current network
371
+ *
372
+ * @since 7.0.0
373
+ */
374
+ ssid: string;
375
+ }
376
+ /**
377
+ * Result from isEnabled()
378
+ *
379
+ * @since 7.0.0
380
+ */
381
+ export interface IsEnabledResult {
382
+ /**
383
+ * Whether Wi-Fi is enabled
384
+ *
385
+ * @since 7.0.0
386
+ */
387
+ enabled: boolean;
388
+ }
389
+ /**
390
+ * Permission status
391
+ *
392
+ * @since 7.0.0
393
+ */
394
+ export interface PermissionStatus {
395
+ /**
396
+ * Location permission state
397
+ *
398
+ * @since 7.0.0
399
+ */
400
+ location: PermissionState;
401
+ }
402
+ /**
403
+ * Possible permission states
404
+ *
405
+ * @since 7.0.0
406
+ */
407
+ export type PermissionState = 'granted' | 'denied' | 'prompt';
408
+ /**
409
+ * Options for requesting permissions
410
+ *
411
+ * @since 7.0.0
412
+ */
413
+ export interface RequestPermissionsOptions {
414
+ /**
415
+ * Permissions to request
416
+ *
417
+ * @since 7.0.0
418
+ */
419
+ permissions?: 'location'[];
420
+ }
421
+ /**
422
+ * Network security types
423
+ *
424
+ * @since 7.0.0
425
+ */
426
+ export declare enum NetworkSecurityType {
427
+ /**
428
+ * Open network with no security
429
+ *
430
+ * @since 7.0.0
431
+ */
432
+ OPEN = 0,
433
+ /**
434
+ * WEP security
435
+ *
436
+ * @since 7.0.0
437
+ */
438
+ WEP = 1,
439
+ /**
440
+ * WPA/WPA2 Personal (PSK)
441
+ *
442
+ * @since 7.0.0
443
+ */
444
+ WPA2_PSK = 2,
445
+ /**
446
+ * WPA/WPA2/WPA3 Enterprise (EAP)
447
+ *
448
+ * @since 7.0.0
449
+ */
450
+ EAP = 3,
451
+ /**
452
+ * WPA3 Personal (SAE)
453
+ *
454
+ * @since 7.0.0
455
+ */
456
+ SAE = 4,
457
+ /**
458
+ * WPA3 Enterprise
459
+ *
460
+ * @since 7.0.0
461
+ */
462
+ WPA3_ENTERPRISE = 5,
463
+ /**
464
+ * WPA3 Enterprise 192-bit mode
465
+ *
466
+ * @since 7.0.0
467
+ */
468
+ WPA3_ENTERPRISE_192_BIT = 6,
469
+ /**
470
+ * Passpoint network
471
+ *
472
+ * @since 7.0.0
473
+ */
474
+ PASSPOINT = 7,
475
+ /**
476
+ * Enhanced Open (OWE)
477
+ *
478
+ * @since 7.0.0
479
+ */
480
+ OWE = 8,
481
+ /**
482
+ * WAPI PSK
483
+ *
484
+ * @since 7.0.0
485
+ */
486
+ WAPI_PSK = 9,
487
+ /**
488
+ * WAPI Certificate
489
+ *
490
+ * @since 7.0.0
491
+ */
492
+ WAPI_CERT = 10
493
+ }
@@ -0,0 +1,75 @@
1
+ /**
2
+ * Network security types
3
+ *
4
+ * @since 7.0.0
5
+ */
6
+ export var NetworkSecurityType;
7
+ (function (NetworkSecurityType) {
8
+ /**
9
+ * Open network with no security
10
+ *
11
+ * @since 7.0.0
12
+ */
13
+ NetworkSecurityType[NetworkSecurityType["OPEN"] = 0] = "OPEN";
14
+ /**
15
+ * WEP security
16
+ *
17
+ * @since 7.0.0
18
+ */
19
+ NetworkSecurityType[NetworkSecurityType["WEP"] = 1] = "WEP";
20
+ /**
21
+ * WPA/WPA2 Personal (PSK)
22
+ *
23
+ * @since 7.0.0
24
+ */
25
+ NetworkSecurityType[NetworkSecurityType["WPA2_PSK"] = 2] = "WPA2_PSK";
26
+ /**
27
+ * WPA/WPA2/WPA3 Enterprise (EAP)
28
+ *
29
+ * @since 7.0.0
30
+ */
31
+ NetworkSecurityType[NetworkSecurityType["EAP"] = 3] = "EAP";
32
+ /**
33
+ * WPA3 Personal (SAE)
34
+ *
35
+ * @since 7.0.0
36
+ */
37
+ NetworkSecurityType[NetworkSecurityType["SAE"] = 4] = "SAE";
38
+ /**
39
+ * WPA3 Enterprise
40
+ *
41
+ * @since 7.0.0
42
+ */
43
+ NetworkSecurityType[NetworkSecurityType["WPA3_ENTERPRISE"] = 5] = "WPA3_ENTERPRISE";
44
+ /**
45
+ * WPA3 Enterprise 192-bit mode
46
+ *
47
+ * @since 7.0.0
48
+ */
49
+ NetworkSecurityType[NetworkSecurityType["WPA3_ENTERPRISE_192_BIT"] = 6] = "WPA3_ENTERPRISE_192_BIT";
50
+ /**
51
+ * Passpoint network
52
+ *
53
+ * @since 7.0.0
54
+ */
55
+ NetworkSecurityType[NetworkSecurityType["PASSPOINT"] = 7] = "PASSPOINT";
56
+ /**
57
+ * Enhanced Open (OWE)
58
+ *
59
+ * @since 7.0.0
60
+ */
61
+ NetworkSecurityType[NetworkSecurityType["OWE"] = 8] = "OWE";
62
+ /**
63
+ * WAPI PSK
64
+ *
65
+ * @since 7.0.0
66
+ */
67
+ NetworkSecurityType[NetworkSecurityType["WAPI_PSK"] = 9] = "WAPI_PSK";
68
+ /**
69
+ * WAPI Certificate
70
+ *
71
+ * @since 7.0.0
72
+ */
73
+ NetworkSecurityType[NetworkSecurityType["WAPI_CERT"] = 10] = "WAPI_CERT";
74
+ })(NetworkSecurityType || (NetworkSecurityType = {}));
75
+ //# sourceMappingURL=definitions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"AAocA;;;;GAIG;AACH,MAAM,CAAN,IAAY,mBA6EX;AA7ED,WAAY,mBAAmB;IAC7B;;;;OAIG;IACH,6DAAQ,CAAA;IAER;;;;OAIG;IACH,2DAAO,CAAA;IAEP;;;;OAIG;IACH,qEAAY,CAAA;IAEZ;;;;OAIG;IACH,2DAAO,CAAA;IAEP;;;;OAIG;IACH,2DAAO,CAAA;IAEP;;;;OAIG;IACH,mFAAmB,CAAA;IAEnB;;;;OAIG;IACH,mGAA2B,CAAA;IAE3B;;;;OAIG;IACH,uEAAa,CAAA;IAEb;;;;OAIG;IACH,2DAAO,CAAA;IAEP;;;;OAIG;IACH,qEAAY,CAAA;IAEZ;;;;OAIG;IACH,wEAAc,CAAA;AAChB,CAAC,EA7EW,mBAAmB,KAAnB,mBAAmB,QA6E9B","sourcesContent":["import type { PluginListenerHandle } from '@capacitor/core';\n\n/**\n * WiFi plugin for managing device WiFi connectivity\n *\n * @since 7.0.0\n */\nexport interface CapacitorWifiPlugin {\n /**\n * Show a system dialog to add a Wi-Fi network to the device.\n * On Android SDK 30+, this opens the system Wi-Fi settings with the network pre-filled.\n * On iOS, this connects to the network directly.\n *\n * @param options - Network configuration options\n * @returns Promise that resolves when the network is added\n * @throws Error if adding the network fails\n * @since 7.0.0\n * @example\n * ```typescript\n * await CapacitorWifi.addNetwork({\n * ssid: 'MyNetwork',\n * password: 'mypassword',\n * isHiddenSsid: false,\n * securityType: NetworkSecurityType.WPA2_PSK\n * });\n * ```\n */\n addNetwork(options: AddNetworkOptions): Promise<void>;\n\n /**\n * Connect to a Wi-Fi network.\n * On Android, this creates a temporary connection that doesn't route traffic through the network by default.\n * For a persistent connection on Android, use addNetwork() instead.\n * On iOS, this creates a persistent connection.\n *\n * @param options - Connection options\n * @returns Promise that resolves when connected\n * @throws Error if connection fails\n * @since 7.0.0\n * @example\n * ```typescript\n * await CapacitorWifi.connect({\n * ssid: 'MyNetwork',\n * password: 'mypassword'\n * });\n * ```\n */\n connect(options: ConnectOptions): Promise<void>;\n\n /**\n * Disconnect from the current Wi-Fi network.\n * On iOS, only disconnects from networks that were added via this plugin.\n *\n * @param options - Optional disconnect options\n * @returns Promise that resolves when disconnected\n * @throws Error if disconnection fails\n * @since 7.0.0\n * @example\n * ```typescript\n * await CapacitorWifi.disconnect();\n * ```\n */\n disconnect(options?: DisconnectOptions): Promise<void>;\n\n /**\n * Get a list of available Wi-Fi networks from the last scan.\n * Only available on Android.\n *\n * @returns Promise that resolves with the list of networks\n * @throws Error if getting networks fails or on unsupported platform\n * @since 7.0.0\n * @example\n * ```typescript\n * const { networks } = await CapacitorWifi.getAvailableNetworks();\n * networks.forEach(network => {\n * console.log(`SSID: ${network.ssid}, Signal: ${network.rssi} dBm`);\n * });\n * ```\n */\n getAvailableNetworks(): Promise<GetAvailableNetworksResult>;\n\n /**\n * Get the device's current IP address.\n * Available on both Android and iOS.\n *\n * @returns Promise that resolves with the IP address\n * @throws Error if getting IP address fails\n * @since 7.0.0\n * @example\n * ```typescript\n * const { ipAddress } = await CapacitorWifi.getIpAddress();\n * console.log('IP Address:', ipAddress);\n * ```\n */\n getIpAddress(): Promise<GetIpAddressResult>;\n\n /**\n * Get the received signal strength indicator (RSSI) of the current network in dBm.\n * Only available on Android.\n *\n * @returns Promise that resolves with the RSSI value\n * @throws Error if getting RSSI fails or on unsupported platform\n * @since 7.0.0\n * @example\n * ```typescript\n * const { rssi } = await CapacitorWifi.getRssi();\n * console.log('Signal strength:', rssi, 'dBm');\n * ```\n */\n getRssi(): Promise<GetRssiResult>;\n\n /**\n * Get the service set identifier (SSID) of the current network.\n * Available on both Android and iOS.\n *\n * @returns Promise that resolves with the SSID\n * @throws Error if getting SSID fails\n * @since 7.0.0\n * @example\n * ```typescript\n * const { ssid } = await CapacitorWifi.getSsid();\n * console.log('Connected to:', ssid);\n * ```\n */\n getSsid(): Promise<GetSsidResult>;\n\n /**\n * Check if Wi-Fi is enabled on the device.\n * Only available on Android.\n *\n * @returns Promise that resolves with the Wi-Fi enabled status\n * @throws Error if checking status fails or on unsupported platform\n * @since 7.0.0\n * @example\n * ```typescript\n * const { enabled } = await CapacitorWifi.isEnabled();\n * console.log('WiFi is', enabled ? 'enabled' : 'disabled');\n * ```\n */\n isEnabled(): Promise<IsEnabledResult>;\n\n /**\n * Start scanning for Wi-Fi networks.\n * Only available on Android.\n * Results are delivered via the 'networksScanned' event listener.\n * Note: May fail due to system throttling or hardware issues.\n *\n * @returns Promise that resolves when scan starts\n * @throws Error if scan fails or on unsupported platform\n * @since 7.0.0\n * @example\n * ```typescript\n * await CapacitorWifi.addListener('networksScanned', () => {\n * console.log('Scan completed');\n * });\n * await CapacitorWifi.startScan();\n * ```\n */\n startScan(): Promise<void>;\n\n /**\n * Check the current permission status for location access.\n * Location permission is required for Wi-Fi operations on both platforms.\n *\n * @returns Promise that resolves with the permission status\n * @throws Error if checking permissions fails\n * @since 7.0.0\n * @example\n * ```typescript\n * const status = await CapacitorWifi.checkPermissions();\n * console.log('Location permission:', status.location);\n * ```\n */\n checkPermissions(): Promise<PermissionStatus>;\n\n /**\n * Request location permissions from the user.\n * Location permission is required for Wi-Fi operations on both platforms.\n *\n * @param options - Optional permission request options\n * @returns Promise that resolves with the updated permission status\n * @throws Error if requesting permissions fails\n * @since 7.0.0\n * @example\n * ```typescript\n * const status = await CapacitorWifi.requestPermissions();\n * if (status.location === 'granted') {\n * console.log('Permission granted');\n * }\n * ```\n */\n requestPermissions(options?: RequestPermissionsOptions): Promise<PermissionStatus>;\n\n /**\n * Add a listener for the 'networksScanned' event.\n * Only available on Android.\n * This event is fired when Wi-Fi scan results are available.\n *\n * @param eventName - The event name ('networksScanned')\n * @param listenerFunc - The callback function to execute\n * @returns Promise that resolves with a listener handle\n * @since 7.0.0\n * @example\n * ```typescript\n * const listener = await CapacitorWifi.addListener('networksScanned', async () => {\n * const { networks } = await CapacitorWifi.getAvailableNetworks();\n * console.log('Found networks:', networks);\n * });\n * ```\n */\n addListener(eventName: 'networksScanned', listenerFunc: () => void): Promise<PluginListenerHandle>;\n\n /**\n * Remove all listeners for this plugin.\n *\n * @returns Promise that resolves when all listeners are removed\n * @since 7.0.0\n * @example\n * ```typescript\n * await CapacitorWifi.removeAllListeners();\n * ```\n */\n removeAllListeners(): Promise<void>;\n\n /**\n * Get the native plugin version.\n *\n * @returns Promise that resolves with the plugin version\n * @throws Error if getting the version fails\n * @since 7.0.0\n * @example\n * ```typescript\n * const { version } = await CapacitorWifi.getPluginVersion();\n * console.log('Plugin version:', version);\n * ```\n */\n getPluginVersion(): Promise<{ version: string }>;\n}\n\n/**\n * Options for adding a network\n *\n * @since 7.0.0\n */\nexport interface AddNetworkOptions {\n /**\n * The SSID of the network to add\n *\n * @since 7.0.0\n */\n ssid: string;\n\n /**\n * The password for the network (optional for open networks)\n *\n * @since 7.0.0\n */\n password?: string;\n\n /**\n * Whether the network is hidden (Android only)\n *\n * @since 7.0.0\n * @default false\n */\n isHiddenSsid?: boolean;\n\n /**\n * The security type of the network (Android only)\n *\n * @since 7.0.0\n * @default NetworkSecurityType.WPA2_PSK\n */\n securityType?: NetworkSecurityType;\n}\n\n/**\n * Options for connecting to a network\n *\n * @since 7.0.0\n */\nexport interface ConnectOptions {\n /**\n * The SSID of the network to connect to\n *\n * @since 7.0.0\n */\n ssid: string;\n\n /**\n * The password for the network (optional for open networks)\n *\n * @since 7.0.0\n */\n password?: string;\n\n /**\n * Whether the network is hidden (Android only)\n *\n * @since 7.0.0\n * @default false\n */\n isHiddenSsid?: boolean;\n}\n\n/**\n * Options for disconnecting from a network\n *\n * @since 7.0.0\n */\nexport interface DisconnectOptions {\n /**\n * The SSID of the network to disconnect from (optional)\n *\n * @since 7.0.0\n */\n ssid?: string;\n}\n\n/**\n * Result from getAvailableNetworks()\n *\n * @since 7.0.0\n */\nexport interface GetAvailableNetworksResult {\n /**\n * List of available networks\n *\n * @since 7.0.0\n */\n networks: Network[];\n}\n\n/**\n * Represents a Wi-Fi network\n *\n * @since 7.0.0\n */\nexport interface Network {\n /**\n * The SSID of the network\n *\n * @since 7.0.0\n */\n ssid: string;\n\n /**\n * The signal strength in dBm\n *\n * @since 7.0.0\n */\n rssi: number;\n\n /**\n * The security types supported by this network (Android SDK 33+ only)\n *\n * @since 7.0.0\n */\n securityTypes?: NetworkSecurityType[];\n}\n\n/**\n * Result from getIpAddress()\n *\n * @since 7.0.0\n */\nexport interface GetIpAddressResult {\n /**\n * The device's IP address\n *\n * @since 7.0.0\n */\n ipAddress: string;\n}\n\n/**\n * Result from getRssi()\n *\n * @since 7.0.0\n */\nexport interface GetRssiResult {\n /**\n * The signal strength in dBm\n *\n * @since 7.0.0\n */\n rssi: number;\n}\n\n/**\n * Result from getSsid()\n *\n * @since 7.0.0\n */\nexport interface GetSsidResult {\n /**\n * The SSID of the current network\n *\n * @since 7.0.0\n */\n ssid: string;\n}\n\n/**\n * Result from isEnabled()\n *\n * @since 7.0.0\n */\nexport interface IsEnabledResult {\n /**\n * Whether Wi-Fi is enabled\n *\n * @since 7.0.0\n */\n enabled: boolean;\n}\n\n/**\n * Permission status\n *\n * @since 7.0.0\n */\nexport interface PermissionStatus {\n /**\n * Location permission state\n *\n * @since 7.0.0\n */\n location: PermissionState;\n}\n\n/**\n * Possible permission states\n *\n * @since 7.0.0\n */\nexport type PermissionState = 'granted' | 'denied' | 'prompt';\n\n/**\n * Options for requesting permissions\n *\n * @since 7.0.0\n */\nexport interface RequestPermissionsOptions {\n /**\n * Permissions to request\n *\n * @since 7.0.0\n */\n permissions?: 'location'[];\n}\n\n/**\n * Network security types\n *\n * @since 7.0.0\n */\nexport enum NetworkSecurityType {\n /**\n * Open network with no security\n *\n * @since 7.0.0\n */\n OPEN = 0,\n\n /**\n * WEP security\n *\n * @since 7.0.0\n */\n WEP = 1,\n\n /**\n * WPA/WPA2 Personal (PSK)\n *\n * @since 7.0.0\n */\n WPA2_PSK = 2,\n\n /**\n * WPA/WPA2/WPA3 Enterprise (EAP)\n *\n * @since 7.0.0\n */\n EAP = 3,\n\n /**\n * WPA3 Personal (SAE)\n *\n * @since 7.0.0\n */\n SAE = 4,\n\n /**\n * WPA3 Enterprise\n *\n * @since 7.0.0\n */\n WPA3_ENTERPRISE = 5,\n\n /**\n * WPA3 Enterprise 192-bit mode\n *\n * @since 7.0.0\n */\n WPA3_ENTERPRISE_192_BIT = 6,\n\n /**\n * Passpoint network\n *\n * @since 7.0.0\n */\n PASSPOINT = 7,\n\n /**\n * Enhanced Open (OWE)\n *\n * @since 7.0.0\n */\n OWE = 8,\n\n /**\n * WAPI PSK\n *\n * @since 7.0.0\n */\n WAPI_PSK = 9,\n\n /**\n * WAPI Certificate\n *\n * @since 7.0.0\n */\n WAPI_CERT = 10,\n}\n"]}
@@ -0,0 +1,4 @@
1
+ import type { CapacitorWifiPlugin } from './definitions';
2
+ declare const CapacitorWifi: CapacitorWifiPlugin;
3
+ export * from './definitions';
4
+ export { CapacitorWifi };
@@ -0,0 +1,7 @@
1
+ import { registerPlugin } from '@capacitor/core';
2
+ const CapacitorWifi = registerPlugin('CapacitorWifi', {
3
+ web: () => import('./web').then((m) => new m.CapacitorWifiWeb()),
4
+ });
5
+ export * from './definitions';
6
+ export { CapacitorWifi };
7
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAIjD,MAAM,aAAa,GAAG,cAAc,CAAsB,eAAe,EAAE;IACzE,GAAG,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,CAAC,gBAAgB,EAAE,CAAC;CACjE,CAAC,CAAC;AAEH,cAAc,eAAe,CAAC;AAC9B,OAAO,EAAE,aAAa,EAAE,CAAC","sourcesContent":["import { registerPlugin } from '@capacitor/core';\n\nimport type { CapacitorWifiPlugin } from './definitions';\n\nconst CapacitorWifi = registerPlugin<CapacitorWifiPlugin>('CapacitorWifi', {\n web: () => import('./web').then((m) => new m.CapacitorWifiWeb()),\n});\n\nexport * from './definitions';\nexport { CapacitorWifi };\n"]}
@@ -0,0 +1,18 @@
1
+ import { WebPlugin } from '@capacitor/core';
2
+ import type { AddNetworkOptions, CapacitorWifiPlugin, ConnectOptions, DisconnectOptions, GetAvailableNetworksResult, GetIpAddressResult, GetRssiResult, GetSsidResult, IsEnabledResult, PermissionStatus, RequestPermissionsOptions } from './definitions';
3
+ export declare class CapacitorWifiWeb extends WebPlugin implements CapacitorWifiPlugin {
4
+ addNetwork(_options: AddNetworkOptions): Promise<void>;
5
+ connect(_options: ConnectOptions): Promise<void>;
6
+ disconnect(_options?: DisconnectOptions): Promise<void>;
7
+ getAvailableNetworks(): Promise<GetAvailableNetworksResult>;
8
+ getIpAddress(): Promise<GetIpAddressResult>;
9
+ getRssi(): Promise<GetRssiResult>;
10
+ getSsid(): Promise<GetSsidResult>;
11
+ isEnabled(): Promise<IsEnabledResult>;
12
+ startScan(): Promise<void>;
13
+ checkPermissions(): Promise<PermissionStatus>;
14
+ requestPermissions(_options?: RequestPermissionsOptions): Promise<PermissionStatus>;
15
+ getPluginVersion(): Promise<{
16
+ version: string;
17
+ }>;
18
+ }
@@ -0,0 +1,40 @@
1
+ import { WebPlugin } from '@capacitor/core';
2
+ export class CapacitorWifiWeb extends WebPlugin {
3
+ async addNetwork(_options) {
4
+ throw this.unimplemented('Not implemented on web.');
5
+ }
6
+ async connect(_options) {
7
+ throw this.unimplemented('Not implemented on web.');
8
+ }
9
+ async disconnect(_options) {
10
+ throw this.unimplemented('Not implemented on web.');
11
+ }
12
+ async getAvailableNetworks() {
13
+ throw this.unimplemented('Not implemented on web.');
14
+ }
15
+ async getIpAddress() {
16
+ throw this.unimplemented('Not implemented on web.');
17
+ }
18
+ async getRssi() {
19
+ throw this.unimplemented('Not implemented on web.');
20
+ }
21
+ async getSsid() {
22
+ throw this.unimplemented('Not implemented on web.');
23
+ }
24
+ async isEnabled() {
25
+ throw this.unimplemented('Not implemented on web.');
26
+ }
27
+ async startScan() {
28
+ throw this.unimplemented('Not implemented on web.');
29
+ }
30
+ async checkPermissions() {
31
+ throw this.unimplemented('Not implemented on web.');
32
+ }
33
+ async requestPermissions(_options) {
34
+ throw this.unimplemented('Not implemented on web.');
35
+ }
36
+ async getPluginVersion() {
37
+ return { version: '1.0.0' };
38
+ }
39
+ }
40
+ //# sourceMappingURL=web.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"web.js","sourceRoot":"","sources":["../../src/web.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAgB5C,MAAM,OAAO,gBAAiB,SAAQ,SAAS;IAC7C,KAAK,CAAC,UAAU,CAAC,QAA2B;QAC1C,MAAM,IAAI,CAAC,aAAa,CAAC,yBAAyB,CAAC,CAAC;IACtD,CAAC;IAED,KAAK,CAAC,OAAO,CAAC,QAAwB;QACpC,MAAM,IAAI,CAAC,aAAa,CAAC,yBAAyB,CAAC,CAAC;IACtD,CAAC;IAED,KAAK,CAAC,UAAU,CAAC,QAA4B;QAC3C,MAAM,IAAI,CAAC,aAAa,CAAC,yBAAyB,CAAC,CAAC;IACtD,CAAC;IAED,KAAK,CAAC,oBAAoB;QACxB,MAAM,IAAI,CAAC,aAAa,CAAC,yBAAyB,CAAC,CAAC;IACtD,CAAC;IAED,KAAK,CAAC,YAAY;QAChB,MAAM,IAAI,CAAC,aAAa,CAAC,yBAAyB,CAAC,CAAC;IACtD,CAAC;IAED,KAAK,CAAC,OAAO;QACX,MAAM,IAAI,CAAC,aAAa,CAAC,yBAAyB,CAAC,CAAC;IACtD,CAAC;IAED,KAAK,CAAC,OAAO;QACX,MAAM,IAAI,CAAC,aAAa,CAAC,yBAAyB,CAAC,CAAC;IACtD,CAAC;IAED,KAAK,CAAC,SAAS;QACb,MAAM,IAAI,CAAC,aAAa,CAAC,yBAAyB,CAAC,CAAC;IACtD,CAAC;IAED,KAAK,CAAC,SAAS;QACb,MAAM,IAAI,CAAC,aAAa,CAAC,yBAAyB,CAAC,CAAC;IACtD,CAAC;IAED,KAAK,CAAC,gBAAgB;QACpB,MAAM,IAAI,CAAC,aAAa,CAAC,yBAAyB,CAAC,CAAC;IACtD,CAAC;IAED,KAAK,CAAC,kBAAkB,CAAC,QAAoC;QAC3D,MAAM,IAAI,CAAC,aAAa,CAAC,yBAAyB,CAAC,CAAC;IACtD,CAAC;IAED,KAAK,CAAC,gBAAgB;QACpB,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC;IAC9B,CAAC;CACF","sourcesContent":["import { WebPlugin } from '@capacitor/core';\n\nimport type {\n AddNetworkOptions,\n CapacitorWifiPlugin,\n ConnectOptions,\n DisconnectOptions,\n GetAvailableNetworksResult,\n GetIpAddressResult,\n GetRssiResult,\n GetSsidResult,\n IsEnabledResult,\n PermissionStatus,\n RequestPermissionsOptions,\n} from './definitions';\n\nexport class CapacitorWifiWeb extends WebPlugin implements CapacitorWifiPlugin {\n async addNetwork(_options: AddNetworkOptions): Promise<void> {\n throw this.unimplemented('Not implemented on web.');\n }\n\n async connect(_options: ConnectOptions): Promise<void> {\n throw this.unimplemented('Not implemented on web.');\n }\n\n async disconnect(_options?: DisconnectOptions): Promise<void> {\n throw this.unimplemented('Not implemented on web.');\n }\n\n async getAvailableNetworks(): Promise<GetAvailableNetworksResult> {\n throw this.unimplemented('Not implemented on web.');\n }\n\n async getIpAddress(): Promise<GetIpAddressResult> {\n throw this.unimplemented('Not implemented on web.');\n }\n\n async getRssi(): Promise<GetRssiResult> {\n throw this.unimplemented('Not implemented on web.');\n }\n\n async getSsid(): Promise<GetSsidResult> {\n throw this.unimplemented('Not implemented on web.');\n }\n\n async isEnabled(): Promise<IsEnabledResult> {\n throw this.unimplemented('Not implemented on web.');\n }\n\n async startScan(): Promise<void> {\n throw this.unimplemented('Not implemented on web.');\n }\n\n async checkPermissions(): Promise<PermissionStatus> {\n throw this.unimplemented('Not implemented on web.');\n }\n\n async requestPermissions(_options?: RequestPermissionsOptions): Promise<PermissionStatus> {\n throw this.unimplemented('Not implemented on web.');\n }\n\n async getPluginVersion(): Promise<{ version: string }> {\n return { version: '1.0.0' };\n }\n}\n"]}