react-native-ble-manager
Advanced tools
Comparing version 1.3.5 to 1.4.0
@@ -134,4 +134,13 @@ 'use strict'; | ||
isPeripheralConnected(peripheralId, serviceUUIDs) { | ||
return this.getConnectedPeripherals(serviceUUIDs).then(function(result) { | ||
if (result.find(function(p) { return p.id === peripheralId; })) { | ||
return true; | ||
} else { | ||
return false; | ||
} | ||
}); | ||
} | ||
} | ||
module.exports = new BleManager(); |
{ | ||
"name": "react-native-ble-manager", | ||
"version": "1.3.5", | ||
"version": "1.4.0", | ||
"description": "A BLE module for react native.", | ||
@@ -5,0 +5,0 @@ "main": "BleManager", |
@@ -363,2 +363,19 @@ # react-native-ble-manager | ||
### isPeripheralConnected(peripheralId, serviceUUIDs) | ||
Check whether a specific peripheral is connected and return `true` or `false`. | ||
Returns a `Promise` object. | ||
__Examples__ | ||
```js | ||
BleManager.isPeripheralConnected('XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX', []) | ||
.then((isConnected) => { | ||
if (isConnected) { | ||
console.log('Peripheral is connected!'); | ||
} else { | ||
console.log('Peripheral is NOT connected!'); | ||
} | ||
}); | ||
``` | ||
##Events | ||
@@ -423,6 +440,12 @@ ### BleManagerStopScan | ||
### BleManagerConnectPeripheral | ||
A peripheral was connected. | ||
__Arguments__ | ||
- `peripheral` - `String` - the id of the peripheral | ||
### BleManagerDisconnectPeripheral | ||
A peripheral is disconnected. | ||
A peripheral was disconnected. | ||
__Arguments__ | ||
- `peripheral` - `String` - the id of the peripheral |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
45667098
137620
450