Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 2 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ Officialy this library supports React Native >= 0.25, it may run on older versio
```
<uses-permission android:name="android.permission.BLUETOOTH" />
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
```

## Manual installation
Expand Down Expand Up @@ -109,12 +111,3 @@ You can use `BluetoothSerial.removeListener(eventName, callback)` to stop listen

## TODO
- Make services configurable on ios









Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
8 changes: 8 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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