diff --git a/README.md b/README.md index eea75d0..0761dce 100644 --- a/README.md +++ b/README.md @@ -13,6 +13,8 @@ Officialy this library supports React Native >= 0.25, it may run on older versio ``` + + ``` ## Manual installation @@ -109,12 +111,3 @@ You can use `BluetoothSerial.removeListener(eventName, callback)` to stop listen ## TODO - Make services configurable on ios - - - - - - - - - diff --git a/android/src/main/java/com/rusel/RCTBluetoothSerial/RCTBluetoothSerialModule.java b/android/src/main/java/com/rusel/RCTBluetoothSerial/RCTBluetoothSerialModule.java index be90cf3..4e48985 100644 --- a/android/src/main/java/com/rusel/RCTBluetoothSerial/RCTBluetoothSerialModule.java +++ b/android/src/main/java/com/rusel/RCTBluetoothSerial/RCTBluetoothSerialModule.java @@ -476,6 +476,7 @@ void onError (Exception e) { * @param data Message */ void onData (String data) { + Log.d(TAG, "ON read data"); mBuffer.append(data); String completeData = readUntil(this.delimiter); if (completeData != null && completeData.length() > 0) { diff --git a/android/src/main/java/com/rusel/RCTBluetoothSerial/RCTBluetoothSerialService.java b/android/src/main/java/com/rusel/RCTBluetoothSerial/RCTBluetoothSerialService.java index c818bc5..1f0faa3 100644 --- a/android/src/main/java/com/rusel/RCTBluetoothSerial/RCTBluetoothSerialService.java +++ b/android/src/main/java/com/rusel/RCTBluetoothSerial/RCTBluetoothSerialService.java @@ -304,7 +304,7 @@ public void run() { try { bytes = mmInStream.read(buffer); // Read from the InputStream String data = new String(buffer, 0, bytes, "ISO-8859-1"); - + Log.i(TAG, "Reading data"); mModule.onData(data); // Send the new data String to the UI Activity } catch (Exception e) { Log.e(TAG, "disconnected", e); diff --git a/index.js b/index.js index 1a151dd..1b1213e 100644 --- a/index.js +++ b/index.js @@ -34,4 +34,12 @@ BluetoothSerial.write = (data) => { return BluetoothSerial.writeToDevice(data.toString('base64')) } + +BluetoothSerial.availableToRead = () => { + return BluetoothSerial.available() +} +BluetoothSerial.setReadDelimiter = (delimiter) => { + return BluetoothSerial.withDelimiter(delimiter); +} + module.exports = BluetoothSerial