changes made for v0 and V1 version
This commit is contained in:
@@ -38,6 +38,7 @@ object Constants {
|
|||||||
const val DEVICE_TYPE_HEMOCUBE = "HEMOCUBE"
|
const val DEVICE_TYPE_HEMOCUBE = "HEMOCUBE"
|
||||||
const val DEVICE_TYPE_TEST_RIGHT = "TEST_RIGHT"
|
const val DEVICE_TYPE_TEST_RIGHT = "TEST_RIGHT"
|
||||||
const val DEVICE_TYPE_TRUEHEME = "TRUEHEME"
|
const val DEVICE_TYPE_TRUEHEME = "TRUEHEME"
|
||||||
|
const val DEVICE_VERSION_TYPE = "V0"
|
||||||
|
|
||||||
const val DEVICE_VENDOR_ID = 1027
|
const val DEVICE_VENDOR_ID = 1027
|
||||||
const val HOMO_CUBE_ID = 29987
|
const val HOMO_CUBE_ID = 29987
|
||||||
|
|||||||
@@ -168,23 +168,33 @@ class AssuranceControlsFragment : Fragment() {
|
|||||||
binding.btnSubmit.setOnClickListener {
|
binding.btnSubmit.setOnClickListener {
|
||||||
val selectedSolution = binding.spinnerSolutions.selectedItem.toString()
|
val selectedSolution = binding.spinnerSolutions.selectedItem.toString()
|
||||||
val selectedConcentration = binding.spinnerConcentration.selectedItem.toString()
|
val selectedConcentration = binding.spinnerConcentration.selectedItem.toString()
|
||||||
val selectedadminOption = binding.spinnerAdmin.selectedItem.toString()
|
|
||||||
|
|
||||||
// Check if any of the selections are default values
|
|
||||||
// if (selectedSolution == "Select solution") {
|
|
||||||
// Toast.makeText(requireContext(), "Please select a solution", Toast.LENGTH_LONG).show()
|
|
||||||
// return@setOnClickListener // Prevent further execution
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// if (selectedConcentration == "Select concentration") {
|
|
||||||
// Toast.makeText(requireContext(), "Please select a concentration", Toast.LENGTH_LONG).show()
|
|
||||||
// return@setOnClickListener // Prevent further execution
|
|
||||||
// }
|
|
||||||
|
|
||||||
if (selectedadminOption == "Select options") {
|
// Check if any of the selections are default values
|
||||||
Toast.makeText(requireContext(), "Please select a option", Toast.LENGTH_LONG).show()
|
if (selectedSolution == "Select solution") {
|
||||||
|
Toast.makeText(requireContext(), "Please select a solution", Toast.LENGTH_LONG).show()
|
||||||
return@setOnClickListener // Prevent further execution
|
return@setOnClickListener // Prevent further execution
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (selectedConcentration == "Select concentration") {
|
||||||
|
Toast.makeText(requireContext(), "Please select a concentration", Toast.LENGTH_LONG).show()
|
||||||
|
return@setOnClickListener // Prevent further execution
|
||||||
|
}
|
||||||
|
//for vizagh
|
||||||
|
// val selectedadminOption = binding.spinnerAdmin.selectedItem.toString()
|
||||||
|
// if (selectedadminOption == "Select options") {
|
||||||
|
// Toast.makeText(requireContext(), "Please select a option", Toast.LENGTH_LONG).show()
|
||||||
|
// return@setOnClickListener // Prevent further execution
|
||||||
|
// }
|
||||||
|
// DataHolder.hemoCubeTestData!!.filter = binding.spinnerAdmin.selectedItem.toString()
|
||||||
|
// if(binding.spinnerAdmin.selectedItem.toString().equals("Select options")){
|
||||||
|
// Toast.makeText(requireContext(), "Please select a option", Toast.LENGTH_LONG).show()
|
||||||
|
// }else {
|
||||||
|
// DataHolder.hemoCubeTestData!!.name = DataHolder.hemoCubeTestData!!.filter.toString()
|
||||||
|
// }
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
DataHolder.hemoCubeTestData!!.quickCapture = true
|
DataHolder.hemoCubeTestData!!.quickCapture = true
|
||||||
val currentUnixTime = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
val currentUnixTime = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||||
Instant.now().epochSecond
|
Instant.now().epochSecond
|
||||||
@@ -194,18 +204,14 @@ class AssuranceControlsFragment : Fragment() {
|
|||||||
DataHolder.hemoCubeTestData!!._id = currentUnixTime.toString() + "SMI"
|
DataHolder.hemoCubeTestData!!._id = currentUnixTime.toString() + "SMI"
|
||||||
DataHolder.hemoCubeTestData!!.solution = binding.spinnerSolutions.selectedItem.toString()
|
DataHolder.hemoCubeTestData!!.solution = binding.spinnerSolutions.selectedItem.toString()
|
||||||
DataHolder.hemoCubeTestData!!.concentration = binding.spinnerConcentration.selectedItem.toString()
|
DataHolder.hemoCubeTestData!!.concentration = binding.spinnerConcentration.selectedItem.toString()
|
||||||
DataHolder.hemoCubeTestData!!.filter = binding.spinnerAdmin.selectedItem.toString()
|
|
||||||
if(binding.spinnerAdmin.selectedItem.toString().equals("Select options")){
|
|
||||||
Toast.makeText(requireContext(), "Please select a option", Toast.LENGTH_LONG).show()
|
|
||||||
}else {
|
|
||||||
DataHolder.hemoCubeTestData!!.name = DataHolder.hemoCubeTestData!!.filter.toString()
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
DataHolder.selectedTest = UserData()
|
DataHolder.selectedTest = UserData()
|
||||||
DataHolder.selectedTest?._id = DataHolder.hemoCubeTestData!!._id
|
DataHolder.selectedTest?._id = DataHolder.hemoCubeTestData!!._id
|
||||||
DataHolder.selectedTest?.name = DataHolder.hemoCubeTestData!!.name
|
DataHolder.selectedTest?.name = DataHolder.hemoCubeTestData!!.name
|
||||||
|
DataHolder.selectedTest?.name = binding.spinnerSolutions.selectedItem.toString() + " " +binding.spinnerConcentration.selectedItem.toString()
|
||||||
|
|
||||||
|
|
||||||
with(sharedPreferences.edit()) {
|
with(sharedPreferences.edit()) {
|
||||||
putString(Constants.QUICK_CAPTURE_SOLUTION, DataHolder.hemoCubeTestData!!.solution)
|
putString(Constants.QUICK_CAPTURE_SOLUTION, DataHolder.hemoCubeTestData!!.solution)
|
||||||
|
|||||||
@@ -38,6 +38,7 @@ import kotlin.math.log10
|
|||||||
class HemoCubeFragment : Fragment() {
|
class HemoCubeFragment : Fragment() {
|
||||||
private var checkCuvette = false
|
private var checkCuvette = false
|
||||||
private var checkCuvetteSam = false
|
private var checkCuvetteSam = false
|
||||||
|
private var borderlineMetric = 0.0
|
||||||
private var sampleClick = false
|
private var sampleClick = false
|
||||||
private lateinit var binding: FragmentHemoCubeReferenceBinding
|
private lateinit var binding: FragmentHemoCubeReferenceBinding
|
||||||
private val hemoCubeViewModel: HemoCubeViewModel by activityViewModels()
|
private val hemoCubeViewModel: HemoCubeViewModel by activityViewModels()
|
||||||
@@ -135,23 +136,23 @@ class HemoCubeFragment : Fragment() {
|
|||||||
|
|
||||||
binding.btnSamplestart.setOnClickListener {
|
binding.btnSamplestart.setOnClickListener {
|
||||||
sampleClick = true
|
sampleClick = true
|
||||||
if(checkCuvetteSam){
|
// if(checkCuvetteSam){
|
||||||
activity?.runOnUiThread {
|
activity?.runOnUiThread {
|
||||||
binding.tvSubtitle4.visibility = View.VISIBLE
|
binding.tvSubtitle4.visibility = View.VISIBLE
|
||||||
// binding.tvSubtitle4.text = "Sample Started"
|
// binding.tvSubtitle4.text = "Sample Started"
|
||||||
}
|
}
|
||||||
startSampleProcess()
|
startSampleProcess()
|
||||||
// it.visibility = View.GONE
|
// it.visibility = View.GONE
|
||||||
}else{
|
// }else{
|
||||||
checkCuvettePresence()
|
// checkCuvettePresence()
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
binding.btnRetryCheckCuvette.setOnClickListener {
|
binding.btnRetryCheckCuvette.setOnClickListener {
|
||||||
|
|
||||||
checkCuvettePresence()
|
checkCuvettePresence()
|
||||||
}
|
}
|
||||||
binding.btnPlacebuffer.setOnClickListener {
|
binding.btnPlacebuffer.setOnClickListener {
|
||||||
if(checkCuvette){
|
// if(checkCuvette){
|
||||||
|
|
||||||
startBufferProcess()
|
startBufferProcess()
|
||||||
// if (isBufferValueAvailable() || !Constants.BLANK_EVERY_TEST) {
|
// if (isBufferValueAvailable() || !Constants.BLANK_EVERY_TEST) {
|
||||||
@@ -166,9 +167,9 @@ class HemoCubeFragment : Fragment() {
|
|||||||
|
|
||||||
// it.visibility = View.GONE
|
// it.visibility = View.GONE
|
||||||
// }
|
// }
|
||||||
}else{
|
// }else{
|
||||||
checkCuvettePresence()
|
// checkCuvettePresence()
|
||||||
}
|
// }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -869,12 +870,16 @@ class HemoCubeFragment : Fragment() {
|
|||||||
val led3Average = log10(led3BufferForDevice.div(led3SampleForDevice))
|
val led3Average = log10(led3BufferForDevice.div(led3SampleForDevice))
|
||||||
val led4Average = log10(led4BufferForDevice.div(led4SampleForDevice))
|
val led4Average = log10(led4BufferForDevice.div(led4SampleForDevice))
|
||||||
//used for latest trueheme and v1
|
//used for latest trueheme and v1
|
||||||
// val deviceRatio = led2Average / led1Average
|
val deviceRatio: Double
|
||||||
// val borderlineMetric = (led1Average - led2Average) / deviceRatio
|
if(Constants.DEVICE_VERSION_TYPE == "V0"){
|
||||||
//used for latest v0 devices
|
//used for latest v0 devices
|
||||||
val deviceRatio = led4Average / led1Average
|
deviceRatio = led4Average / led1Average
|
||||||
val borderlineMetric = (led1Average - led4Average) / deviceRatio
|
borderlineMetric = (led1Average - led4Average) / deviceRatio
|
||||||
|
|
||||||
|
}else {
|
||||||
|
deviceRatio = led2Average / led1Average
|
||||||
|
borderlineMetric = (led1Average - led2Average) / deviceRatio
|
||||||
|
}
|
||||||
if (led1BufferForDevice < Constants.BUFFER_INTENSITY_THRESHOLDS[deviceHardwareId]?.get(0)
|
if (led1BufferForDevice < Constants.BUFFER_INTENSITY_THRESHOLDS[deviceHardwareId]?.get(0)
|
||||||
?.get(0)!!
|
?.get(0)!!
|
||||||
|| led2BufferForDevice < Constants.BUFFER_INTENSITY_THRESHOLDS[deviceHardwareId]?.get(
|
|| led2BufferForDevice < Constants.BUFFER_INTENSITY_THRESHOLDS[deviceHardwareId]?.get(
|
||||||
|
|||||||
@@ -39,7 +39,7 @@
|
|||||||
<Spinner
|
<Spinner
|
||||||
android:id="@+id/spinner_solutions"
|
android:id="@+id/spinner_solutions"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:visibility="gone"
|
android:visibility="visible"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginTop="40dp"
|
android:layout_marginTop="40dp"
|
||||||
android:background="@drawable/spinner_border"
|
android:background="@drawable/spinner_border"
|
||||||
@@ -51,7 +51,7 @@
|
|||||||
<Spinner
|
<Spinner
|
||||||
android:id="@+id/spinner_concentration"
|
android:id="@+id/spinner_concentration"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:visibility="gone"
|
android:visibility="visible"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginTop="48dp"
|
android:layout_marginTop="48dp"
|
||||||
android:background="@drawable/spinner_border"
|
android:background="@drawable/spinner_border"
|
||||||
@@ -65,7 +65,7 @@
|
|||||||
<Spinner
|
<Spinner
|
||||||
android:id="@+id/spinner_admin"
|
android:id="@+id/spinner_admin"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:visibility="visible"
|
android:visibility="gone"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginTop="52dp"
|
android:layout_marginTop="52dp"
|
||||||
android:background="@drawable/spinner_border"
|
android:background="@drawable/spinner_border"
|
||||||
|
|||||||
Reference in New Issue
Block a user