chore: downgrade Kotlin to 2.1.0, add KSP support, and migrate Room to KSP
This commit is contained in:
@@ -4,19 +4,21 @@ import android.app.Application
|
||||
import com.example.esp32aldldashboard.bluetooth.BluetoothService
|
||||
import com.example.esp32aldldashboard.repository.SettingsRepository
|
||||
import com.example.esp32aldldashboard.repository.TelemetryRepository
|
||||
import com.example.esp32aldldashboard.logging.CsvLogger
|
||||
import com.example.esp32aldldashboard.data.database.TelemetryDatabase
|
||||
|
||||
class AldlApplication : Application() {
|
||||
lateinit var bluetoothService: BluetoothService
|
||||
lateinit var telemetryRepository: TelemetryRepository
|
||||
lateinit var settingsRepository: SettingsRepository
|
||||
|
||||
lateinit var csvLogger: com.example.esp32aldldashboard.logging.CsvLogger
|
||||
lateinit var csvLogger: CsvLogger
|
||||
|
||||
override fun onCreate() {
|
||||
super.onCreate()
|
||||
val database = com.example.esp32aldldashboard.data.database.TelemetryDatabase.getDatabase(this)
|
||||
val database = TelemetryDatabase.getDatabase(this)
|
||||
settingsRepository = SettingsRepository(this)
|
||||
csvLogger = com.example.esp32aldldashboard.logging.CsvLogger(this)
|
||||
csvLogger = CsvLogger(this)
|
||||
bluetoothService = BluetoothService(this)
|
||||
telemetryRepository = TelemetryRepository(
|
||||
bluetoothService,
|
||||
|
||||
@@ -5,17 +5,20 @@ import androidx.room.Insert
|
||||
import androidx.room.Query
|
||||
import kotlinx.coroutines.flow.Flow
|
||||
|
||||
import kotlin.jvm.JvmSuppressWildcards
|
||||
|
||||
@Dao
|
||||
@JvmSuppressWildcards
|
||||
interface TelemetryDao {
|
||||
|
||||
@Insert
|
||||
suspend fun insertSession(session: SessionEntity): Long
|
||||
|
||||
@Query("UPDATE sessions SET endTime = :endTime WHERE id = :sessionId")
|
||||
suspend fun endSession(sessionId: Long, endTime: Long)
|
||||
suspend fun endSession(sessionId: Long, endTime: Long): Int
|
||||
|
||||
@Insert
|
||||
suspend fun insertDataPoints(dataPoints: List<TelemetryDataPointEntity>)
|
||||
suspend fun insertDataPoints(dataPoints: List<TelemetryDataPointEntity>): List<Long>
|
||||
|
||||
@Query("SELECT * FROM sessions ORDER BY startTime DESC")
|
||||
fun getAllSessions(): Flow<List<SessionEntity>>
|
||||
@@ -24,5 +27,5 @@ interface TelemetryDao {
|
||||
fun getSessionData(sessionId: Long): Flow<List<TelemetryDataPointEntity>>
|
||||
|
||||
@Query("DELETE FROM sessions WHERE id = :sessionId")
|
||||
suspend fun deleteSession(sessionId: Long)
|
||||
suspend fun deleteSession(sessionId: Long): Int
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user