Compare commits
10 Commits
preprod
...
Test_work_
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1d34ce2a52 | ||
|
|
ec3d0b8628 | ||
|
|
7464bfef6d | ||
|
|
85986c87b1 | ||
|
|
dadddfd558 | ||
|
|
0903647500 | ||
|
|
326c66fea7 | ||
|
|
045eaee578 | ||
|
|
302960922e | ||
|
|
ea4fb6e4d2 |
3
.idea/gradle.xml
generated
3
.idea/gradle.xml
generated
@@ -4,6 +4,8 @@
|
|||||||
<component name="GradleSettings">
|
<component name="GradleSettings">
|
||||||
<option name="linkedExternalProjectsSettings">
|
<option name="linkedExternalProjectsSettings">
|
||||||
<GradleProjectSettings>
|
<GradleProjectSettings>
|
||||||
|
<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">
|
||||||
@@ -12,7 +14,6 @@
|
|||||||
<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.quality"
|
applicationId "in.sminnovations.hpostesting"
|
||||||
minSdk 21
|
minSdk 21
|
||||||
targetSdk 34
|
targetSdk 34
|
||||||
versionCode 68
|
versionCode 44
|
||||||
versionName "2.1.68"
|
versionName "2.1.44"
|
||||||
|
|
||||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||||
}
|
}
|
||||||
@@ -133,6 +133,4 @@ dependencies {
|
|||||||
implementation "com.squareup.retrofit2:retrofit:2.9.0"
|
implementation "com.squareup.retrofit2:retrofit:2.9.0"
|
||||||
implementation "com.squareup.retrofit2:converter-gson:2.9.0"
|
implementation "com.squareup.retrofit2:converter-gson:2.9.0"
|
||||||
|
|
||||||
implementation "androidx.preference:preference-ktx:1.2.1"
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -29,8 +29,6 @@ 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
|
||||||
@@ -40,7 +38,6 @@ 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",
|
||||||
@@ -66,24 +63,6 @@ object Constants {
|
|||||||
"HC-V1-020",
|
"HC-V1-020",
|
||||||
"HCV-000-3001",
|
"HCV-000-3001",
|
||||||
"HCV-000-3002",
|
"HCV-000-3002",
|
||||||
"HCV-000-3003",
|
|
||||||
"HCV-000-3004",
|
|
||||||
"HCV-000-3005",
|
|
||||||
"HCV-000-3006",
|
|
||||||
"HCV-000-3007",
|
|
||||||
"HCV-000-3008",
|
|
||||||
"HCV-000-3009",
|
|
||||||
"HCV-000-3010",
|
|
||||||
"HCV-000-3011",
|
|
||||||
"HCV-000-3012",
|
|
||||||
"HCV-000-3013",
|
|
||||||
"HCV-000-3014",
|
|
||||||
"HCV-000-3015",
|
|
||||||
"HCV-000-3016",
|
|
||||||
"HCV-000-3017",
|
|
||||||
"HCV-000-3018",
|
|
||||||
"HCV-000-3019",
|
|
||||||
"HCV-000-3020"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
const val password = "SMI@12345"
|
const val password = "SMI@12345"
|
||||||
@@ -99,35 +78,6 @@ 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_FIRST_GAIN_STARTED = 12.0
|
|
||||||
const val TEST_STATUS_CODE_FIRST_GAIN_COMPLETED = 13.0
|
|
||||||
const val TEST_STATUS_CODE_FIRST_GAIN_PRINT_STARTED = 14.0
|
|
||||||
const val TEST_STATUS_CODE_FIRST_GAIN_PRINT_COMPLETED = 15.0
|
|
||||||
const val TEST_STATUS_CODE_SECOND_GAIN_STARTED = 16.0
|
|
||||||
const val TEST_STATUS_CODE_SECOND_GAIN_COMPLETED = 17.0
|
|
||||||
const val TEST_STATUS_CODE_SECOND_GAIN_PRINT_STARTED = 18.0
|
|
||||||
const val TEST_STATUS_CODE_SECOND_GAIN_PRINT_COMPLETED = 19.0
|
|
||||||
const val TEST_STATUS_CODE_THIRD_GAIN_STARTED = 20.0
|
|
||||||
const val TEST_STATUS_CODE_THIRD_GAIN_COMPLETED = 21.0
|
|
||||||
const val TEST_STATUS_CODE_THIRD_GAIN_PRINT_STARTED = 22.0
|
|
||||||
const val TEST_STATUS_CODE_THIRD_GAIN_PRINT_COMPLETED = 23.0
|
|
||||||
const val TEST_STATUS_CODE_FORTH_GAIN_STARTED = 24.0
|
|
||||||
const val TEST_STATUS_CODE_FORTH_GAIN_COMPLETED = 25.0
|
|
||||||
const val TEST_STATUS_CODE_FORTH_GAIN_PRINT_STARTED = 26.0
|
|
||||||
const val TEST_STATUS_CODE_FORTH_GAIN_PRINT_COMPLETED = 27.0
|
|
||||||
const val TEST_STATUS_CODE_TEST_COMPLETED = 30.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
|
||||||
@@ -141,119 +91,10 @@ object Constants {
|
|||||||
listOf(0.1964, 0.011565), // LED3, 555nm
|
listOf(0.1964, 0.011565), // LED3, 555nm
|
||||||
listOf(1.0, 0.0) // LED4
|
listOf(1.0, 0.0) // LED4
|
||||||
),
|
),
|
||||||
"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
|
|
||||||
),
|
|
||||||
"HCV-000-3004" to listOf(
|
|
||||||
listOf(1.7272, -1.1977), // LED1, 435nm
|
|
||||||
listOf(0.581462456, -0.58502), // LED2, 415nm
|
|
||||||
listOf(0.2304, -0.0145), // LED3, 555nm
|
|
||||||
listOf(1.0, 0.0) // LED4
|
|
||||||
),
|
|
||||||
"HCV-000-3005" to listOf(
|
|
||||||
listOf(1.3801, -0.372), // LED1, 435nm
|
|
||||||
listOf(0.581462456, -0.58502), // LED2, 415nm
|
|
||||||
listOf(0.4565, -0.0371), // LED3, 555nm
|
|
||||||
listOf(1.0, 0.0) // LED4
|
|
||||||
),
|
|
||||||
"HCV-000-3006" to listOf(
|
|
||||||
listOf(1.3801, -0.372), // LED1, 435nm
|
|
||||||
listOf(0.581462456, -0.58502), // LED2, 415nm
|
|
||||||
listOf(0.4565, -0.0371), // LED3, 555nm
|
|
||||||
listOf(1.0, 0.0) // LED4
|
|
||||||
),
|
|
||||||
"HCV-000-3007" to listOf(
|
|
||||||
listOf(1.8445, -0.8213), // LED1, 435nm
|
|
||||||
listOf(0.581462456, -0.58502), // LED2, 415nm
|
|
||||||
listOf(0.4613, -0.0831), // LED3, 555nm
|
|
||||||
listOf(1.0, 0.0) // LED4
|
|
||||||
),
|
|
||||||
"HCV-000-3008" to listOf(
|
|
||||||
listOf(1.7272, -1.1977), // LED1, 435nm
|
|
||||||
listOf(0.581462456, -0.58502), // LED2, 415nm
|
|
||||||
listOf(0.2304, -0.0145), // LED3, 555nm
|
|
||||||
listOf(1.0, 0.0) // LED4
|
|
||||||
),
|
|
||||||
"HCV-000-3009" to listOf(
|
|
||||||
listOf(1.7272, -1.1977), // LED1, 435nm
|
|
||||||
listOf(0.581462456, -0.58502), // LED2, 415nm
|
|
||||||
listOf(0.2304, -0.0145), // LED3, 555nm
|
|
||||||
listOf(1.0, 0.0) // LED4
|
|
||||||
),
|
|
||||||
"HCV-000-3010" to listOf(
|
|
||||||
listOf(1.7272, -1.1977), // LED1, 435nm
|
|
||||||
listOf(0.581462456, -0.58502), // LED2, 415nm
|
|
||||||
listOf(0.2304, -0.0145), // LED3, 555nm
|
|
||||||
listOf(1.0, 0.0) // LED4
|
|
||||||
),
|
|
||||||
"HCV-000-3011" to listOf(
|
|
||||||
listOf(1.7272, -1.1977), // LED1, 435nm
|
|
||||||
listOf(0.581462456, -0.58502), // LED2, 415nm
|
|
||||||
listOf(0.2304, -0.0145), // LED3, 555nm
|
|
||||||
listOf(1.0, 0.0) // LED4
|
|
||||||
),
|
|
||||||
"HCV-000-3012" to listOf(
|
|
||||||
listOf(1.7272, -1.1977), // LED1, 435nm
|
|
||||||
listOf(0.581462456, -0.58502), // LED2, 415nm
|
|
||||||
listOf(0.2304, -0.0145), // LED3, 555nm
|
|
||||||
listOf(1.0, 0.0) // LED4
|
|
||||||
),
|
|
||||||
"HCV-000-3013" to listOf(
|
|
||||||
listOf(1.7272, -1.1977), // LED1, 435nm
|
|
||||||
listOf(0.581462456, -0.58502), // LED2, 415nm
|
|
||||||
listOf(0.2304, -0.0145), // LED3, 555nm
|
|
||||||
listOf(1.0, 0.0) // LED4
|
|
||||||
),
|
|
||||||
"HCV-000-3014" to listOf(
|
|
||||||
listOf(1.7272, -1.1977), // LED1, 435nm
|
|
||||||
listOf(0.581462456, -0.58502), // LED2, 415nm
|
|
||||||
listOf(0.2304, -0.0145), // LED3, 555nm
|
|
||||||
listOf(1.0, 0.0) // LED4
|
|
||||||
),
|
|
||||||
"HCV-000-3015" to listOf(
|
|
||||||
listOf(1.7272, -1.1977), // LED1, 435nm
|
|
||||||
listOf(0.581462456, -0.58502), // LED2, 415nm
|
|
||||||
listOf(0.2304, -0.0145), // LED3, 555nm
|
|
||||||
listOf(1.0, 0.0) // LED4
|
|
||||||
),
|
|
||||||
"HCV-000-3016" to listOf(
|
|
||||||
listOf(1.7272, -1.1977), // LED1, 435nm
|
|
||||||
listOf(0.581462456, -0.58502), // LED2, 415nm
|
|
||||||
listOf(0.2304, -0.0145), // LED3, 555nm
|
|
||||||
listOf(1.0, 0.0) // LED4
|
|
||||||
),
|
|
||||||
"HCV-000-3017" to listOf(
|
|
||||||
listOf(1.7272, -1.1977), // LED1, 435nm
|
|
||||||
listOf(0.581462456, -0.58502), // LED2, 415nm
|
|
||||||
listOf(0.2304, -0.0145), // LED3, 555nm
|
|
||||||
listOf(1.0, 0.0) // LED4
|
|
||||||
),
|
|
||||||
"HCV-000-3018" to listOf(
|
|
||||||
listOf(1.7272, -1.1977), // LED1, 435nm
|
|
||||||
listOf(0.581462456, -0.58502), // LED2, 415nm
|
|
||||||
listOf(0.2304, -0.0145), // LED3, 555nm
|
|
||||||
listOf(1.0, 0.0) // LED4
|
|
||||||
),
|
|
||||||
"HCV-000-3019" to listOf(
|
|
||||||
listOf(1.7272, -1.1977), // LED1, 435nm
|
|
||||||
listOf(0.581462456, -0.58502), // LED2, 415nm
|
|
||||||
listOf(0.2304, -0.0145), // LED3, 555nm
|
|
||||||
listOf(1.0, 0.0) // LED4
|
|
||||||
),
|
|
||||||
"HCV-000-3020" to listOf(
|
|
||||||
listOf(1.7272, -1.1977), // LED1, 435nm
|
|
||||||
listOf(0.581462456, -0.58502), // LED2, 415nm
|
|
||||||
listOf(0.2304, -0.0145), // LED3, 555nm
|
|
||||||
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
|
|
||||||
|
|
||||||
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(
|
||||||
@@ -267,114 +108,15 @@ 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),
|
|
||||||
),
|
|
||||||
"HCV-000-3005" to listOf(
|
|
||||||
listOf(24500, 26250),
|
|
||||||
listOf(24500, 26250),
|
|
||||||
listOf(24500, 26250),
|
|
||||||
listOf(24500, 26250),
|
|
||||||
),
|
|
||||||
"HCV-000-3006" to listOf(
|
|
||||||
listOf(24500, 26250),
|
|
||||||
listOf(24500, 26250),
|
|
||||||
listOf(24500, 26250),
|
|
||||||
listOf(24500, 26250),
|
|
||||||
),
|
|
||||||
"HCV-000-3007" to listOf(
|
|
||||||
listOf(24500, 26250),
|
|
||||||
listOf(24500, 26250),
|
|
||||||
listOf(24500, 26250),
|
|
||||||
listOf(24500, 26250),
|
|
||||||
),
|
|
||||||
"HCV-000-3008" to listOf(
|
|
||||||
listOf(24500, 26250),
|
|
||||||
listOf(24500, 26250),
|
|
||||||
listOf(24500, 26250),
|
|
||||||
listOf(24500, 26250),
|
|
||||||
),
|
|
||||||
"HCV-000-3009" to listOf(
|
|
||||||
listOf(24500, 26250),
|
|
||||||
listOf(24500, 26250),
|
|
||||||
listOf(24500, 26250),
|
|
||||||
listOf(24500, 26250),
|
|
||||||
),
|
|
||||||
"HCV-000-3010" to listOf(
|
|
||||||
listOf(24500, 26250),
|
|
||||||
listOf(24500, 26250),
|
|
||||||
listOf(24500, 26250),
|
|
||||||
listOf(24500, 26250),
|
|
||||||
),
|
|
||||||
"HCV-000-3011" to listOf(
|
|
||||||
listOf(24500, 26250),
|
|
||||||
listOf(24500, 26250),
|
|
||||||
listOf(24500, 26250),
|
|
||||||
listOf(24500, 26250),
|
|
||||||
),
|
|
||||||
"HCV-000-3012" to listOf(
|
|
||||||
listOf(24500, 26250),
|
|
||||||
listOf(24500, 26250),
|
|
||||||
listOf(24500, 26250),
|
|
||||||
listOf(24500, 26250),
|
|
||||||
),
|
|
||||||
"HCV-000-3013" to listOf(
|
|
||||||
listOf(24500, 26250),
|
|
||||||
listOf(24500, 26250),
|
|
||||||
listOf(24500, 26250),
|
|
||||||
listOf(24500, 26250),
|
|
||||||
),
|
|
||||||
"HCV-000-3014" to listOf(
|
|
||||||
listOf(24500, 26250),
|
|
||||||
listOf(24500, 26250),
|
|
||||||
listOf(24500, 26250),
|
|
||||||
listOf(24500, 26250),
|
|
||||||
),
|
|
||||||
"HCV-000-3015" to listOf(
|
|
||||||
listOf(24500, 26250),
|
|
||||||
listOf(24500, 26250),
|
|
||||||
listOf(24500, 26250),
|
|
||||||
listOf(24500, 26250),
|
|
||||||
),
|
|
||||||
"HCV-000-3016" to listOf(
|
|
||||||
listOf(24500, 26250),
|
|
||||||
listOf(24500, 26250),
|
|
||||||
listOf(24500, 26250),
|
|
||||||
listOf(24500, 26250),
|
|
||||||
),
|
|
||||||
"HCV-000-3017" to listOf(
|
|
||||||
listOf(24500, 26250),
|
|
||||||
listOf(24500, 26250),
|
|
||||||
listOf(24500, 26250),
|
|
||||||
listOf(24500, 26250),
|
|
||||||
),
|
|
||||||
"HCV-000-3018" to listOf(
|
|
||||||
listOf(24500, 26250),
|
|
||||||
listOf(24500, 26250),
|
|
||||||
listOf(24500, 26250),
|
|
||||||
listOf(24500, 26250),
|
|
||||||
),
|
|
||||||
"HCV-000-3019" to listOf(
|
|
||||||
listOf(24500, 26250),
|
|
||||||
listOf(24500, 26250),
|
|
||||||
listOf(24500, 26250),
|
|
||||||
listOf(24500, 26250),
|
|
||||||
),
|
|
||||||
"HCV-000-3020" to listOf(
|
|
||||||
listOf(24500, 26250),
|
|
||||||
listOf(24500, 26250),
|
|
||||||
listOf(24500, 26250),
|
|
||||||
listOf(24500, 26250),
|
|
||||||
),
|
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
val COEFFICIENTS: Map<String, List<List<Double>>> = mapOf(
|
||||||
|
"HC-V1-005" to listOf(
|
||||||
|
listOf(1.5,0.0),
|
||||||
|
listOf(0.0,0.0)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -4,10 +4,6 @@ enum class HemoCubeCommands(val command: String) {
|
|||||||
startBuffer("B\r"),
|
startBuffer("B\r"),
|
||||||
runDiagnostics("D\r"),
|
runDiagnostics("D\r"),
|
||||||
startSample("S\r"),
|
startSample("S\r"),
|
||||||
PRINT_COMMAND("P\r"),
|
getSample("P\r"),
|
||||||
getDeviceId("I\r"),
|
getDeviceId("I\r"),
|
||||||
FIRST_GAIN_COMMAND("T\r"),
|
|
||||||
SECOND_GAIN_COMMAND("U\r"),
|
|
||||||
THIRD_GAIN_COMMAND("V\r"),
|
|
||||||
FORTH_GAIN_COMMAND("W\r"),
|
|
||||||
}
|
}
|
||||||
@@ -1,30 +0,0 @@
|
|||||||
package com.example.hpostesting.data.constant
|
|
||||||
|
|
||||||
import android.content.Context
|
|
||||||
import android.content.SharedPreferences
|
|
||||||
import java.util.Locale
|
|
||||||
|
|
||||||
object LanguageManager {
|
|
||||||
private const val LANGUAGE_PREF_KEY = "language_pref"
|
|
||||||
|
|
||||||
fun setLocale(context: Context, languageCode: String) {
|
|
||||||
val locale = Locale(languageCode)
|
|
||||||
Locale.setDefault(locale)
|
|
||||||
|
|
||||||
val resources = context.resources
|
|
||||||
val configuration = resources.configuration
|
|
||||||
configuration.setLocale(locale)
|
|
||||||
|
|
||||||
context.createConfigurationContext(configuration)
|
|
||||||
}
|
|
||||||
|
|
||||||
fun persistLanguagePreference(context: Context, languageCode: String) {
|
|
||||||
val prefs: SharedPreferences = context.getSharedPreferences("AppPrefs", Context.MODE_PRIVATE)
|
|
||||||
prefs.edit().putString(LANGUAGE_PREF_KEY, languageCode).apply()
|
|
||||||
}
|
|
||||||
|
|
||||||
fun getSavedLanguage(context: Context): String {
|
|
||||||
val prefs: SharedPreferences = context.getSharedPreferences("AppPrefs", Context.MODE_PRIVATE)
|
|
||||||
return prefs.getString(LANGUAGE_PREF_KEY, "en") ?: "en"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,26 +0,0 @@
|
|||||||
package com.example.hpostesting.data.dao
|
|
||||||
|
|
||||||
import androidx.lifecycle.LiveData
|
|
||||||
import androidx.room.Dao
|
|
||||||
import androidx.room.Insert
|
|
||||||
import androidx.room.OnConflictStrategy
|
|
||||||
import androidx.room.Query
|
|
||||||
import com.example.hpostesting.data.model.patient.BufferCheckData
|
|
||||||
|
|
||||||
@Dao
|
|
||||||
interface HemoCubeBufferDao {
|
|
||||||
@Query("SELECT * from hemo_cube_buffer_test_table")
|
|
||||||
fun getAll(): LiveData<List<BufferCheckData>>
|
|
||||||
|
|
||||||
@Insert(onConflict = OnConflictStrategy.REPLACE)
|
|
||||||
suspend fun insertAll(bufferCheckData: BufferCheckData)
|
|
||||||
|
|
||||||
@Query("SELECT * FROM hemo_cube_buffer_test_table WHERE _id = :id")
|
|
||||||
suspend fun getUserByID(id: String): BufferCheckData
|
|
||||||
|
|
||||||
@Query("DELETE FROM hemo_cube_buffer_test_table WHERE _id = :id")
|
|
||||||
suspend fun deleteById(id: String)
|
|
||||||
|
|
||||||
@Query("UPDATE hemo_cube_buffer_test_table SET localFlag = :newValue WHERE _id = :id")
|
|
||||||
suspend fun updateFieldById(id: String, newValue: Boolean)
|
|
||||||
}
|
|
||||||
@@ -1,17 +1,19 @@
|
|||||||
package com.example.hpostesting.data.dao
|
package com.example.hpostesting.data.dao
|
||||||
|
|
||||||
|
import android.content.Context
|
||||||
import androidx.room.Database
|
import androidx.room.Database
|
||||||
|
import androidx.room.Room
|
||||||
import androidx.room.RoomDatabase
|
import androidx.room.RoomDatabase
|
||||||
import androidx.room.TypeConverters
|
import androidx.room.TypeConverters
|
||||||
import com.example.hpostesting.data.model.patient.BufferCheckData
|
|
||||||
import com.example.hpostesting.data.model.patient.DeviceData
|
import com.example.hpostesting.data.model.patient.DeviceData
|
||||||
import com.example.hpostesting.data.model.patient.HemoCubeTestData
|
|
||||||
import com.example.hpostesting.data.model.patient.UserData
|
import com.example.hpostesting.data.model.patient.UserData
|
||||||
|
import com.example.hpostesting.data.model.patient.HemoCubeTestData
|
||||||
|
import com.google.android.datatransport.runtime.dagger.Provides
|
||||||
|
import javax.inject.Singleton
|
||||||
|
|
||||||
@Database(entities = [UserData::class, HemoCubeTestData::class, DeviceData::class], version = 17, exportSchema = false)
|
@Database(entities = [UserData::class, HemoCubeTestData::class, DeviceData::class], version = 11, exportSchema = false)
|
||||||
@TypeConverters(Converters::class)
|
@TypeConverters(Converters::class)
|
||||||
abstract class MyDatabase : RoomDatabase() {
|
abstract class MyDatabase : RoomDatabase() {
|
||||||
abstract fun userDao(): UserDao
|
abstract fun userDao(): UserDao
|
||||||
abstract fun hemoCubeDao(): HemoCubeDao
|
abstract fun hemoCubeDao(): HemoCubeDao
|
||||||
abstract fun hemoCubeBufferDao(): HemoCubeBufferDao
|
|
||||||
}
|
}
|
||||||
@@ -1,47 +1,21 @@
|
|||||||
package com.example.hpostesting.data.model.patient
|
package com.example.hpostesting.data.model.patient
|
||||||
|
|
||||||
import androidx.room.Entity
|
|
||||||
import androidx.room.PrimaryKey
|
|
||||||
|
|
||||||
@Entity(tableName = "hemo_cube_buffer_test_table")
|
|
||||||
data class BufferCheckData(
|
data class BufferCheckData(
|
||||||
@PrimaryKey
|
|
||||||
var _id: String = "",
|
|
||||||
var kitno: String = "",
|
var kitno: String = "",
|
||||||
var deviceId: String? = "",
|
var deviceId: String? = "",
|
||||||
var appVersion:String? = "",
|
var appVersion:String? = "",
|
||||||
var deviceSerialNumber: String = "",
|
var deviceSerialNumber: String = "",
|
||||||
var deviceType: String = "HEMOCUBE",
|
var deviceType: String = "HEMOCUBE",
|
||||||
var localFlag: Boolean = false,
|
|
||||||
var resultData: String = "",
|
var resultData: String = "",
|
||||||
var led1Buffer: Double? = null,
|
var led1Buffer: Double? = null,
|
||||||
var led2Buffer: Double? = null,
|
var led2Buffer: Double? = null,
|
||||||
var led3Buffer: Double? = null,
|
|
||||||
var led4Buffer: Double? = null,
|
|
||||||
var led1Sample: Double? = null,
|
var led1Sample: Double? = null,
|
||||||
var led2Sample: Double? = null,
|
var led2Sample: Double? = null,
|
||||||
var led3Sample: Double? = null,
|
|
||||||
var led4Sample: Double? = null,
|
|
||||||
var led1Average: Double? = null,
|
var led1Average: Double? = null,
|
||||||
var led2Average: Double? = null,
|
var led2Average: Double? = null,
|
||||||
var led3Average: Double? = null,
|
|
||||||
var led4Average: Double? = null,
|
|
||||||
var abs1: Double? = null,
|
|
||||||
var abs2: Double? = null,
|
|
||||||
var abs3: Double? = null,
|
|
||||||
var abs4: Double? = null,
|
|
||||||
var deviceRatio: Double? = null,
|
var deviceRatio: Double? = null,
|
||||||
var calculatedRatio: Double? = null,
|
var calculatedRatio: Double? = null,
|
||||||
var predictedDenovixRatio: Double? = null,
|
|
||||||
var coefficients: String? = "",
|
var coefficients: String? = "",
|
||||||
var classificationResult: String = "",
|
var classificationResult: String = "",
|
||||||
var testTime: String = "",
|
var testTime: String = ""
|
||||||
var prdClassification: String = "",
|
|
||||||
var errorMessages: String = "",
|
|
||||||
var batteryLevel: String = "",
|
|
||||||
var batteryCapacity: String = "",
|
|
||||||
var batteryMaxCapacity: String = "",
|
|
||||||
var batteryTemperature: String = "",
|
|
||||||
var batteryVoltage: String = "",
|
|
||||||
var reportUploadTime: String? = "",
|
|
||||||
)
|
)
|
||||||
@@ -43,31 +43,12 @@ 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 led1Gain1: Double? = null,
|
|
||||||
var led2Gain1: Double? = null,
|
|
||||||
var led3Gain1: Double? = null,
|
|
||||||
var led4Gain1: Double? = null,
|
|
||||||
var led1Gain2: Double? = null,
|
|
||||||
var led2Gain2: Double? = null,
|
|
||||||
var led3Gain2: Double? = null,
|
|
||||||
var led4Gain2: Double? = null,
|
|
||||||
var led1Gain3: Double? = null,
|
|
||||||
var led2Gain3: Double? = null,
|
|
||||||
var led3Gain3: Double? = null,
|
|
||||||
var led4Gain3: Double? = null,
|
|
||||||
var led1Gain4: Double? = null,
|
|
||||||
var led2Gain4: Double? = null,
|
|
||||||
var led3Gain4: Double? = null,
|
|
||||||
var led4Gain4: 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,
|
||||||
var slopeRatio: Double? = null,
|
|
||||||
var coefficients: String? = "",
|
var coefficients: String? = "",
|
||||||
var classificationResult: String = "",
|
var classificationResult: String = "",
|
||||||
var prdClassification: String = "",
|
var prdClassification: String = "",
|
||||||
var deviceRatioClass: String = "",
|
|
||||||
var slopeRatioClass: String = "",
|
|
||||||
var errorMessages: String = "",
|
var errorMessages: String = "",
|
||||||
var batteryLevel: String = "",
|
var batteryLevel: String = "",
|
||||||
var batteryCapacity: String = "",
|
var batteryCapacity: String = "",
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ package com.example.hpostesting.domain.di
|
|||||||
import android.app.Application
|
import android.app.Application
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import androidx.room.Room
|
import androidx.room.Room
|
||||||
import com.example.hpostesting.data.dao.HemoCubeBufferDao
|
|
||||||
import com.example.hpostesting.data.dao.HemoCubeDao
|
import com.example.hpostesting.data.dao.HemoCubeDao
|
||||||
import com.example.hpostesting.data.dao.MyDatabase
|
import com.example.hpostesting.data.dao.MyDatabase
|
||||||
import com.example.hpostesting.data.dao.UserDao
|
import com.example.hpostesting.data.dao.UserDao
|
||||||
@@ -45,12 +44,6 @@ object AppModule {
|
|||||||
fun provideMyHemo(myDatabase: MyDatabase): HemoCubeDao {
|
fun provideMyHemo(myDatabase: MyDatabase): HemoCubeDao {
|
||||||
return myDatabase.hemoCubeDao()
|
return myDatabase.hemoCubeDao()
|
||||||
}
|
}
|
||||||
@Provides
|
|
||||||
@Singleton
|
|
||||||
fun provideMyHemoCubeBuffer(myDatabase: MyDatabase): HemoCubeBufferDao {
|
|
||||||
return myDatabase.hemoCubeBufferDao()
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Provides
|
@Provides
|
||||||
@Singleton
|
@Singleton
|
||||||
|
|||||||
@@ -11,7 +11,6 @@ import android.widget.Toast
|
|||||||
import androidx.appcompat.app.AppCompatActivity
|
import androidx.appcompat.app.AppCompatActivity
|
||||||
import com.example.hpostesting.data.DataHolder
|
import com.example.hpostesting.data.DataHolder
|
||||||
import com.example.hpostesting.data.constant.Constants
|
import com.example.hpostesting.data.constant.Constants
|
||||||
import com.example.hpostesting.data.constant.LanguageManager
|
|
||||||
|
|
||||||
import com.example.hpostesting.presentation.hemocube.HemocubeActivity
|
import com.example.hpostesting.presentation.hemocube.HemocubeActivity
|
||||||
import com.example.hpostesting.presentation.testRight.TestRightActivity
|
import com.example.hpostesting.presentation.testRight.TestRightActivity
|
||||||
@@ -45,12 +44,6 @@ class KitScanActivity : AppCompatActivity() {
|
|||||||
binding.nameEditText.setText(contents)
|
binding.nameEditText.setText(contents)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun attachBaseContext(newBase: Context?) {
|
|
||||||
val languageCode = LanguageManager.getSavedLanguage(newBase!!)
|
|
||||||
LanguageManager.setLocale(newBase, languageCode)
|
|
||||||
super.attachBaseContext(newBase)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onCreate(savedInstanceState: Bundle?) {
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
super.onCreate(savedInstanceState)
|
super.onCreate(savedInstanceState)
|
||||||
|
|
||||||
|
|||||||
@@ -17,7 +17,6 @@ import androidx.core.content.ContextCompat
|
|||||||
import androidx.core.view.get
|
import androidx.core.view.get
|
||||||
import com.example.hpostesting.data.DataHolder
|
import com.example.hpostesting.data.DataHolder
|
||||||
import com.example.hpostesting.data.constant.Constants
|
import com.example.hpostesting.data.constant.Constants
|
||||||
import com.example.hpostesting.data.constant.LanguageManager
|
|
||||||
import com.example.hpostesting.data.model.patient.UserData
|
import com.example.hpostesting.data.model.patient.UserData
|
||||||
import com.example.hpostesting.data.model.test.TestType
|
import com.example.hpostesting.data.model.test.TestType
|
||||||
import com.google.android.gms.location.*
|
import com.google.android.gms.location.*
|
||||||
@@ -45,12 +44,6 @@ class MainActivity : AppCompatActivity() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun attachBaseContext(newBase: Context?) {
|
|
||||||
val languageCode = LanguageManager.getSavedLanguage(newBase!!)
|
|
||||||
LanguageManager.setLocale(newBase, languageCode)
|
|
||||||
super.attachBaseContext(newBase)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onCreate(savedInstanceState: Bundle?) {
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
super.onCreate(savedInstanceState)
|
super.onCreate(savedInstanceState)
|
||||||
binding = ActivityMainBinding.inflate(layoutInflater)
|
binding = ActivityMainBinding.inflate(layoutInflater)
|
||||||
@@ -114,15 +107,6 @@ 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,
|
||||||
|
|||||||
@@ -2,7 +2,6 @@ package com.example.hpostesting.presentation
|
|||||||
|
|
||||||
import com.example.hpostesting.presentation.dashboard.DashboardActivity
|
import com.example.hpostesting.presentation.dashboard.DashboardActivity
|
||||||
import android.Manifest
|
import android.Manifest
|
||||||
import android.content.Context
|
|
||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
import android.content.pm.PackageManager
|
import android.content.pm.PackageManager
|
||||||
import android.os.Build
|
import android.os.Build
|
||||||
@@ -15,7 +14,6 @@ import androidx.annotation.RequiresApi
|
|||||||
import androidx.appcompat.app.AppCompatActivity
|
import androidx.appcompat.app.AppCompatActivity
|
||||||
import androidx.core.content.ContextCompat
|
import androidx.core.content.ContextCompat
|
||||||
import com.example.hpostesting.data.DataHolder
|
import com.example.hpostesting.data.DataHolder
|
||||||
import com.example.hpostesting.data.constant.LanguageManager
|
|
||||||
import com.example.hpostesting.util.MyUtils
|
import com.example.hpostesting.util.MyUtils
|
||||||
import `in`.sminnovations.hpostesting.R
|
import `in`.sminnovations.hpostesting.R
|
||||||
import `in`.sminnovations.hpostesting.databinding.ActivitySplashBinding
|
import `in`.sminnovations.hpostesting.databinding.ActivitySplashBinding
|
||||||
@@ -34,12 +32,6 @@ class SplashActivity : AppCompatActivity() {
|
|||||||
|
|
||||||
private var allPermissionsGranted = false
|
private var allPermissionsGranted = false
|
||||||
|
|
||||||
override fun attachBaseContext(newBase: Context?) {
|
|
||||||
val languageCode = LanguageManager.getSavedLanguage(newBase!!)
|
|
||||||
LanguageManager.setLocale(newBase, languageCode)
|
|
||||||
super.attachBaseContext(newBase)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onCreate(savedInstanceState: Bundle?) {
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
super.onCreate(savedInstanceState)
|
super.onCreate(savedInstanceState)
|
||||||
binding = ActivitySplashBinding.inflate(layoutInflater)
|
binding = ActivitySplashBinding.inflate(layoutInflater)
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
package com.example.hpostesting.presentation.adapter
|
package com.example.hpostesting.presentation.adapter
|
||||||
|
|
||||||
|
import android.annotation.SuppressLint
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
|
import android.content.res.Resources
|
||||||
import android.view.LayoutInflater
|
import android.view.LayoutInflater
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
@@ -26,7 +28,9 @@ class OfflineUserListAdapter(private val view: View, private val batLevel: Int)
|
|||||||
RecyclerView.Adapter<OfflineUserListAdapter.OfflineUserListViewHolder>() {
|
RecyclerView.Adapter<OfflineUserListAdapter.OfflineUserListViewHolder>() {
|
||||||
|
|
||||||
inner class OfflineUserListViewHolder(val binding: OfflineUserListViewBinding) :
|
inner class OfflineUserListViewHolder(val binding: OfflineUserListViewBinding) :
|
||||||
RecyclerView.ViewHolder(binding.root)
|
RecyclerView.ViewHolder(binding.root) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
private val differCallback = object : DiffUtil.ItemCallback<HemoCubeTestData>() {
|
private val differCallback = object : DiffUtil.ItemCallback<HemoCubeTestData>() {
|
||||||
override fun areItemsTheSame(
|
override fun areItemsTheSame(
|
||||||
@@ -54,61 +58,58 @@ class OfflineUserListAdapter(private val view: View, private val batLevel: Int)
|
|||||||
return differ.currentList.size
|
return differ.currentList.size
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressLint("SetTextI18n")
|
||||||
override fun onBindViewHolder(holder: OfflineUserListViewHolder, position: Int) {
|
override fun onBindViewHolder(holder: OfflineUserListViewHolder, position: Int) {
|
||||||
val userList = differ.currentList[position]
|
val userList = differ.currentList[position]
|
||||||
holder.binding.apply {
|
holder.binding.apply {
|
||||||
userID.text = "User ID: ${userList._id}"
|
userID.text = "User ID: ${userList._id}"
|
||||||
bloodGroup.text = "Blood group: ${userList.bloodGroup}"
|
bloodGroup.text = "Blood group: ${userList.bloodGroup}"
|
||||||
time.text = "Time: ${userList.incubationTime}"
|
time.text = "Time: ${isBetween15And30Minutes(userList.incubationTime)} \n Started at: ${
|
||||||
|
SimpleDateFormat("HH:mm:ss").format(
|
||||||
|
SimpleDateFormat(
|
||||||
|
"yyyy-MM-dd HH:mm:ss", Locale.getDefault()
|
||||||
|
).parse(userList.incubationTime)!!
|
||||||
|
)
|
||||||
|
}"
|
||||||
|
|
||||||
|
if (userList.testStatus!!) {
|
||||||
|
teststatus.text = view.context.getString(R.string.test_concluded)
|
||||||
|
|
||||||
|
} else {
|
||||||
|
teststatus.text = view.context.getString(R.string.test_pending)
|
||||||
|
}
|
||||||
|
|
||||||
userCard.setOnClickListener {
|
userCard.setOnClickListener {
|
||||||
if (batLevel < 40) {
|
if (batLevel < 40) {
|
||||||
Toast.makeText(
|
showWarningToast(R.string.low_battery_warning)
|
||||||
view.context,
|
} else {
|
||||||
context?.getString(R.string.low_battery_warning),
|
if (userList.testStatus != null) {
|
||||||
Toast.LENGTH_SHORT
|
if (userList.testStatus!!) {
|
||||||
).show()
|
showWarningToast(R.string.test_already_conducted)
|
||||||
return@setOnClickListener
|
|
||||||
}
|
|
||||||
if (userList.testStatus != null) {
|
|
||||||
if (userList.testStatus!!) {
|
|
||||||
Toast.makeText(
|
|
||||||
view.context,
|
|
||||||
context?.getString(R.string.test_already_conducted),
|
|
||||||
Toast.LENGTH_SHORT
|
|
||||||
).show()
|
|
||||||
} else {
|
|
||||||
if (userList.incubationTime != "") {
|
|
||||||
if (isBetween15And30Minutes(userList.incubationTime) < Constants.INCUBATION_TIME_MIN) {
|
|
||||||
Toast.makeText(
|
|
||||||
view.context,
|
|
||||||
context?.getString(R.string.incubation_not_completed),
|
|
||||||
Toast.LENGTH_SHORT
|
|
||||||
).show()
|
|
||||||
} else if (isBetween15And30Minutes(userList.incubationTime) > Constants.INCUBATION_TIME_MAX) {
|
|
||||||
Toast.makeText(
|
|
||||||
view.context,
|
|
||||||
context?.getString(R.string.incubation_crossed_30_minutes),
|
|
||||||
Toast.LENGTH_SHORT
|
|
||||||
).show()
|
|
||||||
} else {
|
|
||||||
DataHolder.selectedTest = UserData(
|
|
||||||
_id = userList._id,
|
|
||||||
bloodGroup = userList.bloodGroup,
|
|
||||||
incubationTime = userList.incubationTime
|
|
||||||
)
|
|
||||||
view.findNavController()
|
|
||||||
.navigate(R.id.action_nav_home_to_mainActivity)
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
Toast.makeText(
|
if (userList.incubationTime != "") {
|
||||||
view.context,
|
val incubationTimeDiff = isBetween15And30Minutes(userList.incubationTime)
|
||||||
context?.getString(R.string.incubation_not_started),
|
if (incubationTimeDiff < 15) {
|
||||||
Toast.LENGTH_SHORT
|
showWarningToast(R.string.incubation_not_completed)
|
||||||
).show()
|
} else if (incubationTimeDiff > 30) {
|
||||||
|
showWarningToast(R.string.incubation_crossed_30_minutes)
|
||||||
|
} else {
|
||||||
|
DataHolder.selectedTest = UserData(
|
||||||
|
_id = userList._id,
|
||||||
|
bloodGroup = userList.bloodGroup,
|
||||||
|
incubationTime = userList.incubationTime
|
||||||
|
)
|
||||||
|
view.findNavController()
|
||||||
|
.navigate(R.id.action_nav_home_to_mainActivity)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
showWarningToast(R.string.incubation_not_started)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -122,4 +123,25 @@ class OfflineUserListAdapter(private val view: View, private val batLevel: Int)
|
|||||||
|
|
||||||
return diffMillis / (60 * 1000)
|
return diffMillis / (60 * 1000)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private fun showWarningToast(resId: Int) {
|
||||||
|
val contextToUse = view.context ?: return
|
||||||
|
|
||||||
|
val message = try {
|
||||||
|
contextToUse.getString(resId)
|
||||||
|
} catch (e: Resources.NotFoundException) {
|
||||||
|
"Resource not found for ID: $resId"
|
||||||
|
}
|
||||||
|
|
||||||
|
Toast.makeText(
|
||||||
|
contextToUse,
|
||||||
|
message,
|
||||||
|
Toast.LENGTH_SHORT
|
||||||
|
).show()
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -26,7 +26,6 @@ import android.widget.AutoCompleteTextView
|
|||||||
import androidx.core.content.ContextCompat.getSystemService
|
import androidx.core.content.ContextCompat.getSystemService
|
||||||
import androidx.core.content.getSystemService
|
import androidx.core.content.getSystemService
|
||||||
import androidx.fragment.app.FragmentActivity
|
import androidx.fragment.app.FragmentActivity
|
||||||
import com.example.hpostesting.data.constant.Constants
|
|
||||||
import com.example.hpostesting.presentation.hemocube.HemoCubeViewModel
|
import com.example.hpostesting.presentation.hemocube.HemoCubeViewModel
|
||||||
import com.google.firebase.firestore.FirebaseFirestore
|
import com.google.firebase.firestore.FirebaseFirestore
|
||||||
|
|
||||||
@@ -95,13 +94,13 @@ class UserListAdapter(
|
|||||||
|
|
||||||
val builder = AlertDialog.Builder(context)
|
val builder = AlertDialog.Builder(context)
|
||||||
.setView(dialogView)
|
.setView(dialogView)
|
||||||
.setTitle(R.string.blood_group)
|
.setTitle("Add Blood Group")
|
||||||
|
|
||||||
val etBloodGroup = dialogView.findViewById<AutoCompleteTextView>(R.id.et_blood_group)
|
val etBloodGroup = dialogView.findViewById<AutoCompleteTextView>(R.id.et_blood_group)
|
||||||
|
|
||||||
builder.setPositiveButton(R.string.ok) { dialog, which ->
|
builder.setPositiveButton("OK") { dialog, which ->
|
||||||
val bloodGroup = etBloodGroup.text.toString()
|
val bloodGroup = etBloodGroup.text.toString()
|
||||||
if (bloodGroup.equals("Select Blood Group") ||bloodGroup.equals("ರಕ್ತ ಗುಂಪು ಆಯ್ಕೆಮಾಡಿ") || bloodGroup.isNullOrBlank()) {
|
if (bloodGroup.equals("Select Blood Group") || bloodGroup.isNullOrBlank()) {
|
||||||
if (view != null) {
|
if (view != null) {
|
||||||
etBloodGroup.error =view.context.getString(R.string.blood_group_error)
|
etBloodGroup.error =view.context.getString(R.string.blood_group_error)
|
||||||
}
|
}
|
||||||
@@ -167,7 +166,7 @@ class UserListAdapter(
|
|||||||
// Handle the selected blood group here
|
// Handle the selected blood group here
|
||||||
}
|
}
|
||||||
|
|
||||||
builder.setNegativeButton(R.string.cancel) { dialog, which ->
|
builder.setNegativeButton("Cancel") { dialog, which ->
|
||||||
dialog.dismiss()
|
dialog.dismiss()
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -197,7 +196,7 @@ class UserListAdapter(
|
|||||||
// }
|
// }
|
||||||
}
|
}
|
||||||
userCard.setOnClickListener {
|
userCard.setOnClickListener {
|
||||||
if (batLevel < Constants.BATTERY_LEVEL_MIN) {
|
if (batLevel < 40) {
|
||||||
Toast.makeText(
|
Toast.makeText(
|
||||||
view.context,
|
view.context,
|
||||||
context?.getString(R.string.low_battery_warning),
|
context?.getString(R.string.low_battery_warning),
|
||||||
@@ -214,13 +213,13 @@ class UserListAdapter(
|
|||||||
).show()
|
).show()
|
||||||
} else {
|
} else {
|
||||||
if (model.incubationTime != "") {
|
if (model.incubationTime != "") {
|
||||||
if (isBetween15And30Minutes(model.incubationTime) < -15000) {
|
if (isBetween15And30Minutes(model.incubationTime) < 15) {
|
||||||
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) > 300000) {
|
} else if (isBetween15And30Minutes(model.incubationTime) > 30) {
|
||||||
Toast.makeText(
|
Toast.makeText(
|
||||||
view.context,
|
view.context,
|
||||||
context?.getString(R.string.incubation_crossed_30_minutes),
|
context?.getString(R.string.incubation_crossed_30_minutes),
|
||||||
|
|||||||
@@ -1,30 +1,36 @@
|
|||||||
package com.example.hpostesting.presentation.buffercheck
|
package com.example.hpostesting.presentation.buffercheck
|
||||||
|
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
|
import android.content.Intent
|
||||||
import android.content.SharedPreferences
|
import android.content.SharedPreferences
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.view.LayoutInflater
|
import android.view.LayoutInflater
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
|
import android.view.inputmethod.InputMethodManager
|
||||||
import android.widget.Toast
|
import android.widget.Toast
|
||||||
|
import androidx.core.content.ContextCompat
|
||||||
import androidx.fragment.app.Fragment
|
import androidx.fragment.app.Fragment
|
||||||
import androidx.fragment.app.activityViewModels
|
import androidx.fragment.app.activityViewModels
|
||||||
import androidx.lifecycle.MutableLiveData
|
import androidx.lifecycle.MutableLiveData
|
||||||
|
import com.example.hpostesting.data.DataHolder
|
||||||
import com.example.hpostesting.data.constant.Constants
|
import com.example.hpostesting.data.constant.Constants
|
||||||
import com.example.hpostesting.data.constant.HemoCubeCommands
|
import com.example.hpostesting.data.constant.HemoCubeCommands
|
||||||
import com.example.hpostesting.data.model.patient.BufferCheckData
|
import com.example.hpostesting.data.model.patient.BufferCheckData
|
||||||
import com.example.hpostesting.data.model.patient.DeviceData
|
import com.example.hpostesting.data.model.patient.DeviceData
|
||||||
|
import com.example.hpostesting.data.model.patient.toHemoCubeTestData
|
||||||
import com.example.hpostesting.presentation.UsbServiceListener
|
import com.example.hpostesting.presentation.UsbServiceListener
|
||||||
import com.example.hpostesting.presentation.hemocube.HemoCubeViewModel
|
import com.example.hpostesting.presentation.hemocube.HemoCubeViewModel
|
||||||
|
import com.example.hpostesting.presentation.utils.MyDialogListener
|
||||||
|
import com.example.hpostesting.presentation.utils.UIUtils
|
||||||
import com.google.firebase.crashlytics.ktx.crashlytics
|
import com.google.firebase.crashlytics.ktx.crashlytics
|
||||||
import com.google.firebase.ktx.Firebase
|
import com.google.firebase.ktx.Firebase
|
||||||
import `in`.sminnovations.hpostesting.R
|
import `in`.sminnovations.hpostesting.R
|
||||||
import `in`.sminnovations.hpostesting.databinding.FragmentHemoCubeReferenceBinding
|
import `in`.sminnovations.hpostesting.databinding.FragmentHemoCubeReferenceBinding
|
||||||
|
import kotlin.math.log10
|
||||||
import java.text.SimpleDateFormat
|
import java.text.SimpleDateFormat
|
||||||
import java.util.Calendar
|
import java.util.Calendar
|
||||||
import java.util.Locale
|
import java.util.Locale
|
||||||
import java.util.UUID
|
|
||||||
import kotlin.math.log10
|
|
||||||
|
|
||||||
class HemoCubeBufferCheckFragment : Fragment() {
|
class HemoCubeBufferCheckFragment : Fragment() {
|
||||||
|
|
||||||
@@ -35,24 +41,9 @@ class HemoCubeBufferCheckFragment : Fragment() {
|
|||||||
private var resultData: String = ""
|
private var resultData: String = ""
|
||||||
private var kitno: String = ""
|
private var kitno: String = ""
|
||||||
private var isOnline = false
|
private var isOnline = false
|
||||||
|
private val messages = MutableLiveData<String>()
|
||||||
private var isTestOngoing = false
|
private var isTestOngoing = false
|
||||||
private var startListening = MutableLiveData(false)
|
private var startListening = MutableLiveData(false)
|
||||||
private var led1BufferForDevice = 0.0
|
|
||||||
private var led2BufferForDevice = 0.0
|
|
||||||
private var led3BufferForDevice = 0.0
|
|
||||||
private var led4BufferForDevice = 0.0
|
|
||||||
private var led1SampleForDevice = 0.0
|
|
||||||
private var led2SampleForDevice = 0.0
|
|
||||||
private var led3SampleForDevice = 0.0
|
|
||||||
private var led4SampleForDevice = 0.0
|
|
||||||
private var fittedAbs1 = 0.0
|
|
||||||
private var fittedAbs2 = 0.0
|
|
||||||
private var fittedAbs3 = 0.0
|
|
||||||
private var fittedAbs4 = 0.0
|
|
||||||
private var _predictedDenovixRatio = 0.0
|
|
||||||
private var validationError = false
|
|
||||||
private var allErrorMessages = ""
|
|
||||||
private var deviceHardwareId = ""
|
|
||||||
override fun onCreateView(
|
override fun onCreateView(
|
||||||
inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?,
|
inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?,
|
||||||
): View {
|
): View {
|
||||||
@@ -73,14 +64,13 @@ class HemoCubeBufferCheckFragment : Fragment() {
|
|||||||
binding.nameEditText.setText("SMI/SC/")
|
binding.nameEditText.setText("SMI/SC/")
|
||||||
binding.tvTitle.visibility = View.GONE
|
binding.tvTitle.visibility = View.GONE
|
||||||
binding.tvName.visibility = View.GONE
|
binding.tvName.visibility = View.GONE
|
||||||
binding.btnPlacebuffer.visibility = View.GONE
|
|
||||||
|
|
||||||
binding.btnGo.setOnClickListener {
|
binding.btnGo.setOnClickListener {
|
||||||
val serialNumber = binding.nameEditText.text.toString().trim()
|
val serialNumber = binding.nameEditText.text.toString().trim()
|
||||||
if (serialNumber.isNotEmpty() && isSerialValid(serialNumber)) {
|
if (serialNumber.isNotEmpty() && isSerialValid(serialNumber)) {
|
||||||
kitno = serialNumber
|
kitno = serialNumber
|
||||||
listenToHemoCube()
|
listenToHemoCube()
|
||||||
getDeviceInfo()
|
startBufferProcess()
|
||||||
} else {
|
} else {
|
||||||
Toast.makeText(context, R.string.invalid_kit_number, Toast.LENGTH_LONG).show()
|
Toast.makeText(context, R.string.invalid_kit_number, Toast.LENGTH_LONG).show()
|
||||||
return@setOnClickListener
|
return@setOnClickListener
|
||||||
@@ -94,17 +84,17 @@ class HemoCubeBufferCheckFragment : Fragment() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
binding.btnSamplestart.setOnClickListener {
|
|
||||||
startSampleProcess()
|
|
||||||
it.visibility = View.GONE
|
activity?.runOnUiThread {
|
||||||
|
binding.btnSubmit.isEnabled = true
|
||||||
|
binding.btnSubmit.isClickable = true
|
||||||
|
}
|
||||||
|
binding.btnSubmit.setOnClickListener {
|
||||||
|
|
||||||
}
|
}
|
||||||
binding.btnSubmit.isEnabled = false
|
binding.btnSubmit.isEnabled = false
|
||||||
binding.btnSubmit.isClickable = false
|
binding.btnSubmit.isClickable = false
|
||||||
|
|
||||||
binding.btnPlacebuffer.setOnClickListener {
|
|
||||||
checkAndStartProcess()
|
|
||||||
it.visibility = View.GONE
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun observeViewModel() {
|
private fun observeViewModel() {
|
||||||
@@ -126,10 +116,6 @@ class HemoCubeBufferCheckFragment : Fragment() {
|
|||||||
if (result == "Success") {
|
if (result == "Success") {
|
||||||
showToast(R.string.kit_uploaded)
|
showToast(R.string.kit_uploaded)
|
||||||
}
|
}
|
||||||
if (result == "Error") {
|
|
||||||
showToast("Error uploading data, Kit result stored locally")
|
|
||||||
startActivity(Intent(requireActivity(), DashboardActivity::class.java))
|
|
||||||
}
|
|
||||||
if (result == "Local") {
|
if (result == "Local") {
|
||||||
showToast(R.string.kit_upload_failed)
|
showToast(R.string.kit_upload_failed)
|
||||||
}
|
}
|
||||||
@@ -137,24 +123,27 @@ class HemoCubeBufferCheckFragment : Fragment() {
|
|||||||
binding.progressBar.visibility = View.GONE
|
binding.progressBar.visibility = View.GONE
|
||||||
}
|
}
|
||||||
|
|
||||||
hemoCubeViewModel.messages.observe(viewLifecycleOwner) {
|
messages.observe(viewLifecycleOwner) {
|
||||||
binding.tvSubtitle4.text = it
|
binding.tvSubtitle4.text = it
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun checkAndStartProcess() {
|
|
||||||
startBufferProcess()
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun listenToHemoCube() {
|
private fun listenToHemoCube() {
|
||||||
|
if (DataHolder.hemoCubeTestData == null) {
|
||||||
|
DataHolder.hemoCubeTestData = DataHolder.selectedTest?.toHemoCubeTestData()
|
||||||
|
}
|
||||||
|
|
||||||
|
val fullReadOutput = StringBuilder()
|
||||||
startListening.postValue(true)
|
startListening.postValue(true)
|
||||||
|
|
||||||
try {
|
try {
|
||||||
(activity as HemocubeBufferCheckActivity).mService.listenToHemoCube(object :
|
(activity as HemocubeBufferCheckActivity).mService.listenToHemoCube(object :
|
||||||
UsbServiceListener {
|
UsbServiceListener {
|
||||||
override fun onUsbRead(data: ByteArray?) {
|
override fun onUsbRead(data: ByteArray?) {
|
||||||
data?.let {
|
data?.let {
|
||||||
val stringData = String(it)
|
val stringData = String(it)
|
||||||
handleUsbData(stringData)
|
fullReadOutput.append(stringData)
|
||||||
|
handleUsbData(stringData, fullReadOutput)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -167,212 +156,97 @@ class HemoCubeBufferCheckFragment : Fragment() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun handleUsbData(stringData: String) {
|
private fun handleUsbData(stringData: String, fullReadOutput: StringBuilder) {
|
||||||
if (stringData.contains("#")) {
|
if (stringData.contains("#")) {
|
||||||
|
messages.postValue(stringData)
|
||||||
isTestOngoing = true
|
isTestOngoing = true
|
||||||
}
|
}
|
||||||
|
|
||||||
resultData += stringData
|
resultData += fullReadOutput.toString()
|
||||||
|
|
||||||
when {
|
when {
|
||||||
stringData.contains("SN") -> {
|
stringData.contains("#Buffer Completed") -> showStartSampleDialog()
|
||||||
val slData = stringData.split(" ")
|
stringData.contains("#Sample Completed") -> {
|
||||||
if (slData.size > 1) {
|
|
||||||
val hardwareId = slData[1].trim()
|
|
||||||
deviceHardwareId = hardwareId
|
|
||||||
with(sharedPreferences.edit()) {
|
|
||||||
putString(Constants.DEVICE_ID, hardwareId)
|
|
||||||
apply()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
activity?.runOnUiThread {
|
activity?.runOnUiThread {
|
||||||
binding.tvSubtitle4.visibility = View.VISIBLE
|
binding.btnSubmit.isEnabled = true
|
||||||
binding.btnPlacebuffer.visibility = View.VISIBLE
|
binding.btnSubmit.isClickable = true
|
||||||
}
|
}
|
||||||
hemoCubeViewModel.messages.postValue("Start")
|
|
||||||
}
|
|
||||||
|
|
||||||
stringData.contains("#BS") -> {
|
|
||||||
hemoCubeViewModel.messages.postValue("Buffer Started")
|
|
||||||
}
|
|
||||||
|
|
||||||
stringData.contains("#BC") -> {
|
|
||||||
activity?.runOnUiThread {
|
|
||||||
binding.tvSubtitle4.text = "Buffer Completed"
|
|
||||||
binding.btnSamplestart.visibility = View.VISIBLE
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
stringData.contains("#SS") -> {
|
|
||||||
activity?.runOnUiThread {
|
|
||||||
binding.tvSubtitle4.text = "Sample Started"
|
|
||||||
binding.btnSamplestart.visibility = View.GONE
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
stringData.contains("#SC") -> {
|
|
||||||
hemoCubeViewModel.messages.postValue("Sample Completed \nGathering data")
|
|
||||||
fetchResult()
|
fetchResult()
|
||||||
}
|
}
|
||||||
|
|
||||||
resultData.contains("REND") -> {
|
stringData.contains("RESULT") || resultData.contains("REND") -> {
|
||||||
hemoCubeViewModel.messages.postValue(
|
var validString: String
|
||||||
"Data collected \n" + " Processing data"
|
val results: List<String>
|
||||||
)
|
if (stringData.contains("RESULT")) {
|
||||||
val resultLines = resultData.split("\\s+(?=LB|LS)".toRegex())
|
validString = isValidResult(stringData)
|
||||||
var bufferIntensity = resultLines[1].split(' ')[1].trim()
|
if (validString.isEmpty()) {
|
||||||
led1BufferForDevice = bufferIntensity.toDoubleOrNull()!!
|
results = resultData.split("\n")
|
||||||
bufferIntensity = resultLines[2].split(' ')[1].trim()
|
validString = parseResult(results)
|
||||||
led2BufferForDevice = bufferIntensity.toDoubleOrNull()!!
|
}
|
||||||
bufferIntensity = resultLines[3].split(' ')[1].trim()
|
} else {
|
||||||
led3BufferForDevice = bufferIntensity.toDoubleOrNull()!!
|
results = resultData.split("\n")
|
||||||
bufferIntensity = resultLines[4].split(' ')[1].trim()
|
validString = parseResult(results)
|
||||||
led4BufferForDevice = bufferIntensity.toDoubleOrNull()!!
|
}
|
||||||
led1SampleForDevice = resultLines[5].split(' ')[1].trim().toDoubleOrNull()!!
|
if (validString.isNotEmpty()) {
|
||||||
led2SampleForDevice = resultLines[6].split(' ')[1].trim().toDoubleOrNull()!!
|
handleValidResult(validString)
|
||||||
led3SampleForDevice = resultLines[7].split(' ')[1].trim().toDoubleOrNull()!!
|
}
|
||||||
led4SampleForDevice =
|
|
||||||
resultLines[8].split(' ')[1].split('\r')[0].trim().toDoubleOrNull()!!
|
|
||||||
processResult()
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun processResult() {
|
private fun showStartSampleDialog() {
|
||||||
|
activity?.runOnUiThread {
|
||||||
|
UIUtils.createAlertDialog(requireContext(),
|
||||||
|
"Start Sample",
|
||||||
|
"Do you want to start sample reading?",
|
||||||
|
getString(R.string.no),
|
||||||
|
"Yes",
|
||||||
|
object : MyDialogListener {
|
||||||
|
override fun onClickNegativeButton() {}
|
||||||
|
|
||||||
|
override fun onClickPositiveButton() {
|
||||||
|
listenToHemoCube()
|
||||||
|
startSampleProcess()
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun handleValidResult(validString: String) {
|
||||||
try {
|
try {
|
||||||
hemoCubeViewModel.messages.postValue("processing result")
|
val result = validString.split(" ")
|
||||||
val deviceLog = resultData
|
if (result.size == 8) {
|
||||||
|
val deviceId = result[2]
|
||||||
val pInfo = requireActivity().packageManager.getPackageInfo(
|
val led1BufferForDevice = result[3].toDoubleOrNull()
|
||||||
requireActivity().packageName, 0
|
val led2BufferForDevice = result[4].toDoubleOrNull()
|
||||||
)
|
val led1Sample = result[5].toDoubleOrNull()
|
||||||
val version = pInfo.versionName
|
val led2Sample = result[6].toDoubleOrNull()
|
||||||
|
val led1Average = log10(led1BufferForDevice?.div(led1Sample!!) ?: 0.0)
|
||||||
val led1Average = log10(led1BufferForDevice.div(led1SampleForDevice))
|
val led2Average = log10(led2BufferForDevice?.div(led2Sample!!) ?: 0.0)
|
||||||
val led2Average = log10(led2BufferForDevice.div(led2SampleForDevice))
|
val deviceRatio = led1Average / led2Average
|
||||||
val led3Average = log10(led3BufferForDevice.div(led3SampleForDevice))
|
val calculateRatio = calculateRatio(deviceRatio)
|
||||||
val led4Average = log10(led4BufferForDevice.div(led4SampleForDevice))
|
val classificationResult = findResult(calculateRatio)
|
||||||
val deviceRatio = led3Average / led1Average
|
messages.postValue(classificationResult)
|
||||||
|
val bufferData = BufferCheckData(
|
||||||
if (led1BufferForDevice < Constants.BUFFER_INTENSITY_THRESHOLDS[deviceHardwareId]?.get(0)
|
deviceId= deviceId,
|
||||||
?.get(0)!! || led2BufferForDevice < Constants.BUFFER_INTENSITY_THRESHOLDS[deviceHardwareId]?.get(
|
kitno = kitno,
|
||||||
1
|
led1Buffer = led1BufferForDevice,
|
||||||
|
led2Buffer = led2BufferForDevice,
|
||||||
|
led1Average = led1Average,
|
||||||
|
led2Average = led2Average,
|
||||||
|
led1Sample = led1Sample,
|
||||||
|
led2Sample = led2Sample,
|
||||||
|
deviceRatio = deviceRatio,
|
||||||
|
calculatedRatio = calculateRatio,
|
||||||
|
coefficients = currentDeviceData?.coefficients?.get(0).toString() + ", " + currentDeviceData?.coefficients?.get(1).toString(),
|
||||||
|
classificationResult = classificationResult,
|
||||||
|
deviceSerialNumber = sharedPreferences.getString(Constants.USER_ID, "").toString(),
|
||||||
|
testTime = SimpleDateFormat(
|
||||||
|
"yyyy-MM-dd HH:mm:ss", Locale.getDefault()
|
||||||
|
).format(Calendar.getInstance().time)
|
||||||
)
|
)
|
||||||
?.get(0)!! || led3BufferForDevice < Constants.BUFFER_INTENSITY_THRESHOLDS[deviceHardwareId]?.get(
|
hemoCubeViewModel.uploadHemoCubeResultToDatabaseforbuffercheckN(bufferData)
|
||||||
2
|
|
||||||
)
|
|
||||||
?.get(0)!! || led4BufferForDevice < Constants.BUFFER_INTENSITY_THRESHOLDS[deviceHardwareId]?.get(
|
|
||||||
3
|
|
||||||
)?.get(0)!!
|
|
||||||
) {
|
|
||||||
validationError = true
|
|
||||||
allErrorMessages += "Error: Invalid Test. Improper buffer reading (low)"
|
|
||||||
activity?.runOnUiThread {
|
|
||||||
binding.errorMessage.text =
|
|
||||||
"Error: Invalid Test. Improper buffer reading (low)" + "\n"
|
|
||||||
binding.errorMessage.visibility = View.VISIBLE
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (led1BufferForDevice > Constants.BUFFER_INTENSITY_THRESHOLDS[deviceHardwareId]?.get(0)
|
|
||||||
?.get(1)!! || led2BufferForDevice > Constants.BUFFER_INTENSITY_THRESHOLDS[deviceHardwareId]?.get(
|
|
||||||
1
|
|
||||||
)
|
|
||||||
?.get(1)!! || led3BufferForDevice > Constants.BUFFER_INTENSITY_THRESHOLDS[deviceHardwareId]?.get(
|
|
||||||
2
|
|
||||||
)
|
|
||||||
?.get(1)!! || led4BufferForDevice > Constants.BUFFER_INTENSITY_THRESHOLDS[deviceHardwareId]?.get(
|
|
||||||
3
|
|
||||||
)?.get(1)!!
|
|
||||||
) {
|
|
||||||
validationError = true
|
|
||||||
allErrorMessages += "Error: Invalid Test. Improper buffer reading (high)" + "\n"
|
|
||||||
activity?.runOnUiThread {
|
|
||||||
binding.errorMessage.text =
|
|
||||||
"Error: Invalid Test. Improper buffer reading (high)"
|
|
||||||
binding.errorMessage.visibility = View.VISIBLE
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
var gradient = Constants.DEVICE_CONFIGURATION[deviceHardwareId]?.get(0)?.get(0)
|
|
||||||
var constant = Constants.DEVICE_CONFIGURATION[deviceHardwareId]?.get(0)?.get(1)
|
|
||||||
fittedAbs1 = gradient?.times(led1Average)?.plus(constant!!)!!
|
|
||||||
|
|
||||||
gradient = Constants.DEVICE_CONFIGURATION[deviceHardwareId]?.get(1)?.get(0)
|
|
||||||
constant = Constants.DEVICE_CONFIGURATION[deviceHardwareId]?.get(1)?.get(1)
|
|
||||||
fittedAbs2 = gradient?.times(led2Average)?.plus(constant!!)!!
|
|
||||||
|
|
||||||
gradient = Constants.DEVICE_CONFIGURATION[deviceHardwareId]?.get(2)?.get(0)
|
|
||||||
constant = Constants.DEVICE_CONFIGURATION[deviceHardwareId]?.get(2)?.get(1)
|
|
||||||
fittedAbs3 = gradient?.times(led3Average)?.plus(constant!!)!!
|
|
||||||
|
|
||||||
gradient = Constants.DEVICE_CONFIGURATION[deviceHardwareId]?.get(3)?.get(0)
|
|
||||||
constant = Constants.DEVICE_CONFIGURATION[deviceHardwareId]?.get(3)?.get(1)
|
|
||||||
fittedAbs4 = gradient?.times(led4Average)?.plus(constant!!)!!
|
|
||||||
|
|
||||||
_predictedDenovixRatio = fittedAbs3.div(fittedAbs1)
|
|
||||||
|
|
||||||
if (fittedAbs1 <= fittedAbs2) {
|
|
||||||
validationError = true
|
|
||||||
allErrorMessages += "Error: Invalid Test. Problem with de-oxygenation" + "\n"
|
|
||||||
activity?.runOnUiThread {
|
|
||||||
binding.errorMessage.text = "Error: Invalid Test. Problem with de-oxygenation"
|
|
||||||
binding.errorMessage.visibility = View.VISIBLE
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (fittedAbs1 < 0 || fittedAbs2 < 0 || fittedAbs3 < 0 || fittedAbs4 < 0) {
|
|
||||||
validationError = true
|
|
||||||
activity?.runOnUiThread {
|
|
||||||
binding.errorMessage.text = "Error: Negative Abs. Redo Kit check Reading"
|
|
||||||
binding.errorMessage.visibility = View.VISIBLE
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
val prdClassification = absorbanceBasedClassification(_predictedDenovixRatio)
|
|
||||||
hemoCubeViewModel.messages.postValue(prdClassification)
|
|
||||||
|
|
||||||
val bufferData = BufferCheckData(
|
|
||||||
_id = UUID.randomUUID().toString(),
|
|
||||||
deviceId = deviceHardwareId,
|
|
||||||
kitno = kitno,
|
|
||||||
appVersion = version,
|
|
||||||
led1Buffer = led1BufferForDevice,
|
|
||||||
led2Buffer = led2BufferForDevice,
|
|
||||||
led3Buffer = led3BufferForDevice,
|
|
||||||
led4Buffer = led4BufferForDevice,
|
|
||||||
led1Sample = led1SampleForDevice,
|
|
||||||
led2Sample = led2SampleForDevice,
|
|
||||||
led3Sample = led3SampleForDevice,
|
|
||||||
led4Sample = led4SampleForDevice,
|
|
||||||
led1Average = led1Average,
|
|
||||||
led2Average = led2Average,
|
|
||||||
led3Average = led3Average,
|
|
||||||
led4Average = led4Average,
|
|
||||||
abs1 = fittedAbs1,
|
|
||||||
abs2 = fittedAbs2,
|
|
||||||
abs3 = fittedAbs3,
|
|
||||||
abs4 = fittedAbs4,
|
|
||||||
deviceRatio = deviceRatio,
|
|
||||||
resultData = deviceLog,
|
|
||||||
predictedDenovixRatio = _predictedDenovixRatio,
|
|
||||||
prdClassification = prdClassification,
|
|
||||||
errorMessages = allErrorMessages,
|
|
||||||
coefficients = currentDeviceData?.coefficients?.get(0)
|
|
||||||
.toString() + ", " + currentDeviceData?.coefficients?.get(1).toString(),
|
|
||||||
deviceSerialNumber = sharedPreferences.getString(Constants.USER_ID, "").toString(),
|
|
||||||
testTime = SimpleDateFormat(
|
|
||||||
"yyyy-MM-dd HH:mm:ss", Locale.getDefault()
|
|
||||||
).format(Calendar.getInstance().time),
|
|
||||||
batteryLevel = hemoCubeViewModel.getBatteryLevel().toString(),
|
|
||||||
batteryCapacity = hemoCubeViewModel.getBatteryCapacity(requireContext()).toString(),
|
|
||||||
batteryMaxCapacity = hemoCubeViewModel.getBatteryMaxCapacity(requireContext())
|
|
||||||
.toString(),
|
|
||||||
batteryTemperature = hemoCubeViewModel.getBatteryTemperature().toString(),
|
|
||||||
batteryVoltage = hemoCubeViewModel.getBatteryVoltage(requireContext()).toString()
|
|
||||||
)
|
|
||||||
|
|
||||||
hemoCubeViewModel.uploadHemoCubeResultToDatabaseForBufferCheck(isOnline, bufferData)
|
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
Toast.makeText(
|
Toast.makeText(
|
||||||
requireContext(), "Error while processing device data", Toast.LENGTH_SHORT
|
requireContext(), "Error while processing device data", Toast.LENGTH_SHORT
|
||||||
@@ -383,44 +257,23 @@ class HemoCubeBufferCheckFragment : Fragment() {
|
|||||||
|
|
||||||
private fun findResult(calculatedRatio: Double?): String {
|
private fun findResult(calculatedRatio: Double?): String {
|
||||||
try {
|
try {
|
||||||
hemoCubeViewModel.messages.postValue("result classification")
|
|
||||||
if (calculatedRatio != null) {
|
if (calculatedRatio != null) {
|
||||||
if (calculatedRatio < 0.05) return "Inconclusive. Very low Absorbance - Repeat test with Higher Blood Volume"
|
if (calculatedRatio < 0.085) return "Kit Failed"
|
||||||
if (calculatedRatio in 0.05..0.155) return "Normal"
|
if (calculatedRatio in 0.085..0.155) return "Kit Passed"
|
||||||
if (calculatedRatio in 0.155..0.175) return "Negative Borderline. Repeat Test"
|
if (calculatedRatio in 0.155..0.175) return "Kit Failed"
|
||||||
if (calculatedRatio in 0.175..0.22) return "Sickle Cell Trait"
|
if (calculatedRatio in 0.175..0.22) return "Kit Failed"
|
||||||
if (calculatedRatio in 0.22..0.25) return "Positive for Sickle Cell. HPLC for Confirmation"
|
if (calculatedRatio in 0.22..0.25) return "Kit Failed"
|
||||||
if (calculatedRatio in 0.25..0.35) return "Sickle Cell Disease"
|
if (calculatedRatio in 0.25..0.35) return "Kit Failed"
|
||||||
if (calculatedRatio > 0.35) return "Inconclusive. Repeat with test with lower volume of blood"
|
if (calculatedRatio > 0.35) return "Kit Failed"
|
||||||
} else {
|
} else {
|
||||||
return "INVALID"
|
return "NULL"
|
||||||
}
|
}
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
showToast(R.string.error_classification)
|
showToast(R.string.error_classification)
|
||||||
Firebase.crashlytics.recordException(e)
|
Firebase.crashlytics.recordException(e)
|
||||||
return "ERROR"
|
return "ERROR"
|
||||||
}
|
}
|
||||||
return "INVALID"
|
return "NULL"
|
||||||
}
|
|
||||||
|
|
||||||
private fun absorbanceBasedClassification(predictedDenovixRatio: Double?): String {
|
|
||||||
try {
|
|
||||||
hemoCubeViewModel.messages.postValue("result classification")
|
|
||||||
if (predictedDenovixRatio != null) {
|
|
||||||
if (predictedDenovixRatio in 0.0..0.16) return "Kit Passed"
|
|
||||||
if (predictedDenovixRatio in 0.16..0.165) return "Kit Passed"
|
|
||||||
if (predictedDenovixRatio in 0.165..0.235) return "Kit Failed"
|
|
||||||
if (predictedDenovixRatio in 0.235..0.24) return "Kit Failed"
|
|
||||||
if (predictedDenovixRatio in 0.24..1.0) return "Kit Failed"
|
|
||||||
} else {
|
|
||||||
return "INVALID"
|
|
||||||
}
|
|
||||||
} catch (e: Exception) {
|
|
||||||
showToast("error while performing classification")
|
|
||||||
Firebase.crashlytics.recordException(e)
|
|
||||||
return "ERROR"
|
|
||||||
}
|
|
||||||
return "INVALID"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun showToast(messageResId: Int) {
|
private fun showToast(messageResId: Int) {
|
||||||
@@ -429,9 +282,6 @@ class HemoCubeBufferCheckFragment : Fragment() {
|
|||||||
|
|
||||||
|
|
||||||
private fun startBufferProcess() {
|
private fun startBufferProcess() {
|
||||||
activity?.runOnUiThread {
|
|
||||||
binding.btnPlacebuffer.visibility = View.GONE
|
|
||||||
}
|
|
||||||
|
|
||||||
(activity as HemocubeBufferCheckActivity).mService.sendAndListenToHemoCube(HemoCubeCommands.startBuffer,
|
(activity as HemocubeBufferCheckActivity).mService.sendAndListenToHemoCube(HemoCubeCommands.startBuffer,
|
||||||
object : UsbServiceListener {
|
object : UsbServiceListener {
|
||||||
@@ -443,9 +293,6 @@ class HemoCubeBufferCheckFragment : Fragment() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun startSampleProcess() {
|
private fun startSampleProcess() {
|
||||||
activity?.runOnUiThread {
|
|
||||||
binding.btnPlacebuffer.visibility = View.GONE
|
|
||||||
}
|
|
||||||
|
|
||||||
(activity as HemocubeBufferCheckActivity).mService.sendAndListenToHemoCube(HemoCubeCommands.startSample,
|
(activity as HemocubeBufferCheckActivity).mService.sendAndListenToHemoCube(HemoCubeCommands.startSample,
|
||||||
object : UsbServiceListener {
|
object : UsbServiceListener {
|
||||||
@@ -456,28 +303,9 @@ class HemoCubeBufferCheckFragment : Fragment() {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun getDeviceInfo() {
|
|
||||||
hemoCubeViewModel.progressBar.postValue(true)
|
|
||||||
(activity as HemocubeBufferCheckActivity).mService.sendAndListenToHemoCube(
|
|
||||||
HemoCubeCommands.getDeviceId,
|
|
||||||
object : UsbServiceListener {
|
|
||||||
override fun onUsbRead(data: ByteArray?) {
|
|
||||||
data?.let {
|
|
||||||
val stringData = String(it)
|
|
||||||
hemoCubeViewModel.messages.postValue(stringData)
|
|
||||||
binding.tvSubtitle4.text = stringData
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onUsbError(e: Exception?) {
|
|
||||||
hemoCubeViewModel.progressBar.postValue(false)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun fetchResult() {
|
private fun fetchResult() {
|
||||||
|
|
||||||
(activity as HemocubeBufferCheckActivity).mService.sendAndListenToHemoCube(HemoCubeCommands.PRINT_COMMAND,
|
(activity as HemocubeBufferCheckActivity).mService.sendAndListenToHemoCube(HemoCubeCommands.getSample,
|
||||||
object : UsbServiceListener {
|
object : UsbServiceListener {
|
||||||
override fun onUsbRead(data: ByteArray?) {}
|
override fun onUsbRead(data: ByteArray?) {}
|
||||||
|
|
||||||
@@ -492,6 +320,21 @@ class HemoCubeBufferCheckFragment : Fragment() {
|
|||||||
return coefficient1 * ratio + coefficient2
|
return coefficient1 * ratio + coefficient2
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun parseResult(frames: List<String>): String {
|
||||||
|
val lines = mutableListOf<String>()
|
||||||
|
for (frame in frames.reversed()) {
|
||||||
|
if (frame.contains("REND") || frame.contains("RESULT")) lines += frame
|
||||||
|
if (frame.contains("RESULT")) {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
val line = lines.reversed().joinToString("").trim()
|
||||||
|
if (line.contains("RESULT") && line.split(" ").size == 8) {
|
||||||
|
return line
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
private fun isSerialValid(s: String): Boolean {
|
private fun isSerialValid(s: String): Boolean {
|
||||||
if (s.length != 17) {
|
if (s.length != 17) {
|
||||||
binding.nameEditText.error = getString(R.string.invalid_kit)
|
binding.nameEditText.error = getString(R.string.invalid_kit)
|
||||||
@@ -499,4 +342,13 @@ class HemoCubeBufferCheckFragment : Fragment() {
|
|||||||
}
|
}
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private fun isValidResult(line: String): String {
|
||||||
|
return if (line.contains("RESULT") && line.split(" ").size == 8) {
|
||||||
|
line
|
||||||
|
} else {
|
||||||
|
""
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,7 +21,6 @@ import androidx.core.content.ContextCompat
|
|||||||
import androidx.core.view.get
|
import androidx.core.view.get
|
||||||
import com.example.hpostesting.data.DataHolder
|
import com.example.hpostesting.data.DataHolder
|
||||||
import com.example.hpostesting.data.constant.Constants
|
import com.example.hpostesting.data.constant.Constants
|
||||||
import com.example.hpostesting.data.constant.LanguageManager
|
|
||||||
import com.example.hpostesting.presentation.hemocube.HemoCubeViewModel
|
import com.example.hpostesting.presentation.hemocube.HemoCubeViewModel
|
||||||
import com.example.hpostesting.presentation.testRight.UsbService
|
import com.example.hpostesting.presentation.testRight.UsbService
|
||||||
import com.hoho.android.usbserial.driver.UsbSerialDriver
|
import com.hoho.android.usbserial.driver.UsbSerialDriver
|
||||||
@@ -74,12 +73,6 @@ open class HemocubeBufferCheckActivity : AppCompatActivity() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun attachBaseContext(newBase: Context?) {
|
|
||||||
val languageCode = LanguageManager.getSavedLanguage(newBase!!)
|
|
||||||
LanguageManager.setLocale(newBase, languageCode)
|
|
||||||
super.attachBaseContext(newBase)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onCreate(savedInstanceState: Bundle?) {
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
super.onCreate(savedInstanceState)
|
super.onCreate(savedInstanceState)
|
||||||
binding = ActivityHemocubeBinding.inflate(layoutInflater)
|
binding = ActivityHemocubeBinding.inflate(layoutInflater)
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
package com.example.hpostesting.presentation.dashboard
|
package com.example.hpostesting.presentation.dashboard
|
||||||
|
|
||||||
import android.content.Context
|
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.view.Menu
|
import android.view.Menu
|
||||||
import android.widget.Toast
|
import android.widget.Toast
|
||||||
@@ -11,7 +10,6 @@ import androidx.navigation.ui.AppBarConfiguration
|
|||||||
import androidx.navigation.ui.navigateUp
|
import androidx.navigation.ui.navigateUp
|
||||||
import androidx.navigation.ui.setupActionBarWithNavController
|
import androidx.navigation.ui.setupActionBarWithNavController
|
||||||
import androidx.navigation.ui.setupWithNavController
|
import androidx.navigation.ui.setupWithNavController
|
||||||
import com.example.hpostesting.data.constant.LanguageManager
|
|
||||||
import com.google.android.material.navigation.NavigationView
|
import com.google.android.material.navigation.NavigationView
|
||||||
import com.google.firebase.appdistribution.FirebaseAppDistribution
|
import com.google.firebase.appdistribution.FirebaseAppDistribution
|
||||||
import com.google.firebase.appdistribution.FirebaseAppDistributionException
|
import com.google.firebase.appdistribution.FirebaseAppDistributionException
|
||||||
@@ -26,12 +24,6 @@ class DashboardActivity : AppCompatActivity() {
|
|||||||
private lateinit var appBarConfiguration: AppBarConfiguration
|
private lateinit var appBarConfiguration: AppBarConfiguration
|
||||||
private lateinit var binding: ActivityDashboardBinding
|
private lateinit var binding: ActivityDashboardBinding
|
||||||
|
|
||||||
override fun attachBaseContext(newBase: Context?) {
|
|
||||||
val languageCode = LanguageManager.getSavedLanguage(newBase!!)
|
|
||||||
LanguageManager.setLocale(newBase, languageCode)
|
|
||||||
super.attachBaseContext(newBase)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onCreate(savedInstanceState: Bundle?) {
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
super.onCreate(savedInstanceState)
|
super.onCreate(savedInstanceState)
|
||||||
|
|
||||||
|
|||||||
@@ -138,6 +138,7 @@ class HomeFragment : Fragment() {
|
|||||||
binding.btnSubmit.setOnClickListener {
|
binding.btnSubmit.setOnClickListener {
|
||||||
val userId = binding.userId.text.toString()
|
val userId = binding.userId.text.toString()
|
||||||
val bloodGroup = binding.etBloodGroup.text
|
val bloodGroup = binding.etBloodGroup.text
|
||||||
|
|
||||||
if (userId.length >= 18 && !bloodGroup.equals("Select Blood Group") || !bloodGroup.isNullOrBlank()) {
|
if (userId.length >= 18 && !bloodGroup.equals("Select Blood Group") || !bloodGroup.isNullOrBlank()) {
|
||||||
hemoCubeViewModel.addUser(
|
hemoCubeViewModel.addUser(
|
||||||
HemoCubeTestData(
|
HemoCubeTestData(
|
||||||
@@ -162,10 +163,10 @@ class HomeFragment : Fragment() {
|
|||||||
val dateFormat = SimpleDateFormat("yyyy-MM-dd")
|
val dateFormat = SimpleDateFormat("yyyy-MM-dd")
|
||||||
val currentDate = Date()
|
val currentDate = Date()
|
||||||
val formattedDate = dateFormat.format(currentDate)
|
val formattedDate = dateFormat.format(currentDate)
|
||||||
val query = Firebase.firestore.collection("patientData")
|
// val query = Firebase.firestore.collection("patientData")
|
||||||
.whereGreaterThanOrEqualTo("createdAt", formattedDate)
|
// .whereGreaterThanOrEqualTo("createdAt", formattedDate)
|
||||||
.orderBy("createdAt", Query.Direction.DESCENDING)
|
// .orderBy("createdAt", Query.Direction.DESCENDING)
|
||||||
// val query = Firebase.firestore.collection("patientData").whereEqualTo("testStatus", false)
|
val query = Firebase.firestore.collection("patientData").whereEqualTo("testStatus", false)
|
||||||
query.get().addOnSuccessListener {
|
query.get().addOnSuccessListener {
|
||||||
if (it.documents.isEmpty()) {
|
if (it.documents.isEmpty()) {
|
||||||
binding.pendingTest.visibility = View.VISIBLE
|
binding.pendingTest.visibility = View.VISIBLE
|
||||||
@@ -311,12 +312,6 @@ class HomeFragment : Fragment() {
|
|||||||
if (userDataList.any { !it.localFlag && it.testStatus == true}) View.VISIBLE else View.GONE
|
if (userDataList.any { !it.localFlag && it.testStatus == true}) View.VISIBLE else View.GONE
|
||||||
binding.uploadData.visibility = uploadDataVisibility
|
binding.uploadData.visibility = uploadDataVisibility
|
||||||
}
|
}
|
||||||
|
|
||||||
hemoCubeViewModel.allKitTestData.observe(viewLifecycleOwner) {bufferData ->
|
|
||||||
val uploadDataVisibility =
|
|
||||||
if (bufferData.any { !it.localFlag}) View.VISIBLE else View.GONE
|
|
||||||
binding.uploadData.visibility = uploadDataVisibility
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun showUploadDialog(context: Context) {
|
private fun showUploadDialog(context: Context) {
|
||||||
@@ -361,16 +356,6 @@ class HomeFragment : Fragment() {
|
|||||||
}
|
}
|
||||||
dialog.dismiss()
|
dialog.dismiss()
|
||||||
}
|
}
|
||||||
|
|
||||||
hemoCubeViewModel.allKitTestData.observe(viewLifecycleOwner) { kitDataList ->
|
|
||||||
kitDataList.forEach { userData ->
|
|
||||||
if (!userData.localFlag) {
|
|
||||||
userData.localFlag = true
|
|
||||||
hemoCubeViewModel.bulkAddResultKitTestToDb(userData)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
dialog.dismiss()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun deleteIncompleteRegistrations(userDataList: List<UserData>) {
|
private fun deleteIncompleteRegistrations(userDataList: List<UserData>) {
|
||||||
|
|||||||
@@ -1,66 +1,47 @@
|
|||||||
package com.example.hpostesting.presentation.dashboard
|
package com.example.hpostesting.presentation.dashboard
|
||||||
|
|
||||||
import android.content.Context
|
|
||||||
import android.content.pm.PackageManager
|
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.widget.Toast
|
import android.view.LayoutInflater
|
||||||
import androidx.preference.ListPreference
|
import android.view.View
|
||||||
import androidx.preference.Preference
|
import android.view.ViewGroup
|
||||||
import androidx.preference.PreferenceFragmentCompat
|
import androidx.fragment.app.Fragment
|
||||||
import com.example.hpostesting.data.constant.LanguageManager
|
import androidx.lifecycle.ViewModelProvider
|
||||||
import `in`.sminnovations.hpostesting.R
|
import com.example.hpostesting.presentation.dashboard.ui.slideshow.SlideshowViewModel
|
||||||
|
|
||||||
private var isLanguageChanged = false
|
import `in`.sminnovations.hpostesting.databinding.FragmentSlideshowBinding
|
||||||
|
|
||||||
class SlideshowFragment : PreferenceFragmentCompat() {
|
class SlideshowFragment : Fragment() {
|
||||||
override fun onCreatePreferences(savedInstanceState: Bundle?, rootKey: String?) {
|
private var _binding: FragmentSlideshowBinding? = null
|
||||||
val preferenceScreen = preferenceManager.createPreferenceScreen(requireContext())
|
|
||||||
|
|
||||||
val languagePreference = ListPreference(requireContext())
|
// This property is only valid between onCreateView and
|
||||||
languagePreference.key = "language_preference"
|
// onDestroyView.
|
||||||
languagePreference.title = getString(R.string.app_language)
|
private val binding get() = _binding!!
|
||||||
languagePreference.summary = getString(R.string.select_language)
|
|
||||||
languagePreference.entries = arrayOf("English", "Kannada", "Hindi")
|
|
||||||
languagePreference.entryValues = arrayOf("en", "kn", "hi")
|
|
||||||
languagePreference.setDefaultValue("en")
|
|
||||||
|
|
||||||
languagePreference.onPreferenceChangeListener =
|
override fun onCreateView(
|
||||||
Preference.OnPreferenceChangeListener { _, newValue ->
|
inflater: LayoutInflater,
|
||||||
val languageCode = newValue as String
|
container: ViewGroup?,
|
||||||
updateLanguage(requireContext(), languageCode)
|
savedInstanceState: Bundle?,
|
||||||
true
|
): View {
|
||||||
}
|
val slideshowViewModel =
|
||||||
|
ViewModelProvider(this).get(SlideshowViewModel::class.java)
|
||||||
|
|
||||||
preferenceScreen.addPreference(languagePreference)
|
_binding = FragmentSlideshowBinding.inflate(inflater, container, false)
|
||||||
setPreferenceScreen(preferenceScreen)
|
val root: View = binding.root
|
||||||
|
|
||||||
// App Version Preference
|
val pInfo = requireActivity().packageManager.getPackageInfo(
|
||||||
val appVersionPreference = Preference(requireContext())
|
requireActivity().packageName, 0
|
||||||
appVersionPreference.title = "App Version"
|
)
|
||||||
appVersionPreference.summary = getAppVersion(requireContext())
|
val version = pInfo.versionName
|
||||||
|
binding.textSlideshow.text = version
|
||||||
|
|
||||||
preferenceScreen.addPreference(languagePreference)
|
// val textView: TextView = binding.textSlideshow
|
||||||
preferenceScreen.addPreference(appVersionPreference)
|
// slideshowViewModel.text.observe(viewLifecycleOwner) {
|
||||||
setPreferenceScreen(preferenceScreen)
|
// textView.text = it
|
||||||
|
// }
|
||||||
if (isLanguageChanged) {
|
return root
|
||||||
Toast.makeText(requireContext(), R.string.language_update, Toast.LENGTH_SHORT).show()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun updateLanguage(context: Context, languageCode: String) {
|
override fun onDestroyView() {
|
||||||
LanguageManager.persistLanguagePreference(context, languageCode)
|
super.onDestroyView()
|
||||||
LanguageManager.setLocale(context, languageCode)
|
_binding = null
|
||||||
requireActivity().recreate() // Recreate activity to apply language changes
|
|
||||||
isLanguageChanged = true
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun getAppVersion(context: Context): String {
|
|
||||||
return try {
|
|
||||||
val pInfo = context.packageManager.getPackageInfo(context.packageName, 0)
|
|
||||||
pInfo.versionName
|
|
||||||
} catch (e: PackageManager.NameNotFoundException) {
|
|
||||||
"N/A"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -21,7 +21,6 @@ import androidx.core.content.ContextCompat
|
|||||||
import androidx.core.view.get
|
import androidx.core.view.get
|
||||||
import com.example.hpostesting.data.DataHolder
|
import com.example.hpostesting.data.DataHolder
|
||||||
import com.example.hpostesting.data.constant.Constants
|
import com.example.hpostesting.data.constant.Constants
|
||||||
import com.example.hpostesting.data.constant.LanguageManager
|
|
||||||
import com.example.hpostesting.presentation.hemocube.HemoCubeFragment
|
import com.example.hpostesting.presentation.hemocube.HemoCubeFragment
|
||||||
import com.example.hpostesting.presentation.hemocube.HemoCubeViewModel
|
import com.example.hpostesting.presentation.hemocube.HemoCubeViewModel
|
||||||
import com.example.hpostesting.presentation.testRight.UsbService
|
import com.example.hpostesting.presentation.testRight.UsbService
|
||||||
@@ -78,12 +77,6 @@ class DiagnosticsActivity : AppCompatActivity() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun attachBaseContext(newBase: Context?) {
|
|
||||||
val languageCode = LanguageManager.getSavedLanguage(newBase!!)
|
|
||||||
LanguageManager.setLocale(newBase, languageCode)
|
|
||||||
super.attachBaseContext(newBase)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onCreate(savedInstanceState: Bundle?) {
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
super.onCreate(savedInstanceState)
|
super.onCreate(savedInstanceState)
|
||||||
binding = ActivityDiagnosticsBinding.inflate(layoutInflater)
|
binding = ActivityDiagnosticsBinding.inflate(layoutInflater)
|
||||||
|
|||||||
@@ -14,7 +14,6 @@ import android.os.IBinder
|
|||||||
import android.view.Menu
|
import android.view.Menu
|
||||||
import androidx.activity.viewModels
|
import androidx.activity.viewModels
|
||||||
import com.example.hpostesting.data.DataHolder
|
import com.example.hpostesting.data.DataHolder
|
||||||
import com.example.hpostesting.data.constant.LanguageManager
|
|
||||||
import com.example.hpostesting.presentation.testRight.UsbService
|
import com.example.hpostesting.presentation.testRight.UsbService
|
||||||
import com.hoho.android.usbserial.driver.UsbSerialDriver
|
import com.hoho.android.usbserial.driver.UsbSerialDriver
|
||||||
import `in`.sminnovations.hpostesting.R
|
import `in`.sminnovations.hpostesting.R
|
||||||
@@ -22,15 +21,8 @@ import `in`.sminnovations.hpostesting.databinding.ActivityDigitalCardBinding
|
|||||||
import `in`.sminnovations.hpostesting.databinding.ActivityHemocubeBinding
|
import `in`.sminnovations.hpostesting.databinding.ActivityHemocubeBinding
|
||||||
|
|
||||||
class DigitalCardActivity : AppCompatActivity() {
|
class DigitalCardActivity : AppCompatActivity() {
|
||||||
|
|
||||||
private lateinit var binding: ActivityDigitalCardBinding
|
private lateinit var binding: ActivityDigitalCardBinding
|
||||||
|
|
||||||
override fun attachBaseContext(newBase: Context?) {
|
|
||||||
val languageCode = LanguageManager.getSavedLanguage(newBase!!)
|
|
||||||
LanguageManager.setLocale(newBase, languageCode)
|
|
||||||
super.attachBaseContext(newBase)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onCreate(savedInstanceState: Bundle?) {
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
super.onCreate(savedInstanceState)
|
super.onCreate(savedInstanceState)
|
||||||
binding = ActivityDigitalCardBinding.inflate(layoutInflater)
|
binding = ActivityDigitalCardBinding.inflate(layoutInflater)
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -1,11 +1,13 @@
|
|||||||
package com.example.hpostesting.presentation.hemocube
|
package com.example.hpostesting.presentation.hemocube
|
||||||
|
|
||||||
|
import android.app.Application
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
import android.content.IntentFilter
|
import android.content.IntentFilter
|
||||||
import android.content.SharedPreferences
|
import android.content.SharedPreferences
|
||||||
import android.os.BatteryManager
|
import android.os.BatteryManager
|
||||||
import android.util.Log
|
import android.util.Log
|
||||||
|
import androidx.lifecycle.AndroidViewModel
|
||||||
import androidx.lifecycle.LiveData
|
import androidx.lifecycle.LiveData
|
||||||
import androidx.lifecycle.MutableLiveData
|
import androidx.lifecycle.MutableLiveData
|
||||||
import androidx.lifecycle.ViewModel
|
import androidx.lifecycle.ViewModel
|
||||||
@@ -13,13 +15,14 @@ import androidx.lifecycle.viewModelScope
|
|||||||
import com.example.hpostesting.data.DataHolder
|
import com.example.hpostesting.data.DataHolder
|
||||||
import com.example.hpostesting.data.NetworkStatusLiveData
|
import com.example.hpostesting.data.NetworkStatusLiveData
|
||||||
import com.example.hpostesting.data.constant.Constants
|
import com.example.hpostesting.data.constant.Constants
|
||||||
import com.example.hpostesting.data.dao.HemoCubeBufferDao
|
|
||||||
import com.example.hpostesting.data.dao.HemoCubeDao
|
import com.example.hpostesting.data.dao.HemoCubeDao
|
||||||
import com.example.hpostesting.data.model.Response
|
import com.example.hpostesting.data.model.Response
|
||||||
import com.example.hpostesting.data.model.patient.BufferCheckData
|
import com.example.hpostesting.data.model.patient.BufferCheckData
|
||||||
import com.example.hpostesting.data.model.patient.DeviceData
|
import com.example.hpostesting.data.model.patient.DeviceData
|
||||||
import com.example.hpostesting.data.model.patient.HemoCubeTestData
|
import com.example.hpostesting.data.model.patient.HemoCubeTestData
|
||||||
|
import com.example.hpostesting.data.model.patient.UserData
|
||||||
import com.example.hpostesting.data.model.patient.toHemoCubeTestData
|
import com.example.hpostesting.data.model.patient.toHemoCubeTestData
|
||||||
|
import com.example.hpostesting.data.repository.DatabaseRepository
|
||||||
import com.example.hpostesting.data.repository.Repository
|
import com.example.hpostesting.data.repository.Repository
|
||||||
import dagger.hilt.android.lifecycle.HiltViewModel
|
import dagger.hilt.android.lifecycle.HiltViewModel
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
@@ -31,324 +34,250 @@ import javax.inject.Inject
|
|||||||
@HiltViewModel
|
@HiltViewModel
|
||||||
class HemoCubeViewModel @Inject constructor(
|
class HemoCubeViewModel @Inject constructor(
|
||||||
private val hemoCubeDao: HemoCubeDao,
|
private val hemoCubeDao: HemoCubeDao,
|
||||||
private val hemoCubeBufferDao: HemoCubeBufferDao,
|
|
||||||
private val repository: Repository,
|
private val repository: Repository,
|
||||||
context: Context,
|
context: Context,
|
||||||
) : ViewModel() {
|
) : ViewModel() {
|
||||||
var isServiceConnected = false
|
var isServiceConnected = false
|
||||||
val progressBar = MutableLiveData(false)
|
val progressBar = MutableLiveData(false)
|
||||||
val testDetails = DataHolder.selectedTest?.toHemoCubeTestData()
|
val testDetails = DataHolder.selectedTest?.toHemoCubeTestData()
|
||||||
val messages = MutableLiveData<String>()
|
val messages = MutableLiveData<String>()
|
||||||
private val sharedPreference: SharedPreferences =
|
private val sharedPreference: SharedPreferences =
|
||||||
context.getSharedPreferences("PREFERENCE_NAME", Context.MODE_PRIVATE)
|
context.getSharedPreferences("PREFERENCE_NAME", Context.MODE_PRIVATE)
|
||||||
|
|
||||||
// Get the device ID of the device you want to retrieve data for (e.g., the first device in the list)
|
// Get the device ID of the device you want to retrieve data for (e.g., the first device in the list)
|
||||||
|
|
||||||
private val _networkStatusLiveData = NetworkStatusLiveData(context)
|
private val _networkStatusLiveData = NetworkStatusLiveData(context)
|
||||||
val allUserData = hemoCubeDao.getAll()
|
val allUserData = hemoCubeDao.getAll()
|
||||||
val allKitTestData = hemoCubeBufferDao.getAll()
|
val deviceData = MutableLiveData<DeviceData?>()
|
||||||
val deviceData = MutableLiveData<DeviceData?>()
|
val networkStatusLiveData: LiveData<Boolean>
|
||||||
val networkStatusLiveData: LiveData<Boolean>
|
get() = _networkStatusLiveData
|
||||||
get() = _networkStatusLiveData
|
val fireBaseUpload = MutableLiveData<String>()
|
||||||
val deviceMessages = MutableLiveData<String?>()
|
val fireBaseBulkUpload = MutableLiveData<String>()
|
||||||
val fireBaseUpload = MutableLiveData<String>()
|
|
||||||
val fireBaseBulkUpload = MutableLiveData<String>()
|
|
||||||
|
|
||||||
private val batteryStatus: Intent? =
|
private val batteryStatus: Intent? =
|
||||||
IntentFilter(Intent.ACTION_BATTERY_CHANGED).let { ifilter ->
|
IntentFilter(Intent.ACTION_BATTERY_CHANGED).let { ifilter ->
|
||||||
context.registerReceiver(null, ifilter)
|
context.registerReceiver(null, ifilter)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun uploadHemoCubeResultToDatabase(
|
||||||
|
isOnline: Boolean,
|
||||||
|
testStatus: Boolean,
|
||||||
|
kitSerial: String?
|
||||||
|
) =
|
||||||
|
viewModelScope.launch {
|
||||||
|
if (kitSerial != null) {
|
||||||
|
testDetails?.kitSerial = kitSerial
|
||||||
|
}
|
||||||
|
testDetails?.testStatus = testStatus
|
||||||
|
|
||||||
|
try {
|
||||||
|
if (isOnline) {
|
||||||
|
parseData()
|
||||||
|
addResultTestToDb()
|
||||||
|
} else {
|
||||||
|
parseData()
|
||||||
|
testDetails?.testTime = SimpleDateFormat(
|
||||||
|
"yyyy-MM-dd HH:mm:ss", Locale.getDefault()
|
||||||
|
).format(Calendar.getInstance().time)
|
||||||
|
hemoCubeDao.insertAll(testDetails!!)
|
||||||
|
fireBaseUpload.postValue("Local")
|
||||||
|
}
|
||||||
|
} catch (e: Exception) {
|
||||||
|
Log.e("Testdb", "Upload failed: ${e.message}")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
fun uploadHemoCubeResultToDatabaseforbuffercheckN(bufferCheckData: BufferCheckData) =
|
||||||
|
viewModelScope.launch {
|
||||||
|
addResultTestToDbforbuffercheck(bufferCheckData)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun getDeviceData(deviceId: String?) = viewModelScope.launch {
|
||||||
|
deviceData.postValue(deviceId?.let { repository.getDeviceDataById(it) })
|
||||||
}
|
}
|
||||||
|
|
||||||
fun uploadHemoCubeResultToDatabase(isOnline: Boolean, testStatus: Boolean, kitSerial: String?) =
|
private fun parseData() {
|
||||||
viewModelScope.launch {
|
testDetails?.deviceRatio = DataHolder.hemocubeResult
|
||||||
if (kitSerial != null) {
|
testDetails?.resultData = DataHolder.hemoCubeTestData?.resultData.toString()
|
||||||
testDetails?.kitSerial = kitSerial
|
testDetails?.location = DataHolder.location
|
||||||
}
|
testDetails?.testTime = SimpleDateFormat(
|
||||||
testDetails?.testStatus = testStatus
|
"yyyy-MM-dd HH:mm:ss", Locale.getDefault()
|
||||||
|
).format(Calendar.getInstance().time)
|
||||||
|
testDetails?.appVersion = DataHolder.hemoCubeTestData?.appVersion
|
||||||
|
testDetails?.deviceId = DataHolder.hemoCubeTestData?.deviceId
|
||||||
|
testDetails?.deviceSerialNumber =
|
||||||
|
sharedPreference.getString(Constants.USER_ID, "").toString()
|
||||||
|
testDetails?.kitSerial = sharedPreference.getString(Constants.KIT_NUMBER, "").toString()
|
||||||
|
testDetails?.led1Buffer = DataHolder.hemoCubeTestData?.led1Buffer
|
||||||
|
testDetails?.led2Buffer = DataHolder.hemoCubeTestData?.led2Buffer
|
||||||
|
testDetails?.led3Buffer = DataHolder.hemoCubeTestData?.led3Buffer
|
||||||
|
testDetails?.led4Buffer = DataHolder.hemoCubeTestData?.led4Buffer
|
||||||
|
testDetails?.led1Sample = DataHolder.hemoCubeTestData?.led1Sample
|
||||||
|
testDetails?.led2Sample = DataHolder.hemoCubeTestData?.led2Sample
|
||||||
|
testDetails?.led3Sample = DataHolder.hemoCubeTestData?.led3Sample
|
||||||
|
testDetails?.led4Sample = DataHolder.hemoCubeTestData?.led4Sample
|
||||||
|
testDetails?.led1Average = DataHolder.hemoCubeTestData?.led1Average
|
||||||
|
testDetails?.led2Average = DataHolder.hemoCubeTestData?.led2Average
|
||||||
|
testDetails?.led3Average = DataHolder.hemoCubeTestData?.led3Average
|
||||||
|
testDetails?.led4Average = DataHolder.hemoCubeTestData?.led4Average
|
||||||
|
testDetails?.abs1 = DataHolder.hemoCubeTestData?.abs1
|
||||||
|
testDetails?.abs2 = DataHolder.hemoCubeTestData?.abs2
|
||||||
|
testDetails?.abs3 = DataHolder.hemoCubeTestData?.abs3
|
||||||
|
testDetails?.abs4 = DataHolder.hemoCubeTestData?.abs4
|
||||||
|
testDetails?.deviceRatio = DataHolder.hemoCubeTestData?.deviceRatio
|
||||||
|
testDetails?.predictedDenovixRatio = DataHolder.hemoCubeTestData?.predictedDenovixRatio
|
||||||
|
testDetails?.calculatedRatio = DataHolder.hemoCubeTestData?.calculatedRatio
|
||||||
|
testDetails?.coefficients = DataHolder.hemoCubeTestData?.coefficients
|
||||||
|
testDetails?.classificationResult = DataHolder.hemoCubeTestData?.classificationResult!!
|
||||||
|
testDetails?.prdClassification =
|
||||||
|
DataHolder.hemoCubeTestData?.prdClassification.toString()
|
||||||
|
testDetails?.batteryLevel = DataHolder.hemoCubeTestData?.batteryLevel.toString()
|
||||||
|
testDetails?.batteryCapacity = DataHolder.hemoCubeTestData?.batteryCapacity.toString()
|
||||||
|
testDetails?.batteryMaxCapacity =
|
||||||
|
DataHolder.hemoCubeTestData?.batteryMaxCapacity.toString()
|
||||||
|
testDetails?.batteryTemperature =
|
||||||
|
DataHolder.hemoCubeTestData?.batteryTemperature.toString()
|
||||||
|
testDetails?.batteryVoltage = DataHolder.hemoCubeTestData?.batteryVoltage.toString()
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
private fun addResultTestToDb() {
|
||||||
if (isOnline) {
|
viewModelScope.launch {
|
||||||
parseData()
|
try {
|
||||||
addResultTestToDb()
|
testDetails!!.reportUploadTime = SimpleDateFormat(
|
||||||
} else {
|
|
||||||
parseData()
|
|
||||||
testDetails?.testTime = SimpleDateFormat(
|
|
||||||
"yyyy-MM-dd HH:mm:ss", Locale.getDefault()
|
"yyyy-MM-dd HH:mm:ss", Locale.getDefault()
|
||||||
).format(Calendar.getInstance().time)
|
).format(Calendar.getInstance().time)
|
||||||
hemoCubeDao.insertAll(testDetails!!)
|
|
||||||
fireBaseUpload.postValue("Local")
|
|
||||||
}
|
|
||||||
} catch (e: Exception) {
|
|
||||||
Log.e("Testdb", "Upload failed: ${e.message}")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
when (val response = repository.addTestToDatabase(testDetails)) {
|
||||||
fun uploadHemoCubeResultToDatabaseforbuffercheckN(bufferCheckData: BufferCheckData) =
|
|
||||||
viewModelScope.launch {
|
|
||||||
addResultTestToDbforbuffercheck(bufferCheckData)
|
|
||||||
}
|
|
||||||
|
|
||||||
fun getDeviceData(deviceId: String?) = viewModelScope.launch {
|
|
||||||
deviceData.postValue(deviceId?.let { repository.getDeviceDataById(it) })
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
fun uploadHemoCubeResultToDatabaseForBufferCheck(
|
|
||||||
isOnline: Boolean,
|
|
||||||
bufferCheckData: BufferCheckData,
|
|
||||||
) =
|
|
||||||
viewModelScope.launch {
|
|
||||||
if (isOnline) {
|
|
||||||
try {
|
|
||||||
when (val response =
|
|
||||||
repository.addTestToDatabaseforBufferCheck(bufferCheckData)) {
|
|
||||||
is Response.Success -> {
|
is Response.Success -> {
|
||||||
|
val kitCount = sharedPreference.getInt(Constants.KIT_COUNT, 0)
|
||||||
|
with(sharedPreference.edit()) {
|
||||||
|
putInt(Constants.KIT_COUNT, kitCount.plus(1))
|
||||||
|
apply()
|
||||||
|
}
|
||||||
Log.i("Testdb", "Data uploaded to Firestore successfully")
|
Log.i("Testdb", "Data uploaded to Firestore successfully")
|
||||||
fireBaseUpload.postValue("Success")
|
fireBaseUpload.postValue("Success")
|
||||||
bufferCheckData.localFlag = true
|
testDetails.localFlag = true
|
||||||
hemoCubeBufferDao.insertAll(bufferCheckData)
|
hemoCubeDao.insertAll(testDetails)
|
||||||
}
|
}
|
||||||
|
|
||||||
is Response.Error -> {
|
is Response.Error -> {
|
||||||
Log.e("Testdb", "Error uploading data to Firestore: $response")
|
Log.e("Testdb", "Error uploading data to Firestore: $response")
|
||||||
fireBaseUpload.postValue("Error")
|
fireBaseUpload.postValue("Error")
|
||||||
bufferCheckData.localFlag = true
|
hemoCubeDao.insertAll(testDetails)
|
||||||
hemoCubeBufferDao.insertAll(bufferCheckData)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
else -> {}
|
||||||
}
|
}
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
Log.e("Testdb", "Exception during data upload: ${e.message}")
|
Log.e("Testdb", "Exception during data upload: ${e.message}")
|
||||||
fireBaseUpload.postValue("Error")
|
fireBaseUpload.postValue("Error")
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
hemoCubeBufferDao.insertAll(bufferCheckData)
|
|
||||||
fireBaseUpload.postValue("Local")
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun parseData() {
|
|
||||||
testDetails?.deviceRatio = DataHolder.hemocubeResult
|
|
||||||
testDetails?.resultData = DataHolder.hemoCubeTestData?.resultData.toString()
|
|
||||||
testDetails?.location = DataHolder.location
|
|
||||||
testDetails?.testTime = SimpleDateFormat(
|
|
||||||
"yyyy-MM-dd HH:mm:ss", Locale.getDefault()
|
|
||||||
).format(Calendar.getInstance().time)
|
|
||||||
testDetails?.appVersion = DataHolder.hemoCubeTestData?.appVersion
|
|
||||||
testDetails?.deviceId = DataHolder.hemoCubeTestData?.deviceId
|
|
||||||
testDetails?.deviceSerialNumber =
|
|
||||||
sharedPreference.getString(Constants.USER_ID, "").toString()
|
|
||||||
testDetails?.kitSerial = sharedPreference.getString(Constants.KIT_NUMBER, "").toString()
|
|
||||||
testDetails?.led1Buffer = DataHolder.hemoCubeTestData?.led1Buffer
|
|
||||||
testDetails?.led2Buffer = DataHolder.hemoCubeTestData?.led2Buffer
|
|
||||||
testDetails?.led3Buffer = DataHolder.hemoCubeTestData?.led3Buffer
|
|
||||||
testDetails?.led4Buffer = DataHolder.hemoCubeTestData?.led4Buffer
|
|
||||||
testDetails?.led1Sample = DataHolder.hemoCubeTestData?.led1Sample
|
|
||||||
testDetails?.led2Sample = DataHolder.hemoCubeTestData?.led2Sample
|
|
||||||
testDetails?.led3Sample = DataHolder.hemoCubeTestData?.led3Sample
|
|
||||||
testDetails?.led4Sample = DataHolder.hemoCubeTestData?.led4Sample
|
|
||||||
testDetails?.led1Average = DataHolder.hemoCubeTestData?.led1Average
|
|
||||||
testDetails?.led2Average = DataHolder.hemoCubeTestData?.led2Average
|
|
||||||
testDetails?.led3Average = DataHolder.hemoCubeTestData?.led3Average
|
|
||||||
testDetails?.led4Average = DataHolder.hemoCubeTestData?.led4Average
|
|
||||||
testDetails?.abs1 = DataHolder.hemoCubeTestData?.abs1
|
|
||||||
testDetails?.abs2 = DataHolder.hemoCubeTestData?.abs2
|
|
||||||
testDetails?.abs3 = DataHolder.hemoCubeTestData?.abs3
|
|
||||||
testDetails?.abs4 = DataHolder.hemoCubeTestData?.abs4
|
|
||||||
testDetails?.deviceRatio = DataHolder.hemoCubeTestData?.deviceRatio
|
|
||||||
testDetails?.predictedDenovixRatio = DataHolder.hemoCubeTestData?.predictedDenovixRatio
|
|
||||||
testDetails?.calculatedRatio = DataHolder.hemoCubeTestData?.calculatedRatio
|
|
||||||
testDetails?.coefficients = DataHolder.hemoCubeTestData?.coefficients
|
|
||||||
testDetails?.classificationResult = DataHolder.hemoCubeTestData?.classificationResult!!
|
|
||||||
testDetails?.prdClassification = DataHolder.hemoCubeTestData?.prdClassification.toString()
|
|
||||||
testDetails?.errorMessages = DataHolder.hemoCubeTestData?.errorMessages.toString()
|
|
||||||
testDetails?.batteryLevel = DataHolder.hemoCubeTestData?.batteryLevel.toString()
|
|
||||||
testDetails?.batteryCapacity = DataHolder.hemoCubeTestData?.batteryCapacity.toString()
|
|
||||||
testDetails?.batteryMaxCapacity = DataHolder.hemoCubeTestData?.batteryMaxCapacity.toString()
|
|
||||||
testDetails?.batteryTemperature = DataHolder.hemoCubeTestData?.batteryTemperature.toString()
|
|
||||||
testDetails?.batteryVoltage = DataHolder.hemoCubeTestData?.batteryVoltage.toString()
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun addResultTestToDb() {
|
private fun addResultTestToDbforbuffercheck(bufferCheckData: BufferCheckData) {
|
||||||
viewModelScope.launch {
|
viewModelScope.launch {
|
||||||
try {
|
try {
|
||||||
testDetails!!.reportUploadTime = SimpleDateFormat(
|
|
||||||
|
when (val response =
|
||||||
|
repository.addTestToDatabaseforBufferCheck(bufferCheckData)) {
|
||||||
|
is Response.Success -> {
|
||||||
|
Log.i("Testdb", "Data uploaded to Firestore successfully")
|
||||||
|
fireBaseUpload.postValue("Success")
|
||||||
|
}
|
||||||
|
|
||||||
|
is Response.Error -> {
|
||||||
|
Log.e("Testdb", "Error uploading data to Firestore: $response")
|
||||||
|
fireBaseUpload.postValue("Error")
|
||||||
|
}
|
||||||
|
|
||||||
|
else -> {}
|
||||||
|
}
|
||||||
|
} catch (e: Exception) {
|
||||||
|
Log.e("Testdb", "Exception during data upload: ${e.message}")
|
||||||
|
fireBaseUpload.postValue("Error")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun bulkAddResultTestToDb(userData: HemoCubeTestData) {
|
||||||
|
viewModelScope.launch {
|
||||||
|
userData.reportUploadTime = SimpleDateFormat(
|
||||||
"yyyy-MM-dd HH:mm:ss", Locale.getDefault()
|
"yyyy-MM-dd HH:mm:ss", Locale.getDefault()
|
||||||
).format(Calendar.getInstance().time)
|
).format(Calendar.getInstance().time)
|
||||||
|
when (repository.addTestToDatabase(userData)) {
|
||||||
when (val response = repository.addTestToDatabase(testDetails)) {
|
|
||||||
is Response.Success -> {
|
is Response.Success -> {
|
||||||
val kitCount = sharedPreference.getInt(Constants.KIT_COUNT, 0)
|
fireBaseBulkUpload.postValue("Success")
|
||||||
with(sharedPreference.edit()) {
|
updateLocalFlag(userData._id)
|
||||||
putInt(Constants.KIT_COUNT, kitCount.plus(1))
|
|
||||||
apply()
|
|
||||||
}
|
|
||||||
Log.i("Testdb", "Data uploaded to Firestore successfully")
|
|
||||||
fireBaseUpload.postValue("Success")
|
|
||||||
testDetails.localFlag = true
|
|
||||||
hemoCubeDao.insertAll(testDetails)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
is Response.Error -> {
|
else -> {
|
||||||
Log.e("Testdb", "Error uploading data to Firestore: $response")
|
fireBaseBulkUpload.postValue("Error")
|
||||||
fireBaseUpload.postValue("Error")
|
|
||||||
hemoCubeDao.insertAll(testDetails)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (e: Exception) {
|
|
||||||
Log.e("Testdb", "Exception during data upload: ${e.message}")
|
|
||||||
fireBaseUpload.postValue("Error")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fun bulkAddResultKitTestToDb(bufferCheckData: BufferCheckData) {
|
|
||||||
viewModelScope.launch {
|
|
||||||
bufferCheckData.reportUploadTime = SimpleDateFormat(
|
|
||||||
"yyyy-MM-dd HH:mm:ss", Locale.getDefault()
|
|
||||||
).format(Calendar.getInstance().time)
|
|
||||||
when (repository.addTestToDatabaseforBufferCheck(bufferCheckData)) {
|
|
||||||
is Response.Success -> {
|
|
||||||
fireBaseBulkUpload.postValue("Success")
|
|
||||||
updateBufferLocalFlag(bufferCheckData._id)
|
|
||||||
}
|
|
||||||
|
|
||||||
else -> {
|
|
||||||
fireBaseBulkUpload.postValue("Error")
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
private fun addResultTestToDbforbuffercheck(bufferCheckData: BufferCheckData) {
|
private fun updateLocalFlag(userId: String) = viewModelScope.launch {
|
||||||
viewModelScope.launch {
|
|
||||||
try {
|
|
||||||
|
|
||||||
when (val response =
|
|
||||||
repository.addTestToDatabaseforBufferCheck(bufferCheckData)) {
|
|
||||||
is Response.Success -> {
|
|
||||||
Log.i("Testdb", "Data uploaded to Firestore successfully")
|
|
||||||
fireBaseUpload.postValue("Success")
|
|
||||||
}
|
|
||||||
|
|
||||||
is Response.Error -> {
|
|
||||||
Log.e("Testdb", "Error uploading data to Firestore: $response")
|
|
||||||
fireBaseUpload.postValue("Error")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} catch (e: Exception) {
|
|
||||||
Log.e("Testdb", "Exception during data upload: ${e.message}")
|
|
||||||
fireBaseUpload.postValue("Error")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun updateBufferLocalFlag(bufferId: String) =
|
|
||||||
viewModelScope.launch {
|
|
||||||
hemoCubeBufferDao.updateFieldById(id = bufferId, true)
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
fun bulkAddResultTestToDb(userData: HemoCubeTestData) {
|
|
||||||
viewModelScope.launch {
|
|
||||||
userData.reportUploadTime = SimpleDateFormat(
|
|
||||||
"yyyy-MM-dd HH:mm:ss", Locale.getDefault()
|
|
||||||
).format(Calendar.getInstance().time)
|
|
||||||
when (repository.addTestToDatabase(userData)) {
|
|
||||||
is Response.Success -> {
|
|
||||||
fireBaseBulkUpload.postValue("Success")
|
|
||||||
updateLocalFlag(userData._id)
|
|
||||||
}
|
|
||||||
|
|
||||||
else -> {
|
|
||||||
fireBaseBulkUpload.postValue("Error")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun updateLocalFlag(userId: String) =
|
|
||||||
viewModelScope.launch {
|
|
||||||
hemoCubeDao.updateFieldById(id = userId, true)
|
hemoCubeDao.updateFieldById(id = userId, true)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun addUser(userData: HemoCubeTestData) =
|
fun addUser(userData: HemoCubeTestData) = viewModelScope.launch {
|
||||||
viewModelScope.launch {
|
|
||||||
hemoCubeDao.insertAll(userData)
|
hemoCubeDao.insertAll(userData)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun deleteById(userId: String) = viewModelScope.launch {
|
fun deleteById(userId: String) = viewModelScope.launch {
|
||||||
hemoCubeDao.deleteById(id = userId)
|
hemoCubeDao.deleteById(id = userId)
|
||||||
}
|
|
||||||
|
|
||||||
fun getBatteryLevel(): Float? {
|
|
||||||
val batteryPct: Float? = batteryStatus?.let { intent ->
|
|
||||||
val level: Int =
|
|
||||||
intent.getIntExtra(
|
|
||||||
BatteryManager.EXTRA_LEVEL,
|
|
||||||
-1
|
|
||||||
)
|
|
||||||
val scale: Int =
|
|
||||||
intent.getIntExtra(
|
|
||||||
BatteryManager.EXTRA_SCALE,
|
|
||||||
-1
|
|
||||||
)
|
|
||||||
level * 100 / scale.toFloat()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return batteryPct
|
fun getBatteryLevel(): Float? {
|
||||||
}
|
val batteryPct: Float? = batteryStatus?.let { intent ->
|
||||||
|
val level: Int = intent.getIntExtra(BatteryManager.EXTRA_LEVEL, -1)
|
||||||
|
val scale: Int = intent.getIntExtra(BatteryManager.EXTRA_SCALE, -1)
|
||||||
|
level * 100 / scale.toFloat()
|
||||||
|
}
|
||||||
|
|
||||||
fun getBatteryTemperature()
|
return batteryPct
|
||||||
|
|
||||||
: Float
|
|
||||||
? {
|
|
||||||
val batteryTemp: Float? = batteryStatus?.let { intent ->
|
|
||||||
val temperature = intent?.getIntExtra(
|
|
||||||
BatteryManager.EXTRA_TEMPERATURE,
|
|
||||||
0
|
|
||||||
) ?: 0
|
|
||||||
temperature.toFloat() / 10
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return batteryTemp
|
fun getBatteryTemperature(): Float? {
|
||||||
|
val batteryTemp: Float? = batteryStatus?.let { intent ->
|
||||||
|
val temperature = intent?.getIntExtra(BatteryManager.EXTRA_TEMPERATURE, 0) ?: 0
|
||||||
|
temperature.toFloat() / 10
|
||||||
|
}
|
||||||
|
|
||||||
|
return batteryTemp
|
||||||
|
}
|
||||||
|
|
||||||
|
fun getBatteryVoltage(context: Context): Float {
|
||||||
|
val batteryIntent =
|
||||||
|
context.registerReceiver(null, IntentFilter(Intent.ACTION_BATTERY_CHANGED))
|
||||||
|
val voltage = batteryIntent?.getIntExtra(BatteryManager.EXTRA_VOLTAGE, 0) ?: 0
|
||||||
|
|
||||||
|
// milli-volts to volts
|
||||||
|
return voltage.toFloat() / 1000
|
||||||
|
}
|
||||||
|
|
||||||
|
fun getBatteryCapacity(context: Context): Int {
|
||||||
|
val batteryManager = context.getSystemService(Context.BATTERY_SERVICE) as BatteryManager
|
||||||
|
val currentCapacity =
|
||||||
|
batteryManager.getIntProperty(BatteryManager.BATTERY_PROPERTY_CHARGE_COUNTER)
|
||||||
|
|
||||||
|
return currentCapacity
|
||||||
|
}
|
||||||
|
|
||||||
|
fun getBatteryMaxCapacity(context: Context): Float {
|
||||||
|
val batteryManager = context.getSystemService(Context.BATTERY_SERVICE) as BatteryManager
|
||||||
|
val designCapacity =
|
||||||
|
batteryManager.getIntProperty(BatteryManager.BATTERY_PROPERTY_CAPACITY)
|
||||||
|
val currentCapacity =
|
||||||
|
batteryManager.getIntProperty(BatteryManager.BATTERY_PROPERTY_CHARGE_COUNTER)
|
||||||
|
|
||||||
|
// Calculate the estimated maximum battery capacity in mAh
|
||||||
|
val maxCapacity = currentCapacity.toFloat() / designCapacity.toFloat() * 100
|
||||||
|
|
||||||
|
return maxCapacity
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun getBatteryVoltage(context: Context): Float {
|
|
||||||
val batteryIntent =
|
|
||||||
context.registerReceiver(
|
|
||||||
null,
|
|
||||||
IntentFilter(Intent.ACTION_BATTERY_CHANGED)
|
|
||||||
)
|
|
||||||
val voltage = batteryIntent?.getIntExtra(
|
|
||||||
BatteryManager.EXTRA_VOLTAGE,
|
|
||||||
0
|
|
||||||
) ?: 0
|
|
||||||
|
|
||||||
// milli-volts to volts
|
|
||||||
return voltage.toFloat() / 1000
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
fun getBatteryCapacity(context: Context): Int {
|
|
||||||
val batteryManager =
|
|
||||||
context.getSystemService(Context.BATTERY_SERVICE) as BatteryManager
|
|
||||||
val currentCapacity =
|
|
||||||
batteryManager.getIntProperty(BatteryManager.BATTERY_PROPERTY_CHARGE_COUNTER)
|
|
||||||
|
|
||||||
return currentCapacity
|
|
||||||
}
|
|
||||||
|
|
||||||
fun getBatteryMaxCapacity(context: Context): Float {
|
|
||||||
val batteryManager = context.getSystemService(Context.BATTERY_SERVICE) as BatteryManager
|
|
||||||
val designCapacity =
|
|
||||||
batteryManager.getIntProperty(BatteryManager.BATTERY_PROPERTY_CAPACITY)
|
|
||||||
val currentCapacity =
|
|
||||||
batteryManager.getIntProperty(BatteryManager.BATTERY_PROPERTY_CHARGE_COUNTER)
|
|
||||||
|
|
||||||
// Calculate the estimated maximum battery capacity in mAh
|
|
||||||
val maxCapacity = currentCapacity.toFloat() / designCapacity.toFloat() * 100
|
|
||||||
|
|
||||||
return maxCapacity
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -21,7 +21,6 @@ import androidx.core.content.ContextCompat
|
|||||||
import androidx.core.view.get
|
import androidx.core.view.get
|
||||||
import com.example.hpostesting.data.DataHolder
|
import com.example.hpostesting.data.DataHolder
|
||||||
import com.example.hpostesting.data.constant.Constants
|
import com.example.hpostesting.data.constant.Constants
|
||||||
import com.example.hpostesting.data.constant.LanguageManager
|
|
||||||
import com.example.hpostesting.presentation.testRight.UsbService
|
import com.example.hpostesting.presentation.testRight.UsbService
|
||||||
import com.hoho.android.usbserial.driver.UsbSerialDriver
|
import com.hoho.android.usbserial.driver.UsbSerialDriver
|
||||||
import com.hoho.android.usbserial.driver.UsbSerialProber
|
import com.hoho.android.usbserial.driver.UsbSerialProber
|
||||||
@@ -73,12 +72,6 @@ open class HemocubeActivity : AppCompatActivity() {
|
|||||||
viewModel.isServiceConnected = false
|
viewModel.isServiceConnected = false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
override fun attachBaseContext(newBase: Context?) {
|
|
||||||
val languageCode = LanguageManager.getSavedLanguage(newBase!!)
|
|
||||||
LanguageManager.setLocale(newBase, languageCode)
|
|
||||||
super.attachBaseContext(newBase)
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
override fun onCreate(savedInstanceState: Bundle?) {
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
super.onCreate(savedInstanceState)
|
super.onCreate(savedInstanceState)
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ class UsbService : Service() {
|
|||||||
fun connect(driver: UsbSerialDriver, connection: UsbDeviceConnection) {
|
fun connect(driver: UsbSerialDriver, connection: UsbDeviceConnection) {
|
||||||
mPort = driver.ports[0] // Most devices have just one port (port 0)
|
mPort = driver.ports[0] // Most devices have just one port (port 0)
|
||||||
mPort.open(connection)
|
mPort.open(connection)
|
||||||
mPort.setParameters(9600, 8, UsbSerialPort.STOPBITS_1, UsbSerialPort.PARITY_NONE)
|
mPort.setParameters(115200, 8, UsbSerialPort.STOPBITS_1, UsbSerialPort.PARITY_NONE)
|
||||||
isUsbConnected = true
|
isUsbConnected = true
|
||||||
Log.d(TAG, "My Usb Connected ${mPort.driver}")
|
Log.d(TAG, "My Usb Connected ${mPort.driver}")
|
||||||
|
|
||||||
|
|||||||
@@ -31,17 +31,17 @@
|
|||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toBottomOf="@id/tv_title" />
|
app:layout_constraintTop_toBottomOf="@id/tv_title" />
|
||||||
|
|
||||||
<!-- <TextView-->
|
<!-- <TextView-->
|
||||||
<!-- android:id="@+id/tv_subtitle3"-->
|
<!-- android:id="@+id/tv_subtitle3"-->
|
||||||
<!-- style="@style/title2"-->
|
<!-- style="@style/title2"-->
|
||||||
<!-- android:layout_width="0dp"-->
|
<!-- android:layout_width="0dp"-->
|
||||||
<!-- android:layout_height="wrap_content"-->
|
<!-- android:layout_height="wrap_content"-->
|
||||||
<!-- android:layout_marginHorizontal="24dp"-->
|
<!-- android:layout_marginHorizontal="24dp"-->
|
||||||
<!-- android:layout_marginTop="16dp"-->
|
<!-- android:layout_marginTop="16dp"-->
|
||||||
<!-- android:text="@string/step5"-->
|
<!-- android:text="@string/step5"-->
|
||||||
<!-- 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/tv_subtitle2" />-->
|
<!-- app:layout_constraintTop_toBottomOf="@id/tv_subtitle2" />-->
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/tv_name"
|
android:id="@+id/tv_name"
|
||||||
@@ -147,35 +147,8 @@
|
|||||||
app:layout_constraintHorizontal_bias="1.0"
|
app:layout_constraintHorizontal_bias="1.0"
|
||||||
app:layout_constraintStart_toEndOf="@id/et_abha_id"
|
app:layout_constraintStart_toEndOf="@id/et_abha_id"
|
||||||
app:layout_constraintTop_toTopOf="@id/et_abha_id" />
|
app:layout_constraintTop_toTopOf="@id/et_abha_id" />
|
||||||
<Button
|
|
||||||
android:visibility="gone"
|
|
||||||
android:id="@+id/btn_samplestart"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginHorizontal="16dp"
|
|
||||||
android:layout_marginTop="24dp"
|
|
||||||
android:clickable="false"
|
|
||||||
android:text="@string/Start_Sample"
|
|
||||||
android:textColor="@color/white"
|
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
|
||||||
app:layout_constraintTop_toBottomOf="@id/btn_placebuffer" />
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<Button
|
|
||||||
android:id="@+id/btn_placebuffer"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginHorizontal="16dp"
|
|
||||||
android:layout_marginTop="24dp"
|
|
||||||
android:clickable="false"
|
|
||||||
android:text="@string/place_buffer"
|
|
||||||
android:textColor="@color/white"
|
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
|
||||||
app:layout_constraintTop_toBottomOf="@id/btn_submit" />
|
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
android:visibility="gone"
|
android:visibility="gone"
|
||||||
android:id="@+id/btn_submit"
|
android:id="@+id/btn_submit"
|
||||||
@@ -195,49 +168,72 @@
|
|||||||
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="40dp"
|
android:layout_height="80dp"
|
||||||
android:layout_marginHorizontal="24dp"
|
android:layout_marginHorizontal="24dp"
|
||||||
android:layout_marginTop="72dp"
|
android:layout_marginTop="172dp"
|
||||||
android:gravity="center"
|
android:gravity="center"
|
||||||
android:textColor="@color/red"
|
android:textColor="@color/red"
|
||||||
android:textSize="12sp"
|
android:textSize="18sp"
|
||||||
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" />
|
||||||
|
|
||||||
<ScrollView
|
<!-- <com.google.android.material.textfield.TextInputLayout-->
|
||||||
android:layout_width="match_parent"
|
<!-- android:id="@+id/til_blood_group"-->
|
||||||
android:layout_height="wrap_content"
|
<!-- style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox.ExposedDropdownMenu"-->
|
||||||
android:layout_marginHorizontal="24dp"
|
<!-- android:layout_width="match_parent"-->
|
||||||
android:layout_marginTop="12dp"
|
<!-- android:layout_height="wrap_content"-->
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
<!-- android:layout_marginHorizontal="24dp"-->
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
<!-- android:layout_marginTop="16dp"-->
|
||||||
app:layout_constraintTop_toBottomOf="@id/error_message">
|
<!-- app:layout_constraintEnd_toEndOf="parent"-->
|
||||||
|
<!-- app:layout_constraintStart_toStartOf="parent"-->
|
||||||
|
<!-- app:layout_constraintTop_toBottomOf="@id/tv_subtitle4">-->
|
||||||
|
|
||||||
<TextView
|
<!-- <AutoCompleteTextView-->
|
||||||
android:id="@+id/tv_device_messages"
|
<!-- android:id="@+id/et_blood_group"-->
|
||||||
style="@style/title1_1"
|
<!-- android:layout_width="match_parent"-->
|
||||||
android:layout_width="match_parent"
|
<!-- android:layout_height="wrap_content"-->
|
||||||
android:layout_height="wrap_content"
|
<!-- android:hint="@string/select_blood_group"-->
|
||||||
android:gravity="center"
|
<!-- android:inputType="none"-->
|
||||||
android:textColor="@color/black"
|
<!-- android:labelFor="@id/til_blood_group"-->
|
||||||
android:textSize="11sp"
|
<!-- app:simpleItems="@array/blood_group" />-->
|
||||||
android:visibility="gone" />
|
|
||||||
</ScrollView>
|
<!-- </com.google.android.material.textfield.TextInputLayout>-->
|
||||||
|
|
||||||
|
<!-- <Button-->
|
||||||
|
<!-- android:id="@+id/btn_kit"-->
|
||||||
|
<!-- android:layout_width="wrap_content"-->
|
||||||
|
<!-- android:layout_height="wrap_content"-->
|
||||||
|
<!-- android:layout_margin="10dp"-->
|
||||||
|
<!-- android:text="@string/new_kit"-->
|
||||||
|
<!-- android:textColor="@color/white"-->
|
||||||
|
<!-- app:layout_constraintBottom_toBottomOf="parent"-->
|
||||||
|
<!-- app:layout_constraintEnd_toEndOf="parent"-->
|
||||||
|
<!-- app:layout_constraintStart_toStartOf="parent" />-->
|
||||||
|
|
||||||
|
<!-- <Button-->
|
||||||
|
<!-- android:id="@+id/btn_buffer"-->
|
||||||
|
<!-- android:layout_width="wrap_content"-->
|
||||||
|
<!-- android:layout_height="wrap_content"-->
|
||||||
|
<!-- android:text="@string/new_buffer"-->
|
||||||
|
<!-- android:textColor="@color/white"-->
|
||||||
|
<!-- android:layout_margin="10dp"-->
|
||||||
|
<!-- app:layout_constraintBottom_toBottomOf="parent"-->
|
||||||
|
<!-- app:layout_constraintStart_toStartOf="parent"-->
|
||||||
|
<!-- app:layout_constraintEnd_toStartOf="@id/btn_kit"/>-->
|
||||||
|
|
||||||
|
<!-- <Button-->
|
||||||
|
<!-- android:id="@+id/btn_read"-->
|
||||||
|
<!-- android:layout_width="wrap_content"-->
|
||||||
|
<!-- android:layout_height="wrap_content"-->
|
||||||
|
<!-- android:text="@string/read"-->
|
||||||
|
<!-- android:layout_margin="16dp"-->
|
||||||
|
<!-- android:clickable="false"-->
|
||||||
|
<!-- app:layout_constraintTop_toBottomOf="@id/btn_set_reference"-->
|
||||||
|
<!-- app:layout_constraintStart_toStartOf="parent" />-->
|
||||||
|
|
||||||
|
<!-- </androidx.constraintlayout.widget.ConstraintLayout>-->
|
||||||
|
|
||||||
<Button
|
|
||||||
android:visibility="gone"
|
|
||||||
android:id="@+id/btn_digitalCard"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginHorizontal="16dp"
|
|
||||||
android:layout_marginTop="24dp"
|
|
||||||
android:clickable="false"
|
|
||||||
android:text="DigitalCard View"
|
|
||||||
android:textColor="@color/white"
|
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
|
||||||
app:layout_constraintTop_toBottomOf="@id/error_message" />
|
|
||||||
<ProgressBar
|
<ProgressBar
|
||||||
android:id="@+id/progressBar"
|
android:id="@+id/progressBar"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
@@ -253,5 +249,5 @@
|
|||||||
app:layout_constraintTop_toTopOf="parent" />
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
</layout>
|
</layout>
|
||||||
|
|
||||||
|
|||||||
@@ -1,9 +1,36 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<!-- SlideshowFragment layout -->
|
||||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
tools:context="com.example.hpostesting.presentation.dashboard.SlideshowFragment">
|
tools:context="com.example.hpostesting.presentation.dashboard.SlideshowFragment">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:visibility="gone"
|
||||||
|
android:id="@+id/text_slideshow"
|
||||||
|
style="@style/title1"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_margin="24dp"
|
||||||
|
android:textAlignment="center"
|
||||||
|
android:textSize="20sp"
|
||||||
|
android:text="@string/to_be_launched_in_next_version_of_the_app"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
|
<!-- Language Settings -->
|
||||||
|
<FrameLayout
|
||||||
|
android:id="@+id/fragment_container"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="0dp"
|
||||||
|
app:layout_constraintTop_toBottomOf="@id/text_slideshow"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent">
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</FrameLayout>
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
@@ -48,6 +48,20 @@
|
|||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toBottomOf="@id/userID"
|
app:layout_constraintTop_toBottomOf="@id/userID"
|
||||||
tools:text="UserID: MohamedKaif" />
|
tools:text="UserID: MohamedKaif" />
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/teststatus"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
style="@style/title1_1"
|
||||||
|
android:layout_marginTop="4dp"
|
||||||
|
android:layout_marginStart="16dp"
|
||||||
|
android:gravity="start"
|
||||||
|
android:textColor="@color/black"
|
||||||
|
android:textSize="14sp"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toBottomOf="@id/bloodGroup"
|
||||||
|
tools:text="Test Status: Completed"/>
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/time"
|
android:id="@+id/time"
|
||||||
@@ -61,9 +75,8 @@
|
|||||||
android:textSize="14sp"
|
android:textSize="14sp"
|
||||||
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/bloodGroup"
|
app:layout_constraintTop_toBottomOf="@id/teststatus"
|
||||||
tools:text="Test Status: Completed" />
|
tools:text="startedAt: yyyy-MM-dd HH:mm:ss" />
|
||||||
|
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
|
|
||||||
</androidx.cardview.widget.CardView>
|
</androidx.cardview.widget.CardView>
|
||||||
|
|||||||
@@ -255,9 +255,5 @@
|
|||||||
<string name="place_sample">सैम्पल रखें</string>
|
<string name="place_sample">सैम्पल रखें</string>
|
||||||
<string name="invalid">अमान्य</string>
|
<string name="invalid">अमान्य</string>
|
||||||
<string name="error">त्रुटि</string>
|
<string name="error">त्रुटि</string>
|
||||||
<string name="language_update">भाषा सफलतापूर्वक अपडेट की गई है</string>
|
|
||||||
<string name="select_language">अपनी पसंदीदा भाषा का चयन करें</string>
|
|
||||||
<string name="app_language">ऐप भाषा</string>
|
|
||||||
<string name="add_blood_group">रक्त समूह जोड़ें</string>
|
|
||||||
<string name="ok">ठीक है</string>
|
|
||||||
</resources>
|
</resources>
|
||||||
@@ -170,7 +170,7 @@
|
|||||||
<string name="aadhaar_in_tv"><b>ಆಧಾರ್ ಸಂಖ್ಯೆ</b></string>
|
<string name="aadhaar_in_tv"><b>ಆಧಾರ್ ಸಂಖ್ಯೆ</b></string>
|
||||||
<string name="please_use_official_abha_app_to_create_abha_id_and_come_back">ದಯವಿಟ್ಟು "ಆಧಿಕಾರಿ ABHA ಆಪ್" ಅನ್ನು ಬಳಸಿ ABHA ಐಡಿ ರಚಿಸಿ ಮತ್ತು ಹಿಂತಿರುಗಿ ಬನ್ನಿ.</string>
|
<string name="please_use_official_abha_app_to_create_abha_id_and_come_back">ದಯವಿಟ್ಟು "ಆಧಿಕಾರಿ ABHA ಆಪ್" ಅನ್ನು ಬಳಸಿ ABHA ಐಡಿ ರಚಿಸಿ ಮತ್ತು ಹಿಂತಿರುಗಿ ಬನ್ನಿ.</string>
|
||||||
<string name="please_enter_aadhaar">ಮುಂದುವರಿಸಲು ದಯವಿಟ್ಟು ಆಧಾರ್ ಸಂಖ್ಯೆಯನ್ನು ನಮೂದಿಸಿ</string>
|
<string name="please_enter_aadhaar">ಮುಂದುವರಿಸಲು ದಯವಿಟ್ಟು ಆಧಾರ್ ಸಂಖ್ಯೆಯನ್ನು ನಮೂದಿಸಿ</string>
|
||||||
<string name="scan_qr_code_of_the_kit">ಕಿಟ್ನ ಕ್ಯೂಆರ್ ಕೋಡ್ ಅನ್ನು ಸ್ಕ್ಯಾನ್ ಮಾಡಿ</string>
|
<string name="scan_qr_code_of_the_kit">ಕಿಟ್ ಯಾವಾಗಲೂ QR ಕೋಡ್ ಸ್ಕ್ಯಾನ್ ಮಾಡಿ</string>
|
||||||
<string name="enter_kit_serial_number_manually">ಕಿಟ್ ಸೀರಿಯಲ್ ಸಂಖ್ಯೆಯನ್ನು ಕೈಯಿಂದ ನಮೂದಿಸಿ</string>
|
<string name="enter_kit_serial_number_manually">ಕಿಟ್ ಸೀರಿಯಲ್ ಸಂಖ್ಯೆಯನ್ನು ಕೈಯಿಂದ ನಮೂದಿಸಿ</string>
|
||||||
<string name="serial_number">ಸೀರಿಯಲ್ ಸಂಖ್ಯೆ</string>
|
<string name="serial_number">ಸೀರಿಯಲ್ ಸಂಖ್ಯೆ</string>
|
||||||
<string name="set_baseline_reference_again">ಬೇಸ್ಲೈನ್/ಸಂದರ್ಭ ಹೊಂದಿಸಿರಾ?</string>
|
<string name="set_baseline_reference_again">ಬೇಸ್ಲೈನ್/ಸಂದರ್ಭ ಹೊಂದಿಸಿರಾ?</string>
|
||||||
@@ -255,11 +255,5 @@
|
|||||||
<string name="place_sample">ನಮೂನೆ ಇಟ್ಟುಕೊಳ್ಳಿ</string>
|
<string name="place_sample">ನಮೂನೆ ಇಟ್ಟುಕೊಳ್ಳಿ</string>
|
||||||
<string name="invalid">ಅಮಾನ್ಯ</string>
|
<string name="invalid">ಅಮಾನ್ಯ</string>
|
||||||
<string name="error">ದೋಷ</string>
|
<string name="error">ದೋಷ</string>
|
||||||
<string name="language_update">ಭಾಷೆ ಯಶಸ್ವಿಯಾಗಿ ನವೀಕರಿಸಲಾಗಿದೆ</string>
|
|
||||||
<string name="select_language">ನಿಮ್ಮ ಆದರಿತ ಭಾಷೆಯನ್ನು ಆಯ್ಕೆ ಮಾಡಿ</string>
|
|
||||||
<string name="app_language">ಅಪ್ಲಿಕೇಶನ್ ಭಾಷೆ</string>
|
|
||||||
<string name="add_blood_group">ರಕ್ತ ಗುಂಡನ್ನು ಸೇರಿಸಿ</string>
|
|
||||||
<string name="ok">ಸರಿ</string>
|
|
||||||
<!-- Add translations for other strings -->
|
|
||||||
|
|
||||||
</resources>
|
</resources>
|
||||||
@@ -155,7 +155,6 @@
|
|||||||
<string name="is_patient_married_yes_no">Is Patient Married? (Yes/No)</string>
|
<string name="is_patient_married_yes_no">Is Patient Married? (Yes/No)</string>
|
||||||
<string name="category">Category</string>
|
<string name="category">Category</string>
|
||||||
<string name="blood_group">Blood Group</string>
|
<string name="blood_group">Blood Group</string>
|
||||||
<string name="add_blood_group">Add Blood Group</string>
|
|
||||||
<string name="digital_card">Digital Counselling Card</string>
|
<string name="digital_card">Digital Counselling Card</string>
|
||||||
<string name="patient_medical_records">Patient Medical Records</string>
|
<string name="patient_medical_records">Patient Medical Records</string>
|
||||||
<string name="patient_address_details">Patient Address Details</string>
|
<string name="patient_address_details">Patient Address Details</string>
|
||||||
@@ -252,13 +251,9 @@
|
|||||||
<string name="sample_started">Sample Started</string>
|
<string name="sample_started">Sample Started</string>
|
||||||
<string name="buffer_completed">Buffer Completed</string>
|
<string name="buffer_completed">Buffer Completed</string>
|
||||||
<string name="buffer_started">Buffer Started</string>
|
<string name="buffer_started">Buffer Started</string>
|
||||||
<string name="power_bank">Connect with Power Bank</string>
|
|
||||||
<string name="start">Start</string>
|
<string name="start">Start</string>
|
||||||
<string name="place_sample">Place Sample</string>
|
<string name="place_sample">Place Sample</string>
|
||||||
<string name="invalid">Invalid</string>
|
<string name="invalid">Invalid</string>
|
||||||
<string name="error">Error</string>
|
<string name="error">Error</string>
|
||||||
<string name="language_update">Language updated successfully</string>
|
|
||||||
<string name="select_language">Select your preferred language</string>
|
|
||||||
<string name="app_language">App Language</string>
|
|
||||||
<string name="ok">OK</string>
|
|
||||||
</resources>
|
</resources>
|
||||||
@@ -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="24577" /> <!-- 0x6015: FT230X, FT231X, FT234XD -->
|
<usb-device vendor-id="1027" product-id="24597" /> <!-- 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