refactor: update package namespace from com.example to com.gronod

This commit is contained in:
2026-06-14 11:15:01 +01:00
parent 6a6232649c
commit 2e94463f37
40 changed files with 116 additions and 115 deletions
+1
View File
@@ -0,0 +1 @@
-NoNewline
+2 -2
View File
@@ -6,10 +6,10 @@ plugins {
}
android {
namespace = "com.example.esp32aldldashboard"
namespace = "com.gronod.esp32aldldashboard"
compileSdk = 36
defaultConfig {
applicationId = "com.example.esp32aldldashboard"
applicationId = "com.gronod.esp32aldldashboard"
minSdk = 24
targetSdk = 36
versionCode = 1
@@ -1,4 +1,4 @@
package com.example.esp32aldldashboard.ui.main
package com.gronod.esp32aldldashboard.ui.main
import androidx.activity.ComponentActivity
import androidx.compose.ui.test.junit4.createAndroidComposeRule
@@ -7,7 +7,7 @@ import org.junit.Before
import org.junit.Rule
import org.junit.Test
/** UI tests for [com.example.esp32aldldashboard.ui.main.MainScreen]. */
/** UI tests for [com.gronod.esp32aldldashboard.ui.main.MainScreen]. */
class MainScreenTest {
@get:Rule val composeTestRule = createAndroidComposeRule<ComponentActivity>()
@@ -1,14 +1,14 @@
package com.example.esp32aldldashboard
package com.gronod.esp32aldldashboard
import android.app.Application
import com.example.esp32aldldashboard.bluetooth.BluetoothService
import com.example.esp32aldldashboard.repository.BLMTableRepository
import com.example.esp32aldldashboard.repository.ChartPreferencesRepository
import com.example.esp32aldldashboard.repository.SettingsRepository
import com.example.esp32aldldashboard.repository.TelemetryRepository
import com.example.esp32aldldashboard.logging.CsvLogger
import com.example.esp32aldldashboard.logging.RawStreamLogger
import com.example.esp32aldldashboard.data.database.TelemetryDatabase
import com.gronod.esp32aldldashboard.bluetooth.BluetoothService
import com.gronod.esp32aldldashboard.repository.BLMTableRepository
import com.gronod.esp32aldldashboard.repository.ChartPreferencesRepository
import com.gronod.esp32aldldashboard.repository.SettingsRepository
import com.gronod.esp32aldldashboard.repository.TelemetryRepository
import com.gronod.esp32aldldashboard.logging.CsvLogger
import com.gronod.esp32aldldashboard.logging.RawStreamLogger
import com.gronod.esp32aldldashboard.data.database.TelemetryDatabase
class AldlApplication : Application() {
lateinit var bluetoothService: BluetoothService
@@ -1,4 +1,4 @@
package com.example.esp32aldldashboard
package com.gronod.esp32aldldashboard
import android.os.Bundle
import androidx.activity.ComponentActivity
@@ -8,7 +8,7 @@ import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Surface
import androidx.compose.ui.Modifier
import com.example.esp32aldldashboard.theme.ESP32ALDLDashboardTheme
import com.gronod.esp32aldldashboard.theme.ESP32ALDLDashboardTheme
class MainActivity : ComponentActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
@@ -1,4 +1,4 @@
package com.example.esp32aldldashboard
package com.gronod.esp32aldldashboard
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.safeDrawingPadding
@@ -8,7 +8,7 @@ import androidx.compose.ui.unit.dp
import androidx.navigation3.runtime.entryProvider
import androidx.navigation3.runtime.rememberNavBackStack
import androidx.navigation3.ui.NavDisplay
import com.example.esp32aldldashboard.ui.main.MainScreen
import com.gronod.esp32aldldashboard.ui.main.MainScreen
@Composable
fun MainNavigation() {
@@ -1,4 +1,4 @@
package com.example.esp32aldldashboard
package com.gronod.esp32aldldashboard
import androidx.navigation3.runtime.NavKey
import kotlinx.serialization.Serializable
@@ -1,4 +1,4 @@
package com.example.esp32aldldashboard.bluetooth
package com.gronod.esp32aldldashboard.bluetooth
import android.app.Notification
import android.app.NotificationChannel
@@ -9,9 +9,9 @@ import android.content.Intent
import android.os.Build
import android.os.IBinder
import androidx.core.app.NotificationCompat
import com.example.esp32aldldashboard.AldlApplication
import com.example.esp32aldldashboard.MainActivity
import com.example.esp32aldldashboard.R
import com.gronod.esp32aldldashboard.AldlApplication
import com.gronod.esp32aldldashboard.MainActivity
import com.gronod.esp32aldldashboard.R
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.Job
@@ -1,4 +1,4 @@
package com.example.esp32aldldashboard.bluetooth
package com.gronod.esp32aldldashboard.bluetooth
import android.annotation.SuppressLint
import android.bluetooth.BluetoothAdapter
@@ -7,10 +7,10 @@ import android.bluetooth.BluetoothManager
import android.bluetooth.BluetoothSocket
import android.content.Context
import android.util.Log
import com.example.esp32aldldashboard.parser.ALDLFrame
import com.example.esp32aldldashboard.parser.ALDLParser
import com.example.esp32aldldashboard.logging.RawStreamLogger
import com.example.esp32aldldashboard.repository.SettingsRepository
import com.gronod.esp32aldldashboard.parser.ALDLFrame
import com.gronod.esp32aldldashboard.parser.ALDLParser
import com.gronod.esp32aldldashboard.logging.RawStreamLogger
import com.gronod.esp32aldldashboard.repository.SettingsRepository
import kotlinx.coroutines.flow.first
import kotlinx.coroutines.*
import kotlinx.coroutines.flow.MutableStateFlow
@@ -234,7 +234,7 @@ class BluetoothService(
payload[24] = bpwLowRaw.toByte()
val parsed = ALDLParser.parseFrame(payload)
if (parsed is com.example.esp32aldldashboard.parser.ALDLParseResult.Success) {
if (parsed is com.gronod.esp32aldldashboard.parser.ALDLParseResult.Success) {
_latestFrame.value = parsed.frame
val hexString = payload.joinToString(" ") { String.format("%02X", it) }
addRawHexLog("AA 55 $hexString (SIMULATED)")
@@ -380,7 +380,7 @@ class BluetoothService(
val parsed = ALDLParser.parseFrame(payload)
when (parsed) {
is com.example.esp32aldldashboard.parser.ALDLParseResult.Success -> {
is com.gronod.esp32aldldashboard.parser.ALDLParseResult.Success -> {
_framesReceived.value += 1
framesInCurrentSecond++
@@ -397,11 +397,11 @@ class BluetoothService(
addRawHexLog("AA 55 $hexString")
}
}
is com.example.esp32aldldashboard.parser.ALDLParseResult.InvalidData -> {
is com.gronod.esp32aldldashboard.parser.ALDLParseResult.InvalidData -> {
_parseErrors.value += 1
Log.w(TAG, "Invalid frame: ${parsed.reason}")
}
com.example.esp32aldldashboard.parser.ALDLParseResult.Incomplete -> {
com.gronod.esp32aldldashboard.parser.ALDLParseResult.Incomplete -> {
// Handled by size check
}
}
@@ -1,4 +1,4 @@
package com.example.esp32aldldashboard.data
package com.gronod.esp32aldldashboard.data
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.flow
@@ -1,4 +1,4 @@
package com.example.esp32aldldashboard.data.database
package com.gronod.esp32aldldashboard.data.database
import androidx.room.Entity
import androidx.room.PrimaryKey
@@ -1,4 +1,4 @@
package com.example.esp32aldldashboard.data.database
package com.gronod.esp32aldldashboard.data.database
import androidx.room.Dao
import androidx.room.Insert
@@ -1,4 +1,4 @@
package com.example.esp32aldldashboard.data.database
package com.gronod.esp32aldldashboard.data.database
import androidx.room.Entity
import androidx.room.ForeignKey
@@ -1,4 +1,4 @@
package com.example.esp32aldldashboard.data.database
package com.gronod.esp32aldldashboard.data.database
import android.content.Context
import androidx.room.Database
@@ -1,11 +1,11 @@
package com.example.esp32aldldashboard.logging
package com.gronod.esp32aldldashboard.logging
import android.content.ContentValues
import android.content.Context
import android.os.Build
import android.os.Environment
import android.provider.MediaStore
import com.example.esp32aldldashboard.parser.ALDLFrame
import com.gronod.esp32aldldashboard.parser.ALDLFrame
import java.io.OutputStream
import java.text.SimpleDateFormat
import java.util.Date
@@ -1,4 +1,4 @@
package com.example.esp32aldldashboard.logging
package com.gronod.esp32aldldashboard.logging
import android.content.ContentValues
import android.content.Context
@@ -1,4 +1,4 @@
package com.example.esp32aldldashboard.parser
package com.gronod.esp32aldldashboard.parser
data class ALDLFrame(
val rawBytes: ByteArray,
@@ -1,4 +1,4 @@
package com.example.esp32aldldashboard.parser
package com.gronod.esp32aldldashboard.parser
// Approximate Engine Load (0.0 to 1.0)
// Very rough approximation: MAP (kPa) / ~100 kPa (atmospheric at sea level)
@@ -1,4 +1,4 @@
package com.example.esp32aldldashboard.parser
package com.gronod.esp32aldldashboard.parser
object TroubleCodeDictionary {
val DTC_DESCRIPTIONS = mapOf(
@@ -1,4 +1,4 @@
package com.example.esp32aldldashboard.repository
package com.gronod.esp32aldldashboard.repository
import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.flow.StateFlow
@@ -1,10 +1,10 @@
package com.example.esp32aldldashboard.repository
package com.gronod.esp32aldldashboard.repository
import android.content.Context
import androidx.datastore.core.DataStore
import androidx.datastore.preferences.core.*
import androidx.datastore.preferences.preferencesDataStore
import com.example.esp32aldldashboard.ui.charts.ChartParameter
import com.gronod.esp32aldldashboard.ui.charts.ChartParameter
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.map
@@ -1,4 +1,4 @@
package com.example.esp32aldldashboard.repository
package com.gronod.esp32aldldashboard.repository
import android.content.ContentUris
import android.content.Context
@@ -1,15 +1,15 @@
package com.example.esp32aldldashboard.repository
package com.gronod.esp32aldldashboard.repository
import android.content.Context
import android.content.Intent
import com.example.esp32aldldashboard.bluetooth.BluetoothService
import com.example.esp32aldldashboard.bluetooth.BluetoothForegroundService
import com.example.esp32aldldashboard.bluetooth.ConnectionState
import com.example.esp32aldldashboard.parser.ALDLFrame
import com.example.esp32aldldashboard.data.database.SessionEntity
import com.example.esp32aldldashboard.data.database.TelemetryDao
import com.example.esp32aldldashboard.data.database.TelemetryDataPointEntity
import com.example.esp32aldldashboard.logging.CsvLogger
import com.gronod.esp32aldldashboard.bluetooth.BluetoothService
import com.gronod.esp32aldldashboard.bluetooth.BluetoothForegroundService
import com.gronod.esp32aldldashboard.bluetooth.ConnectionState
import com.gronod.esp32aldldashboard.parser.ALDLFrame
import com.gronod.esp32aldldashboard.data.database.SessionEntity
import com.gronod.esp32aldldashboard.data.database.TelemetryDao
import com.gronod.esp32aldldashboard.data.database.TelemetryDataPointEntity
import com.gronod.esp32aldldashboard.logging.CsvLogger
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.Job
@@ -1,4 +1,4 @@
package com.example.esp32aldldashboard.theme
package com.gronod.esp32aldldashboard.theme
import androidx.compose.ui.graphics.Color
@@ -1,4 +1,4 @@
package com.example.esp32aldldashboard.theme
package com.gronod.esp32aldldashboard.theme
import android.os.Build
import androidx.compose.foundation.isSystemInDarkTheme
@@ -1,4 +1,4 @@
package com.example.esp32aldldashboard.theme
package com.gronod.esp32aldldashboard.theme
import androidx.compose.material3.Typography
import androidx.compose.ui.text.TextStyle
@@ -1,4 +1,4 @@
package com.example.esp32aldldashboard.ui.blm
package com.gronod.esp32aldldashboard.ui.blm
import androidx.compose.foundation.background
import androidx.compose.foundation.border
@@ -18,7 +18,7 @@ import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import androidx.lifecycle.compose.collectAsStateWithLifecycle
import com.example.esp32aldldashboard.repository.BLMTableRepository
import com.gronod.esp32aldldashboard.repository.BLMTableRepository
@Composable
fun BLMTableScreen(
@@ -1,9 +1,9 @@
package com.example.esp32aldldashboard.ui.blm
package com.gronod.esp32aldldashboard.ui.blm
import androidx.lifecycle.ViewModel
import androidx.lifecycle.ViewModelProvider
import com.example.esp32aldldashboard.repository.BLMCellData
import com.example.esp32aldldashboard.repository.BLMTableRepository
import com.gronod.esp32aldldashboard.repository.BLMCellData
import com.gronod.esp32aldldashboard.repository.BLMTableRepository
import kotlinx.coroutines.flow.StateFlow
class BLMTableViewModel(private val repository: BLMTableRepository) : ViewModel() {
@@ -1,7 +1,7 @@
package com.example.esp32aldldashboard.ui.charts
package com.gronod.esp32aldldashboard.ui.charts
import androidx.compose.ui.graphics.Color
import com.example.esp32aldldashboard.parser.ALDLFrame
import com.gronod.esp32aldldashboard.parser.ALDLFrame
enum class ChartParameter(
val displayName: String,
@@ -1,5 +1,5 @@
@file:OptIn(androidx.compose.material3.ExperimentalMaterial3Api::class)
package com.example.esp32aldldashboard.ui.charts
package com.gronod.esp32aldldashboard.ui.charts
import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.foundation.Canvas
@@ -16,8 +16,8 @@ import androidx.compose.ui.graphics.Path
import androidx.compose.ui.graphics.drawscope.Stroke
import androidx.compose.ui.unit.dp
import androidx.lifecycle.compose.collectAsStateWithLifecycle
import com.example.esp32aldldashboard.parser.ALDLFrame
import com.example.esp32aldldashboard.repository.ChartPreferencesRepository
import com.gronod.esp32aldldashboard.parser.ALDLFrame
import com.gronod.esp32aldldashboard.repository.ChartPreferencesRepository
import kotlinx.coroutines.flow.StateFlow
import kotlinx.coroutines.launch
@@ -1,4 +1,4 @@
package com.example.esp32aldldashboard.ui.components
package com.gronod.esp32aldldashboard.ui.components
import androidx.compose.animation.core.Spring
import androidx.compose.animation.core.animateFloatAsState
@@ -1,4 +1,4 @@
package com.example.esp32aldldashboard.ui.main
package com.gronod.esp32aldldashboard.ui.main
import androidx.compose.foundation.background
import androidx.compose.foundation.border
@@ -16,11 +16,11 @@ import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import com.example.esp32aldldashboard.bluetooth.ConnectionState
import com.example.esp32aldldashboard.parser.ALDLFrame
import com.example.esp32aldldashboard.parser.TroubleCodeDictionary
import com.example.esp32aldldashboard.ui.components.RpmGauge
import com.example.esp32aldldashboard.ui.components.TpsBar
import com.gronod.esp32aldldashboard.bluetooth.ConnectionState
import com.gronod.esp32aldldashboard.parser.ALDLFrame
import com.gronod.esp32aldldashboard.parser.TroubleCodeDictionary
import com.gronod.esp32aldldashboard.ui.components.RpmGauge
import com.gronod.esp32aldldashboard.ui.components.TpsBar
// Theme Colors
val DarkBg = Color(0xFF0F0F12)
@@ -1,4 +1,4 @@
package com.example.esp32aldldashboard.ui.main
package com.gronod.esp32aldldashboard.ui.main
import android.Manifest
import android.content.pm.PackageManager
@@ -18,11 +18,11 @@ import androidx.compose.ui.platform.LocalContext
import androidx.core.content.ContextCompat
import androidx.lifecycle.compose.collectAsStateWithLifecycle
import androidx.lifecycle.viewmodel.compose.viewModel
import com.example.esp32aldldashboard.AldlApplication
import com.example.esp32aldldashboard.ui.blm.BLMTableScreen
import com.example.esp32aldldashboard.ui.blm.BLMTableViewModelFactory
import com.example.esp32aldldashboard.ui.charts.ChartsScreen
import com.example.esp32aldldashboard.ui.settings.SettingsScreen
import com.gronod.esp32aldldashboard.AldlApplication
import com.gronod.esp32aldldashboard.ui.blm.BLMTableScreen
import com.gronod.esp32aldldashboard.ui.blm.BLMTableViewModelFactory
import com.gronod.esp32aldldashboard.ui.charts.ChartsScreen
import com.gronod.esp32aldldashboard.ui.settings.SettingsScreen
@Composable
fun MainScreen(
@@ -131,7 +131,7 @@ fun MainScreen(
modifier = modifier.padding(paddingValues)
)
2 -> {
val blmViewModel: com.example.esp32aldldashboard.ui.blm.BLMTableViewModel = viewModel(
val blmViewModel: com.gronod.esp32aldldashboard.ui.blm.BLMTableViewModel = viewModel(
factory = BLMTableViewModelFactory(app.blmTableRepository)
)
BLMTableScreen(
@@ -1,11 +1,11 @@
package com.example.esp32aldldashboard.ui.main
package com.gronod.esp32aldldashboard.ui.main
import androidx.lifecycle.ViewModel
import androidx.lifecycle.viewModelScope
import com.example.esp32aldldashboard.bluetooth.ConnectionState
import com.example.esp32aldldashboard.parser.ALDLFrame
import com.example.esp32aldldashboard.repository.SettingsRepository
import com.example.esp32aldldashboard.repository.TelemetryRepository
import com.gronod.esp32aldldashboard.bluetooth.ConnectionState
import com.gronod.esp32aldldashboard.parser.ALDLFrame
import com.gronod.esp32aldldashboard.repository.SettingsRepository
import com.gronod.esp32aldldashboard.repository.TelemetryRepository
import kotlinx.coroutines.flow.SharingStarted
import kotlinx.coroutines.flow.StateFlow
import kotlinx.coroutines.flow.stateIn
@@ -1,9 +1,9 @@
package com.example.esp32aldldashboard.ui.main
package com.gronod.esp32aldldashboard.ui.main
import androidx.lifecycle.ViewModel
import androidx.lifecycle.ViewModelProvider
import com.example.esp32aldldashboard.repository.SettingsRepository
import com.example.esp32aldldashboard.repository.TelemetryRepository
import com.gronod.esp32aldldashboard.repository.SettingsRepository
import com.gronod.esp32aldldashboard.repository.TelemetryRepository
class MainScreenViewModelFactory(
private val telemetryRepository: TelemetryRepository,
@@ -1,4 +1,4 @@
package com.example.esp32aldldashboard.ui.settings
package com.gronod.esp32aldldashboard.ui.settings
import android.content.Intent
import androidx.compose.foundation.layout.*
@@ -14,8 +14,8 @@ import androidx.compose.ui.Modifier
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.unit.dp
import androidx.core.content.FileProvider
import com.example.esp32aldldashboard.repository.FileType
import com.example.esp32aldldashboard.repository.LoggedFile
import com.gronod.esp32aldldashboard.repository.FileType
import com.gronod.esp32aldldashboard.repository.LoggedFile
@Composable
fun LogFilesDialog(
@@ -1,4 +1,4 @@
package com.example.esp32aldldashboard.ui.settings
package com.gronod.esp32aldldashboard.ui.settings
import androidx.compose.foundation.layout.*
import androidx.compose.material.icons.Icons
@@ -9,8 +9,8 @@ import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.unit.dp
import androidx.lifecycle.compose.collectAsStateWithLifecycle
import com.example.esp32aldldashboard.repository.LoggedFile
import com.example.esp32aldldashboard.repository.SettingsRepository
import com.gronod.esp32aldldashboard.repository.LoggedFile
import com.gronod.esp32aldldashboard.repository.SettingsRepository
import kotlinx.coroutines.launch
@Composable
@@ -1,6 +1,6 @@
package com.example.esp32aldldashboard
package com.gronod.esp32aldldashboard
import com.example.esp32aldldashboard.parser.ALDLParser
import com.gronod.esp32aldldashboard.parser.ALDLParser
import org.junit.Assert.*
import org.junit.Test
@@ -20,8 +20,8 @@ class ALDLParserTest {
)
val result = ALDLParser.parseFrame(rawPayload)
assertTrue(result is com.example.esp32aldldashboard.parser.ALDLParseResult.Success)
val frame = (result as com.example.esp32aldldashboard.parser.ALDLParseResult.Success).frame
assertTrue(result is com.gronod.esp32aldldashboard.parser.ALDLParseResult.Success)
val frame = (result as com.gronod.esp32aldldashboard.parser.ALDLParseResult.Success).frame
// Assert values based on 24-INT10.ads specifications:
assertEquals(95, frame.iacPosition) // u[3] (Byte 4)
@@ -78,7 +78,7 @@ class ALDLParserTest {
this[7] = 255.toByte() // 255 * 25 = 6375 RPM
}
val validResult = ALDLParser.parseFrame(validPayload)
assertTrue("Max representable RPM should be valid", validResult is com.example.esp32aldldashboard.parser.ALDLParseResult.Success)
assertTrue("Max representable RPM should be valid", validResult is com.gronod.esp32aldldashboard.parser.ALDLParseResult.Success)
}
@Test
@@ -88,28 +88,28 @@ class ALDLParserTest {
this[17] = 80.toByte()
}
val minResult = ALDLParser.parseFrame(minPayload)
assertTrue("Battery at 8V should be valid", minResult is com.example.esp32aldldashboard.parser.ALDLParseResult.Success)
assertTrue("Battery at 8V should be valid", minResult is com.gronod.esp32aldldashboard.parser.ALDLParseResult.Success)
// Max valid: 18V (180 * 0.1 = 18.0V)
val maxPayload = createBasePayload().apply {
this[17] = 180.toByte()
}
val maxResult = ALDLParser.parseFrame(maxPayload)
assertTrue("Battery at 18V should be valid", maxResult is com.example.esp32aldldashboard.parser.ALDLParseResult.Success)
assertTrue("Battery at 18V should be valid", maxResult is com.gronod.esp32aldldashboard.parser.ALDLParseResult.Success)
// Too low: 4.9V (49 * 0.1 = 4.9V, below 5V minimum)
val lowPayload = createBasePayload().apply {
this[17] = 49.toByte()
}
val lowResult = ALDLParser.parseFrame(lowPayload)
assertTrue("Battery below 5V should be rejected", lowResult is com.example.esp32aldldashboard.parser.ALDLParseResult.InvalidData)
assertTrue("Battery below 5V should be rejected", lowResult is com.gronod.esp32aldldashboard.parser.ALDLParseResult.InvalidData)
// Too high: 20.1V (201 * 0.1 = 20.1V, above 20V maximum)
val highPayload = createBasePayload().apply {
this[17] = 201.toByte()
}
val highResult = ALDLParser.parseFrame(highPayload)
assertTrue("Battery above 20V should be rejected", highResult is com.example.esp32aldldashboard.parser.ALDLParseResult.InvalidData)
assertTrue("Battery above 20V should be rejected", highResult is com.gronod.esp32aldldashboard.parser.ALDLParseResult.InvalidData)
}
@Test
@@ -119,7 +119,7 @@ class ALDLParserTest {
this[8] = 255.toByte()
}
val validResult = ALDLParser.parseFrame(validPayload)
assertTrue("Max representable TPS should be valid", validResult is com.example.esp32aldldashboard.parser.ALDLParseResult.Success)
assertTrue("Max representable TPS should be valid", validResult is com.gronod.esp32aldldashboard.parser.ALDLParseResult.Success)
}
@Test
@@ -127,21 +127,21 @@ class ALDLParserTest {
// Valid temperature: 89 * 0.75 - 40 = 26.75C (within -45 to 220 range)
val validPayload = createBasePayload()
val validResult = ALDLParser.parseFrame(validPayload)
assertTrue("Valid coolant temp should be accepted", validResult is com.example.esp32aldldashboard.parser.ALDLParseResult.Success)
assertTrue("Valid coolant temp should be accepted", validResult is com.gronod.esp32aldldashboard.parser.ALDLParseResult.Success)
// Max representable: 255 * 0.75 - 40 = 151.25C
val maxPayload = createBasePayload().apply {
this[4] = 255.toByte()
}
val maxResult = ALDLParser.parseFrame(maxPayload)
assertTrue("Max representable coolant temp should be accepted", maxResult is com.example.esp32aldldashboard.parser.ALDLParseResult.Success)
assertTrue("Max representable coolant temp should be accepted", maxResult is com.gronod.esp32aldldashboard.parser.ALDLParseResult.Success)
// Min representable: 0 * 0.75 - 40 = -40C
val minPayload = createBasePayload().apply {
this[4] = 0.toByte()
}
val minResult = ALDLParser.parseFrame(minPayload)
assertTrue("Min representable coolant temp should be accepted", minResult is com.example.esp32aldldashboard.parser.ALDLParseResult.Success)
assertTrue("Min representable coolant temp should be accepted", minResult is com.gronod.esp32aldldashboard.parser.ALDLParseResult.Success)
}
@Test
@@ -149,7 +149,7 @@ class ALDLParserTest {
// Payload with only 24 bytes (incomplete)
val incompletePayload = ByteArray(24) { 0x20.toByte() }
val result = ALDLParser.parseFrame(incompletePayload)
assertTrue("Incomplete payload should return Incomplete result", result is com.example.esp32aldldashboard.parser.ALDLParseResult.Incomplete)
assertTrue("Incomplete payload should return Incomplete result", result is com.gronod.esp32aldldashboard.parser.ALDLParseResult.Incomplete)
}
private fun createBasePayload(): ByteArray {
@@ -1,4 +1,4 @@
package com.example.esp32aldldashboard.parser
package com.gronod.esp32aldldashboard.parser
import org.junit.Assert.*
import org.junit.Test
@@ -1,9 +1,9 @@
@file:OptIn(kotlinx.coroutines.ExperimentalCoroutinesApi::class)
package com.example.esp32aldldashboard.ui.main
package com.gronod.esp32aldldashboard.ui.main
import com.example.esp32aldldashboard.bluetooth.ConnectionState
import com.example.esp32aldldashboard.repository.SettingsRepository
import com.example.esp32aldldashboard.repository.TelemetryRepository
import com.gronod.esp32aldldashboard.bluetooth.ConnectionState
import com.gronod.esp32aldldashboard.repository.SettingsRepository
import com.gronod.esp32aldldashboard.repository.TelemetryRepository
import io.mockk.*
import junit.framework.TestCase.assertEquals
import junit.framework.TestCase.assertFalse