Open bchaves2604 opened 5 years ago
You need to use the onDataReadListener
.
I have it but when I log data it shows in the console "Works in React Native!" and what I actually want to do is receive something form the device
onDataRead(data) { console.log("onDataRead", data); }
componentWillMount() { this.onDeviceFoundEvent = EasyBluetooth.addOnDeviceFoundListener(this.onDeviceFound.bind(this)); this.onStatusChangeEvent = EasyBluetooth.addOnStatusChangeListener(this.onStatusChange.bind(this)); this.onDataReadEvent = EasyBluetooth.addOnDataReadListener(this.onDataRead.bind(this)); this.onDeviceNameEvent = EasyBluetooth.addOnDeviceNameListener(this.onDeviceName.bind(this)); }
I have the write and read methods and it seems to work as #expected.
EasyBluetooth.writeln("Works in React Native!") .then(() => { console.log("Writing...") }) .catch((ex) => { console.warn(ex); })
But I want to retrieve data from the device which is and OBD II, any ideas?