Made some internal changes, pritimoi please check and remove unwanted code
This commit is contained in:
@@ -13,8 +13,8 @@ object Constants {
|
|||||||
const val uid = "NKH5555AH"
|
const val uid = "NKH5555AH"
|
||||||
const val deviceProvisionEmail = "HPOS_provisioner@bigtec.co.in"
|
const val deviceProvisionEmail = "HPOS_provisioner@bigtec.co.in"
|
||||||
const val deviceProvisionPassword = "f2ab0e7f9d69"
|
const val deviceProvisionPassword = "f2ab0e7f9d69"
|
||||||
const val deviceID = "HCV-000-3001"
|
const val DEVICE_ID_API = "deviceIDAPI"
|
||||||
const val devicePassword = "810516d8f4c7"
|
const val DEVICE_PASSWORD_API = "devicePasswordAPI"
|
||||||
|
|
||||||
const val ACCESS_TOKEN = "accessToken"
|
const val ACCESS_TOKEN = "accessToken"
|
||||||
const val NATS_TOKEN = "natsToken"
|
const val NATS_TOKEN = "natsToken"
|
||||||
@@ -43,8 +43,8 @@ object Constants {
|
|||||||
const val DEVICE_VENDOR_ID = 1027
|
const val DEVICE_VENDOR_ID = 1027
|
||||||
const val HOMO_CUBE_ID = 29987
|
const val HOMO_CUBE_ID = 29987
|
||||||
const val VENDOR_ID = 6790
|
const val VENDOR_ID = 6790
|
||||||
const val HEMO_CUBE_V2_PRODUCT_ID = 24577
|
const val HEMO_CUBE_V2_PRODUCT_ID = 60000
|
||||||
const val HEMO_CUBE_V2_VENDOR_ID = 1027
|
const val HEMO_CUBE_V2_VENDOR_ID = 4292
|
||||||
|
|
||||||
const val ERROR_NORMAL = 400
|
const val ERROR_NORMAL = 400
|
||||||
const val ERROR_CRITICAL = 401
|
const val ERROR_CRITICAL = 401
|
||||||
@@ -54,6 +54,7 @@ object Constants {
|
|||||||
const val USER_ID = "usernameId"
|
const val USER_ID = "usernameId"
|
||||||
|
|
||||||
val STATICID = listOf(
|
val STATICID = listOf(
|
||||||
|
"FACTORY",
|
||||||
"ADMIN",
|
"ADMIN",
|
||||||
"VIZ-1000-0004",
|
"VIZ-1000-0004",
|
||||||
"VIZ-1000-0005",
|
"VIZ-1000-0005",
|
||||||
@@ -97,7 +98,8 @@ object Constants {
|
|||||||
"HCV-000-3017",
|
"HCV-000-3017",
|
||||||
"HCV-000-3018",
|
"HCV-000-3018",
|
||||||
"HCV-000-3019",
|
"HCV-000-3019",
|
||||||
"HCV-000-3020"
|
"HCV-000-3020",
|
||||||
|
"HPP1-1024-0001"
|
||||||
)
|
)
|
||||||
|
|
||||||
const val password = "SMI@12345"
|
const val password = "SMI@12345"
|
||||||
@@ -149,7 +151,7 @@ object Constants {
|
|||||||
listOf(0.2012, 0.0092), // LED3, 555nm
|
listOf(0.2012, 0.0092), // LED3, 555nm
|
||||||
listOf(1.0, 0.0) // LED4, 560nm
|
listOf(1.0, 0.0) // LED4, 560nm
|
||||||
),
|
),
|
||||||
"HCV-000-3002" to listOf(
|
"HPP1-0124-0001" to listOf(
|
||||||
listOf(0.723142, -0.09135), // LED1, 435nm
|
listOf(0.723142, -0.09135), // LED1, 435nm
|
||||||
listOf(0.581462456, -0.58502), // LED2, 415nm
|
listOf(0.581462456, -0.58502), // LED2, 415nm
|
||||||
listOf(0.1964, 0.011565), // LED3, 555nm
|
listOf(0.1964, 0.011565), // LED3, 555nm
|
||||||
@@ -158,7 +160,7 @@ object Constants {
|
|||||||
)
|
)
|
||||||
|
|
||||||
val DEVICE_HB_PARAMETERS: Map<String, List<List<Double>>> = mapOf<String, List<List<Double>>>(
|
val DEVICE_HB_PARAMETERS: Map<String, List<List<Double>>> = mapOf<String, List<List<Double>>>(
|
||||||
"HCV-000-3001" to listOf(
|
"HPP1-0124-0001" to listOf(
|
||||||
listOf(1.0, 0.0), // LED1, 435nm
|
listOf(1.0, 0.0), // LED1, 435nm
|
||||||
listOf(1.0, 0.0), // LED2, 415nm
|
listOf(1.0, 0.0), // LED2, 415nm
|
||||||
listOf(42.241, -24.105), // LED3, 555nm
|
listOf(42.241, -24.105), // LED3, 555nm
|
||||||
@@ -288,7 +290,7 @@ object Constants {
|
|||||||
const val MINIMUM_BATTERY_LEVEL = 0
|
const val MINIMUM_BATTERY_LEVEL = 0
|
||||||
|
|
||||||
val BUFFER_INTENSITY_THRESHOLDS: Map<String, List<List<Int>>> = mapOf<String, List<List<Int>>>(
|
val BUFFER_INTENSITY_THRESHOLDS: Map<String, List<List<Int>>> = mapOf<String, List<List<Int>>>(
|
||||||
"HCV-000-3001" to listOf(
|
"HPP1-0124-0001" to listOf(
|
||||||
listOf(20000, 25074),
|
listOf(20000, 25074),
|
||||||
listOf(20000, 24596),
|
listOf(20000, 24596),
|
||||||
listOf(20000, 26065),
|
listOf(20000, 26065),
|
||||||
|
|||||||
@@ -8,5 +8,6 @@ data class LoginRequest(
|
|||||||
val mode: String? = "",
|
val mode: String? = "",
|
||||||
val password: String? = "",
|
val password: String? = "",
|
||||||
val serialNumber: String? = "",
|
val serialNumber: String? = "",
|
||||||
val username: String? = ""
|
val username: String? = "",
|
||||||
|
val version: String? = ""
|
||||||
)
|
)
|
||||||
@@ -15,10 +15,10 @@ class CheckUpdateWorker(
|
|||||||
|
|
||||||
override suspend fun doWork(): Result = withContext(Dispatchers.IO) {
|
override suspend fun doWork(): Result = withContext(Dispatchers.IO) {
|
||||||
try {
|
try {
|
||||||
for (i in 1..900){
|
// for (i in 1..900){
|
||||||
delay(1000)
|
// delay(1000)
|
||||||
Log.d("Work for every second", "doWork: Running")
|
// Log.d("Work for every second", "doWork: Running")
|
||||||
}
|
// }
|
||||||
|
|
||||||
Result.success()
|
Result.success()
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
|
|||||||
@@ -116,7 +116,7 @@ object AppModule {
|
|||||||
@Provides
|
@Provides
|
||||||
@Singleton
|
@Singleton
|
||||||
fun provideSharedPreferences(@ApplicationContext context: Context): SharedPreferences {
|
fun provideSharedPreferences(@ApplicationContext context: Context): SharedPreferences {
|
||||||
return context.getSharedPreferences("PREFERENCE_NAME", Context.MODE_PRIVATE)
|
return context.getSharedPreferences("HEMOCUBE", Context.MODE_PRIVATE)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Provides
|
@Provides
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ class NatsManager(datacollector: DashboardActivity) {
|
|||||||
Log.d(TAG, "TRY TO CONNECT")
|
Log.d(TAG, "TRY TO CONNECT")
|
||||||
Thread {
|
Thread {
|
||||||
|
|
||||||
val seedString = "SUAK5IDCMHY4T2WA2LHNXGICGHKR3TPJFNSP6AUQP523RLANO4PSR6IEYA"
|
val seedString = "SUAEB5PUWNS6C2HUV3MFI6HUDEAPGPFPBHMI73NHIQATCDD2BWALVEZXZ4"
|
||||||
val seedBytes = seedString.toCharArray()
|
val seedBytes = seedString.toCharArray()
|
||||||
|
|
||||||
val theNKey = NKey.fromSeed(seedBytes) // really should load from somewhere
|
val theNKey = NKey.fromSeed(seedBytes) // really should load from somewhere
|
||||||
|
|||||||
@@ -61,7 +61,7 @@ class OfflineUserListAdapter(private val view: View, private val batLevel: Int)
|
|||||||
bloodGroup.text = "Blood group: ${userList.bloodGroup}"
|
bloodGroup.text = "Blood group: ${userList.bloodGroup}"
|
||||||
time.text = "Time: ${userList.incubationTime}"
|
time.text = "Time: ${userList.incubationTime}"
|
||||||
userCard.setOnClickListener {
|
userCard.setOnClickListener {
|
||||||
if (batLevel < 40) {
|
if (false) {
|
||||||
Toast.makeText(
|
Toast.makeText(
|
||||||
view.context,
|
view.context,
|
||||||
context?.getString(R.string.low_battery_warning),
|
context?.getString(R.string.low_battery_warning),
|
||||||
|
|||||||
@@ -49,8 +49,8 @@ class DashboardActivity : AppCompatActivity(), IDataCollector {
|
|||||||
setContentView(binding.root)
|
setContentView(binding.root)
|
||||||
setSupportActionBar(binding.appBarDashboard.toolbar)
|
setSupportActionBar(binding.appBarDashboard.toolbar)
|
||||||
nats = NatsManager(this)
|
nats = NatsManager(this)
|
||||||
// nats.connect()
|
nats.connect()
|
||||||
// nats.pub("server.hpos.HCV-000-3001.ping", "THIS IS A TEST MSG")
|
nats.pub("server.hpos.HCV-000-3001.ping", "THIS IS A TEST MSG")
|
||||||
|
|
||||||
val drawerLayout: DrawerLayout = binding.drawerLayout
|
val drawerLayout: DrawerLayout = binding.drawerLayout
|
||||||
val navView: NavigationView = binding.navView
|
val navView: NavigationView = binding.navView
|
||||||
|
|||||||
@@ -1,15 +1,20 @@
|
|||||||
package com.example.hpostesting.presentation.dashboard
|
package com.example.hpostesting.presentation.dashboard
|
||||||
|
|
||||||
|
import android.content.Context
|
||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
|
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 androidx.fragment.app.Fragment
|
import androidx.fragment.app.Fragment
|
||||||
|
import androidx.fragment.app.activityViewModels
|
||||||
|
import com.example.hpostesting.data.constant.Constants
|
||||||
import com.example.hpostesting.presentation.autodac.AutoDacActivity
|
import com.example.hpostesting.presentation.autodac.AutoDacActivity
|
||||||
import com.example.hpostesting.presentation.buffercheck.HemocubeBufferCheckActivity
|
import com.example.hpostesting.presentation.buffercheck.HemocubeBufferCheckActivity
|
||||||
import com.example.hpostesting.presentation.calibration.CalibrationActivity
|
import com.example.hpostesting.presentation.calibration.CalibrationActivity
|
||||||
import com.example.hpostesting.presentation.diagnostics.DiagnosticsActivity
|
import com.example.hpostesting.presentation.diagnostics.DiagnosticsActivity
|
||||||
|
import com.example.hpostesting.presentation.hemocube.HemoCubeViewModel
|
||||||
import `in`.sminnovations.hpostesting.databinding.FragmentGalleryBinding
|
import `in`.sminnovations.hpostesting.databinding.FragmentGalleryBinding
|
||||||
|
|
||||||
class GalleryFragment : Fragment() {
|
class GalleryFragment : Fragment() {
|
||||||
@@ -20,10 +25,12 @@ class GalleryFragment : Fragment() {
|
|||||||
// onDestroyView.
|
// onDestroyView.
|
||||||
private val binding get() = _binding!!
|
private val binding get() = _binding!!
|
||||||
|
|
||||||
|
private lateinit var sharedPreference: SharedPreferences
|
||||||
|
|
||||||
|
private val hemoCubeViewModel: HemoCubeViewModel by activityViewModels()
|
||||||
|
|
||||||
override fun onCreateView(
|
override fun onCreateView(
|
||||||
inflater: LayoutInflater,
|
inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?
|
||||||
container: ViewGroup?,
|
|
||||||
savedInstanceState: Bundle?
|
|
||||||
): View {
|
): View {
|
||||||
// val galleryViewModel =
|
// val galleryViewModel =
|
||||||
// ViewModelProvider(this).get(GalleryViewModel::class.java)
|
// ViewModelProvider(this).get(GalleryViewModel::class.java)
|
||||||
@@ -31,6 +38,23 @@ class GalleryFragment : Fragment() {
|
|||||||
_binding = FragmentGalleryBinding.inflate(inflater, container, false)
|
_binding = FragmentGalleryBinding.inflate(inflater, container, false)
|
||||||
val root: View = binding.root
|
val root: View = binding.root
|
||||||
|
|
||||||
|
sharedPreference = requireContext().getSharedPreferences("HEMOCUBE", Context.MODE_PRIVATE)
|
||||||
|
|
||||||
|
if (sharedPreference.getString(
|
||||||
|
Constants.USER_ID, ""
|
||||||
|
) == "FACTORY" && sharedPreference.getString(Constants.DEVICE_ID_API, "").toString()
|
||||||
|
.isEmpty() && sharedPreference.getString(Constants.DEVICE_PASSWORD_API, "")
|
||||||
|
.toString().isEmpty()
|
||||||
|
) {
|
||||||
|
binding.btnDeviceProvision.visibility = View.VISIBLE
|
||||||
|
} else {
|
||||||
|
binding.btnDeviceProvision.visibility = View.GONE
|
||||||
|
}
|
||||||
|
|
||||||
|
binding.btnDeviceProvision.setOnClickListener {
|
||||||
|
// hemoCubeViewModel.deviceProvision()
|
||||||
|
}
|
||||||
|
|
||||||
binding.btnSubmit.setOnClickListener {
|
binding.btnSubmit.setOnClickListener {
|
||||||
startActivity(Intent(requireContext(), HemocubeBufferCheckActivity::class.java))
|
startActivity(Intent(requireContext(), HemocubeBufferCheckActivity::class.java))
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ import com.example.hpostesting.data.model.login.LoginResponse
|
|||||||
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.UserData
|
||||||
import com.example.hpostesting.data.model.updates.CheckUpdateRequest
|
import com.example.hpostesting.data.model.updates.CheckUpdateRequest
|
||||||
|
import com.example.hpostesting.data.model.updates.DeviceUpdateRequest
|
||||||
import com.example.hpostesting.presentation.KitScanActivity
|
import com.example.hpostesting.presentation.KitScanActivity
|
||||||
import com.example.hpostesting.presentation.adapter.OfflineUserListAdapter
|
import com.example.hpostesting.presentation.adapter.OfflineUserListAdapter
|
||||||
import com.example.hpostesting.presentation.adapter.UserListAdapter
|
import com.example.hpostesting.presentation.adapter.UserListAdapter
|
||||||
@@ -69,8 +70,7 @@ class HomeFragment : Fragment() {
|
|||||||
return super.onCreateView(inflater, container, savedInstanceState)
|
return super.onCreateView(inflater, container, savedInstanceState)
|
||||||
}
|
}
|
||||||
|
|
||||||
sharedPreference =
|
sharedPreference = requireContext().getSharedPreferences("HEMOCUBE", Context.MODE_PRIVATE)
|
||||||
requireContext().getSharedPreferences("PREFERENCE_NAME", Context.MODE_PRIVATE)
|
|
||||||
DataHolder.selectedTest = null
|
DataHolder.selectedTest = null
|
||||||
|
|
||||||
return binding.root
|
return binding.root
|
||||||
@@ -130,41 +130,55 @@ class HomeFragment : Fragment() {
|
|||||||
showUploadDialog(requireContext())
|
showUploadDialog(requireContext())
|
||||||
}
|
}
|
||||||
binding.btnNewKit.setOnClickListener {
|
binding.btnNewKit.setOnClickListener {
|
||||||
with(sharedPreference.edit()) {
|
// with(sharedPreference.edit()) {
|
||||||
putString(Constants.KIT_NUMBER, "")
|
// putString(Constants.KIT_NUMBER, "")
|
||||||
putInt(Constants.KIT_COUNT, 0)
|
// putInt(Constants.KIT_COUNT, 0)
|
||||||
apply()
|
// apply()
|
||||||
}
|
// }
|
||||||
startActivity(Intent(requireContext(), KitScanActivity::class.java))
|
// startActivity(Intent(requireContext(), KitScanActivity::class.java))
|
||||||
requireActivity().finish()
|
// requireActivity().finish()
|
||||||
|
val password = sharedPreference.getString(Constants.DEVICE_PASSWORD_API, "810516d8f4c7").toString()
|
||||||
|
val userID = sharedPreference.getString(Constants.DEVICE_ID_API, "HCV-000-3001").toString()
|
||||||
|
hemoCubeViewModel.deviceUpdate(createDeviceUpdateRequestData())
|
||||||
|
hemoCubeViewModel.login(createLoginRequestData(userID, password))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun checkForTokenAndUpdate() {
|
private fun checkForTokenAndUpdate() {
|
||||||
val accessToken = sharedPreference.getString(Constants.ACCESS_TOKEN, "").toString()
|
val accessToken = sharedPreference.getString(Constants.ACCESS_TOKEN, "").toString()
|
||||||
val natsToken = sharedPreference.getString(Constants.NATS_TOKEN, "").toString()
|
val natsToken = sharedPreference.getString(Constants.NATS_TOKEN, "").toString()
|
||||||
val natsTokenExpireDate = sharedPreference.getString(Constants.NATS_TOKEN_EXPIRE_DATE, "").toString()
|
val natsTokenExpireDate =
|
||||||
if (accessToken.isEmpty() && natsToken.isEmpty()) {
|
sharedPreference.getString(Constants.NATS_TOKEN_EXPIRE_DATE, "").toString()
|
||||||
hemoCubeViewModel.login(createLoginRequestData())
|
val password = sharedPreference.getString(Constants.DEVICE_PASSWORD_API, "810516d8f4c7").toString()
|
||||||
} else {
|
val userID = sharedPreference.getString(Constants.DEVICE_ID_API, "HCV-000-3001").toString()
|
||||||
if (isTokenExpired(accessToken)) {
|
if (userID.isNotEmpty() && password.isNotEmpty()) {
|
||||||
hemoCubeViewModel.login(createLoginRequestData())
|
if (accessToken.isEmpty() && natsToken.isEmpty()) {
|
||||||
|
hemoCubeViewModel.login(createLoginRequestData(userID, password))
|
||||||
} else {
|
} else {
|
||||||
hemoCubeViewModel.checkUpdate(createCheckUpdateRequestData())
|
if (true) {
|
||||||
hemoCubeViewModel.uploadLogs()
|
hemoCubeViewModel.login(createLoginRequestData(userID, password))
|
||||||
hemoCubeViewModel.startPeriodicCheckUpdate()
|
} else {
|
||||||
|
hemoCubeViewModel.deviceUpdate(createDeviceUpdateRequestData())
|
||||||
|
hemoCubeViewModel.uploadLogs()
|
||||||
|
hemoCubeViewModel.startPeriodicCheckUpdate()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
Toast.makeText(
|
||||||
|
requireContext(),
|
||||||
|
"Contact Help and get your device provision done",
|
||||||
|
Toast.LENGTH_SHORT
|
||||||
|
).show()
|
||||||
}
|
}
|
||||||
hemoCubeViewModel.loginResponse.observe(viewLifecycleOwner) { response ->
|
hemoCubeViewModel.loginResponse.observe(viewLifecycleOwner) { response ->
|
||||||
when (response) {
|
when (response) {
|
||||||
is Result.Success -> {
|
is Result.Success -> {
|
||||||
updateTokens(response)
|
updateTokens(response)
|
||||||
checkForTokenAndUpdate()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
is Result.Error -> {
|
is Result.Error -> {
|
||||||
response.exception.let { message ->
|
response.exception.let { message ->
|
||||||
Toast.makeText(activity, "An error occurred: $message", Toast.LENGTH_LONG)
|
Toast.makeText(activity, "An error occurred in login: $message", Toast.LENGTH_LONG)
|
||||||
.show()
|
.show()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -177,17 +191,17 @@ class HomeFragment : Fragment() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
hemoCubeViewModel.checkUpdate.observe(viewLifecycleOwner) { response ->
|
hemoCubeViewModel.deviceUpdate.observe(viewLifecycleOwner) { response ->
|
||||||
when (response) {
|
when (response) {
|
||||||
is Result.Success -> {
|
is Result.Success -> {
|
||||||
Toast.makeText(
|
Toast.makeText(
|
||||||
requireContext(), response.data.data?.version, Toast.LENGTH_SHORT
|
requireContext(), response.data.toString(), Toast.LENGTH_SHORT
|
||||||
).show()
|
).show()
|
||||||
}
|
}
|
||||||
|
|
||||||
is Result.Error -> {
|
is Result.Error -> {
|
||||||
response.exception.let { message ->
|
response.exception.let { message ->
|
||||||
Toast.makeText(activity, "An error occurred: $message", Toast.LENGTH_LONG)
|
Toast.makeText(activity, "An error occurred check update: $message", Toast.LENGTH_LONG)
|
||||||
.show()
|
.show()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -212,7 +226,7 @@ class HomeFragment : Fragment() {
|
|||||||
|
|
||||||
is Result.Error -> {
|
is Result.Error -> {
|
||||||
response.exception.let { message ->
|
response.exception.let { message ->
|
||||||
Toast.makeText(activity, "An error occurred: $message", Toast.LENGTH_LONG)
|
Toast.makeText(activity, "An error occurred in uploading logs: $message", Toast.LENGTH_LONG)
|
||||||
.show()
|
.show()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -241,16 +255,24 @@ class HomeFragment : Fragment() {
|
|||||||
with(sharedPreference.edit()) {
|
with(sharedPreference.edit()) {
|
||||||
putString(Constants.ACCESS_TOKEN, response.data.data?.accessToken)
|
putString(Constants.ACCESS_TOKEN, response.data.data?.accessToken)
|
||||||
putString(Constants.NATS_TOKEN, response.data.data?.deviceUser?.natsToken)
|
putString(Constants.NATS_TOKEN, response.data.data?.deviceUser?.natsToken)
|
||||||
putString(Constants.NATS_TOKEN_EXPIRE_DATE, response.data.data?.deviceUser?.natsTokenExpiry)
|
putString(
|
||||||
|
Constants.NATS_TOKEN_EXPIRE_DATE,
|
||||||
|
response.data.data?.deviceUser?.natsTokenExpiry
|
||||||
|
)
|
||||||
apply()
|
apply()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun createLoginRequestData(): LoginRequest {
|
private fun createLoginRequestData(userID: String, password: String): LoginRequest {
|
||||||
|
val pInfo = requireActivity().packageManager.getPackageInfo(
|
||||||
|
requireActivity().packageName, 0
|
||||||
|
)
|
||||||
|
val version = pInfo.versionName
|
||||||
return LoginRequest(
|
return LoginRequest(
|
||||||
password = Constants.devicePassword,
|
password = password,
|
||||||
serialNumber = Constants.deviceID,
|
serialNumber = userID,
|
||||||
username = Constants.deviceID
|
username = userID,
|
||||||
|
version = version
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -264,6 +286,12 @@ class HomeFragment : Fragment() {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun createDeviceUpdateRequestData(): DeviceUpdateRequest {
|
||||||
|
return DeviceUpdateRequest(
|
||||||
|
serial_no = "HPOS-000-3001"
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
private fun setUserId() {
|
private fun setUserId() {
|
||||||
binding.btnSubmit.setOnClickListener {
|
binding.btnSubmit.setOnClickListener {
|
||||||
val userId = binding.userId.text.toString()
|
val userId = binding.userId.text.toString()
|
||||||
@@ -448,9 +476,9 @@ class HomeFragment : Fragment() {
|
|||||||
binding.uploadData.visibility = uploadDataVisibility
|
binding.uploadData.visibility = uploadDataVisibility
|
||||||
}
|
}
|
||||||
|
|
||||||
hemoCubeViewModel.allKitTestData.observe(viewLifecycleOwner) {bufferData ->
|
hemoCubeViewModel.allKitTestData.observe(viewLifecycleOwner) { bufferData ->
|
||||||
val uploadDataVisibility =
|
val uploadDataVisibility =
|
||||||
if (bufferData.any { !it.localFlag}) View.VISIBLE else View.GONE
|
if (bufferData.any { !it.localFlag }) View.VISIBLE else View.GONE
|
||||||
binding.uploadData.visibility = uploadDataVisibility
|
binding.uploadData.visibility = uploadDataVisibility
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ class LoginFragment : Fragment() {
|
|||||||
): View {
|
): View {
|
||||||
_binding = FragmentLoginBinding.inflate(inflater, container, false)
|
_binding = FragmentLoginBinding.inflate(inflater, container, false)
|
||||||
sharedPreference =
|
sharedPreference =
|
||||||
requireContext().getSharedPreferences("PREFERENCE_NAME", Context.MODE_PRIVATE)
|
requireContext().getSharedPreferences("HEMOCUBE", Context.MODE_PRIVATE)
|
||||||
return binding.root
|
return binding.root
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -396,17 +396,21 @@ class HemoCubeFragment : Fragment() {
|
|||||||
|
|
||||||
when {
|
when {
|
||||||
resultData.contains("SNE") && this.testStatusCode < Constants.TEST_STATUS_CODE_CONFIG_COMPLETED -> {
|
resultData.contains("SNE") && this.testStatusCode < Constants.TEST_STATUS_CODE_CONFIG_COMPLETED -> {
|
||||||
val pattern = Regex("HCV-\\d{3}-\\d{4}")
|
val pattern = Regex("HPP1-\\d{4}-\\d{4}")
|
||||||
val matchResult = pattern.find(resultData)
|
val matchResult = pattern.find(resultData)
|
||||||
val hardwareId = matchResult?.value
|
val hardwareId = matchResult?.value
|
||||||
|
|
||||||
if (hardwareId.toString().length == 12) {
|
if (hardwareId.toString().length == 14) {
|
||||||
deviceHardwareId += hardwareId
|
deviceHardwareId += hardwareId
|
||||||
with(sharedPreferences.edit()) {
|
with(sharedPreferences.edit()) {
|
||||||
putString(Constants.DEVICE_ID, deviceHardwareId)
|
putString(Constants.DEVICE_ID, deviceHardwareId)
|
||||||
apply()
|
apply()
|
||||||
}
|
}
|
||||||
this.testStatusCode = Constants.TEST_STATUS_CODE_CONFIG_COMPLETED
|
this.testStatusCode = Constants.TEST_STATUS_CODE_CONFIG_COMPLETED
|
||||||
|
activity?.runOnUiThread {
|
||||||
|
binding.btnPlacebuffer.visibility = View.VISIBLE
|
||||||
|
}
|
||||||
|
hemoCubeViewModel.messages.postValue(getString(R.string.start))
|
||||||
|
|
||||||
if (!Constants.DEVICE_CONFIGURATION.containsKey(deviceHardwareId)) {
|
if (!Constants.DEVICE_CONFIGURATION.containsKey(deviceHardwareId)) {
|
||||||
allErrorMessages += "Calibration configuration for this device id is not found"
|
allErrorMessages += "Calibration configuration for this device id is not found"
|
||||||
@@ -419,10 +423,6 @@ class HemoCubeFragment : Fragment() {
|
|||||||
} else {
|
} else {
|
||||||
hemoCubeViewModel.messages.postValue("Config error")
|
hemoCubeViewModel.messages.postValue("Config error")
|
||||||
}
|
}
|
||||||
activity?.runOnUiThread {
|
|
||||||
binding.btnPlacebuffer.visibility = View.VISIBLE
|
|
||||||
}
|
|
||||||
hemoCubeViewModel.messages.postValue(getString(R.string.start))
|
|
||||||
}
|
}
|
||||||
|
|
||||||
resultData.contains("#BS") && this.testStatusCode < Constants.TEST_STATUS_CODE_BUFFER_STARTED -> {
|
resultData.contains("#BS") && this.testStatusCode < Constants.TEST_STATUS_CODE_BUFFER_STARTED -> {
|
||||||
|
|||||||
@@ -16,7 +16,6 @@
|
|||||||
android:text="@string/check_buffer"
|
android:text="@string/check_buffer"
|
||||||
android:textColor="@color/white"
|
android:textColor="@color/white"
|
||||||
app:cornerRadius="16dp"
|
app:cornerRadius="16dp"
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toTopOf="parent" />
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
@@ -64,4 +63,19 @@
|
|||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toBottomOf="@id/btn_auto_dac" />
|
app:layout_constraintTop_toBottomOf="@id/btn_auto_dac" />
|
||||||
|
|
||||||
|
<com.google.android.material.button.MaterialButton
|
||||||
|
android:id="@+id/btn_deviceProvision"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:visibility="gone"
|
||||||
|
android:layout_marginHorizontal="16dp"
|
||||||
|
android:layout_marginTop="24dp"
|
||||||
|
android:clickable="false"
|
||||||
|
android:text="@string/deviceProvision"
|
||||||
|
android:textColor="@color/white"
|
||||||
|
app:cornerRadius="16dp"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toBottomOf="@id/btn_calibration" />
|
||||||
|
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
@@ -113,6 +113,7 @@
|
|||||||
<string name="auto_dac">Auto DAC</string>
|
<string name="auto_dac">Auto DAC</string>
|
||||||
<string name="assurance_controls">Quality Assurance</string>
|
<string name="assurance_controls">Quality Assurance</string>
|
||||||
<string name="calibration">Calibration</string>
|
<string name="calibration">Calibration</string>
|
||||||
|
<string name="deviceProvision">Device Provision</string>
|
||||||
<string name="place_buffer">स्थान</string>
|
<string name="place_buffer">स्थान</string>
|
||||||
<string name="Start_Sample">सैम्पल शुरू करें</string>
|
<string name="Start_Sample">सैम्पल शुरू करें</string>
|
||||||
<string name="new_kit">नया किट</string>
|
<string name="new_kit">नया किट</string>
|
||||||
|
|||||||
@@ -113,6 +113,7 @@
|
|||||||
<string name="auto_dac">Auto DAC</string>
|
<string name="auto_dac">Auto DAC</string>
|
||||||
<string name="assurance_controls">Quality Controls</string>
|
<string name="assurance_controls">Quality Controls</string>
|
||||||
<string name="calibration">Calibration</string>
|
<string name="calibration">Calibration</string>
|
||||||
|
<string name="deviceProvision">Device Provision</string>
|
||||||
<string name="place_buffer">ಪ್ರಾರಂಭಿಸಿ</string>
|
<string name="place_buffer">ಪ್ರಾರಂಭಿಸಿ</string>
|
||||||
<string name="Start_Sample">ನಮೂನೆ ಪ್ರಾರಂಭಿಸಿ</string>
|
<string name="Start_Sample">ನಮೂನೆ ಪ್ರಾರಂಭಿಸಿ</string>
|
||||||
<string name="new_kit">ಹೊಸ ಕಿಟ್</string>
|
<string name="new_kit">ಹೊಸ ಕಿಟ್</string>
|
||||||
|
|||||||
@@ -114,6 +114,7 @@
|
|||||||
<string name="auto_dac">Auto DAC</string>
|
<string name="auto_dac">Auto DAC</string>
|
||||||
<string name="assurance_controls">Quality Assurance</string>
|
<string name="assurance_controls">Quality Assurance</string>
|
||||||
<string name="calibration">Calibration</string>
|
<string name="calibration">Calibration</string>
|
||||||
|
<string name="deviceProvision">Device Provision</string>
|
||||||
<string name="place_buffer">Start</string>
|
<string name="place_buffer">Start</string>
|
||||||
<string name="Start_Sample">Start Sample</string>
|
<string name="Start_Sample">Start Sample</string>
|
||||||
<string name="new_kit">New Kit</string>
|
<string name="new_kit">New Kit</string>
|
||||||
|
|||||||
@@ -11,6 +11,7 @@
|
|||||||
<!-- <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="24577" /> <!-- 0x6015: FT230X, FT231X, FT234XD -->
|
||||||
<usb-device vendor-id="6790" product-id="29987" /> <!-- 0x6015: FT230X, FT231X, FT234XD -->
|
<usb-device vendor-id="6790" product-id="29987" /> <!-- 0x6015: FT230X, FT231X, FT234XD -->
|
||||||
|
<usb-device vendor-id="4292" product-id="60000" /> <!-- 0x6015: FT230X, FT231X, FT234XD -->
|
||||||
|
|
||||||
<!-- 0x10C4 / 0xEA??: Silabs CP210x -->
|
<!-- 0x10C4 / 0xEA??: Silabs CP210x -->
|
||||||
<!-- <usb-device vendor-id="4292" product-id="60000" /> <!– 0xea60: CP2102 and other CP210x single port devices –>-->
|
<!-- <usb-device vendor-id="4292" product-id="60000" /> <!– 0xea60: CP2102 and other CP210x single port devices –>-->
|
||||||
|
|||||||
Reference in New Issue
Block a user