Fetching caliberation value done

This commit is contained in:
smileomi18@gmail.com
2023-08-03 13:40:35 +05:30
parent 1ba919c956
commit 47633267f7
5 changed files with 31 additions and 5 deletions

View File

@@ -3,6 +3,6 @@ package com.example.hpostesting.data.model.patient
data class DeviceData (
val deviceId: String? = "",
val deviceType: String? = "",
val coefficient: List<Double>? = null,
val coefficients: List<Double>? = null,
val calibratedAt: String
)

View File

@@ -116,7 +116,19 @@ class DatabaseRepository : Repository {
}
}
suspend fun getDeviceDataById(): List<DeviceData> {
suspend fun getDeviceData(): List<DeviceData> {
return db.collection("devices").get().await().toObjects(DeviceData::class.java)
}
suspend fun getDeviceDataById(deviceId: String): DeviceData? {
val querySnapshot = db.collection("devices").get().await()
val allDeviceDataList = querySnapshot.toObjects(DeviceData::class.java)
// Find the DeviceData object with the specified deviceId
return allDeviceDataList.find { it.deviceId == deviceId }
}
}