react-native-ble-manager 9.1.0 → 10.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/android/src/main/java/it/innove/NotifyBufferContainer.java +19 -15
- package/android/src/main/java/it/innove/Peripheral.java +286 -272
- package/ios/BleManager.m +10 -10
- package/ios/CBPeripheral+Extensions.m +24 -22
- package/package.json +1 -1
- package/android/.gradle/7.4/checksums/checksums.lock +0 -0
- package/android/.gradle/7.4/dependencies-accessors/dependencies-accessors.lock +0 -0
- package/android/.gradle/7.4/dependencies-accessors/gc.properties +0 -0
- package/android/.gradle/7.4/executionHistory/executionHistory.bin +0 -0
- package/android/.gradle/7.4/executionHistory/executionHistory.lock +0 -0
- package/android/.gradle/7.4/fileChanges/last-build.bin +0 -0
- package/android/.gradle/7.4/fileHashes/fileHashes.bin +0 -0
- package/android/.gradle/7.4/fileHashes/fileHashes.lock +0 -0
- package/android/.gradle/7.4/fileHashes/resourceHashesCache.bin +0 -0
- package/android/.gradle/7.4/gc.properties +0 -0
- package/android/.gradle/buildOutputCleanup/buildOutputCleanup.lock +0 -0
- package/android/.gradle/buildOutputCleanup/cache.properties +0 -2
- package/android/.gradle/buildOutputCleanup/outputFiles.bin +0 -0
- package/android/.gradle/file-system.probe +0 -0
- package/android/.gradle/vcs-1/gc.properties +0 -0
- package/android/.idea/.name +0 -1
- package/android/.idea/compiler.xml +0 -6
- package/android/.idea/gradle.xml +0 -18
- package/android/.idea/jarRepositories.xml +0 -40
- package/android/.idea/misc.xml +0 -10
- package/android/.idea/vcs.xml +0 -6
- package/android/gradle/wrapper/gradle-wrapper.jar +0 -0
- package/android/gradle/wrapper/gradle-wrapper.properties +0 -5
- package/android/gradlew +0 -234
- package/android/gradlew.bat +0 -89
- package/android/local.properties +0 -8
package/README.md
CHANGED
|
@@ -301,7 +301,7 @@ BleManager.startNotification(
|
|
|
301
301
|
|
|
302
302
|
### startNotificationUseBuffer(peripheralId, serviceUUID, characteristicUUID, buffer) [Android only]
|
|
303
303
|
|
|
304
|
-
Start the notification on the specified characteristic, you need to call `retrieveServices` method before. The buffer
|
|
304
|
+
Start the notification on the specified characteristic, you need to call `retrieveServices` method before. The buffer collect messages until the buffer of messages bytes reaches the limit defined with the `buffer` argument and then emit all the collected data. Helpful to reducing the number or js bridge crossings when a characteristic is sending a lot of messages.
|
|
305
305
|
Returns a `Promise` object.
|
|
306
306
|
|
|
307
307
|
**Arguments**
|
|
@@ -309,7 +309,7 @@ Returns a `Promise` object.
|
|
|
309
309
|
- `peripheralId` - `String` - the id/mac address of the peripheral.
|
|
310
310
|
- `serviceUUID` - `String` - the UUID of the service.
|
|
311
311
|
- `characteristicUUID` - `String` - the UUID of the characteristic.
|
|
312
|
-
- `buffer` - `Integer` -
|
|
312
|
+
- `buffer` - `Integer` - the capacity of the buffer (bytes) stored before emitting the data for the characteristic.
|
|
313
313
|
|
|
314
314
|
**Examples**
|
|
315
315
|
|
|
@@ -3,30 +3,34 @@ package it.innove;
|
|
|
3
3
|
import java.nio.ByteBuffer;
|
|
4
4
|
|
|
5
5
|
public class NotifyBufferContainer {
|
|
6
|
-
public final Integer maxBufferSize;
|
|
7
|
-
private Integer bufferCount;
|
|
8
6
|
public ByteBuffer items;
|
|
9
7
|
|
|
10
|
-
public NotifyBufferContainer(
|
|
11
|
-
this.
|
|
12
|
-
this.resetBuffer();
|
|
8
|
+
public NotifyBufferContainer(int size) {
|
|
9
|
+
this.items = ByteBuffer.allocate(size);
|
|
13
10
|
}
|
|
14
11
|
public void resetBuffer(){
|
|
15
|
-
this.
|
|
16
|
-
this.items = ByteBuffer.allocate(this.maxBufferSize);
|
|
12
|
+
this.items.clear();
|
|
17
13
|
}
|
|
18
|
-
public
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
14
|
+
public byte[] put(byte[] value){
|
|
15
|
+
int restLength = value.length - this.items.remaining();
|
|
16
|
+
byte[] toInsert;
|
|
17
|
+
byte[] rest;
|
|
18
|
+
if (restLength < 0) {
|
|
19
|
+
rest = new byte[restLength];
|
|
20
|
+
toInsert = new byte[value.length - restLength];
|
|
21
|
+
System.arraycopy(value, 0, toInsert, 0, toInsert.length);
|
|
22
|
+
System.arraycopy(value, toInsert.length, rest, restLength, rest.length);
|
|
23
|
+
} else {
|
|
24
|
+
toInsert = value;
|
|
22
25
|
}
|
|
23
|
-
this.items.put(
|
|
26
|
+
this.items.put(toInsert);
|
|
27
|
+
return rest;
|
|
24
28
|
}
|
|
25
29
|
public boolean isBufferFull(){
|
|
26
|
-
return this.
|
|
30
|
+
return this.remaining() == 0;
|
|
27
31
|
}
|
|
28
|
-
public
|
|
29
|
-
return this.
|
|
32
|
+
public int size() {
|
|
33
|
+
return this.items.limit();
|
|
30
34
|
}
|
|
31
35
|
@Override
|
|
32
36
|
protected void finalize() throws Throwable {
|