Open vladinko0 opened 6 years ago
I also need to pass hex value with this package. Can anyone help please?
Have you managed to solve this problem? I'm facing similar one right now. Any help would be appreciated
Here is my solution:
let buf = new Buffer("AA22EC00000000000102AA5500023C4E000001007000000000002300000000000000D0", "hex");
BluetoothSerial.write(buf)
Hope that still helpful.
basically the array wasn't showing as a uint8array but as a typedArray Buffer.from() fixed it
let encoder = new EscPosEncoder();
let result = encoder
.initialize()
.text("HelloWorld")
.newline()
.qrcode('HelloWorld')
.encode();
const { Buffer } = require('buffer');
BluetoothSerial.write(Buffer.from(result.buffer))
In the BluetoothSerialExample I see:
But I need to send the Enquiry ENQ (0x05). And if I store into the "message" value 0x05, slave device gives me no response, because it probably wants hex value 0x05, not string value.
In the ..\react-native-bluetooth-serial-master\index.js I see:
Should I replace data.toString('base64') with data('base64') to pass hex value, or should I in ..\node_modules\react-native-bluetooth-serial\android\src\main\java\com\rusel\RCTBluetoothSerial\RCTBluetoothSerialModule.java:
replace String message with Int message in order to send hex value 0x05?
Please help me. I feel so lost.