ionic-ble icon indicating copy to clipboard operation
ionic-ble copied to clipboard

Disconnect not working with subscribe

Open nimeso opened this issue 8 years ago • 1 comments

I get this error when trying to subscribe to the disconnet callback.

this.ble.disconnect(this.device_id).subscribe((data) => {
  console.log("disconnected good");
}, error => {
  console.log("disconnected bad");
});

the error I get is this

Supplied parameters do not match any signature of call target.
 L116:  if (this.device_id) {
 L117:      this.ble.disconnect(this.device_id).subscribe((data) => {
 L118:              console.log("disconnected good");

nimeso avatar Jul 22 '17 23:07 nimeso

Update:

Ok, I got it working using then() and not subscribe()

this.ble.disconnect(this.device_id).then(() => {
  console.log('Disconnected');
});

BUT I need a 'failed' callback like the cordova plugin docs say I can use.

ble.disconnect(device_id, [success], [failure]);

Is this possible?

nimeso avatar Jul 22 '17 23:07 nimeso