Skip to content

Commit

Permalink
dependency update
Browse files Browse the repository at this point in the history
  • Loading branch information
barnhill committed Feb 4, 2024
1 parent 1627566 commit 5f0414f
Show file tree
Hide file tree
Showing 10 changed files with 34 additions and 43 deletions.
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ plugins {

tasks {
wrapper {
gradleVersion = "8.5"
gradleVersion = "8.6"
distributionType = Wrapper.DistributionType.BIN
}
}
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ android.useAndroidX=true
android.enableJetifier=false

GROUP=com.pnuema.android
VERSION_NAME=1.4.2
VERSION_NAME=1.4.3

POM_NAME=Android OBD Library
POM_ARTIFACT_ID=obd
Expand Down
6 changes: 3 additions & 3 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
[versions]
#libs
kotlinx-serialization = "1.5.1"
kotlinx-serialization = "1.6.2"
vanniktech-maven-publish = "0.25.3"
evalex = "3.1.0"
androidx-startup = "1.1.1"

#plugins
kotlin= "1.9.21"
gradlePlugins-agp = "8.2.0"
kotlin= "1.9.22"
gradlePlugins-agp = "8.2.2"
tomlChecker = "0.47.0"
gradleCacheFix = "3.0"
dokka = "1.9.10"
Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
20 changes: 10 additions & 10 deletions gradlew.bat
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,11 @@ set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if %ERRORLEVEL% equ 0 goto execute

echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
echo. 1>&2
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
echo. 1>&2
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
echo location of your Java installation. 1>&2

goto fail

Expand All @@ -57,11 +57,11 @@ set JAVA_EXE=%JAVA_HOME%/bin/java.exe

if exist "%JAVA_EXE%" goto execute

echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
echo. 1>&2
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
echo. 1>&2
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
echo location of your Java installation. 1>&2

goto fail

Expand Down
2 changes: 1 addition & 1 deletion obd/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ plugins {
alias(libs.plugins.toml.version.checker)
}

version = "1.4.2"
version = "1.4.3"
group = "com.pnuema.android"

android {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -222,9 +222,7 @@ abstract class BaseObdCommand {
* Gets whether imperial or metric units should be shown
* @return true if imperial units are used, or false otherwise
*/
fun useImperialUnits(): Boolean {
return useImperialUnits
}
fun useImperialUnits(): Boolean = useImperialUnits

/**
* Sets whether to use imperial units or metric.
Expand Down
3 changes: 1 addition & 2 deletions obd/src/main/java/com/pnuema/android/obd/enums/ObdModes.kt
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,7 @@ enum class ObdModes constructor(val value: Char) {
*/
MODE_0A('A');

val intValue: Int
get() = parseLong(value.toString(), 16).toInt()
val intValue: Int get() = parseLong(value.toString(), 16).toInt()

override fun toString(): String = value.toString()
}
21 changes: 8 additions & 13 deletions obd/src/main/java/com/pnuema/android/obd/statics/PIDUtils.kt
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import android.util.SparseArray
import com.pnuema.android.obd.enums.ObdModes
import com.pnuema.android.obd.models.PID
import com.pnuema.android.obd.models.PIDS
import kotlinx.serialization.decodeFromString
import kotlinx.serialization.json.Json
import java.io.IOException
import java.util.*
Expand All @@ -41,9 +40,7 @@ object PIDUtils {
* @throws IOException thrown if IO can not be performed
*/
@Throws(IOException::class)
fun getPidList(mode: ObdModes): List<PID> {
return ArrayList(getPidMap(mode)!!.values)
}
fun getPidList(mode: ObdModes): List<PID> = ArrayList(getPidMap(mode)!!.values)

/**
* Gets PID object by mode and pid.
Expand All @@ -57,19 +54,17 @@ object PIDUtils {
fun getPid(mode: ObdModes, pid: String): PID? {
val start = Calendar.getInstance().time

val pids = getPidMap(mode)
getPidMap(mode)?.let { pids ->
val p = pids[Integer.parseInt(pid, 16)]
p?.let {
Log.d(TAG, "Found pid " + it.PID + " in " + (Calendar.getInstance().time.time - start.time).toString() + " ms")
}

if (pids == null) {
return p
} ?: run {
Log.d(TAG, "Pids for this mode do not exist.")
return null
}

val p = pids[Integer.parseInt(pid, 16)]
if (p != null) {
Log.d(TAG, "Found pid " + p.PID + " in " + (Calendar.getInstance().time.time - start.time).toString() + " ms")
}

return p
}

@Throws(IOException::class,java.lang.IllegalArgumentException::class)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
package com.pnuema.android.obd.statics

import com.pnuema.android.obd.models.PID
import java.util.*

/**
* Storage for the persistent pids so they dont have to be retrieved more than once.
Expand All @@ -25,21 +24,21 @@ object PersistentStorage {
private val persistentPidStorage by lazy { HashMap<String, PID>() }

fun addElement(element: PID?) {
if (element != null) {
persistentPidStorage[formKey(element)] = element
element?.let { pid ->
persistentPidStorage[formKey(pid)] = pid
}
}

fun removeElement(element: PID?) {
if (element != null) {
persistentPidStorage.remove(formKey(element))
element?.let { pid ->
persistentPidStorage.remove(formKey(pid))
}
}

fun getElement(element: PID?): PID? {
return if (element != null) {
persistentPidStorage[formKey(element)]
} else null
return element?.let { pid ->
persistentPidStorage[formKey(pid)]
}
}

fun containsPid(element: PID): Boolean {
Expand Down

0 comments on commit 5f0414f

Please sign in to comment.