Added A command in HemoCubeFragment for checking temperature before start buffer or sample
This commit is contained in:
@@ -10,12 +10,13 @@ enum class TestStatus(val code: Double) {
|
||||
FIRST_EMPTY_AIR_READING_PRINT_COMPLETED(4.4),
|
||||
EPROM_ADC_RETRIEVAL_STARTED(4.5),
|
||||
EPROM_ADC_RETRIEVAL_COMPLETED(4.6),
|
||||
CUVETTE_ABSENT(4.7),
|
||||
CUVETTE_PRESENT(4.8),
|
||||
TEMPERATURE_CHECK(4.7),
|
||||
CUVETTE_ABSENT(4.8),
|
||||
CUVETTE_PRESENT(4.9),
|
||||
CUVETTE_ABSENTS(7.7),
|
||||
CUVETTE_PRESENTS(7.8),
|
||||
BUFFER_STARTED(4.9),
|
||||
BUFFER_COMPLETED(5.1),
|
||||
BUFFER_STARTED(5.1),
|
||||
BUFFER_COMPLETED(5.2),
|
||||
BUFFER_PRINT_STARTED(6.0),
|
||||
BUFFER_PRINT_COMPLETED(7.0),
|
||||
SAMPLE_STARTED(8.0),
|
||||
|
||||
@@ -127,7 +127,8 @@ class DeviceFragment : Fragment() {
|
||||
// }
|
||||
val lines = resultData.split("\n")
|
||||
var temp = lines[2]
|
||||
binding.tvSubtitleNew.text = "Device ID : "+hardwareId+"\nTemperature : $temp"
|
||||
val temp1 = resultData.substringAfter("#AS").substringBefore("#AC")
|
||||
binding.tvSubtitleNew.text = "Device ID : "+hardwareId+"\nTemperature : $temp\n"+temp1
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -25,6 +25,7 @@ import com.example.hpostesting.data.model.patient.DeviceData
|
||||
import com.example.hpostesting.data.model.patient.toHemoCubeTestData
|
||||
import com.example.hpostesting.presentation.utils.UsbServiceListener
|
||||
import com.example.hpostesting.presentation.dashboard.DashboardActivity
|
||||
import com.example.hpostesting.presentation.deviceinfo.DeviceActivity
|
||||
import com.example.hpostesting.presentation.utils.MyDialogListener
|
||||
import com.example.hpostesting.presentation.utils.UIUtils
|
||||
import com.google.firebase.crashlytics.ktx.crashlytics
|
||||
@@ -36,6 +37,7 @@ import kotlin.math.log10
|
||||
|
||||
@Suppress("MemberVisibilityCanBePrivate")
|
||||
class HemoCubeFragment : Fragment() {
|
||||
private var temperature=""
|
||||
private var checkCuvette = false
|
||||
private var checkCuvetteSam = false
|
||||
private var sampleClick = false
|
||||
@@ -448,10 +450,16 @@ class HemoCubeFragment : Fragment() {
|
||||
fetchResult()
|
||||
}
|
||||
|
||||
(resultData.contains("#RC") && this.testStatusCode < TestStatus.EPROM_ADC_RETRIEVAL_COMPLETED.code) -> {
|
||||
(resultData.contains("#EC") && this.testStatusCode < TestStatus.EPROM_ADC_RETRIEVAL_COMPLETED.code) -> {
|
||||
this.testStatusCode = TestStatus.EPROM_ADC_RETRIEVAL_COMPLETED.code
|
||||
hemoCubeViewModel.messages.postValue("EPROM ADC Loaded")
|
||||
//checkCuvettePresence()
|
||||
getTemp()
|
||||
}
|
||||
(resultData.contains("#AC") && this.testStatusCode < TestStatus.TEMPERATURE_CHECK.code) -> {
|
||||
this.testStatusCode = TestStatus.TEMPERATURE_CHECK.code
|
||||
temperature = resultData.substringAfter("#AS").substringBefore("#AC")
|
||||
hemoCubeViewModel.messages.postValue("EPROM ADC Loaded and Temperature fetched \n Temp : $temperature")
|
||||
}
|
||||
resultData.contains("#CIN") && sampleClick && this.testStatusCode < TestStatus.CUVETTE_PRESENTS.code -> {
|
||||
hemoCubeViewModel.messages.postValue(getString(R.string.cuvette_present))
|
||||
@@ -1337,7 +1345,18 @@ class HemoCubeFragment : Fragment() {
|
||||
}
|
||||
})
|
||||
}
|
||||
private fun getTemp() {
|
||||
hemoCubeViewModel.progressBar.postValue(true)
|
||||
|
||||
(activity as HemocubeActivity).mService.sendAndListenToHemoCube(HemoCubeCommands.CHECK_TEMP_COMMAND,
|
||||
object : UsbServiceListener {
|
||||
override fun onUsbRead(data: ByteArray?) {}
|
||||
|
||||
override fun onUsbError(e: Exception?) {
|
||||
hemoCubeViewModel.progressBar.postValue(false)
|
||||
}
|
||||
})
|
||||
}
|
||||
private fun fetchResult() {
|
||||
hemoCubeViewModel.progressBar.postValue(true)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user