Skip to content

Commit

Permalink
update chunkSend parms
Browse files Browse the repository at this point in the history
  • Loading branch information
carterharrison committed Mar 4, 2019
1 parent fd7e483 commit de1b334
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package network.xyo.modbluetoothkotlin.client
import android.bluetooth.BluetoothGatt
import android.bluetooth.BluetoothGattCharacteristic
import android.content.Context
import android.util.Log
import kotlinx.coroutines.*
import network.xyo.ble.devices.XYAppleBluetoothDevice
import network.xyo.ble.devices.XYBluetoothDevice
Expand Down Expand Up @@ -320,8 +321,7 @@ class XyoBluetoothClient(context: Context, scanResult: XYScanResult, hash : Int)
val chunknedOutgoingPacket = XyoBluetoothOutgoingPacket(mtu, outgoingPacket, sizeOfSize)

while (chunknedOutgoingPacket.canSendNext) {
val test = chunknedOutgoingPacket.getNext()
val error = findAndWriteCharacteristic(XyoUuids.XYO_SERVICE, XyoUuids.XYO_WRITE, test).await().error
val error = findAndWriteCharacteristic(service, characteristic, chunknedOutgoingPacket.getNext()).await().error
if (error != null) {
cont.resume(error)
return@launch
Expand Down Expand Up @@ -362,7 +362,7 @@ class XyoBluetoothClient(context: Context, scanResult: XYScanResult, hash : Int)
override fun onCharacteristicChanged(gatt: BluetoothGatt?, characteristic: BluetoothGattCharacteristic?) {
super.onCharacteristicChanged(gatt, characteristic)
val value = characteristic?.value

if (characteristic?.uuid == XyoUuids.XYO_WRITE && !hasResumed) {

if (numberOfPackets == 0 && value != null) {
Expand Down

0 comments on commit de1b334

Please sign in to comment.