Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
isPeripheralConnected() {
BleManager.isPeripheralConnected(this.state.id, [])
.then((isConnected) => {
if (isConnected) {
console.log('Peripheral is connected!');
} else {
console.log('Peripheral is NOT connected!');
}
});
}
return new Promise( (resolve, reject) =>{
BleManager.isPeripheralConnected(this.peripheralId, [])
.then((isConnected) => {
resolve(isConnected);
if (isConnected) {
console.log('Peripheral is connected!');
} else {
console.log('Peripheral is NOT connected!');
}
}).catch(error=>{
reject(error);
})
});
}