(BluetoothGatt gatt,
BluetoothGattCharacteristic dataCharacteristic)
| 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; |
no test coverage detected