rusel1989 / react-native-bluetooth-serial

Port of https://github.com/don/BluetoothSerial for react native
475 stars 291 forks source link

Can't write and disconnect. #100

Open manelsanz opened 5 years ago

manelsanz commented 5 years ago

Hi, I can connect perfectly to my bluetooth serial port, but when I call BluetoothSerial.write("Hi"), it shows the following error: RTCBluetoothSerial.writeToDevice got 4 arguments, expected 3.

The same with the "disconnect" method: RTCBluetoothSerial.disconnect got 3 arguments, expected 2.

I need some help, please...

chamaloriz commented 4 years ago

I found how to :p spent 2 Days

let encoder = new EscPosEncoder();

let result = encoder
  .initialize()
  .text("HelloWorld")
  .newline()
  .qrcode('HelloWorld')
  .encode();

const { Buffer } = require('buffer');

BluetoothSerial.write(Buffer.from(result.buffer))
tienw commented 4 years ago

I had the same issue and your solution works! However, I recieved the following error after printed

Attempt to invoke virtual method 'double java.lang.Double.doubleValue()' on a null object reference

Anyone have same issue? it looks like a Java issue