add config error msg and v2 usb config

This commit is contained in:
Pritimay Sarkar
2023-12-15 10:22:50 +05:30
parent 41798aa37b
commit 7fe8202968
2 changed files with 5 additions and 1 deletions

View File

@@ -29,6 +29,8 @@ 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_VENDOR_ID = 1027
const val ERROR_NORMAL = 400
const val ERROR_CRITICAL = 401

View File

@@ -294,13 +294,15 @@ class HemoCubeFragment : Fragment() {
when {
stringData.contains("SN") -> {
val slData = stringData.split(" ")
if (slData.size > 1) {
if (slData.size > 1 && slData[1].trim().length == 12) {
val hardwareId = slData[1].trim()
deviceHardwareId = hardwareId
with(sharedPreferences.edit()) {
putString(Constants.DEVICE_ID, hardwareId)
apply()
}
} else {
hemoCubeViewModel.messages.postValue("Config error")
}
activity?.runOnUiThread {
binding.btnPlacebuffer.visibility = View.VISIBLE