ble api update

This commit is contained in:
Vineyro 2024-11-02 16:31:58 +07:00
parent ab27faa832
commit a2cc797320
3 changed files with 18 additions and 11 deletions

View File

@ -19,8 +19,8 @@ android {
applicationId "llc.arma.ble" applicationId "llc.arma.ble"
minSdk 26 minSdk 26
targetSdk 34 targetSdk 34
versionCode 41 versionCode 44
versionName "1.4.13" versionName "1.4.16"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
vectorDrawables { vectorDrawables {
@ -30,11 +30,11 @@ android {
buildTypes { buildTypes {
debug { debug {
minifyEnabled true minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
} }
release { release {
minifyEnabled true minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
} }
} }

View File

@ -35,6 +35,8 @@
-keeppackagenames org.apache.poi.ss.formula.function -keeppackagenames org.apache.poi.ss.formula.function
-keep class org.apache.**
-keep class com.fasterxml.aalto.stax.InputFactoryImpl -keep class com.fasterxml.aalto.stax.InputFactoryImpl
-keep class com.fasterxml.aalto.stax.OutputFactoryImpl -keep class com.fasterxml.aalto.stax.OutputFactoryImpl
-keep class com.fasterxml.aalto.stax.EventFactoryImpl -keep class com.fasterxml.aalto.stax.EventFactoryImpl

View File

@ -39,12 +39,19 @@ suspend fun readTable(
do { do {
val nextPackageDataCount = value.get2byteUIntAt(2) val nextPackageDataCount = if(value.size > 3)
value.get2byteUIntAt(2)
else
UInt.MIN_VALUE
tableResult.addAll(value.asList().subList(4, value.size)) if(value.size > 4) {
characteristic.write(DataByteArray(nextRequestPayload)) tableResult.addAll(value.asList().subList(4, value.size))
value = characteristic.read().value
characteristic.write(DataByteArray(nextRequestPayload))
value = characteristic.read().value
}
} while (nextPackageDataCount.toInt() != 0) } while (nextPackageDataCount.toInt() != 0)
@ -91,7 +98,7 @@ fun readHostHistory(
readTable( readTable(
characteristic, characteristic,
//Чтение без удаления //Чтение без удаления
byteArrayOf(1, 0, 0, -2, -1), byteArrayOf(1, 0, 0, -1, -1),
byteArrayOf(5) byteArrayOf(5)
) )
) )
@ -192,7 +199,6 @@ fun readHostHistory(
periodBle = mutableListOf() periodBle = mutableListOf()
continue continue
} }
if (bleIdTableCell.contentEquals(intervalEndAndHit.hexToByteArray())) { if (bleIdTableCell.contentEquals(intervalEndAndHit.hexToByteArray())) {
@ -202,7 +208,6 @@ fun readHostHistory(
periodBle = mutableListOf() periodBle = mutableListOf()
continue continue
} }
val innerIndex = getInnerIndex(bleIdTableCell[1]) val innerIndex = getInnerIndex(bleIdTableCell[1])