You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The successCallback isn't actually used. Listen to initialize callbacks for change in Bluetooth state. A successful disable will return an error => enable via initialize error callback.
292
293
293
294
295
+
### getAdapterInfo ###
296
+
Retrieve useful information such as the address, name, and various states (initialized, enabled, scanning, discoverable).
297
+
This can be very useful when the general state of the adapter has been lost, and we would otherwise need to go through a series of callbacks to get the correct state (first initialized, then enabled, then isScanning, and so forth).
298
+
The result of this method allows us to take business logic decisions while avoiding a large part of the callback hell.
299
+
300
+
Currently the discoverable state does not have any relevance because there is no "setDiscoverable" functionality in place.
301
+
That may change in the future.
302
+
303
+
```javascript
304
+
bluetoothle.getAdapterInfo(successCallback);
305
+
```
306
+
307
+
##### Success #####
308
+
The successCallback contains the following properties:
309
+
* name = the adapters's display name
310
+
* address = the adapter's address
311
+
* isInitialized = boolean value, true if the adapter was initialized, otherwise false
312
+
* isEnabled = boolean value, true if the adapter was enabled, otherwise false
313
+
* isScanning = boolean value, true if the adapter is currently scanning, otherwise false
314
+
* isDiscoverable = boolean value, true if the adapter is in discoverable mode, otherwise false (currently largely false)
315
+
294
316
295
317
### startScan ###
296
318
Scan for Bluetooth LE devices. Since scanning is expensive, stop as soon as possible. The Cordova app should use a timer to limit the scan interval. Also, Android uses an AND operator for filtering, while iOS uses an OR operator. Android API >= 23 requires ACCESS_COARSE_LOCATION permissions to find unpaired devices. Permissions can be requested by using the hasPermission and requestPermission functions. Android API >= 23 also requires location services to be enabled. Use ```isLocationEnabled``` to determine whether location services are enabled. If not enabled, use ```requestLocation``` to prompt the location services settings page.
0 commit comments