MCPcopy Create free account
hub / github.com/XCSoar/XCSoar / beginWriteNextChunk

Method beginWriteNextChunk

android/src/HM10WriteBuffer.java:44–63  ·  view source on GitHub ↗
(BluetoothGatt gatt,
                                           BluetoothGattCharacteristic dataCharacteristic)

Source from the content-addressed store, hash-verified

42 private boolean lastChunkWriteError;
43
44 synchronized boolean beginWriteNextChunk(BluetoothGatt gatt,
45 BluetoothGattCharacteristic dataCharacteristic) {
46 if (pendingWriteChunks == null)
47 return false;
48
49 dataCharacteristic.setValue(pendingWriteChunks[nextWriteChunkIdx]);
50 if (!gatt.writeCharacteristic(dataCharacteristic)) {
51 Log.e(TAG, "GATT characteristic write request failed");
52 setError();
53 return false;
54 }
55
56 ++nextWriteChunkIdx;
57 if (nextWriteChunkIdx >= pendingWriteChunks.length) {
58 /* writing is done */
59 clear();
60 }
61
62 return true;
63 }
64
65 synchronized void clear() {
66 pendingWriteChunks = null;

Callers 2

onCharacteristicReadMethod · 0.80
onCharacteristicWriteMethod · 0.80

Calls 2

setErrorMethod · 0.95
clearMethod · 0.95

Tested by

no test coverage detected