0

i'm trying to use Bluez (python) on a raspberry pi to receive data with bluetooth from a ionic2 app. I'm using the built in Bluetooth from "native ionic" which is the bluetoothSerial framework from Cordova

I can't receive any data on the rasp. I'm using list() to check if the device is connected to the rasp (it return true).

I'm using write to send a "hello world" message.

The Ionic2 script:

   BluetoothSerial.connect("B8:27:EB:F7:3B:B5");
    BluetoothSerial.write("hello world").then(this.success, this.failure);

After the write, my callback succes is called which means that the data was correctly sent. I was wondering on which bluetooth port the ionic2 app send the data. Bluez need a specific port to listen to.

Nathan Schwarz
  • 631
  • 5
  • 19
  • Do you mean you cannot connect or you cannot receive data? – Huiting Feb 28 '17 at 06:46
  • It seems that I cannot connect – Nathan Schwarz Feb 28 '17 at 12:36
  • I'm using list() to check if the device is connected to the rasp (it return true). What do you mean by this? It returns you true but you say you cannot connect – Huiting Mar 01 '17 at 00:42
  • Well in debug mode it's connected when i'm using list, but when I use 'isConnected()' it is not. That's the weird thing. – Nathan Schwarz Mar 02 '17 at 14:38
  • https://github.com/don/BluetoothSerial Is this the plugin you are using? Provide more info so people can help you better – Huiting Mar 03 '17 at 00:42
  • Yes it is, it's mentioned in the ionic native component in the section BluetoothSerial – Nathan Schwarz Mar 03 '17 at 00:45
  • What I suggest is that instead of using BluetoothSerial through `ionic-native`, import it directly from the author github `cordova plugin add cordova-plugin-bluetooth-serial` – Huiting Mar 03 '17 at 01:00
  • Not too sure if `ionic-native` `connect(macAddress_or_uuid)` returns any success or error message but the plugin does: `bluetoothSerial.connect(macAddress_or_uuid, connectSuccess, connectFailure);` – Huiting Mar 03 '17 at 01:01
  • Take a look here: https://github.com/don/BluetoothSerial – Huiting Mar 03 '17 at 01:01

0 Answers0