Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disconnect function not available #314

Closed
mohammed-mudassir opened this issue Jul 6, 2017 · 3 comments
Closed

Disconnect function not available #314

mohammed-mudassir opened this issue Jul 6, 2017 · 3 comments

Comments

@mohammed-mudassir
Copy link

Property disconnect does not exist on type 'Typeof BlutoothSerial'

@mohammed-mudassir
Copy link
Author

@don please reply on this issue

@don
Copy link
Owner

don commented Jul 7, 2017

This is a duplicate of #293. The TypeScript bindings are part of Ionic native not this plugin.

It looks like disconnect was added to the api https://ionicframework.com/docs/native/bluetooth-serial/#disconnect in danielsogl/awesome-cordova-plugins#1151.

Maybe you have an older version of Ionic? I just tested with Ionic 3.4.0 and it looks OK.

Try this

ionic start disconnect-test blank
cd disconnect-test
ionic cordova plugin add cordova-plugin-bluetooth-serial
npm install --save @ionic-native/bluetooth-serial

Open src/pages/home/home.ts in your editor and import BluetoothSerial, add to the constructor, then call disconnect.

import { Component } from '@angular/core';
import { NavController } from 'ionic-angular';
import { BluetoothSerial } from '@ionic-native/bluetooth-serial';

@Component({
  selector: 'page-home',
  templateUrl: 'home.html'
})
export class HomePage {

  constructor(private bluetoothSerial: BluetoothSerial) {
    // just testing if disconnect exists
    bluetoothSerial.disconnect();
  }

}

Ensure everything compiles without errors

ionic cordova build android

@mohammed-mudassir
Copy link
Author

Hey @don thanks for reply my issue is fixed now

@don don closed this as completed Jul 12, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants