From f048335f77c993a4fbe99ad27b3ca06cdaaa1514 Mon Sep 17 00:00:00 2001 From: Mariya Date: Wed, 13 Dec 2023 19:12:55 +0530 Subject: [PATCH 01/13] gradle version changed --- app/build.gradle | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index ff27811..256eac2 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -19,8 +19,8 @@ android { applicationId "in.sminnovations.hpostesting.quality" minSdk 21 targetSdk 34 - versionCode 44 - versionName "2.1.45" + versionCode 46 + versionName "2.1.46" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" } From 3aeb7ef5437469b19f80034aa0c9ed77864df5ae Mon Sep 17 00:00:00 2001 From: Pritimay Sarkar Date: Wed, 13 Dec 2023 18:55:41 +0530 Subject: [PATCH 02/13] coeffs for dev4 --- .../hpostesting/data/constant/Constants.kt | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/app/src/main/java/com/example/hpostesting/data/constant/Constants.kt b/app/src/main/java/com/example/hpostesting/data/constant/Constants.kt index 78e1020..0eae6c2 100644 --- a/app/src/main/java/com/example/hpostesting/data/constant/Constants.kt +++ b/app/src/main/java/com/example/hpostesting/data/constant/Constants.kt @@ -107,6 +107,18 @@ object Constants { listOf(0.0305, 0.2067), // LED3, 555nm listOf(0.0258, 0.5534) // LED4, 560nm ), + "HCV-000-3003" to listOf( + listOf(0.723142, -0.09135), // LED1, 435nm + listOf(0.581462456, -0.58502), // LED2, 415nm + listOf(0.1964, 0.011565), // LED3, 555nm + listOf(1.0, 0.0) // LED4 + ), + "HCV-000-3004" to listOf( + listOf(1.6837, -1.1417), // LED1, 435nm + listOf(0.581462456, -0.58502), // LED2, 415nm + listOf(0.2241, -0.0106), // LED3, 555nm + listOf(1.0, 0.0) // LED4 + ), ) const val INCUBATION_TIME_MIN = 0 @@ -126,6 +138,18 @@ object Constants { 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), ) ) } \ No newline at end of file From aa8a991fbbe55101825f3bf628385a6bd57cef0a Mon Sep 17 00:00:00 2001 From: Pritimay Sarkar Date: Thu, 14 Dec 2023 14:53:53 +0530 Subject: [PATCH 03/13] release 2.1.52 for qa --- app/build.gradle | 4 +- .../hpostesting/data/constant/Constants.kt | 85 ++++++++++++++++++- 2 files changed, 84 insertions(+), 5 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 256eac2..7fe82c8 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -19,8 +19,8 @@ android { applicationId "in.sminnovations.hpostesting.quality" minSdk 21 targetSdk 34 - versionCode 46 - versionName "2.1.46" + versionCode 52 + versionName "2.1.52" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" } diff --git a/app/src/main/java/com/example/hpostesting/data/constant/Constants.kt b/app/src/main/java/com/example/hpostesting/data/constant/Constants.kt index 0eae6c2..e8f028e 100644 --- a/app/src/main/java/com/example/hpostesting/data/constant/Constants.kt +++ b/app/src/main/java/com/example/hpostesting/data/constant/Constants.kt @@ -63,7 +63,14 @@ object Constants { "HC-V1-020", "HCV-000-3001", "HCV-000-3002", - "devuser", + "HCV-000-3003", + "HCV-000-3004", + "HCV-000-3005", + "HCV-000-3006", + "HCV-000-3007", + "HCV-000-3008", + "HCV-000-3009", + "HCV-000-3010" ) const val password = "SMI@12345" @@ -114,9 +121,45 @@ object Constants { listOf(1.0, 0.0) // LED4 ), "HCV-000-3004" to listOf( - listOf(1.6837, -1.1417), // LED1, 435nm + listOf(1.7272, -1.1977), // LED1, 435nm listOf(0.581462456, -0.58502), // LED2, 415nm - listOf(0.2241, -0.0106), // LED3, 555nm + listOf(0.2304, -0.0145), // LED3, 555nm + listOf(1.0, 0.0) // LED4 + ), + "HCV-000-3005" 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-3006" 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-3007" 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-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 ), ) @@ -150,6 +193,42 @@ object Constants { 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), ) ) } \ No newline at end of file From dfe39fb4605c93d39b7cce16af01153d9b3d00a5 Mon Sep 17 00:00:00 2001 From: Mariya Date: Wed, 13 Dec 2023 18:56:40 +0530 Subject: [PATCH 04/13] gradle version changed --- app/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/build.gradle b/app/build.gradle index 7fe82c8..89ca91f 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -16,7 +16,7 @@ android { // prod - production, preprod - preproduction, quality - qc, defaultConfig { - applicationId "in.sminnovations.hpostesting.quality" + applicationId "in.sminnovations.hpostesting" minSdk 21 targetSdk 34 versionCode 52 From bf73ea70b8c740e7cab770717d001dc4c2457aa3 Mon Sep 17 00:00:00 2001 From: Kaif Date: Thu, 14 Dec 2023 16:56:39 +0530 Subject: [PATCH 05/13] Changes for new Arduieno Device --- .../example/hpostesting/data/constant/Constants.kt | 4 ++-- .../presentation/hemocube/HemoCubeFragment.kt | 12 ++++++++++-- app/src/main/res/xml/device_filter.xml | 2 +- 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/app/src/main/java/com/example/hpostesting/data/constant/Constants.kt b/app/src/main/java/com/example/hpostesting/data/constant/Constants.kt index e8f028e..622b5f4 100644 --- a/app/src/main/java/com/example/hpostesting/data/constant/Constants.kt +++ b/app/src/main/java/com/example/hpostesting/data/constant/Constants.kt @@ -27,8 +27,8 @@ object Constants { const val DEVICE_TYPE_TEST_RIGHT = "TEST_RIGHT" const val DEVICE_VENDOR_ID = 1027 - const val HOMO_CUBE_ID = 29987 - const val VENDOR_ID = 6790 + const val HOMO_CUBE_ID = 24577 + const val VENDOR_ID = 1027 const val ERROR_NORMAL = 400 const val ERROR_CRITICAL = 401 diff --git a/app/src/main/java/com/example/hpostesting/presentation/hemocube/HemoCubeFragment.kt b/app/src/main/java/com/example/hpostesting/presentation/hemocube/HemoCubeFragment.kt index 30db0f0..551d258 100644 --- a/app/src/main/java/com/example/hpostesting/presentation/hemocube/HemoCubeFragment.kt +++ b/app/src/main/java/com/example/hpostesting/presentation/hemocube/HemoCubeFragment.kt @@ -294,13 +294,21 @@ class HemoCubeFragment : Fragment() { resultData += stringData when { - stringData.contains("SN") -> { + stringData.contains("SNS") -> { val slData = stringData.split(" ") if (slData.size > 1 && slData[1].trim().length == 12) { val hardwareId = slData[1].trim() deviceHardwareId = hardwareId + } + } + + stringData.contains("SNE") -> { + val slData = stringData.split(" ") + if (slData.size > 1) { + val hardwareId = slData[0].trim() + deviceHardwareId += hardwareId with(sharedPreferences.edit()) { - putString(Constants.DEVICE_ID, hardwareId) + putString(Constants.DEVICE_ID, deviceHardwareId) apply() } } else { diff --git a/app/src/main/res/xml/device_filter.xml b/app/src/main/res/xml/device_filter.xml index b07e602..93713c1 100644 --- a/app/src/main/res/xml/device_filter.xml +++ b/app/src/main/res/xml/device_filter.xml @@ -9,7 +9,7 @@ - + From 92a01dbd9f91453f9b22c11a3b1a2deff29fb965 Mon Sep 17 00:00:00 2001 From: Mariya Date: Thu, 14 Dec 2023 13:07:15 +0530 Subject: [PATCH 06/13] Digital Card button removed --- .../hpostesting/presentation/hemocube/HemoCubeFragment.kt | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/com/example/hpostesting/presentation/hemocube/HemoCubeFragment.kt b/app/src/main/java/com/example/hpostesting/presentation/hemocube/HemoCubeFragment.kt index 551d258..c4c8902 100644 --- a/app/src/main/java/com/example/hpostesting/presentation/hemocube/HemoCubeFragment.kt +++ b/app/src/main/java/com/example/hpostesting/presentation/hemocube/HemoCubeFragment.kt @@ -130,13 +130,11 @@ class HemoCubeFragment : Fragment() { activity?.runOnUiThread { binding.btnSubmit.visibility = View.GONE - binding.btnDigitalCard.visibility = View.VISIBLE - binding.btnDigitalCard.setOnClickListener { val i = Intent( - requireContext().applicationContext, DigitalCardActivity::class.java + requireContext().applicationContext, DashboardActivity::class.java ) startActivity(i) - } + } } if (result == "Local") { From add61d9c652a07aa8847e5c3fb8bf6379bf2e198 Mon Sep 17 00:00:00 2001 From: Pritimay Sarkar Date: Fri, 15 Dec 2023 10:22:50 +0530 Subject: [PATCH 07/13] add config error msg and v2 usb config --- .../hpostesting/data/constant/Constants.kt | 111 ++---------------- 1 file changed, 8 insertions(+), 103 deletions(-) diff --git a/app/src/main/java/com/example/hpostesting/data/constant/Constants.kt b/app/src/main/java/com/example/hpostesting/data/constant/Constants.kt index 622b5f4..b8d8eac 100644 --- a/app/src/main/java/com/example/hpostesting/data/constant/Constants.kt +++ b/app/src/main/java/com/example/hpostesting/data/constant/Constants.kt @@ -27,8 +27,10 @@ object Constants { const val DEVICE_TYPE_TEST_RIGHT = "TEST_RIGHT" const val DEVICE_VENDOR_ID = 1027 - const val HOMO_CUBE_ID = 24577 - const val VENDOR_ID = 1027 + const val HOMO_CUBE_ID = 29987 + const val VENDOR_ID = 6790 + const val HEMO_CUBE_V2_ID = 24577 + const val HEMO_CUBE_V2_VENDOR_ID = 1027 const val ERROR_NORMAL = 400 const val ERROR_CRITICAL = 401 @@ -63,14 +65,6 @@ object Constants { "HC-V1-020", "HCV-000-3001", "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" ) const val password = "SMI@12345" @@ -91,28 +85,13 @@ object Constants { listOf(1.313, -0.89), // LED1, 435nm listOf(0.581462456, -0.58502), // LED2, 415nm listOf(0.2012, 0.0092), // LED3, 555nm - listOf(1.0, 0.0) // LED4, 560nm + listOf(1.0, 0.0) // LED4 ), "HCV-000-3002" to listOf( listOf(0.723142, -0.09135), // LED1, 435nm listOf(0.581462456, -0.58502), // LED2, 415nm listOf(0.1964, 0.011565), // LED3, 555nm - listOf(1.0, 0.0) // LED4, 560nm - ), - ) - - val DEVICE_HB_PARAMETERS: Map>> = mapOf>>( - "HCV-000-3001" to listOf( - listOf(1.0, 0.0), // LED1, 435nm - listOf(1.0, 0.0), // LED2, 415nm - listOf(42.241, -24.105), // LED3, 555nm - listOf(0.0258, 0.5534) // LED4, 560nm - ), - "HCV-000-3002" to listOf( - listOf(1.0, 0.0), // LED1, 435nm - listOf(1.0, 0.0), // LED2, 415nm - listOf(0.0305, 0.2067), // LED3, 555nm - listOf(0.0258, 0.5534) // LED4, 560nm + listOf(1.0, 0.0) // LED4 ), "HCV-000-3003" to listOf( listOf(0.723142, -0.09135), // LED1, 435nm @@ -121,45 +100,9 @@ object Constants { listOf(1.0, 0.0) // LED4 ), "HCV-000-3004" to listOf( - listOf(1.7272, -1.1977), // LED1, 435nm + listOf(1.6837, -1.1417), // 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.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-3006" 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-3007" 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-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(0.2241, -0.0106), // LED3, 555nm listOf(1.0, 0.0) // LED4 ), ) @@ -167,8 +110,6 @@ object Constants { const val INCUBATION_TIME_MIN = 0 const val INCUBATION_TIME_MAX = 1400 - const val MINIMUM_BATTERY_LEVEL = 0 - val BUFFER_INTENSITY_THRESHOLDS: Map>> = mapOf>>( "HCV-000-3001" to listOf( listOf(20000, 25074), @@ -193,42 +134,6 @@ object Constants { 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), ) ) } \ No newline at end of file From 82360b22c88c0451043f988eae44287bddcbe294 Mon Sep 17 00:00:00 2001 From: Pritimay Sarkar Date: Fri, 15 Dec 2023 14:37:41 +0530 Subject: [PATCH 08/13] handle-msg-fragmentation --- .idea/gradle.xml | 3 +-- app/build.gradle | 4 ++-- .../hpostesting/data/constant/Constants.kt | 3 ++- .../example/hpostesting/data/dao/MyDataBase.kt | 2 +- .../hpostesting/presentation/MainActivity.kt | 9 +++++++++ .../presentation/adapter/UserListAdapter.kt | 2 +- .../presentation/hemocube/HemoCubeFragment.kt | 16 +++++----------- 7 files changed, 21 insertions(+), 18 deletions(-) diff --git a/.idea/gradle.xml b/.idea/gradle.xml index ae388c2..cb865f6 100644 --- a/.idea/gradle.xml +++ b/.idea/gradle.xml @@ -4,8 +4,6 @@ diff --git a/app/build.gradle b/app/build.gradle index 89ca91f..1943d1d 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -19,8 +19,8 @@ android { applicationId "in.sminnovations.hpostesting" minSdk 21 targetSdk 34 - versionCode 52 - versionName "2.1.52" + versionCode 56 + versionName "2.1.56" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" } diff --git a/app/src/main/java/com/example/hpostesting/data/constant/Constants.kt b/app/src/main/java/com/example/hpostesting/data/constant/Constants.kt index b8d8eac..a700d6c 100644 --- a/app/src/main/java/com/example/hpostesting/data/constant/Constants.kt +++ b/app/src/main/java/com/example/hpostesting/data/constant/Constants.kt @@ -29,7 +29,7 @@ object Constants { const val DEVICE_VENDOR_ID = 1027 const val HOMO_CUBE_ID = 29987 const val VENDOR_ID = 6790 - const val HEMO_CUBE_V2_ID = 24577 + const val HEMO_CUBE_V2_PRODUCT_ID = 24577 const val HEMO_CUBE_V2_VENDOR_ID = 1027 const val ERROR_NORMAL = 400 @@ -109,6 +109,7 @@ object Constants { const val INCUBATION_TIME_MIN = 0 const val INCUBATION_TIME_MAX = 1400 + const val BATTERY_LEVEL_MIN = 0 val BUFFER_INTENSITY_THRESHOLDS: Map>> = mapOf>>( "HCV-000-3001" to listOf( diff --git a/app/src/main/java/com/example/hpostesting/data/dao/MyDataBase.kt b/app/src/main/java/com/example/hpostesting/data/dao/MyDataBase.kt index a7832c9..49115b7 100644 --- a/app/src/main/java/com/example/hpostesting/data/dao/MyDataBase.kt +++ b/app/src/main/java/com/example/hpostesting/data/dao/MyDataBase.kt @@ -11,7 +11,7 @@ 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 = 12, exportSchema = false) +@Database(entities = [UserData::class, HemoCubeTestData::class, DeviceData::class], version = 13, exportSchema = false) @TypeConverters(Converters::class) abstract class MyDatabase : RoomDatabase() { abstract fun userDao(): UserDao diff --git a/app/src/main/java/com/example/hpostesting/presentation/MainActivity.kt b/app/src/main/java/com/example/hpostesting/presentation/MainActivity.kt index 85d5052..91763ae 100644 --- a/app/src/main/java/com/example/hpostesting/presentation/MainActivity.kt +++ b/app/src/main/java/com/example/hpostesting/presentation/MainActivity.kt @@ -114,6 +114,15 @@ class MainActivity : AppCompatActivity() { 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 -> { Log.d( TAG, diff --git a/app/src/main/java/com/example/hpostesting/presentation/adapter/UserListAdapter.kt b/app/src/main/java/com/example/hpostesting/presentation/adapter/UserListAdapter.kt index 694f154..b3b9338 100644 --- a/app/src/main/java/com/example/hpostesting/presentation/adapter/UserListAdapter.kt +++ b/app/src/main/java/com/example/hpostesting/presentation/adapter/UserListAdapter.kt @@ -197,7 +197,7 @@ class UserListAdapter( // } } userCard.setOnClickListener { - if (batLevel < Constants.MINIMUM_BATTERY_LEVEL) { + if (batLevel < Constants.BATTERY_LEVEL_MIN) { Toast.makeText( view.context, context?.getString(R.string.low_battery_warning), diff --git a/app/src/main/java/com/example/hpostesting/presentation/hemocube/HemoCubeFragment.kt b/app/src/main/java/com/example/hpostesting/presentation/hemocube/HemoCubeFragment.kt index c4c8902..7d66889 100644 --- a/app/src/main/java/com/example/hpostesting/presentation/hemocube/HemoCubeFragment.kt +++ b/app/src/main/java/com/example/hpostesting/presentation/hemocube/HemoCubeFragment.kt @@ -292,18 +292,12 @@ class HemoCubeFragment : Fragment() { resultData += stringData when { - stringData.contains("SNS") -> { - val slData = stringData.split(" ") - if (slData.size > 1 && slData[1].trim().length == 12) { - val hardwareId = slData[1].trim() - deviceHardwareId = hardwareId - } - } + resultData.contains("SNE") -> { + val pattern = Regex("HCV-\\d{3}-\\d{4}") + val matchResult = pattern.find(resultData) + val hardwareId = matchResult?.value - stringData.contains("SNE") -> { - val slData = stringData.split(" ") - if (slData.size > 1) { - val hardwareId = slData[0].trim() + if (hardwareId.toString().length == 12) { deviceHardwareId += hardwareId with(sharedPreferences.edit()) { putString(Constants.DEVICE_ID, deviceHardwareId) From 21d53cc2b80edfb78dbadb1246b8922f3df22cbc Mon Sep 17 00:00:00 2001 From: Pritimay Sarkar Date: Mon, 18 Dec 2023 12:48:07 +0530 Subject: [PATCH 09/13] fix msg fragmentation in app and add log dsiplay for admin --- app/build.gradle | 2 +- .../hpostesting/data/constant/Constants.kt | 14 ++++++++ .../presentation/hemocube/HemoCubeFragment.kt | 33 ++++++++++++++----- .../hemocube/HemoCubeViewModel.kt | 1 + .../layout/fragment_hemo_cube_reference.xml | 21 ++++++++++-- 5 files changed, 59 insertions(+), 12 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 1943d1d..0a45e20 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -14,7 +14,7 @@ android { compileSdk 34 namespace 'in.sminnovations.hpostesting' - // prod - production, preprod - preproduction, quality - qc, + // prod - production, preprod - preproduction, quality - qc defaultConfig { applicationId "in.sminnovations.hpostesting" minSdk 21 diff --git a/app/src/main/java/com/example/hpostesting/data/constant/Constants.kt b/app/src/main/java/com/example/hpostesting/data/constant/Constants.kt index a700d6c..fed9211 100644 --- a/app/src/main/java/com/example/hpostesting/data/constant/Constants.kt +++ b/app/src/main/java/com/example/hpostesting/data/constant/Constants.kt @@ -40,6 +40,7 @@ object Constants { const val USER_ID = "usernameId" val STATICID = listOf( + "ADMIN", "VIZ-1000-0004", "VIZ-1000-0005", "VIZ-1000-0006", @@ -80,6 +81,19 @@ object Constants { const val BUFFER_LED_LOWER_BOUND = 21000 const val BUFFER_LED_UPPER_BOUND = 24500 + const val TEST_STATUS_CODE_TEST_STARTED = 1.0 + const val TEST_STATUS_CODE_CONFIG_STARTED = 2.0 + const val TEST_STATUS_CODE_CONFIG_COMPLETED = 3.0 + const val TEST_STATUS_CODE_BUFFER_STARTED = 4.0 + const val TEST_STATUS_CODE_BUFFER_COMPLETED = 5.0 + const val TEST_STATUS_CODE_BUFFER_PRINT_STARTED = 6.0 + const val TEST_STATUS_CODE_BUFFER_PRINT_COMPLETED = 7.0 + const val TEST_STATUS_CODE_SAMPLE_STARTED = 8.0 + const val TEST_STATUS_CODE_SAMPLE_COMPLETED = 9.0 + const val TEST_STATUS_CODE_SAMPLE_PRINT_STARTED = 10.0 + const val TEST_STATUS_CODE_SAMPLE_PRINT_COMPLETED = 11.0 + const val TEST_STATUS_CODE_TEST_COMPLETED = 12.0 + val DEVICE_CONFIGURATION: Map>> = mapOf>>( "HCV-000-3001" to listOf( listOf(1.313, -0.89), // LED1, 435nm diff --git a/app/src/main/java/com/example/hpostesting/presentation/hemocube/HemoCubeFragment.kt b/app/src/main/java/com/example/hpostesting/presentation/hemocube/HemoCubeFragment.kt index 7d66889..cc677e4 100644 --- a/app/src/main/java/com/example/hpostesting/presentation/hemocube/HemoCubeFragment.kt +++ b/app/src/main/java/com/example/hpostesting/presentation/hemocube/HemoCubeFragment.kt @@ -57,6 +57,7 @@ class HemoCubeFragment : Fragment() { private var validationError = false private var deviceHardwareId = "" private var allErrorMessages = "" + private var testStatusCode = 0.0 override fun onCreateView( inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?, @@ -121,6 +122,11 @@ class HemoCubeFragment : Fragment() { } + if (sharedPreferences.getString(Constants.USER_ID, "").toString() == "ADMIN") { + activity?.runOnUiThread { + binding.tvDeviceMessages.visibility = View.VISIBLE + } + } } private fun observeViewModel() { @@ -171,6 +177,10 @@ class HemoCubeFragment : Fragment() { hemoCubeViewModel.messages.observe(viewLifecycleOwner) { binding.tvSubtitle4.text = it } + + hemoCubeViewModel.deviceMessages.observe(viewLifecycleOwner) { + binding.tvDeviceMessages.text = it + } } private fun checkAndStartProcess() { @@ -251,7 +261,7 @@ class HemoCubeFragment : Fragment() { data?.let { val stringData = String(it) fullReadOutput.append(stringData) - handleUsbData(stringData, fullReadOutput) + handleUsbData(stringData, testStatusCode) } } @@ -284,15 +294,16 @@ class HemoCubeFragment : Fragment() { }) } - private fun handleUsbData(stringData: String, fullReadOutput: StringBuilder) { + private fun handleUsbData(stringData: String, testStatusCode: Double) { if (stringData.contains("#")) { isTestOngoing = true } resultData += stringData + hemoCubeViewModel.deviceMessages.postValue(resultData) when { - resultData.contains("SNE") -> { + resultData.contains("SNE") && this.testStatusCode < Constants.TEST_STATUS_CODE_CONFIG_COMPLETED -> { val pattern = Regex("HCV-\\d{3}-\\d{4}") val matchResult = pattern.find(resultData) val hardwareId = matchResult?.value @@ -303,6 +314,7 @@ class HemoCubeFragment : Fragment() { putString(Constants.DEVICE_ID, deviceHardwareId) apply() } + this.testStatusCode = Constants.TEST_STATUS_CODE_CONFIG_COMPLETED } else { hemoCubeViewModel.messages.postValue("config error") } @@ -312,32 +324,37 @@ class HemoCubeFragment : Fragment() { hemoCubeViewModel.messages.postValue(getString(R.string.start)) } - stringData.contains("#BS") -> { + resultData.contains("#BS") && this.testStatusCode < Constants.TEST_STATUS_CODE_BUFFER_STARTED -> { hemoCubeViewModel.messages.postValue(getString(R.string.buffer_started)) + this.testStatusCode = Constants.TEST_STATUS_CODE_BUFFER_STARTED } - stringData.contains("#BC") -> { + resultData.contains("#BC") && this.testStatusCode < Constants.TEST_STATUS_CODE_BUFFER_COMPLETED -> { + this.testStatusCode = Constants.TEST_STATUS_CODE_BUFFER_COMPLETED activity?.runOnUiThread { binding.tvSubtitle4.text = getString(R.string.buffer_completed) binding.btnSamplestart.visibility = View.VISIBLE } } - stringData.contains("#SS") -> { + resultData.contains("#SS") && this.testStatusCode < Constants.TEST_STATUS_CODE_SAMPLE_STARTED -> { + this.testStatusCode = Constants.TEST_STATUS_CODE_SAMPLE_STARTED activity?.runOnUiThread { binding.tvSubtitle4.text = getString(R.string.sample_started) binding.btnSamplestart.visibility = View.GONE } } - stringData.contains("#SC") -> { + resultData.contains("#SC") && this.testStatusCode < Constants.TEST_STATUS_CODE_SAMPLE_COMPLETED -> { + this.testStatusCode = Constants.TEST_STATUS_CODE_SAMPLE_COMPLETED hemoCubeViewModel.messages.postValue( getString(R.string.sample_completed) + "\n" + getString(R.string.gathering_data)) fetchResult() testingTrace.stop() } - resultData.contains("REND") -> { + resultData.contains("REND") && this.testStatusCode < Constants.TEST_STATUS_CODE_SAMPLE_PRINT_COMPLETED -> { + this.testStatusCode = Constants.TEST_STATUS_CODE_SAMPLE_PRINT_COMPLETED hemoCubeViewModel.messages.postValue( getString(R.string.data_collected_processing_data) ) diff --git a/app/src/main/java/com/example/hpostesting/presentation/hemocube/HemoCubeViewModel.kt b/app/src/main/java/com/example/hpostesting/presentation/hemocube/HemoCubeViewModel.kt index f711a5a..4ff4bb3 100644 --- a/app/src/main/java/com/example/hpostesting/presentation/hemocube/HemoCubeViewModel.kt +++ b/app/src/main/java/com/example/hpostesting/presentation/hemocube/HemoCubeViewModel.kt @@ -51,6 +51,7 @@ class HemoCubeViewModel @Inject constructor( val deviceData = MutableLiveData() val networkStatusLiveData: LiveData get() = _networkStatusLiveData + val deviceMessages = MutableLiveData() val fireBaseUpload = MutableLiveData() val fireBaseBulkUpload = MutableLiveData() diff --git a/app/src/main/res/layout/fragment_hemo_cube_reference.xml b/app/src/main/res/layout/fragment_hemo_cube_reference.xml index a9aa2dd..9b166f9 100644 --- a/app/src/main/res/layout/fragment_hemo_cube_reference.xml +++ b/app/src/main/res/layout/fragment_hemo_cube_reference.xml @@ -195,16 +195,31 @@ style="@style/title1_1" android:visibility="gone" android:layout_width="match_parent" - android:layout_height="80dp" + android:layout_height="40dp" android:layout_marginHorizontal="24dp" - android:layout_marginTop="172dp" + android:layout_marginTop="72dp" android:gravity="center" android:textColor="@color/red" - android:textSize="18sp" + android:textSize="12sp" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toBottomOf="@id/btn_submit" /> + +