Added Buffer Value Logic

This commit is contained in:
mohamedkaif356
2023-08-03 13:01:03 +05:30
parent 4c847fb132
commit 8237e753c0
2 changed files with 17 additions and 1 deletions

View File

@@ -46,6 +46,6 @@ object Constants {
const val password = "SMI@12345"
const val KIT_NUMBER = "KitNumber"
const val KIT_COUNT = "KitCount"
const val BUFFER_VALUE = "BufferValue"
}

View File

@@ -14,6 +14,7 @@ import android.widget.Toast
import androidx.fragment.app.Fragment
import androidx.fragment.app.activityViewModels
import com.example.hpostesting.data.DataHolder
import com.example.hpostesting.data.constant.Constants
import com.example.hpostesting.data.constant.HemoCubeCommands
import com.example.hpostesting.data.model.patient.DeviceData
import com.example.hpostesting.data.model.patient.toHemoCubeTestData
@@ -83,6 +84,21 @@ class HemoCubeFragment : Fragment() {
isOnline = isNetworkAvailable
}
}
if (checkBufferValue()) {
TODO("Call S command")
//We have to store the buffer value like this
with(sharedPreference.edit()) {
putInt(Constants.BUFFER_VALUE, 2000)
apply()
}
} else {
TODO("Call B command")
}
}
private fun checkBufferValue(): Boolean {
return sharedPreference.getInt(Constants.BUFFER_VALUE, 0) > 0
}
private fun setupButtonClickListeners() {