Compare commits
15 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1e70f3c9a6 | ||
|
|
2642106b32 | ||
|
|
f50a1d8dcd | ||
|
|
5db43bf16c | ||
|
|
21d53cc2b8 | ||
|
|
82360b22c8 | ||
|
|
add61d9c65 | ||
|
|
92a01dbd9f | ||
|
|
bf73ea70b8 | ||
|
|
dfe39fb460 | ||
|
|
aa8a991fbb | ||
|
|
3aeb7ef543 | ||
|
|
f048335f77 | ||
|
|
44d5b4f0ba | ||
|
|
0b17ea9ab9 |
2
.idea/gradle.xml
generated
2
.idea/gradle.xml
generated
@@ -5,7 +5,6 @@
|
|||||||
<option name="linkedExternalProjectsSettings">
|
<option name="linkedExternalProjectsSettings">
|
||||||
<GradleProjectSettings>
|
<GradleProjectSettings>
|
||||||
<option name="testRunner" value="GRADLE" />
|
<option name="testRunner" value="GRADLE" />
|
||||||
<option name="distributionType" value="DEFAULT_WRAPPED" />
|
|
||||||
<option name="externalProjectPath" value="$PROJECT_DIR$" />
|
<option name="externalProjectPath" value="$PROJECT_DIR$" />
|
||||||
<option name="gradleJvm" value="jbr-17" />
|
<option name="gradleJvm" value="jbr-17" />
|
||||||
<option name="modules">
|
<option name="modules">
|
||||||
@@ -14,6 +13,7 @@
|
|||||||
<option value="$PROJECT_DIR$/app" />
|
<option value="$PROJECT_DIR$/app" />
|
||||||
</set>
|
</set>
|
||||||
</option>
|
</option>
|
||||||
|
<option name="resolveExternalAnnotations" value="false" />
|
||||||
</GradleProjectSettings>
|
</GradleProjectSettings>
|
||||||
</option>
|
</option>
|
||||||
</component>
|
</component>
|
||||||
|
|||||||
@@ -14,13 +14,13 @@ android {
|
|||||||
compileSdk 34
|
compileSdk 34
|
||||||
namespace 'in.sminnovations.hpostesting'
|
namespace 'in.sminnovations.hpostesting'
|
||||||
|
|
||||||
// prod - production, preprod - preproduction, quality - qc,
|
// prod - production, preprod - preproduction, quality - qc
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
applicationId "in.sminnovations.hpostesting"
|
applicationId "in.sminnovations.hpostesting.preprod"
|
||||||
minSdk 21
|
minSdk 21
|
||||||
targetSdk 34
|
targetSdk 34
|
||||||
versionCode 44
|
versionCode 81
|
||||||
versionName "2.1.45"
|
versionName "2.1.81"
|
||||||
|
|
||||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,6 +29,8 @@ object Constants {
|
|||||||
const val DEVICE_VENDOR_ID = 1027
|
const val DEVICE_VENDOR_ID = 1027
|
||||||
const val HOMO_CUBE_ID = 29987
|
const val HOMO_CUBE_ID = 29987
|
||||||
const val VENDOR_ID = 6790
|
const val VENDOR_ID = 6790
|
||||||
|
const val HEMO_CUBE_V2_PRODUCT_ID = 24577
|
||||||
|
const val HEMO_CUBE_V2_VENDOR_ID = 1027
|
||||||
|
|
||||||
const val ERROR_NORMAL = 400
|
const val ERROR_NORMAL = 400
|
||||||
const val ERROR_CRITICAL = 401
|
const val ERROR_CRITICAL = 401
|
||||||
@@ -38,6 +40,7 @@ object Constants {
|
|||||||
const val USER_ID = "usernameId"
|
const val USER_ID = "usernameId"
|
||||||
|
|
||||||
val STATICID = listOf(
|
val STATICID = listOf(
|
||||||
|
"ADMIN",
|
||||||
"VIZ-1000-0004",
|
"VIZ-1000-0004",
|
||||||
"VIZ-1000-0005",
|
"VIZ-1000-0005",
|
||||||
"VIZ-1000-0006",
|
"VIZ-1000-0006",
|
||||||
@@ -78,23 +81,72 @@ object Constants {
|
|||||||
const val BUFFER_LED_LOWER_BOUND = 21000
|
const val BUFFER_LED_LOWER_BOUND = 21000
|
||||||
const val BUFFER_LED_UPPER_BOUND = 24500
|
const val BUFFER_LED_UPPER_BOUND = 24500
|
||||||
|
|
||||||
|
const val TEST_STATUS_CODE_TEST_STARTED = 1.0
|
||||||
|
const val TEST_STATUS_CODE_CONFIG_STARTED = 2.0
|
||||||
|
const val TEST_STATUS_CODE_CONFIG_COMPLETED = 3.0
|
||||||
|
const val TEST_STATUS_CODE_BUFFER_STARTED = 4.0
|
||||||
|
const val TEST_STATUS_CODE_BUFFER_COMPLETED = 5.0
|
||||||
|
const val TEST_STATUS_CODE_BUFFER_PRINT_STARTED = 6.0
|
||||||
|
const val TEST_STATUS_CODE_BUFFER_PRINT_COMPLETED = 7.0
|
||||||
|
const val TEST_STATUS_CODE_SAMPLE_STARTED = 8.0
|
||||||
|
const val TEST_STATUS_CODE_SAMPLE_COMPLETED = 9.0
|
||||||
|
const val TEST_STATUS_CODE_SAMPLE_PRINT_STARTED = 10.0
|
||||||
|
const val TEST_STATUS_CODE_SAMPLE_PRINT_COMPLETED = 11.0
|
||||||
|
const val TEST_STATUS_CODE_TEST_COMPLETED = 12.0
|
||||||
|
|
||||||
val DEVICE_CONFIGURATION: Map<String, List<List<Double>>> = mapOf<String, List<List<Double>>>(
|
val DEVICE_CONFIGURATION: Map<String, List<List<Double>>> = mapOf<String, List<List<Double>>>(
|
||||||
"HCV-000-3001" to listOf(
|
"HCV-000-3001" to listOf(
|
||||||
listOf(1.313, -0.89), // LED1, 435nm
|
listOf(1.313, -0.89), // LED1, 435nm
|
||||||
listOf(0.581462456, -0.58502), // LED2, 415nm
|
listOf(0.581462456, -0.58502), // LED2, 415nm
|
||||||
listOf(0.2012, 0.0092), // LED3, 555nm
|
listOf(0.2012, 0.0092), // LED3, 555nm
|
||||||
listOf(1.0, 0.0) // LED4
|
listOf(1.0, 0.0) // LED4, 560nm
|
||||||
),
|
),
|
||||||
"HCV-000-3002" to listOf(
|
"HCV-000-3002" to listOf(
|
||||||
listOf(0.723142, -0.09135), // LED1, 435nm
|
listOf(0.723142, -0.09135), // LED1, 435nm
|
||||||
listOf(0.581462456, -0.58502), // LED2, 415nm
|
listOf(0.581462456, -0.58502), // LED2, 415nm
|
||||||
listOf(0.1964, 0.011565), // LED3, 555nm
|
listOf(0.1964, 0.011565), // LED3, 555nm
|
||||||
|
listOf(1.0, 0.0) // LED4, 560nm
|
||||||
|
),
|
||||||
|
"HCV-000-3003" to listOf(
|
||||||
|
listOf(0.723142, -0.09135), // LED1, 435nm
|
||||||
|
listOf(0.581462456, -0.58502), // LED2, 415nm
|
||||||
|
listOf(0.1964, 0.011565), // LED3, 555nm
|
||||||
|
listOf(1.0, 0.0) // LED4, 560nm
|
||||||
|
),
|
||||||
|
)
|
||||||
|
|
||||||
|
val DEVICE_HB_PARAMETERS: Map<String, List<List<Double>>> = mapOf<String, List<List<Double>>>(
|
||||||
|
"HCV-000-3001" to listOf(
|
||||||
|
listOf(1.0, 0.0), // LED1, 435nm
|
||||||
|
listOf(1.0, 0.0), // LED2, 415nm
|
||||||
|
listOf(0.0305, 0.2067), // LED3, 555nm
|
||||||
|
listOf(0.0258, 0.5534) // LED4, 560nm
|
||||||
|
),
|
||||||
|
"HCV-000-3002" to listOf(
|
||||||
|
listOf(1.0, 0.0), // LED1, 435nm
|
||||||
|
listOf(1.0, 0.0), // LED2, 415nm
|
||||||
|
listOf(0.0305, 0.2067), // LED3, 555nm
|
||||||
|
listOf(0.0258, 0.5534) // LED4, 560nm
|
||||||
|
),
|
||||||
|
"HCV-000-3003" to listOf(
|
||||||
|
listOf(0.0562, 0.1001), // LED1, 435nm
|
||||||
|
listOf(0.0902, 0.7021), // LED2, 415nm
|
||||||
|
listOf(0.0208, 0.0191), // LED3, 555nm
|
||||||
|
listOf(0.0153, 0.0152) // LED4
|
||||||
|
),
|
||||||
|
"HCV-000-3004" to listOf(
|
||||||
|
listOf(1.6837, -1.1417), // LED1, 435nm
|
||||||
|
listOf(0.581462456, -0.58502), // LED2, 415nm
|
||||||
|
listOf(0.2241, -0.0106), // LED3, 555nm
|
||||||
listOf(1.0, 0.0) // LED4
|
listOf(1.0, 0.0) // LED4
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
|
||||||
const val INCUBATION_TIME_MIN = 0
|
const val INCUBATION_TIME_MIN = 0
|
||||||
const val INCUBATION_TIME_MAX = 1400
|
const val INCUBATION_TIME_MAX = 1400
|
||||||
|
const val BATTERY_LEVEL_MIN = 0
|
||||||
|
|
||||||
|
const val MINIMUM_BATTERY_LEVEL = 0
|
||||||
|
|
||||||
val BUFFER_INTENSITY_THRESHOLDS: Map<String, List<List<Int>>> = mapOf<String, List<List<Int>>>(
|
val BUFFER_INTENSITY_THRESHOLDS: Map<String, List<List<Int>>> = mapOf<String, List<List<Int>>>(
|
||||||
"HCV-000-3001" to listOf(
|
"HCV-000-3001" to listOf(
|
||||||
@@ -108,6 +160,18 @@ object Constants {
|
|||||||
listOf(24500, 26250),
|
listOf(24500, 26250),
|
||||||
listOf(24500, 26250),
|
listOf(24500, 26250),
|
||||||
listOf(24500, 26250),
|
listOf(24500, 26250),
|
||||||
|
),
|
||||||
|
"HCV-000-3003" to listOf(
|
||||||
|
listOf(24500, 26250),
|
||||||
|
listOf(24500, 26250),
|
||||||
|
listOf(24500, 26250),
|
||||||
|
listOf(24500, 26250),
|
||||||
|
),
|
||||||
|
"HCV-000-3004" to listOf(
|
||||||
|
listOf(24500, 26250),
|
||||||
|
listOf(24500, 26250),
|
||||||
|
listOf(24500, 26250),
|
||||||
|
listOf(24500, 26250),
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -11,7 +11,7 @@ import com.example.hpostesting.data.model.patient.HemoCubeTestData
|
|||||||
import com.google.android.datatransport.runtime.dagger.Provides
|
import com.google.android.datatransport.runtime.dagger.Provides
|
||||||
import javax.inject.Singleton
|
import javax.inject.Singleton
|
||||||
|
|
||||||
@Database(entities = [UserData::class, HemoCubeTestData::class, DeviceData::class], version = 11, exportSchema = false)
|
@Database(entities = [UserData::class, HemoCubeTestData::class, DeviceData::class], version = 13, exportSchema = false)
|
||||||
@TypeConverters(Converters::class)
|
@TypeConverters(Converters::class)
|
||||||
abstract class MyDatabase : RoomDatabase() {
|
abstract class MyDatabase : RoomDatabase() {
|
||||||
abstract fun userDao(): UserDao
|
abstract fun userDao(): UserDao
|
||||||
|
|||||||
@@ -43,6 +43,8 @@ data class HemoCubeTestData(
|
|||||||
var abs2: Double? = null,
|
var abs2: Double? = null,
|
||||||
var abs3: Double? = null,
|
var abs3: Double? = null,
|
||||||
var abs4: Double? = null,
|
var abs4: Double? = null,
|
||||||
|
var hb3: Double? = null,
|
||||||
|
var hb4: Double? = null,
|
||||||
var deviceRatio: Double? = null,
|
var deviceRatio: Double? = null,
|
||||||
var calculatedRatio: Double? = null,
|
var calculatedRatio: Double? = null,
|
||||||
var predictedDenovixRatio: Double? = null,
|
var predictedDenovixRatio: Double? = null,
|
||||||
|
|||||||
@@ -114,6 +114,15 @@ class MainActivity : AppCompatActivity() {
|
|||||||
Constants.DEVICE_TYPE_HOMOCUBE
|
Constants.DEVICE_TYPE_HOMOCUBE
|
||||||
}
|
}
|
||||||
|
|
||||||
|
device.productId == Constants.HEMO_CUBE_V2_PRODUCT_ID && device.vendorId == Constants.HEMO_CUBE_V2_VENDOR_ID -> {
|
||||||
|
binding.cvItem1.visibility = View.VISIBLE
|
||||||
|
binding.cvItem3.visibility = View.VISIBLE
|
||||||
|
binding.cvItem2.visibility = View.GONE
|
||||||
|
binding.cvItem4.visibility = View.GONE
|
||||||
|
DataHolder.deviceType.postValue(Constants.DEVICE_TYPE_HOMOCUBE)
|
||||||
|
Constants.DEVICE_TYPE_HOMOCUBE
|
||||||
|
}
|
||||||
|
|
||||||
device.productId == Constants.DEVICE_PRODUCT_ID && device.vendorId == Constants.DEVICE_VENDOR_ID -> {
|
device.productId == Constants.DEVICE_PRODUCT_ID && device.vendorId == Constants.DEVICE_VENDOR_ID -> {
|
||||||
Log.d(
|
Log.d(
|
||||||
TAG,
|
TAG,
|
||||||
|
|||||||
@@ -213,13 +213,13 @@ class UserListAdapter(
|
|||||||
).show()
|
).show()
|
||||||
} else {
|
} else {
|
||||||
if (model.incubationTime != "") {
|
if (model.incubationTime != "") {
|
||||||
if (isBetween15And30Minutes(model.incubationTime) < 15) {
|
if (isBetween15And30Minutes(model.incubationTime) < 0) {
|
||||||
Toast.makeText(
|
Toast.makeText(
|
||||||
view.context,
|
view.context,
|
||||||
context?.getString(R.string.incubation_not_completed),
|
context?.getString(R.string.incubation_not_completed),
|
||||||
Toast.LENGTH_SHORT
|
Toast.LENGTH_SHORT
|
||||||
).show()
|
).show()
|
||||||
} else if (isBetween15And30Minutes(model.incubationTime) > 30) {
|
} else if (isBetween15And30Minutes(model.incubationTime) > 140000) {
|
||||||
Toast.makeText(
|
Toast.makeText(
|
||||||
view.context,
|
view.context,
|
||||||
context?.getString(R.string.incubation_crossed_30_minutes),
|
context?.getString(R.string.incubation_crossed_30_minutes),
|
||||||
|
|||||||
@@ -57,6 +57,7 @@ class HemoCubeFragment : Fragment() {
|
|||||||
private var validationError = false
|
private var validationError = false
|
||||||
private var deviceHardwareId = ""
|
private var deviceHardwareId = ""
|
||||||
private var allErrorMessages = ""
|
private var allErrorMessages = ""
|
||||||
|
private var testStatusCode = 0.0
|
||||||
|
|
||||||
override fun onCreateView(
|
override fun onCreateView(
|
||||||
inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?,
|
inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?,
|
||||||
@@ -121,6 +122,11 @@ class HemoCubeFragment : Fragment() {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (sharedPreferences.getString(Constants.USER_ID, "").toString() == "ADMIN") {
|
||||||
|
activity?.runOnUiThread {
|
||||||
|
binding.tvDeviceMessages.visibility = View.VISIBLE
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun observeViewModel() {
|
private fun observeViewModel() {
|
||||||
@@ -130,13 +136,11 @@ class HemoCubeFragment : Fragment() {
|
|||||||
|
|
||||||
activity?.runOnUiThread {
|
activity?.runOnUiThread {
|
||||||
binding.btnSubmit.visibility = View.GONE
|
binding.btnSubmit.visibility = View.GONE
|
||||||
binding.btnDigitalCard.visibility = View.VISIBLE
|
|
||||||
binding.btnDigitalCard.setOnClickListener {
|
|
||||||
val i = Intent(
|
val i = Intent(
|
||||||
requireContext().applicationContext, DigitalCardActivity::class.java
|
requireContext().applicationContext, DashboardActivity::class.java
|
||||||
)
|
)
|
||||||
startActivity(i)
|
startActivity(i)
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (result == "Local") {
|
if (result == "Local") {
|
||||||
@@ -173,6 +177,10 @@ class HemoCubeFragment : Fragment() {
|
|||||||
hemoCubeViewModel.messages.observe(viewLifecycleOwner) {
|
hemoCubeViewModel.messages.observe(viewLifecycleOwner) {
|
||||||
binding.tvSubtitle4.text = it
|
binding.tvSubtitle4.text = it
|
||||||
}
|
}
|
||||||
|
|
||||||
|
hemoCubeViewModel.deviceMessages.observe(viewLifecycleOwner) {
|
||||||
|
binding.tvDeviceMessages.text = it
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun checkAndStartProcess() {
|
private fun checkAndStartProcess() {
|
||||||
@@ -253,7 +261,7 @@ class HemoCubeFragment : Fragment() {
|
|||||||
data?.let {
|
data?.let {
|
||||||
val stringData = String(it)
|
val stringData = String(it)
|
||||||
fullReadOutput.append(stringData)
|
fullReadOutput.append(stringData)
|
||||||
handleUsbData(stringData, fullReadOutput)
|
handleUsbData(stringData, testStatusCode)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -286,23 +294,29 @@ class HemoCubeFragment : Fragment() {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun handleUsbData(stringData: String, fullReadOutput: StringBuilder) {
|
private fun handleUsbData(stringData: String, testStatusCode: Double) {
|
||||||
if (stringData.contains("#")) {
|
if (stringData.contains("#")) {
|
||||||
isTestOngoing = true
|
isTestOngoing = true
|
||||||
}
|
}
|
||||||
|
|
||||||
resultData += stringData
|
resultData += stringData
|
||||||
|
hemoCubeViewModel.deviceMessages.postValue(resultData)
|
||||||
|
|
||||||
when {
|
when {
|
||||||
stringData.contains("SN") -> {
|
resultData.contains("SNE") && this.testStatusCode < Constants.TEST_STATUS_CODE_CONFIG_COMPLETED -> {
|
||||||
val slData = stringData.split(" ")
|
val pattern = Regex("HCV-\\d{3}-\\d{4}")
|
||||||
if (slData.size > 1) {
|
val matchResult = pattern.find(resultData)
|
||||||
val hardwareId = slData[1].trim()
|
val hardwareId = matchResult?.value
|
||||||
deviceHardwareId = hardwareId
|
|
||||||
|
if (hardwareId.toString().length == 12) {
|
||||||
|
deviceHardwareId += hardwareId
|
||||||
with(sharedPreferences.edit()) {
|
with(sharedPreferences.edit()) {
|
||||||
putString(Constants.DEVICE_ID, hardwareId)
|
putString(Constants.DEVICE_ID, deviceHardwareId)
|
||||||
apply()
|
apply()
|
||||||
}
|
}
|
||||||
|
this.testStatusCode = Constants.TEST_STATUS_CODE_CONFIG_COMPLETED
|
||||||
|
} else {
|
||||||
|
hemoCubeViewModel.messages.postValue("config error")
|
||||||
}
|
}
|
||||||
activity?.runOnUiThread {
|
activity?.runOnUiThread {
|
||||||
binding.btnPlacebuffer.visibility = View.VISIBLE
|
binding.btnPlacebuffer.visibility = View.VISIBLE
|
||||||
@@ -310,32 +324,37 @@ class HemoCubeFragment : Fragment() {
|
|||||||
hemoCubeViewModel.messages.postValue(getString(R.string.start))
|
hemoCubeViewModel.messages.postValue(getString(R.string.start))
|
||||||
}
|
}
|
||||||
|
|
||||||
stringData.contains("#BS") -> {
|
resultData.contains("#BS") && this.testStatusCode < Constants.TEST_STATUS_CODE_BUFFER_STARTED -> {
|
||||||
hemoCubeViewModel.messages.postValue(getString(R.string.buffer_started))
|
hemoCubeViewModel.messages.postValue(getString(R.string.buffer_started))
|
||||||
|
this.testStatusCode = Constants.TEST_STATUS_CODE_BUFFER_STARTED
|
||||||
}
|
}
|
||||||
|
|
||||||
stringData.contains("#BC") -> {
|
resultData.contains("#BC") && this.testStatusCode < Constants.TEST_STATUS_CODE_BUFFER_COMPLETED -> {
|
||||||
|
this.testStatusCode = Constants.TEST_STATUS_CODE_BUFFER_COMPLETED
|
||||||
activity?.runOnUiThread {
|
activity?.runOnUiThread {
|
||||||
binding.tvSubtitle4.text = getString(R.string.buffer_completed)
|
binding.tvSubtitle4.text = getString(R.string.buffer_completed)
|
||||||
binding.btnSamplestart.visibility = View.VISIBLE
|
binding.btnSamplestart.visibility = View.VISIBLE
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
stringData.contains("#SS") -> {
|
resultData.contains("#SS") && this.testStatusCode < Constants.TEST_STATUS_CODE_SAMPLE_STARTED -> {
|
||||||
|
this.testStatusCode = Constants.TEST_STATUS_CODE_SAMPLE_STARTED
|
||||||
activity?.runOnUiThread {
|
activity?.runOnUiThread {
|
||||||
binding.tvSubtitle4.text = getString(R.string.sample_started)
|
binding.tvSubtitle4.text = getString(R.string.sample_started)
|
||||||
binding.btnSamplestart.visibility = View.GONE
|
binding.btnSamplestart.visibility = View.GONE
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
stringData.contains("#SC") -> {
|
resultData.contains("#SC") && this.testStatusCode < Constants.TEST_STATUS_CODE_SAMPLE_COMPLETED -> {
|
||||||
|
this.testStatusCode = Constants.TEST_STATUS_CODE_SAMPLE_COMPLETED
|
||||||
hemoCubeViewModel.messages.postValue(
|
hemoCubeViewModel.messages.postValue(
|
||||||
getString(R.string.sample_completed) + "\n" + getString(R.string.gathering_data))
|
getString(R.string.sample_completed) + "\n" + getString(R.string.gathering_data))
|
||||||
fetchResult()
|
fetchResult()
|
||||||
testingTrace.stop()
|
testingTrace.stop()
|
||||||
}
|
}
|
||||||
|
|
||||||
resultData.contains("REND") -> {
|
resultData.contains("REND") && this.testStatusCode < Constants.TEST_STATUS_CODE_SAMPLE_PRINT_COMPLETED -> {
|
||||||
|
this.testStatusCode = Constants.TEST_STATUS_CODE_SAMPLE_PRINT_COMPLETED
|
||||||
hemoCubeViewModel.messages.postValue(
|
hemoCubeViewModel.messages.postValue(
|
||||||
getString(R.string.data_collected_processing_data)
|
getString(R.string.data_collected_processing_data)
|
||||||
)
|
)
|
||||||
@@ -440,7 +459,7 @@ class HemoCubeFragment : Fragment() {
|
|||||||
allErrorMessages += "Error: Invalid Test. Improper buffer reading (low)"
|
allErrorMessages += "Error: Invalid Test. Improper buffer reading (low)"
|
||||||
activity?.runOnUiThread {
|
activity?.runOnUiThread {
|
||||||
binding.errorMessage.text = getString(R.string.error_improper_buffer_low)
|
binding.errorMessage.text = getString(R.string.error_improper_buffer_low)
|
||||||
binding.errorMessage.visibility = View.VISIBLE
|
// binding.errorMessage.visibility = View.VISIBLE
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -461,7 +480,7 @@ class HemoCubeFragment : Fragment() {
|
|||||||
activity?.runOnUiThread {
|
activity?.runOnUiThread {
|
||||||
binding.errorMessage.text =
|
binding.errorMessage.text =
|
||||||
getString(R.string.error_improper_buffer_high)
|
getString(R.string.error_improper_buffer_high)
|
||||||
binding.errorMessage.visibility = View.VISIBLE
|
// binding.errorMessage.visibility = View.VISIBLE
|
||||||
binding.btnSubmit.isEnabled = true
|
binding.btnSubmit.isEnabled = true
|
||||||
binding.btnSubmit.isClickable = true
|
binding.btnSubmit.isClickable = true
|
||||||
}
|
}
|
||||||
@@ -479,10 +498,26 @@ class HemoCubeFragment : Fragment() {
|
|||||||
constant = Constants.DEVICE_CONFIGURATION[deviceHardwareId]?.get(2)?.get(1)
|
constant = Constants.DEVICE_CONFIGURATION[deviceHardwareId]?.get(2)?.get(1)
|
||||||
fittedAbs3 = gradient?.times(led3Average)?.plus(constant!!)!!
|
fittedAbs3 = gradient?.times(led3Average)?.plus(constant!!)!!
|
||||||
|
|
||||||
gradient = Constants.DEVICE_CONFIGURATION[deviceHardwareId]?.get(3)?.get(0)
|
gradient = Constants.DEVICE_CONFIGURATION[deviceHardwareId]?.get(0)?.get(0)
|
||||||
constant = Constants.DEVICE_CONFIGURATION[deviceHardwareId]?.get(3)?.get(1)
|
constant = Constants.DEVICE_CONFIGURATION[deviceHardwareId]?.get(0)?.get(1)
|
||||||
fittedAbs4 = gradient?.times(led4Average)?.plus(constant!!)!!
|
fittedAbs4 = gradient?.times(led4Average)?.plus(constant!!)!!
|
||||||
|
|
||||||
|
val slope1 = Constants.DEVICE_HB_PARAMETERS[deviceHardwareId]?.get(1)?.get(0)
|
||||||
|
val intercept1 = Constants.DEVICE_HB_PARAMETERS[deviceHardwareId]?.get(1)?.get(1)
|
||||||
|
val _hb1 = (led3Average - intercept1!!) / slope1!!
|
||||||
|
|
||||||
|
val slope2 = Constants.DEVICE_HB_PARAMETERS[deviceHardwareId]?.get(3)?.get(0)
|
||||||
|
val intercept = Constants.DEVICE_HB_PARAMETERS[deviceHardwareId]?.get(3)?.get(1)
|
||||||
|
val _hb2 = (led4Average - intercept!!) / slope2!!
|
||||||
|
|
||||||
|
val slope3 = Constants.DEVICE_HB_PARAMETERS[deviceHardwareId]?.get(2)?.get(0)
|
||||||
|
val intercept3 = Constants.DEVICE_HB_PARAMETERS[deviceHardwareId]?.get(2)?.get(1)
|
||||||
|
val _hb3 = (led3Average - intercept3!!) / slope3!!
|
||||||
|
|
||||||
|
val slope4 = Constants.DEVICE_HB_PARAMETERS[deviceHardwareId]?.get(3)?.get(0)
|
||||||
|
val intercept4 = Constants.DEVICE_HB_PARAMETERS[deviceHardwareId]?.get(3)?.get(1)
|
||||||
|
val _hb4 = (led4Average - intercept4!!) / slope4!!
|
||||||
|
|
||||||
_predictedDenovixRatio = fittedAbs3.div(fittedAbs1)
|
_predictedDenovixRatio = fittedAbs3.div(fittedAbs1)
|
||||||
|
|
||||||
if (fittedAbs1 <= fittedAbs2) {
|
if (fittedAbs1 <= fittedAbs2) {
|
||||||
@@ -490,7 +525,7 @@ class HemoCubeFragment : Fragment() {
|
|||||||
allErrorMessages += "Error: Invalid Test. Problem with de-oxygenation" + "\n"
|
allErrorMessages += "Error: Invalid Test. Problem with de-oxygenation" + "\n"
|
||||||
activity?.runOnUiThread {
|
activity?.runOnUiThread {
|
||||||
binding.errorMessage.text = getString(R.string.error_invalid_test)
|
binding.errorMessage.text = getString(R.string.error_invalid_test)
|
||||||
binding.errorMessage.visibility = View.VISIBLE
|
// binding.errorMessage.visibility = View.VISIBLE
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -498,7 +533,7 @@ class HemoCubeFragment : Fragment() {
|
|||||||
validationError = true
|
validationError = true
|
||||||
activity?.runOnUiThread {
|
activity?.runOnUiThread {
|
||||||
binding.errorMessage.text = getString(R.string.error_negative_abs)
|
binding.errorMessage.text = getString(R.string.error_negative_abs)
|
||||||
binding.errorMessage.visibility = View.VISIBLE
|
// binding.errorMessage.visibility = View.VISIBLE
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -507,7 +542,7 @@ class HemoCubeFragment : Fragment() {
|
|||||||
allErrorMessages += "Error: Low Hb. Repeat test" + "\n"
|
allErrorMessages += "Error: Low Hb. Repeat test" + "\n"
|
||||||
activity?.runOnUiThread {
|
activity?.runOnUiThread {
|
||||||
binding.errorMessage.text = "Error: Low Hb. Repeat test"
|
binding.errorMessage.text = "Error: Low Hb. Repeat test"
|
||||||
binding.errorMessage.visibility = View.VISIBLE
|
// binding.errorMessage.visibility = View.VISIBLE
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -530,6 +565,8 @@ class HemoCubeFragment : Fragment() {
|
|||||||
this.abs2 = fittedAbs2
|
this.abs2 = fittedAbs2
|
||||||
this.abs3 = fittedAbs3
|
this.abs3 = fittedAbs3
|
||||||
this.abs4 = fittedAbs4
|
this.abs4 = fittedAbs4
|
||||||
|
this.hb3 = _hb3
|
||||||
|
this.hb4 = _hb4
|
||||||
this.deviceRatio = deviceRatio
|
this.deviceRatio = deviceRatio
|
||||||
this.calculatedRatio = calculateRatio(deviceRatio)
|
this.calculatedRatio = calculateRatio(deviceRatio)
|
||||||
this.predictedDenovixRatio = _predictedDenovixRatio
|
this.predictedDenovixRatio = _predictedDenovixRatio
|
||||||
@@ -537,7 +574,7 @@ class HemoCubeFragment : Fragment() {
|
|||||||
.toString() + ", " + currentDeviceData?.coefficients?.get(1).toString()
|
.toString() + ", " + currentDeviceData?.coefficients?.get(1).toString()
|
||||||
this.classificationResult = findResult(calculatedRatio)
|
this.classificationResult = findResult(calculatedRatio)
|
||||||
this.prdClassification = absorbanceBasedClassification(predictedDenovixRatio)
|
this.prdClassification = absorbanceBasedClassification(predictedDenovixRatio)
|
||||||
hemoCubeViewModel.messages.postValue(this.prdClassification)
|
hemoCubeViewModel.messages.postValue("HB: $_hb4")
|
||||||
this.errorMessages = allErrorMessages
|
this.errorMessages = allErrorMessages
|
||||||
this.resultData = deviceLog
|
this.resultData = deviceLog
|
||||||
this.batteryLevel = hemoCubeViewModel.getBatteryLevel().toString()
|
this.batteryLevel = hemoCubeViewModel.getBatteryLevel().toString()
|
||||||
|
|||||||
@@ -51,6 +51,7 @@ class HemoCubeViewModel @Inject constructor(
|
|||||||
val deviceData = MutableLiveData<DeviceData?>()
|
val deviceData = MutableLiveData<DeviceData?>()
|
||||||
val networkStatusLiveData: LiveData<Boolean>
|
val networkStatusLiveData: LiveData<Boolean>
|
||||||
get() = _networkStatusLiveData
|
get() = _networkStatusLiveData
|
||||||
|
val deviceMessages = MutableLiveData<String?>()
|
||||||
val fireBaseUpload = MutableLiveData<String>()
|
val fireBaseUpload = MutableLiveData<String>()
|
||||||
val fireBaseBulkUpload = MutableLiveData<String>()
|
val fireBaseBulkUpload = MutableLiveData<String>()
|
||||||
|
|
||||||
@@ -125,6 +126,8 @@ class HemoCubeViewModel @Inject constructor(
|
|||||||
testDetails?.abs2 = DataHolder.hemoCubeTestData?.abs2
|
testDetails?.abs2 = DataHolder.hemoCubeTestData?.abs2
|
||||||
testDetails?.abs3 = DataHolder.hemoCubeTestData?.abs3
|
testDetails?.abs3 = DataHolder.hemoCubeTestData?.abs3
|
||||||
testDetails?.abs4 = DataHolder.hemoCubeTestData?.abs4
|
testDetails?.abs4 = DataHolder.hemoCubeTestData?.abs4
|
||||||
|
testDetails?.hb3 = DataHolder.hemoCubeTestData?.hb3
|
||||||
|
testDetails?.hb4 = DataHolder.hemoCubeTestData?.hb4
|
||||||
testDetails?.deviceRatio = DataHolder.hemoCubeTestData?.deviceRatio
|
testDetails?.deviceRatio = DataHolder.hemoCubeTestData?.deviceRatio
|
||||||
testDetails?.predictedDenovixRatio = DataHolder.hemoCubeTestData?.predictedDenovixRatio
|
testDetails?.predictedDenovixRatio = DataHolder.hemoCubeTestData?.predictedDenovixRatio
|
||||||
testDetails?.calculatedRatio = DataHolder.hemoCubeTestData?.calculatedRatio
|
testDetails?.calculatedRatio = DataHolder.hemoCubeTestData?.calculatedRatio
|
||||||
|
|||||||
@@ -62,7 +62,7 @@
|
|||||||
android:id="@+id/tv_subtitle4"
|
android:id="@+id/tv_subtitle4"
|
||||||
style="@style/title1_1"
|
style="@style/title1_1"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="80dp"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginHorizontal="24dp"
|
android:layout_marginHorizontal="24dp"
|
||||||
android:layout_marginTop="72dp"
|
android:layout_marginTop="72dp"
|
||||||
android:gravity="center"
|
android:gravity="center"
|
||||||
@@ -195,16 +195,32 @@
|
|||||||
style="@style/title1_1"
|
style="@style/title1_1"
|
||||||
android:visibility="gone"
|
android:visibility="gone"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="80dp"
|
android:layout_height="40dp"
|
||||||
android:layout_marginHorizontal="24dp"
|
android:layout_marginHorizontal="24dp"
|
||||||
android:layout_marginTop="172dp"
|
android:layout_marginTop="72dp"
|
||||||
android:gravity="center"
|
android:gravity="center"
|
||||||
android:textColor="@color/red"
|
android:textColor="@color/red"
|
||||||
android:textSize="18sp"
|
android:textSize="12sp"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toBottomOf="@id/btn_submit" />
|
app:layout_constraintTop_toBottomOf="@id/btn_submit" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/tv_device_messages"
|
||||||
|
style="@style/title1_1"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="0dp"
|
||||||
|
android:layout_marginHorizontal="24dp"
|
||||||
|
android:layout_marginTop="72dp"
|
||||||
|
android:gravity="center"
|
||||||
|
android:textColor="@color/black"
|
||||||
|
android:textSize="11sp"
|
||||||
|
android:visibility="visible"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toBottomOf="@id/error_message" />
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
android:visibility="gone"
|
android:visibility="gone"
|
||||||
android:id="@+id/btn_digitalCard"
|
android:id="@+id/btn_digitalCard"
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
<!-- <usb-device vendor-id="1027" product-id="24592" /> <!– 0x6010: FT2232H –>-->
|
<!-- <usb-device vendor-id="1027" product-id="24592" /> <!– 0x6010: FT2232H –>-->
|
||||||
<!-- <usb-device vendor-id="1027" product-id="24593" /> <!– 0x6011: FT4232H –>-->
|
<!-- <usb-device vendor-id="1027" product-id="24593" /> <!– 0x6011: FT4232H –>-->
|
||||||
<!-- <usb-device vendor-id="1027" product-id="24596" /> <!– 0x6014: FT232H –>-->
|
<!-- <usb-device vendor-id="1027" product-id="24596" /> <!– 0x6014: FT232H –>-->
|
||||||
<usb-device vendor-id="1027" product-id="24597" /> <!-- 0x6015: FT230X, FT231X, FT234XD -->
|
<usb-device vendor-id="1027" product-id="24577" /> <!-- 0x6015: FT230X, FT231X, FT234XD -->
|
||||||
<usb-device vendor-id="6790" product-id="29987" /> <!-- 0x6015: FT230X, FT231X, FT234XD -->
|
<usb-device vendor-id="6790" product-id="29987" /> <!-- 0x6015: FT230X, FT231X, FT234XD -->
|
||||||
|
|
||||||
<!-- 0x10C4 / 0xEA??: Silabs CP210x -->
|
<!-- 0x10C4 / 0xEA??: Silabs CP210x -->
|
||||||
|
|||||||
Reference in New Issue
Block a user