I am using BluetoothSerial in ionic 2. Upon listing devices (BluetoothSerial.list()), I am connecting to a device using BluetoothSerial.connect(MacID) which is a observable call.
The connection is success. When the device is out of range, I expect the connect call to return failure. However, it returns success still. Am I missing something ?
Code snippet below
connectDevice(device) {
BluetoothSerial.isConnected().then (
res => {
console.log("Bluetooth connection active" + " " + JSON.stringify(res));
},
err => {
console.error("Bluetooth connection not active", err);
BluetoothSerial.connect(device.id).subscribe(
res => {
console.log("Connected" + " " +JSON.stringify(res));
},
err => {
console.log("Unable to connect" + " " + err);
}
)
}
)
}