react-native-bluetooth-serial icon indicating copy to clipboard operation
react-native-bluetooth-serial copied to clipboard

Can't write and disconnect.

Open manelsanz opened this issue 6 years ago • 2 comments

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...

manelsanz avatar Feb 14 '19 18:02 manelsanz

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))

chamaloriz avatar Sep 29 '19 09:09 chamaloriz

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

tienw avatar Nov 06 '19 15:11 tienw