Compare commits
86 Commits
dev-withou
...
smi_131_re
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
63eaf1cadc | ||
|
|
c180f7be31 | ||
|
|
c243ec6c8f | ||
|
|
7c9238591b | ||
|
|
5c843ca232 | ||
|
|
736dff2b11 | ||
|
|
20dd1e41eb | ||
|
|
ad6670a1e8 | ||
|
|
e6f8ab69e9 | ||
|
|
ccd2138f66 | ||
|
|
d54436996d | ||
|
|
52a555a63a | ||
|
|
8e80cfe525 | ||
|
|
f26f54e51d | ||
|
|
1d029b8ff8 | ||
|
|
c88efd148b | ||
|
|
cb27983d21 | ||
|
|
0b268dda47 | ||
|
|
d9777edf02 | ||
|
|
238424ad89 | ||
|
|
c1f02c878c | ||
|
|
b344dbcb69 | ||
|
|
af7b426416 | ||
|
|
07abfcce6c | ||
|
|
2c62cc11ba | ||
|
|
312e2da79a | ||
|
|
9768a0a835 | ||
|
|
db7aba4549 | ||
|
|
302239d191 | ||
|
|
cc1ae1ff82 | ||
|
|
d420a42fcc | ||
|
|
21b3960ca9 | ||
|
|
9183216cfe | ||
|
|
a72bd3d59e | ||
|
|
54be3a1037 | ||
|
|
69055b5498 | ||
|
|
7dde6bf976 | ||
|
|
ee0f1d748a | ||
|
|
d32e7b6cbb | ||
|
|
d306d0b9fa | ||
|
|
8e074e01c9 | ||
|
|
6b0c81213e | ||
|
|
51480393da | ||
|
|
d9221a3bb6 | ||
|
|
569155d193 | ||
|
|
ad029e4cce | ||
|
|
31654be3bb | ||
|
|
738375afc5 | ||
|
|
e77b4d9a23 | ||
|
|
cf429b4fc3 | ||
|
|
30df9732a7 | ||
|
|
a1ce200ad8 | ||
|
|
2512556e8a | ||
|
|
4c1429f3cb | ||
|
|
d0f33582df | ||
|
|
6be6a65e95 | ||
|
|
b32c5e29d0 | ||
|
|
453af33baa | ||
|
|
dd345a1b31 | ||
|
|
ba52efc670 | ||
|
|
eb60025add | ||
|
|
5e1283873d | ||
|
|
735afbf3c0 | ||
|
|
5c8d6581b6 | ||
|
|
1f9784aea6 | ||
|
|
81b799d9c1 | ||
|
|
b89139d571 | ||
|
|
0de4b71866 | ||
|
|
331726682f | ||
|
|
c41a2f5139 | ||
|
|
262f334f40 | ||
|
|
50fd8c0632 | ||
|
|
bdb58f9b49 | ||
|
|
7fe72b0371 | ||
|
|
d620aa9e0d | ||
|
|
238debae85 | ||
|
|
4ba2f38583 | ||
|
|
0b6e3749c3 | ||
|
|
f2e9bf2eed | ||
|
|
7fcfd58544 | ||
|
|
628b84bfef | ||
|
|
c825ebbda3 | ||
|
|
fe8a340021 | ||
|
|
6bbbcea227 | ||
|
|
ad237e75ae | ||
|
|
5cfb04c680 |
107
.gitlab-ci.yml
107
.gitlab-ci.yml
@@ -1,63 +1,31 @@
|
|||||||
# This file is a template, and might need editing before it works on your project.
|
|
||||||
# To contribute improvements to CI/CD templates, please follow the Development guide at:
|
|
||||||
# https://docs.gitlab.com/ee/development/cicd/templates.html
|
|
||||||
# This specific template is located at:
|
|
||||||
# https://gitlab.com/gitlab-org/gitlab/-/blob/master/lib/gitlab/ci/templates/Android.gitlab-ci.yml
|
|
||||||
|
|
||||||
# Read more about this script on this blog post https://about.gitlab.com/2018/10/24/setting-up-gitlab-ci-for-android-projects/, by Jason Lenny
|
|
||||||
# If you are interested in using Android with FastLane for publishing take a look at the Android-Fastlane template.
|
|
||||||
|
|
||||||
image: eclipse-temurin:17-jdk-jammy
|
image: eclipse-temurin:17-jdk-jammy
|
||||||
|
|
||||||
variables:
|
variables:
|
||||||
|
|
||||||
# ANDROID_COMPILE_SDK is the version of Android you're compiling with.
|
|
||||||
# It should match compileSdkVersion.
|
|
||||||
ANDROID_COMPILE_SDK: "34"
|
ANDROID_COMPILE_SDK: "34"
|
||||||
|
|
||||||
# ANDROID_BUILD_TOOLS is the version of the Android build tools you are using.
|
|
||||||
# It should match buildToolsVersion.
|
|
||||||
ANDROID_BUILD_TOOLS: "33.0.2"
|
ANDROID_BUILD_TOOLS: "33.0.2"
|
||||||
|
|
||||||
# It's what version of the command line tools we're going to download from the official site.
|
|
||||||
# Official Site-> https://developer.android.com/studio/index.html
|
|
||||||
# There, look down below at the cli tools only, sdk tools package is of format:
|
|
||||||
# commandlinetools-os_type-ANDROID_SDK_TOOLS_latest.zip
|
|
||||||
# when the script was last modified for latest compileSdkVersion, it was which is written down below
|
|
||||||
ANDROID_SDK_TOOLS: "9477386"
|
ANDROID_SDK_TOOLS: "9477386"
|
||||||
|
|
||||||
|
# Keystore credentials stored as GitLab CI/CD variables
|
||||||
|
KEYSTORE_PASSWORD: $KS_PASSWORD
|
||||||
|
KEY_ALIAS: $KS_ALIAS
|
||||||
|
KEY_PASSWORD: $KS_KEY_PASSWORD
|
||||||
|
|
||||||
# Packages installation before running script
|
|
||||||
before_script:
|
before_script:
|
||||||
- apt-get --quiet update --yes
|
- apt-get --quiet update --yes
|
||||||
- apt-get --quiet install --yes wget unzip
|
- apt-get --quiet install --yes wget unzip
|
||||||
|
|
||||||
# Setup path as android_home for moving/exporting the downloaded sdk into it
|
|
||||||
- export ANDROID_HOME="${PWD}/android-sdk-root"
|
- export ANDROID_HOME="${PWD}/android-sdk-root"
|
||||||
# Create a new directory at specified location
|
|
||||||
- install -d $ANDROID_HOME
|
- install -d $ANDROID_HOME
|
||||||
# Here we are installing androidSDK tools from official source,
|
|
||||||
# (the key thing here is the url from where you are downloading these sdk tool for command line, so please do note this url pattern there and here as well)
|
|
||||||
# after that unzipping those tools and
|
|
||||||
# then running a series of SDK manager commands to install necessary android SDK packages that'll allow the app to build
|
|
||||||
- wget --no-verbose --output-document=$ANDROID_HOME/cmdline-tools.zip https://dl.google.com/android/repository/commandlinetools-linux-${ANDROID_SDK_TOOLS}_latest.zip
|
- wget --no-verbose --output-document=$ANDROID_HOME/cmdline-tools.zip https://dl.google.com/android/repository/commandlinetools-linux-${ANDROID_SDK_TOOLS}_latest.zip
|
||||||
- unzip -q -d "$ANDROID_HOME/cmdline-tools" "$ANDROID_HOME/cmdline-tools.zip"
|
- unzip -q -d "$ANDROID_HOME/cmdline-tools" "$ANDROID_HOME/cmdline-tools.zip"
|
||||||
- mv -T "$ANDROID_HOME/cmdline-tools/cmdline-tools" "$ANDROID_HOME/cmdline-tools/tools"
|
- mv -T "$ANDROID_HOME/cmdline-tools/cmdline-tools" "$ANDROID_HOME/cmdline-tools/tools"
|
||||||
- export PATH=$PATH:$ANDROID_HOME/cmdline-tools/latest/bin:$ANDROID_HOME/cmdline-tools/tools/bin
|
- export PATH=$PATH:$ANDROID_HOME/cmdline-tools/latest/bin:$ANDROID_HOME/cmdline-tools/tools/bin
|
||||||
|
|
||||||
# Nothing fancy here, just checking sdkManager version
|
|
||||||
- sdkmanager --version
|
- sdkmanager --version
|
||||||
|
|
||||||
# use yes to accept all licenses
|
|
||||||
- yes | sdkmanager --licenses > /dev/null || true
|
- yes | sdkmanager --licenses > /dev/null || true
|
||||||
- sdkmanager "platforms;android-${ANDROID_COMPILE_SDK}"
|
- sdkmanager "platforms;android-${ANDROID_COMPILE_SDK}"
|
||||||
- sdkmanager "platform-tools"
|
- sdkmanager "platform-tools"
|
||||||
- sdkmanager "build-tools;${ANDROID_BUILD_TOOLS}"
|
- sdkmanager "build-tools;${ANDROID_BUILD_TOOLS}"
|
||||||
|
|
||||||
# Not necessary, but just for surity
|
|
||||||
- chmod +x ./gradlew
|
- chmod +x ./gradlew
|
||||||
|
|
||||||
# Basic android and gradle stuff
|
|
||||||
# Check linting
|
|
||||||
lintDebug:
|
lintDebug:
|
||||||
interruptible: true
|
interruptible: true
|
||||||
stage: build
|
stage: build
|
||||||
@@ -69,7 +37,6 @@ lintDebug:
|
|||||||
expose_as: "lint-report"
|
expose_as: "lint-report"
|
||||||
when: always
|
when: always
|
||||||
|
|
||||||
# Make Project
|
|
||||||
assembleDebug:
|
assembleDebug:
|
||||||
interruptible: true
|
interruptible: true
|
||||||
stage: build
|
stage: build
|
||||||
@@ -78,8 +45,68 @@ assembleDebug:
|
|||||||
artifacts:
|
artifacts:
|
||||||
paths:
|
paths:
|
||||||
- app/build/outputs/
|
- app/build/outputs/
|
||||||
|
|
||||||
|
# Job for building signed release APK for tags containing "release" on any branch
|
||||||
|
assembleRelease:
|
||||||
|
stage: build
|
||||||
|
script:
|
||||||
|
- |
|
||||||
|
if [[ "$CI_COMMIT_TAG" =~ release ]]; then
|
||||||
|
echo "Decoding keystore file from Base64"
|
||||||
|
|
||||||
|
# Debug: Print the first few characters of BASE64_KEYSTORE
|
||||||
|
echo "First 20 characters of BASE64_KEYSTORE: ${BASE64_KEYSTORE:0:20}..."
|
||||||
|
|
||||||
|
# Check if BASE64_KEYSTORE is a file path
|
||||||
|
if [[ "$BASE64_KEYSTORE" == /* ]] && [[ -f "$BASE64_KEYSTORE" ]]; then
|
||||||
|
echo "BASE64_KEYSTORE appears to be a file path. Reading content..."
|
||||||
|
BASE64_CONTENT=$(cat "$BASE64_KEYSTORE")
|
||||||
|
else
|
||||||
|
echo "BASE64_KEYSTORE is not a file path. Using as-is."
|
||||||
|
BASE64_CONTENT="$BASE64_KEYSTORE"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Remove any potential whitespace or newline characters
|
||||||
|
CLEANED_KEYSTORE=$(echo "$BASE64_CONTENT" | tr -d '[:space:]')
|
||||||
|
|
||||||
|
# Attempt to decode and save to a file
|
||||||
|
if echo "$CLEANED_KEYSTORE" | base64 -d > "$CI_PROJECT_DIR/app/keystore.jks" 2>/tmp/base64_error; then
|
||||||
|
echo "Keystore file decoded successfully"
|
||||||
|
else
|
||||||
|
echo "Error decoding keystore file:"
|
||||||
|
cat /tmp/base64_error
|
||||||
|
echo "First 20 characters of cleaned content: ${CLEANED_KEYSTORE:0:20}..."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Check if the keystore file was created and has content
|
||||||
|
if [ -s "$CI_PROJECT_DIR/app/keystore.jks" ]; then
|
||||||
|
echo "Keystore file created successfully"
|
||||||
|
# Print file size for verification
|
||||||
|
ls -l "$CI_PROJECT_DIR/app/keystore.jks"
|
||||||
|
else
|
||||||
|
echo "Error: Keystore file is empty or not created"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Building signed release APK"
|
||||||
|
./gradlew assembleRelease \
|
||||||
|
-Pandroid.injected.signing.store.file="$CI_PROJECT_DIR/app/keystore.jks" \
|
||||||
|
-Pandroid.injected.signing.store.password="$KEYSTORE_PASSWORD" \
|
||||||
|
-Pandroid.injected.signing.key.alias="$KEY_ALIAS" \
|
||||||
|
-Pandroid.injected.signing.key.password="$KEY_PASSWORD"
|
||||||
|
else
|
||||||
|
echo "Tag '$CI_COMMIT_TAG' does not contain 'release'. Skipping release build."
|
||||||
|
fi
|
||||||
|
artifacts:
|
||||||
|
paths:
|
||||||
|
- app/build/outputs/
|
||||||
|
expire_in: never
|
||||||
|
rules:
|
||||||
|
- if: $CI_COMMIT_TAG =~ /release/
|
||||||
|
when: always
|
||||||
|
- when: never
|
||||||
|
|
||||||
# Run all tests, if any fails, interrupt the pipeline(fail it)
|
|
||||||
debugTests:
|
debugTests:
|
||||||
needs: [lintDebug, assembleDebug]
|
needs: [lintDebug, assembleDebug]
|
||||||
interruptible: true
|
interruptible: true
|
||||||
@@ -98,4 +125,4 @@ publishTestResults:
|
|||||||
artifacts:
|
artifacts:
|
||||||
when: always
|
when: always
|
||||||
reports:
|
reports:
|
||||||
junit: app/build/test-results/testDebugUnitTest/*.xml
|
junit: app/build/test-results/testDebugUnitTest/*.xml
|
||||||
@@ -1,4 +1,7 @@
|
|||||||
|
# Latest hpos app version
|
||||||
|
## current version : 2.1.132
|
||||||
|
|
||||||
### Release key
|
### Release key
|
||||||
|
|
||||||
key0: prime24
|
key0: prime24
|
||||||
|
|
||||||
@@ -15,13 +15,13 @@ android {
|
|||||||
namespace 'in.sminnovations.hpostesting'
|
namespace 'in.sminnovations.hpostesting'
|
||||||
|
|
||||||
// dev -> development, quality -> qc, uat -> User Acceptance Testing, preprod -> preproduction, prod -> production, iocl -> iocl-iisc production
|
// dev -> development, quality -> qc, uat -> User Acceptance Testing, preprod -> preproduction, prod -> production, iocl -> iocl-iisc production
|
||||||
|
// server -> for server switching for internal test
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
applicationId "in.sminnovations.hpostesting.dev"
|
applicationId "in.sminnovations.hpostesting.server"
|
||||||
minSdk 21
|
minSdk 30
|
||||||
targetSdk 34
|
targetSdk 34
|
||||||
versionCode 122
|
versionCode 134
|
||||||
versionName "2.1.122"
|
versionName "2.1.131"
|
||||||
|
|
||||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -30,6 +30,7 @@ android {
|
|||||||
release {
|
release {
|
||||||
minifyEnabled false
|
minifyEnabled false
|
||||||
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
||||||
|
signingConfig signingConfigs.debug
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
compileOptions {
|
compileOptions {
|
||||||
@@ -89,7 +90,6 @@ dependencies {
|
|||||||
implementation("com.google.firebase:firebase-appdistribution-api-ktx:16.0.0-beta12")
|
implementation("com.google.firebase:firebase-appdistribution-api-ktx:16.0.0-beta12")
|
||||||
implementation 'androidx.preference:preference-ktx:1.2.1'
|
implementation 'androidx.preference:preference-ktx:1.2.1'
|
||||||
implementation 'androidx.preference:preference-ktx:1.2.1'
|
implementation 'androidx.preference:preference-ktx:1.2.1'
|
||||||
implementation 'com.google.android.play:core:1.10.3'
|
|
||||||
implementation 'io.nats:jnats:2.11.4'
|
implementation 'io.nats:jnats:2.11.4'
|
||||||
|
|
||||||
|
|
||||||
@@ -121,10 +121,9 @@ dependencies {
|
|||||||
|
|
||||||
implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:2.7.0"
|
implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:2.7.0"
|
||||||
implementation 'com.opencsv:opencsv:5.9'
|
implementation 'com.opencsv:opencsv:5.9'
|
||||||
implementation 'com.github.mik3y:usb-serial-for-android:3.5.1'
|
implementation 'com.github.mik3y:usb-serial-for-android:3.8.0'
|
||||||
|
|
||||||
implementation "androidx.fragment:fragment-ktx:1.6.2"
|
implementation "androidx.fragment:fragment-ktx:1.6.2"
|
||||||
|
|
||||||
// CSV read, write
|
// CSV read, write
|
||||||
implementation 'com.opencsv:opencsv:5.9'
|
implementation 'com.opencsv:opencsv:5.9'
|
||||||
|
|
||||||
@@ -164,10 +163,12 @@ dependencies {
|
|||||||
implementation("androidx.work:work-runtime-ktx:2.9.0")
|
implementation("androidx.work:work-runtime-ktx:2.9.0")
|
||||||
|
|
||||||
// implementation("io.nats:jnats:2.11.2")
|
// implementation("io.nats:jnats:2.11.2")
|
||||||
implementation 'com.google.android.play:core:1.10.3'
|
// implementation 'com.google.android.play:core:1.10.3'
|
||||||
|
|
||||||
implementation fileTree(dir: 'libs', include: ['*.aar'])
|
implementation fileTree(dir: 'libs', include: ['*.aar'])
|
||||||
implementation 'io.nats:jnats:2.11.4'
|
implementation 'io.nats:jnats:2.11.4'
|
||||||
implementation 'org.apache.commons:commons-math3:3.6.1'
|
implementation 'org.apache.commons:commons-math3:3.6.1'
|
||||||
|
implementation 'pl.droidsonroids.gif:android-gif-drawable:1.2.17'
|
||||||
|
implementation 'androidx.security:security-crypto:1.1.0-alpha03'
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -1,202 +1,33 @@
|
|||||||
{
|
{
|
||||||
"project_info": {
|
"project_info": {
|
||||||
"project_number": "650071678820",
|
"project_number": "1012719870714",
|
||||||
"project_id": "hpos-af3cc",
|
"project_id": "hpos-prod",
|
||||||
"storage_bucket": "hpos-af3cc.appspot.com"
|
"storage_bucket": "hpos-prod.appspot.com"
|
||||||
},
|
},
|
||||||
"client": [
|
"client": [
|
||||||
{
|
{
|
||||||
"client_info": {
|
"client_info": {
|
||||||
"mobilesdk_app_id": "1:650071678820:android:f1435a1c07f710036c6471",
|
"mobilesdk_app_id": "1:1012719870714:android:d8d7c962d96f4097de5f43",
|
||||||
"android_client_info": {
|
"android_client_info": {
|
||||||
"package_name": "com.example.hposconsentform"
|
"package_name": "in.sminnovations.hpostesting.server"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"oauth_client": [
|
"oauth_client": [
|
||||||
{
|
{
|
||||||
"client_id": "650071678820-to41afi9f0gi5r3k6v7pe1e5p96nupcs.apps.googleusercontent.com",
|
"client_id": "1012719870714-uli6cdjea3lfnnueh6e4r15i10ei1vlj.apps.googleusercontent.com",
|
||||||
"client_type": 3
|
"client_type": 3
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"api_key": [
|
"api_key": [
|
||||||
{
|
{
|
||||||
"current_key": "AIzaSyAVdNGCev_AFX0qmuZJF6kxzRzXUTeAW5I"
|
"current_key": "AIzaSyA_O0oZGzy3Kiw9fiLQ3OFPME-xQJP88vs"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"services": {
|
"services": {
|
||||||
"appinvite_service": {
|
"appinvite_service": {
|
||||||
"other_platform_oauth_client": [
|
"other_platform_oauth_client": [
|
||||||
{
|
{
|
||||||
"client_id": "650071678820-to41afi9f0gi5r3k6v7pe1e5p96nupcs.apps.googleusercontent.com",
|
"client_id": "1012719870714-uli6cdjea3lfnnueh6e4r15i10ei1vlj.apps.googleusercontent.com",
|
||||||
"client_type": 3
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"client_info": {
|
|
||||||
"mobilesdk_app_id": "1:650071678820:android:7865bef608cdee6f6c6471",
|
|
||||||
"android_client_info": {
|
|
||||||
"package_name": "com.smi.counselling"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"oauth_client": [
|
|
||||||
{
|
|
||||||
"client_id": "650071678820-to41afi9f0gi5r3k6v7pe1e5p96nupcs.apps.googleusercontent.com",
|
|
||||||
"client_type": 3
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"api_key": [
|
|
||||||
{
|
|
||||||
"current_key": "AIzaSyAVdNGCev_AFX0qmuZJF6kxzRzXUTeAW5I"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"services": {
|
|
||||||
"appinvite_service": {
|
|
||||||
"other_platform_oauth_client": [
|
|
||||||
{
|
|
||||||
"client_id": "650071678820-to41afi9f0gi5r3k6v7pe1e5p96nupcs.apps.googleusercontent.com",
|
|
||||||
"client_type": 3
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"client_info": {
|
|
||||||
"mobilesdk_app_id": "1:650071678820:android:2925e9ce3417d2386c6471",
|
|
||||||
"android_client_info": {
|
|
||||||
"package_name": "in.sminnovations.hemocube"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"oauth_client": [
|
|
||||||
{
|
|
||||||
"client_id": "650071678820-srhm9spm9hjn4frcd3r6o02gdhdbtd15.apps.googleusercontent.com",
|
|
||||||
"client_type": 1,
|
|
||||||
"android_info": {
|
|
||||||
"package_name": "in.sminnovations.hemocube",
|
|
||||||
"certificate_hash": "7714b9268a81d0cf0fb178b0af8dbb630f8fc70a"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"client_id": "650071678820-to41afi9f0gi5r3k6v7pe1e5p96nupcs.apps.googleusercontent.com",
|
|
||||||
"client_type": 3
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"api_key": [
|
|
||||||
{
|
|
||||||
"current_key": "AIzaSyAVdNGCev_AFX0qmuZJF6kxzRzXUTeAW5I"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"services": {
|
|
||||||
"appinvite_service": {
|
|
||||||
"other_platform_oauth_client": [
|
|
||||||
{
|
|
||||||
"client_id": "650071678820-to41afi9f0gi5r3k6v7pe1e5p96nupcs.apps.googleusercontent.com",
|
|
||||||
"client_type": 3
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"client_info": {
|
|
||||||
"mobilesdk_app_id": "1:650071678820:android:7569c1cad4fc99916c6471",
|
|
||||||
"android_client_info": {
|
|
||||||
"package_name": "in.sminnovations.hposregistration"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"oauth_client": [
|
|
||||||
{
|
|
||||||
"client_id": "650071678820-70kp5jvjda4r5diqch2kn4lc40p4f42g.apps.googleusercontent.com",
|
|
||||||
"client_type": 1,
|
|
||||||
"android_info": {
|
|
||||||
"package_name": "in.sminnovations.hposregistration",
|
|
||||||
"certificate_hash": "7714b9268a81d0cf0fb178b0af8dbb630f8fc70a"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"client_id": "650071678820-to41afi9f0gi5r3k6v7pe1e5p96nupcs.apps.googleusercontent.com",
|
|
||||||
"client_type": 3
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"api_key": [
|
|
||||||
{
|
|
||||||
"current_key": "AIzaSyAVdNGCev_AFX0qmuZJF6kxzRzXUTeAW5I"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"services": {
|
|
||||||
"appinvite_service": {
|
|
||||||
"other_platform_oauth_client": [
|
|
||||||
{
|
|
||||||
"client_id": "650071678820-to41afi9f0gi5r3k6v7pe1e5p96nupcs.apps.googleusercontent.com",
|
|
||||||
"client_type": 3
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"client_info": {
|
|
||||||
"mobilesdk_app_id": "1:650071678820:android:f96be19e5d43102b6c6471",
|
|
||||||
"android_client_info": {
|
|
||||||
"package_name": "in.sminnovations.hpostesting"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"oauth_client": [
|
|
||||||
{
|
|
||||||
"client_id": "650071678820-l87dnr0bdj95get0khgnvfv2an1k6ogq.apps.googleusercontent.com",
|
|
||||||
"client_type": 1,
|
|
||||||
"android_info": {
|
|
||||||
"package_name": "in.sminnovations.hpostesting",
|
|
||||||
"certificate_hash": "7714b9268a81d0cf0fb178b0af8dbb630f8fc70a"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"client_id": "650071678820-to41afi9f0gi5r3k6v7pe1e5p96nupcs.apps.googleusercontent.com",
|
|
||||||
"client_type": 3
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"api_key": [
|
|
||||||
{
|
|
||||||
"current_key": "AIzaSyAVdNGCev_AFX0qmuZJF6kxzRzXUTeAW5I"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"services": {
|
|
||||||
"appinvite_service": {
|
|
||||||
"other_platform_oauth_client": [
|
|
||||||
{
|
|
||||||
"client_id": "650071678820-to41afi9f0gi5r3k6v7pe1e5p96nupcs.apps.googleusercontent.com",
|
|
||||||
"client_type": 3
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"client_info": {
|
|
||||||
"mobilesdk_app_id": "1:650071678820:android:a53292637abb7c0d6c6471",
|
|
||||||
"android_client_info": {
|
|
||||||
"package_name": "in.sminnovations.hpostesting.dev"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"oauth_client": [
|
|
||||||
{
|
|
||||||
"client_id": "650071678820-to41afi9f0gi5r3k6v7pe1e5p96nupcs.apps.googleusercontent.com",
|
|
||||||
"client_type": 3
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"api_key": [
|
|
||||||
{
|
|
||||||
"current_key": "AIzaSyAVdNGCev_AFX0qmuZJF6kxzRzXUTeAW5I"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"services": {
|
|
||||||
"appinvite_service": {
|
|
||||||
"other_platform_oauth_client": [
|
|
||||||
{
|
|
||||||
"client_id": "650071678820-to41afi9f0gi5r3k6v7pe1e5p96nupcs.apps.googleusercontent.com",
|
|
||||||
"client_type": 3
|
"client_type": 3
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -4,17 +4,34 @@
|
|||||||
"type": "APK",
|
"type": "APK",
|
||||||
"kind": "Directory"
|
"kind": "Directory"
|
||||||
},
|
},
|
||||||
"applicationId": "in.sminnovations.hpostesting.quality",
|
"applicationId": "in.sminnovations.hpostesting.dev",
|
||||||
"variantName": "release",
|
"variantName": "release",
|
||||||
"elements": [
|
"elements": [
|
||||||
{
|
{
|
||||||
"type": "SINGLE",
|
"type": "SINGLE",
|
||||||
"filters": [],
|
"filters": [],
|
||||||
"attributes": [],
|
"attributes": [],
|
||||||
"versionCode": 101,
|
"versionCode": 127,
|
||||||
"versionName": "2.1.101",
|
"versionName": "2.1.127",
|
||||||
"outputFile": "app-release.apk"
|
"outputFile": "app-release.apk"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"elementType": "File"
|
"elementType": "File",
|
||||||
|
"baselineProfiles": [
|
||||||
|
{
|
||||||
|
"minApi": 28,
|
||||||
|
"maxApi": 30,
|
||||||
|
"baselineProfiles": [
|
||||||
|
"baselineProfiles/1/app-release.dm"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"minApi": 31,
|
||||||
|
"maxApi": 2147483647,
|
||||||
|
"baselineProfiles": [
|
||||||
|
"baselineProfiles/0/app-release.dm"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"minSdkVersionForDexing": 21
|
||||||
}
|
}
|
||||||
@@ -2,6 +2,9 @@
|
|||||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:tools="http://schemas.android.com/tools">
|
xmlns:tools="http://schemas.android.com/tools">
|
||||||
|
|
||||||
|
<uses-permission
|
||||||
|
android:name="android.permission.AUTHENTICATE_ACCOUNTS"
|
||||||
|
android:maxSdkVersion="22" />
|
||||||
<uses-permission android:name="android.permission.MANAGE_EXTERNAL_STORAGE" />
|
<uses-permission android:name="android.permission.MANAGE_EXTERNAL_STORAGE" />
|
||||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
|
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
|
||||||
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
|
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
|
||||||
@@ -22,6 +25,12 @@
|
|||||||
|
|
||||||
<uses-permission android:name="android.permission.USB_PERMISSION" />
|
<uses-permission android:name="android.permission.USB_PERMISSION" />
|
||||||
|
|
||||||
|
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
|
||||||
|
<uses-permission android:name="android.permission.MANAGE_ACCOUNTS" />
|
||||||
|
<uses-permission android:name="android.permission.ACCOUNT_MANAGER"
|
||||||
|
tools:ignore="ProtectedPermissions" />
|
||||||
|
|
||||||
|
|
||||||
<application
|
<application
|
||||||
android:name="com.example.hpostesting.HPOSTestingApplication"
|
android:name="com.example.hpostesting.HPOSTestingApplication"
|
||||||
android:allowBackup="true"
|
android:allowBackup="true"
|
||||||
@@ -34,27 +43,54 @@
|
|||||||
android:supportsRtl="true"
|
android:supportsRtl="true"
|
||||||
android:theme="@style/Theme.HPOSTesting"
|
android:theme="@style/Theme.HPOSTesting"
|
||||||
tools:targetApi="31">
|
tools:targetApi="31">
|
||||||
|
<activity
|
||||||
|
android:name="com.example.hpostesting.presentation.main_base.UpdateValuesActivity"
|
||||||
|
android:exported="false"
|
||||||
|
android:screenOrientation="portrait"/>
|
||||||
|
|
||||||
|
<service
|
||||||
|
android:name="com.example.hpostesting.util.MyAuthenticatorService"
|
||||||
|
android:exported="true"
|
||||||
|
android:permission="android.permission.BIND_AUTOFILL_SERVICE">
|
||||||
|
<intent-filter>
|
||||||
|
<action android:name="android.accounts.AccountAuthenticator" />
|
||||||
|
</intent-filter>
|
||||||
|
|
||||||
|
<meta-data
|
||||||
|
android:name="android.accounts.AccountAuthenticator"
|
||||||
|
android:resource="@xml/authenticator" />
|
||||||
|
</service>
|
||||||
|
|
||||||
|
<activity
|
||||||
|
android:name="com.example.hpostesting.presentation.main_base.ui.PasswordResetActivity"
|
||||||
|
android:exported="false"
|
||||||
|
android:screenOrientation="portrait" />
|
||||||
<activity
|
<activity
|
||||||
android:name="com.example.hpostesting.presentation.usb_teminal.UsbTerminalActivity"
|
android:name="com.example.hpostesting.presentation.usb_teminal.UsbTerminalActivity"
|
||||||
android:screenOrientation="portrait"
|
android:exported="false"
|
||||||
android:exported="false" />
|
android:screenOrientation="portrait" />
|
||||||
<activity
|
<activity
|
||||||
android:name="com.example.hpostesting.presentation.deviceinfo.DeviceActivity"
|
android:name="com.example.hpostesting.presentation.deviceinfo.DeviceActivity"
|
||||||
android:exported="false" />
|
android:exported="false"
|
||||||
|
android:theme="@style/Theme.HPOS.NoActionBar" />
|
||||||
<activity
|
<activity
|
||||||
android:name="com.example.hpostesting.presentation.hemocube.DigitalCardActivity"
|
android:name="com.example.hpostesting.presentation.trueheme_test.DigitalCardActivity"
|
||||||
android:exported="false" />
|
android:exported="false" />
|
||||||
<activity
|
<activity
|
||||||
android:name="com.example.hpostesting.presentation.diagnostics.DiagnosticsActivity"
|
android:name="com.example.hpostesting.presentation.diagnostics.DiagnosticsActivity"
|
||||||
android:exported="false"
|
android:exported="false"
|
||||||
android:theme="@style/Theme.HPOS.NoActionBar" />
|
android:theme="@style/Theme.HPOS.NoActionBar" />
|
||||||
|
<activity
|
||||||
|
android:name="com.example.hpostesting.presentation.hb_test.HBTestActivity"
|
||||||
|
android:exported="false"
|
||||||
|
android:theme="@style/Theme.HPOS.NoActionBar" />
|
||||||
<activity
|
<activity
|
||||||
android:name="com.example.hpostesting.presentation.autodac.AutoDacActivity"
|
android:name="com.example.hpostesting.presentation.autodac.AutoDacActivity"
|
||||||
android:exported="false"
|
android:exported="false"
|
||||||
android:theme="@style/Theme.HPOS.NoActionBar" />
|
android:theme="@style/Theme.HPOS.NoActionBar" />
|
||||||
<activity
|
<activity
|
||||||
android:name="com.example.hpostesting.presentation.jig.JigActivity"
|
android:name="com.example.hpostesting.presentation.jig.JigActivity"
|
||||||
android:exported="false"
|
android:exported="true"
|
||||||
android:theme="@style/Theme.HPOS.NoActionBar" />
|
android:theme="@style/Theme.HPOS.NoActionBar" />
|
||||||
<activity
|
<activity
|
||||||
android:name="com.example.hpostesting.presentation.deviceprovision.DeviceProvisionActivity"
|
android:name="com.example.hpostesting.presentation.deviceprovision.DeviceProvisionActivity"
|
||||||
@@ -70,7 +106,7 @@
|
|||||||
android:screenOrientation="portrait"
|
android:screenOrientation="portrait"
|
||||||
android:theme="@style/Theme.HPOS.NoActionBar" />
|
android:theme="@style/Theme.HPOS.NoActionBar" />
|
||||||
<activity
|
<activity
|
||||||
android:name="com.example.hpostesting.presentation.hemocube.HemocubeActivity"
|
android:name="com.example.hpostesting.presentation.trueheme_test.TrueHemeTestActivity"
|
||||||
android:exported="false"
|
android:exported="false"
|
||||||
android:noHistory="true"
|
android:noHistory="true"
|
||||||
android:parentActivityName="com.example.hpostesting.presentation.MainActivity"
|
android:parentActivityName="com.example.hpostesting.presentation.MainActivity"
|
||||||
@@ -97,13 +133,12 @@
|
|||||||
android:noHistory="true"
|
android:noHistory="true"
|
||||||
android:theme="@style/Theme.HPOS.NoActionBar" />
|
android:theme="@style/Theme.HPOS.NoActionBar" />
|
||||||
<activity
|
<activity
|
||||||
android:name="com.example.hpostesting.presentation.dashboard.DashboardActivity"
|
android:name="com.example.hpostesting.presentation.main_base.DashboardActivity"
|
||||||
android:exported="false"
|
android:exported="true"
|
||||||
android:label="@string/title_activity_dashboard"
|
android:label="@string/title_activity_dashboard"
|
||||||
android:screenOrientation="portrait"
|
android:screenOrientation="portrait"
|
||||||
android:theme="@style/Theme.HPOS.NoActionBar"
|
android:theme="@style/Theme.HPOS.NoActionBar"
|
||||||
tools:ignore="AppLinkUrlError,MissingClass">
|
tools:ignore="AppLinkUrlError,MissingClass">
|
||||||
|
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
<action android:name="android.intent.action.VIEW" />
|
<action android:name="android.intent.action.VIEW" />
|
||||||
|
|
||||||
@@ -125,13 +160,14 @@
|
|||||||
android:exported="true"
|
android:exported="true"
|
||||||
android:noHistory="true"
|
android:noHistory="true"
|
||||||
android:theme="@style/AppTheme.NoActionBar">
|
android:theme="@style/AppTheme.NoActionBar">
|
||||||
<!-- <intent-filter>-->
|
<intent-filter>
|
||||||
<!-- <action android:name="android.intent.action.MAIN" />-->
|
<action android:name="android.intent.action.MAIN" />
|
||||||
<!-- <category android:name="android.intent.category.HOME" />-->
|
|
||||||
<!-- <category android:name="android.intent.category.DEFAULT" />-->
|
<category android:name="android.intent.category.HOME" />
|
||||||
<!-- <category android:name="android.intent.category.MONKEY"/>-->
|
<category android:name="android.intent.category.DEFAULT" />
|
||||||
<!-- <category android:name="android.intent.category.LAUNCHER_APP" />-->
|
<category android:name="android.intent.category.MONKEY" />
|
||||||
<!-- </intent-filter>-->
|
<category android:name="android.intent.category.LAUNCHER_APP" />
|
||||||
|
</intent-filter>
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
<action android:name="android.intent.action.MAIN" />
|
<action android:name="android.intent.action.MAIN" />
|
||||||
|
|
||||||
@@ -140,7 +176,7 @@
|
|||||||
</activity>
|
</activity>
|
||||||
<activity
|
<activity
|
||||||
android:name="com.example.hpostesting.presentation.testRight.TestRightActivity"
|
android:name="com.example.hpostesting.presentation.testRight.TestRightActivity"
|
||||||
android:exported="false"
|
android:exported="true"
|
||||||
android:noHistory="true"
|
android:noHistory="true"
|
||||||
android:parentActivityName="com.example.hpostesting.presentation.MainActivity"
|
android:parentActivityName="com.example.hpostesting.presentation.MainActivity"
|
||||||
android:theme="@style/Theme.HPOS.NoActionBar"
|
android:theme="@style/Theme.HPOS.NoActionBar"
|
||||||
|
|||||||
@@ -14,25 +14,29 @@
|
|||||||
package com.example.hpostesting
|
package com.example.hpostesting
|
||||||
|
|
||||||
import android.app.Application
|
import android.app.Application
|
||||||
|
import com.example.hpostesting.firebase.FirebaseManager
|
||||||
import com.google.firebase.firestore.FirebaseFirestore
|
import com.google.firebase.firestore.FirebaseFirestore
|
||||||
import com.google.firebase.firestore.FirebaseFirestoreSettings
|
import com.google.firebase.firestore.FirebaseFirestoreSettings
|
||||||
import dagger.hilt.android.HiltAndroidApp
|
import dagger.hilt.android.HiltAndroidApp
|
||||||
import kotlinx.coroutines.CoroutineScope
|
import kotlinx.coroutines.CoroutineScope
|
||||||
import kotlinx.coroutines.Dispatchers
|
import kotlinx.coroutines.Dispatchers
|
||||||
import kotlinx.coroutines.SupervisorJob
|
import kotlinx.coroutines.SupervisorJob
|
||||||
|
import javax.inject.Inject
|
||||||
|
|
||||||
@HiltAndroidApp
|
@HiltAndroidApp
|
||||||
class HPOSTestingApplication : Application() {
|
class HPOSTestingApplication : Application() {
|
||||||
val applicationScope = CoroutineScope(SupervisorJob() + Dispatchers.IO)
|
@Inject
|
||||||
|
lateinit var firebaseManager: FirebaseManager
|
||||||
override fun onCreate() {
|
override fun onCreate() {
|
||||||
super.onCreate()
|
super.onCreate()
|
||||||
val applicationScope = CoroutineScope(SupervisorJob() + Dispatchers.IO)
|
val applicationScope = CoroutineScope(SupervisorJob() + Dispatchers.IO)
|
||||||
|
|
||||||
|
// You can now use firebaseManager here after Hilt injects it
|
||||||
val firestoreSettings = FirebaseFirestoreSettings.Builder()
|
val firestoreSettings = FirebaseFirestoreSettings.Builder()
|
||||||
.setPersistenceEnabled(true) // Enable offline persistence if needed
|
.setPersistenceEnabled(true) // Enable offline persistence if needed
|
||||||
.build()
|
.build()
|
||||||
|
|
||||||
val firestore = FirebaseFirestore.getInstance()
|
val firestore = firebaseManager.getCurrentFirestore()
|
||||||
firestore.firestoreSettings = firestoreSettings
|
firestore.firestoreSettings = firestoreSettings
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -43,6 +43,10 @@ interface MolbioResultApi {
|
|||||||
@Body checkUpdateRequest: CheckUpdateRequest,
|
@Body checkUpdateRequest: CheckUpdateRequest,
|
||||||
): CheckUpdateResponse
|
): CheckUpdateResponse
|
||||||
|
|
||||||
|
// @POST("deviceService/device/getUpdate")
|
||||||
|
// suspend fun deviceUpdate(
|
||||||
|
// @Body deviceUpdateRequest: DeviceUpdateRequest,
|
||||||
|
// ): ResponseBody
|
||||||
@POST("deviceService/device/getUpdate")
|
@POST("deviceService/device/getUpdate")
|
||||||
suspend fun deviceUpdate(
|
suspend fun deviceUpdate(
|
||||||
@Body deviceUpdateRequest: DeviceUpdateRequest,
|
@Body deviceUpdateRequest: DeviceUpdateRequest,
|
||||||
|
|||||||
@@ -14,6 +14,13 @@
|
|||||||
package com.example.hpostesting.data.constant
|
package com.example.hpostesting.data.constant
|
||||||
|
|
||||||
object Constants {
|
object Constants {
|
||||||
|
const val CENTER_NAME =""
|
||||||
|
const val DISTRICT =""
|
||||||
|
const val BUFFER_FLAGS_ENABLED = true//testing flag disable then pass buffer and sample checks
|
||||||
|
const val ABS_FLAGS_ENABLED = false
|
||||||
|
const val IP_ADDRESS="ip_address"
|
||||||
|
const val QUICK_CAPTURE="quick_capture"
|
||||||
|
const val KIT_TIME = "kit_time"
|
||||||
const val ACTION_USB_PERMISSION = "shanmukha.in.sickle_cell.USB_PERMISSION"
|
const val ACTION_USB_PERMISSION = "shanmukha.in.sickle_cell.USB_PERMISSION"
|
||||||
const val HEMOCUBE_USB_PERMISSION = "shanmukha.in.sickle_cell_homocube.USB_PERMISSION"
|
const val HEMOCUBE_USB_PERMISSION = "shanmukha.in.sickle_cell_homocube.USB_PERMISSION"
|
||||||
const val passphrase = "smi_#@sql"
|
const val passphrase = "smi_#@sql"
|
||||||
@@ -38,7 +45,8 @@ object Constants {
|
|||||||
|
|
||||||
const val TEST_RIGHT_TOTAL_PIXEL = 3694
|
const val TEST_RIGHT_TOTAL_PIXEL = 3694
|
||||||
|
|
||||||
const val MAXIMUM_TEST_ALLOWED_BEFORE_REFERENCE = 40
|
const val MAXIMUM_TEST_ALLOWED_BEFORE_REFERENCE = 34
|
||||||
|
const val MAXIMUM_TEST_ALLOWED_BEFORE_REFERENCE10MM = 9
|
||||||
|
|
||||||
const val RANGE_IN_RESULT_CALCULATIONS = 10
|
const val RANGE_IN_RESULT_CALCULATIONS = 10
|
||||||
|
|
||||||
@@ -79,178 +87,16 @@ object Constants {
|
|||||||
// jig
|
// jig
|
||||||
const val NAVIGATE_TO_TEST_JIG_DIRECTLY = false
|
const val NAVIGATE_TO_TEST_JIG_DIRECTLY = false
|
||||||
|
|
||||||
val STATICID = listOf(
|
//update values of abs
|
||||||
"FACTORY",
|
const val ABS2LED1MMLL = "ABS2LED1MMLL"
|
||||||
"ADMIN",
|
const val ABS2LED1MMUL = "ABS2LED1MMUL"
|
||||||
"PQUSER",
|
const val ABS2LED2MMLL = "ABS2LED2MMLL"
|
||||||
"QCUSER",
|
const val ABS2LED2MMUL = "ABS2LED2MMUL"
|
||||||
"VIZ-1000-0004",
|
|
||||||
"VIZ-1000-0005",
|
|
||||||
"VIZ-1000-0006",
|
|
||||||
"HC-V1-001",
|
|
||||||
"HC-V1-002",
|
|
||||||
"HC-V1-003",
|
|
||||||
"HC-V1-004",
|
|
||||||
"HC-V1-005",
|
|
||||||
"HC-V1-006",
|
|
||||||
"HC-V1-007",
|
|
||||||
"HC-V1-008",
|
|
||||||
"HC-V1-009",
|
|
||||||
"HC-V1-010",
|
|
||||||
"HC-V1-011",
|
|
||||||
"HC-V1-012",
|
|
||||||
"HC-V1-013",
|
|
||||||
"HC-V1-014",
|
|
||||||
"HC-V1-015",
|
|
||||||
"HC-V1-016",
|
|
||||||
"HC-V1-017",
|
|
||||||
"HC-V1-018",
|
|
||||||
"HC-V1-019",
|
|
||||||
"HC-V1-020",
|
|
||||||
"HCV-000-1015",
|
|
||||||
"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",
|
|
||||||
"HCV-000-3021",
|
|
||||||
"HCV-000-3022",
|
|
||||||
"HCV-000-3023",
|
|
||||||
"HCV-000-3024",
|
|
||||||
"HCV-000-3025",
|
|
||||||
"HCV-000-3026",
|
|
||||||
"HCV-000-3027",
|
|
||||||
"HCV-000-3028",
|
|
||||||
"HCV-000-3029",
|
|
||||||
"HCV-000-3030",
|
|
||||||
"HPP1-0124-0001",
|
|
||||||
"HPP1-0124-0002",
|
|
||||||
"HPP1-0124-0003",
|
|
||||||
"HPP1-0124-0004",
|
|
||||||
"HPP1-0124-0005",
|
|
||||||
"HPP1-0124-0006",
|
|
||||||
"HPP1-0124-0007",
|
|
||||||
"HPP1-0124-0008",
|
|
||||||
"HPP1-0124-0009",
|
|
||||||
"HPP1-0124-0010",
|
|
||||||
"HPP1-0124-0011",
|
|
||||||
"HPP1-0124-0012",
|
|
||||||
"HPP1-0124-0013",
|
|
||||||
"HPP1-0124-0014",
|
|
||||||
"HPP1-0124-0015",
|
|
||||||
"HPP1-0124-0016",
|
|
||||||
"HPP1-0124-0017",
|
|
||||||
"HPP1-0124-0018",
|
|
||||||
"HPP1-0124-0019",
|
|
||||||
"HPP1-0124-0020",
|
|
||||||
"HPP1-0124-0021",
|
|
||||||
"HPP1-0124-0022",
|
|
||||||
"HPP1-0124-0023",
|
|
||||||
"HPP1-0124-0024",
|
|
||||||
"HPP1-0124-0025",
|
|
||||||
"HPP1-0124-0026",
|
|
||||||
"HPP1-0124-0027",
|
|
||||||
"HPP1-0124-0028",
|
|
||||||
"HPP1-0124-0029",
|
|
||||||
"HPP1-0124-0030",
|
|
||||||
"HPP1-0124-0031",
|
|
||||||
"HPP1-0124-0032",
|
|
||||||
"HPP1-0124-0033",
|
|
||||||
"HPP1-0124-0034",
|
|
||||||
"HPP1-0124-0035",
|
|
||||||
"HPP1-0124-0036",
|
|
||||||
"HPP1-0124-0037",
|
|
||||||
"HPP1-0124-0038",
|
|
||||||
"HPP1-0124-0039",
|
|
||||||
"HPP1-0124-0040",
|
|
||||||
"HPP1-0124-0041",
|
|
||||||
"HPP1-0124-0042",
|
|
||||||
"HPP1-0124-0043",
|
|
||||||
"HPP1-0124-0044",
|
|
||||||
"HPP1-0124-0045",
|
|
||||||
"HPP1-0124-0046",
|
|
||||||
"HPP1-0124-0047",
|
|
||||||
"HPP1-0124-0048",
|
|
||||||
"HPP1-0124-0049",
|
|
||||||
"HPP1-0124-0050",
|
|
||||||
"HCV-001-0001",
|
|
||||||
"HCV-001-0002",
|
|
||||||
"HCV-001-0003",
|
|
||||||
"HCV-001-0004",
|
|
||||||
"HCV-001-0005",
|
|
||||||
"HCV-001-0006",
|
|
||||||
"HCV-001-0007",
|
|
||||||
"HCV-001-0008",
|
|
||||||
"HCV-001-0009",
|
|
||||||
"HCV-001-0010",
|
|
||||||
"HCV-001-0011",
|
|
||||||
"HCV-001-0012",
|
|
||||||
"HCV-001-0013",
|
|
||||||
"HCV-001-0014",
|
|
||||||
"HCV-001-0015",
|
|
||||||
"HCV-001-0016",
|
|
||||||
"HCV-001-0017",
|
|
||||||
"HCV-001-0018",
|
|
||||||
"HCV-001-0019",
|
|
||||||
"HCV-001-0020",
|
|
||||||
"HCV-001-0021",
|
|
||||||
"HCV-001-0022",
|
|
||||||
"HCV-001-0023",
|
|
||||||
"HCV-001-0024",
|
|
||||||
"HCV-001-0025",
|
|
||||||
"HCV-001-0026",
|
|
||||||
"HCV-001-0027",
|
|
||||||
"HCV-001-0028",
|
|
||||||
"HCV-001-0029",
|
|
||||||
"HCV-001-0030",
|
|
||||||
"HCV-001-0031",
|
|
||||||
"HCV-001-0032",
|
|
||||||
"HCV-001-0033",
|
|
||||||
"HCV-001-0034",
|
|
||||||
"HCV-001-0003",
|
|
||||||
"HCV-001-0035",
|
|
||||||
"HCV-001-0036",
|
|
||||||
"HCV-001-0037",
|
|
||||||
"HCV-001-0038",
|
|
||||||
"HCV-001-0039",
|
|
||||||
"HCV-001-0040",
|
|
||||||
"HCV-001-0041",
|
|
||||||
"HCV-001-0042",
|
|
||||||
"HCV-001-0043",
|
|
||||||
"HCV-001-0044",
|
|
||||||
"HCV-001-0045",
|
|
||||||
"HCV-001-0046",
|
|
||||||
"HCV-001-0047",
|
|
||||||
"HCV-001-0048",
|
|
||||||
"HCV-001-0049",
|
|
||||||
"HCV-001-0050",
|
|
||||||
"HCV-000-6001",
|
|
||||||
"HCV-000-6002",
|
|
||||||
"HCV-000-6003",
|
|
||||||
"HCV-000-6004",
|
|
||||||
"HCV-000-6005",
|
|
||||||
"HCV-000-6006",
|
|
||||||
"HCV-000-6007",
|
|
||||||
"HCV-000-6008",
|
|
||||||
"HCV-000-6009",
|
|
||||||
"HCV-000-6010",
|
|
||||||
)
|
|
||||||
|
|
||||||
const val password = "SMI@12345"
|
const val ABS10LED1MMLL = "ABS10LED1MMLL"
|
||||||
|
const val ABS10LED1MMUL = "ABS10LED1MMUL"
|
||||||
|
const val ABS10LED2MMLL = "ABS10LED2MMLL"
|
||||||
|
const val ABS10LED2MMUL = "ABS10LED2MMUL"
|
||||||
|
|
||||||
const val KIT_NUMBER = "KitNumber"
|
const val KIT_NUMBER = "KitNumber"
|
||||||
const val KIT_COUNT = "KitCount"
|
const val KIT_COUNT = "KitCount"
|
||||||
@@ -261,7 +107,7 @@ object Constants {
|
|||||||
const val BUFFER_VALUE_4 = "BufferValue4"
|
const val BUFFER_VALUE_4 = "BufferValue4"
|
||||||
const val DEVICE_ID = "DEVICE_ID"
|
const val DEVICE_ID = "DEVICE_ID"
|
||||||
const val LABNAME = "LAB_NAME"
|
const val LABNAME = "LAB_NAME"
|
||||||
|
const val CUVETTE_SIZE = "CUVETTE_SIZE"
|
||||||
const val IS_TOKEN_AVAILABLE = "IS_TOKEN_AVAILABLE"
|
const val IS_TOKEN_AVAILABLE = "IS_TOKEN_AVAILABLE"
|
||||||
const val BUFFER_LED_LOWER_BOUND = 21000
|
const val BUFFER_LED_LOWER_BOUND = 21000
|
||||||
const val BUFFER_LED_UPPER_BOUND = 23500
|
const val BUFFER_LED_UPPER_BOUND = 23500
|
||||||
@@ -1239,13 +1085,14 @@ object Constants {
|
|||||||
)
|
)
|
||||||
|
|
||||||
const val INCUBATION_TIME_MIN = 0
|
const val INCUBATION_TIME_MIN = 0
|
||||||
const val INCUBATION_TIME_MAX = 1400
|
const val INCUBATION_TIME_MAX = 300
|
||||||
|
const val MAX_KIT_TIME = 240
|
||||||
const val BATTERY_LEVEL_MIN = Int.MIN_VALUE
|
const val BATTERY_LEVEL_MIN = Int.MIN_VALUE
|
||||||
|
|
||||||
const val PQ_MODE = true
|
const val PQ_MODE = true
|
||||||
const val READINGS_PER_SAMPLE = 1
|
const val READINGS_PER_SAMPLE = 1
|
||||||
|
|
||||||
const val MINIMUM_BATTERY_LEVEL = 40F
|
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(
|
"HCV-000-3001" to listOf(
|
||||||
@@ -1736,5 +1583,227 @@ object Constants {
|
|||||||
listOf(0.0, 0.0)
|
listOf(0.0, 0.0)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
//Trueheme for 10mm
|
||||||
|
//Before changing below values review before
|
||||||
|
//classification borderline metric
|
||||||
|
const val positiveBoderLineMetricCheck10mmMin = 1.3
|
||||||
|
const val positiveBoderLineMetricCheck10mmMax = 1.66
|
||||||
|
const val negativeBoderLineMetricCheck10mmMin = 2.0
|
||||||
|
const val negativeBoderLineMetricCheck10mmMax = 2.4
|
||||||
|
//classification device ratio
|
||||||
|
const val normalMin10mm = 0.07
|
||||||
|
const val normalMax10mm = 0.23
|
||||||
|
const val negativeBorderlineMin10mm = 0.23
|
||||||
|
const val negativeBorderlineMax10mm = 0.27
|
||||||
|
const val sickleCellTraitMin10mm = 0.27
|
||||||
|
const val sickleCellTraitMax10mm = 0.31
|
||||||
|
const val positiveBoderlineMin10mm = 0.31
|
||||||
|
const val positiveBoderlineMax10mm = 0.39
|
||||||
|
const val sickleCellDiseaseMin10mm = 0.39
|
||||||
|
const val sickleCellDiseaseMax10mm = 0.7
|
||||||
|
//Trueheme for 2mm
|
||||||
|
//classification borderline metric
|
||||||
|
const val positiveBoderLineMetricCheck2mmMin = 0.8
|
||||||
|
const val positiveBoderLineMetricCheck2mmMax = 1.1
|
||||||
|
const val negativeBoderLineMetricCheck2mmMin = 1.5
|
||||||
|
const val negativeBoderLineMetricCheck2mmMax = 1.9
|
||||||
|
//classification device ratio
|
||||||
|
const val normalMin2mm = 0.1
|
||||||
|
const val normalMax2mm = 0.23
|
||||||
|
const val negativeBorderlineMin2mm = 0.23
|
||||||
|
const val negativeBorderlineMax2mm = 0.25
|
||||||
|
const val sickleCellTraitMin2mm = 0.25
|
||||||
|
const val sickleCellTraitMax2mm = 0.31
|
||||||
|
const val positiveForSickleCellMin2mm = 0.31
|
||||||
|
const val positiveForSickleCellMax2mm = 0.45
|
||||||
|
const val sickleCellDiseaseMin2mm = 0.45
|
||||||
|
const val sickleCellDiseaseMax2mm = 0.7
|
||||||
|
|
||||||
|
const val min2mmLed1 = 0.34
|
||||||
|
const val max2mmLed1 = 1.48
|
||||||
|
const val min2mmLed2 = 0.04
|
||||||
|
const val max2mmLed2 = 0.33
|
||||||
|
const val min10mmLed1 = 0.22
|
||||||
|
const val max10mmLed1 = 1.12
|
||||||
|
const val min10mmLed2 = 0.05
|
||||||
|
const val max10mmLed2 = 0.41
|
||||||
|
|
||||||
|
//Check used in handling the buffer values on buffer complete
|
||||||
|
const val bufferMinLed1 = 21000.00
|
||||||
|
const val bufferMaxLed1 = 23000.00
|
||||||
|
const val bufferMinLed2 = 17000.00
|
||||||
|
const val bufferMaxLed2 = 19000.00
|
||||||
|
|
||||||
|
|
||||||
|
// val STATICID = listOf(
|
||||||
|
// "FACTORY",
|
||||||
|
// "ADMIN",
|
||||||
|
// "PQUSER",
|
||||||
|
// "QCUSER",
|
||||||
|
// "VIZ-1000-0004",
|
||||||
|
// "VIZ-1000-0005",
|
||||||
|
// "VIZ-1000-0006",
|
||||||
|
// "HC-V1-001",
|
||||||
|
// "HC-V1-002",
|
||||||
|
// "HC-V1-003",
|
||||||
|
// "HC-V1-004",
|
||||||
|
// "HC-V1-005",
|
||||||
|
// "HC-V1-006",
|
||||||
|
// "HC-V1-007",
|
||||||
|
// "HC-V1-008",
|
||||||
|
// "HC-V1-009",
|
||||||
|
// "HC-V1-010",
|
||||||
|
// "HC-V1-011",
|
||||||
|
// "HC-V1-012",
|
||||||
|
// "HC-V1-013",
|
||||||
|
// "HC-V1-014",
|
||||||
|
// "HC-V1-015",
|
||||||
|
// "HC-V1-016",
|
||||||
|
// "HC-V1-017",
|
||||||
|
// "HC-V1-018",
|
||||||
|
// "HC-V1-019",
|
||||||
|
// "HC-V1-020",
|
||||||
|
// "HCV-000-1015",
|
||||||
|
// "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",
|
||||||
|
// "HCV-000-3021",
|
||||||
|
// "HCV-000-3022",
|
||||||
|
// "HCV-000-3023",
|
||||||
|
// "HCV-000-3024",
|
||||||
|
// "HCV-000-3025",
|
||||||
|
// "HCV-000-3026",
|
||||||
|
// "HCV-000-3027",
|
||||||
|
// "HCV-000-3028",
|
||||||
|
// "HCV-000-3029",
|
||||||
|
// "HCV-000-3030",
|
||||||
|
// "HPP1-0124-0001",
|
||||||
|
// "HPP1-0124-0002",
|
||||||
|
// "HPP1-0124-0003",
|
||||||
|
// "HPP1-0124-0004",
|
||||||
|
// "HPP1-0124-0005",
|
||||||
|
// "HPP1-0124-0006",
|
||||||
|
// "HPP1-0124-0007",
|
||||||
|
// "HPP1-0124-0008",
|
||||||
|
// "HPP1-0124-0009",
|
||||||
|
// "HPP1-0124-0010",
|
||||||
|
// "HPP1-0124-0011",
|
||||||
|
// "HPP1-0124-0012",
|
||||||
|
// "HPP1-0124-0013",
|
||||||
|
// "HPP1-0124-0014",
|
||||||
|
// "HPP1-0124-0015",
|
||||||
|
// "HPP1-0124-0016",
|
||||||
|
// "HPP1-0124-0017",
|
||||||
|
// "HPP1-0124-0018",
|
||||||
|
// "HPP1-0124-0019",
|
||||||
|
// "HPP1-0124-0020",
|
||||||
|
// "HPP1-0124-0021",
|
||||||
|
// "HPP1-0124-0022",
|
||||||
|
// "HPP1-0124-0023",
|
||||||
|
// "HPP1-0124-0024",
|
||||||
|
// "HPP1-0124-0025",
|
||||||
|
// "HPP1-0124-0026",
|
||||||
|
// "HPP1-0124-0027",
|
||||||
|
// "HPP1-0124-0028",
|
||||||
|
// "HPP1-0124-0029",
|
||||||
|
// "HPP1-0124-0030",
|
||||||
|
// "HPP1-0124-0031",
|
||||||
|
// "HPP1-0124-0032",
|
||||||
|
// "HPP1-0124-0033",
|
||||||
|
// "HPP1-0124-0034",
|
||||||
|
// "HPP1-0124-0035",
|
||||||
|
// "HPP1-0124-0036",
|
||||||
|
// "HPP1-0124-0037",
|
||||||
|
// "HPP1-0124-0038",
|
||||||
|
// "HPP1-0124-0039",
|
||||||
|
// "HPP1-0124-0040",
|
||||||
|
// "HPP1-0124-0041",
|
||||||
|
// "HPP1-0124-0042",
|
||||||
|
// "HPP1-0124-0043",
|
||||||
|
// "HPP1-0124-0044",
|
||||||
|
// "HPP1-0124-0045",
|
||||||
|
// "HPP1-0124-0046",
|
||||||
|
// "HPP1-0124-0047",
|
||||||
|
// "HPP1-0124-0048",
|
||||||
|
// "HPP1-0124-0049",
|
||||||
|
// "HPP1-0124-0050",
|
||||||
|
// "HCV-001-0001",
|
||||||
|
// "HCV-001-0002",
|
||||||
|
// "HCV-001-0003",
|
||||||
|
// "HCV-001-0004",
|
||||||
|
// "HCV-001-0005",
|
||||||
|
// "HCV-001-0006",
|
||||||
|
// "HCV-001-0007",
|
||||||
|
// "HCV-001-0008",
|
||||||
|
// "HCV-001-0009",
|
||||||
|
// "HCV-001-0010",
|
||||||
|
// "HCV-001-0011",
|
||||||
|
// "HCV-001-0012",
|
||||||
|
// "HCV-001-0013",
|
||||||
|
// "HCV-001-0014",
|
||||||
|
// "HCV-001-0015",
|
||||||
|
// "HCV-001-0016",
|
||||||
|
// "HCV-001-0017",
|
||||||
|
// "HCV-001-0018",
|
||||||
|
// "HCV-001-0019",
|
||||||
|
// "HCV-001-0020",
|
||||||
|
// "HCV-001-0021",
|
||||||
|
// "HCV-001-0022",
|
||||||
|
// "HCV-001-0023",
|
||||||
|
// "HCV-001-0024",
|
||||||
|
// "HCV-001-0025",
|
||||||
|
// "HCV-001-0026",
|
||||||
|
// "HCV-001-0027",
|
||||||
|
// "HCV-001-0028",
|
||||||
|
// "HCV-001-0029",
|
||||||
|
// "HCV-001-0030",
|
||||||
|
// "HCV-001-0031",
|
||||||
|
// "HCV-001-0032",
|
||||||
|
// "HCV-001-0033",
|
||||||
|
// "HCV-001-0034",
|
||||||
|
// "HCV-001-0003",
|
||||||
|
// "HCV-001-0035",
|
||||||
|
// "HCV-001-0036",
|
||||||
|
// "HCV-001-0037",
|
||||||
|
// "HCV-001-0038",
|
||||||
|
// "HCV-001-0039",
|
||||||
|
// "HCV-001-0040",
|
||||||
|
// "HCV-001-0041",
|
||||||
|
// "HCV-001-0042",
|
||||||
|
// "HCV-001-0043",
|
||||||
|
// "HCV-001-0044",
|
||||||
|
// "HCV-001-0045",
|
||||||
|
// "HCV-001-0046",
|
||||||
|
// "HCV-001-0047",
|
||||||
|
// "HCV-001-0048",
|
||||||
|
// "HCV-001-0049",
|
||||||
|
// "HCV-001-0050",
|
||||||
|
// "HCV-000-6001",
|
||||||
|
// "HCV-000-6002",
|
||||||
|
// "HCV-000-6003",
|
||||||
|
// "HCV-000-6004",
|
||||||
|
// "HCV-000-6005",
|
||||||
|
// "HCV-000-6006",
|
||||||
|
// "HCV-000-6007",
|
||||||
|
// "HCV-000-6008",
|
||||||
|
// "HCV-000-6009",
|
||||||
|
// "HCV-000-6010",
|
||||||
|
// )
|
||||||
|
//
|
||||||
}
|
}
|
||||||
@@ -21,12 +21,14 @@ import com.example.hpostesting.data.model.test.TestType
|
|||||||
|
|
||||||
object DataHolder {
|
object DataHolder {
|
||||||
|
|
||||||
|
var sampleId: String = "sampleId"
|
||||||
var selectedTestType: TestType = TestType.SICKLECERT
|
var selectedTestType: TestType = TestType.SICKLECERT
|
||||||
val usbConnected = MutableLiveData(true)
|
val usbConnected = MutableLiveData(true)
|
||||||
var mobileUniqueId: String? = null
|
var mobileUniqueId: String? = null
|
||||||
var isAppFolderCreated = false
|
var isAppFolderCreated = false
|
||||||
var appFolderPath = ""
|
var appFolderPath = ""
|
||||||
var isReferenceTaken = false
|
var isReferenceTaken = false
|
||||||
|
var isToken = false
|
||||||
var sampleReadCounter = 0
|
var sampleReadCounter = 0
|
||||||
|
|
||||||
var deviceConstant: TestRightDeviceConstants? = null
|
var deviceConstant: TestRightDeviceConstants? = null
|
||||||
@@ -36,9 +38,14 @@ object DataHolder {
|
|||||||
val intensityReferenceArray = ArrayList<Double>()
|
val intensityReferenceArray = ArrayList<Double>()
|
||||||
var selectedTest: UserData? = null
|
var selectedTest: UserData? = null
|
||||||
var hemoCubeTestData: HemoCubeTestData? = null
|
var hemoCubeTestData: HemoCubeTestData? = null
|
||||||
|
var bloodGroup: String = "Unknown"
|
||||||
|
var age = "0"
|
||||||
var kitSerial: String = ""
|
var kitSerial: String = ""
|
||||||
|
var centerName: String = ""
|
||||||
|
var district: String = ""
|
||||||
|
var quickCapture:Boolean = false
|
||||||
var location: UserData.Location? = null
|
var location: UserData.Location? = null
|
||||||
var ipAddress: String = "0.0"
|
var ipAddress: String ="0.0"
|
||||||
var testExp: Boolean = true
|
var testExp: Boolean = true
|
||||||
var hemocubeResult: Double? = null
|
var hemocubeResult: Double? = null
|
||||||
}
|
}
|
||||||
@@ -30,4 +30,5 @@ enum class HemoCubeCommands(val command: String) {
|
|||||||
FORTH_GAIN_COMMAND("W\r"),
|
FORTH_GAIN_COMMAND("W\r"),
|
||||||
CHECK_CUVETTE_COMMAND("L\r"),
|
CHECK_CUVETTE_COMMAND("L\r"),
|
||||||
CHECK_TEMP_COMMAND("A\r"),
|
CHECK_TEMP_COMMAND("A\r"),
|
||||||
|
J_COMMAND("J\r"),
|
||||||
}
|
}
|
||||||
@@ -26,13 +26,17 @@ enum class TestStatus(val code: Double) {
|
|||||||
TEMPERATURE_CHECK(4.7),
|
TEMPERATURE_CHECK(4.7),
|
||||||
CUVETTE_ABSENT(4.8),
|
CUVETTE_ABSENT(4.8),
|
||||||
CUVETTE_PRESENT(4.9),
|
CUVETTE_PRESENT(4.9),
|
||||||
|
CUVETTE_ABSENTR(5.1),
|
||||||
|
CUVETTE_PRESENTR(5.2),
|
||||||
CUVETTE_ABSENTS(7.7),
|
CUVETTE_ABSENTS(7.7),
|
||||||
CUVETTE_PRESENTS(7.8),
|
CUVETTE_PRESENTS(7.8),
|
||||||
BUFFER_STARTED(5.1),
|
BUFFER_STARTED(5.4),
|
||||||
BUFFER_COMPLETED(5.2),
|
BUFFER_COMPLETED(5.5),
|
||||||
BUFFER_PRINT_STARTED(6.0),
|
BUFFER_PRINT_STARTED(6.0),
|
||||||
BUFFER_PRINT_COMPLETED(7.0),
|
BUFFER_PRINT_COMPLETED(7.0),
|
||||||
SAMPLE_STARTED(8.0),
|
SAMPLE_STARTED(8.0),
|
||||||
|
CUVETTE_ABSENTT(30.2),
|
||||||
|
CUVETTE_PRESENTT(30.1),
|
||||||
SAMPLE_COMPLETED(9.0),
|
SAMPLE_COMPLETED(9.0),
|
||||||
SAMPLE_PRINT_STARTED(10.0),
|
SAMPLE_PRINT_STARTED(10.0),
|
||||||
SAMPLE_PRINT_COMPLETED(11.0),
|
SAMPLE_PRINT_COMPLETED(11.0),
|
||||||
|
|||||||
@@ -40,7 +40,8 @@ interface HemoCubeDao {
|
|||||||
|
|
||||||
@Query("DELETE FROM hemo_cube_test_table WHERE _id = :id")
|
@Query("DELETE FROM hemo_cube_test_table WHERE _id = :id")
|
||||||
suspend fun deleteById(id: String)
|
suspend fun deleteById(id: String)
|
||||||
|
@Query("DELETE FROM hemo_cube_test_table WHERE testStatus = 0")
|
||||||
|
suspend fun deleteByStatus()
|
||||||
@Query("UPDATE hemo_cube_test_table SET localFlag = :newValue WHERE _id = :id")
|
@Query("UPDATE hemo_cube_test_table SET localFlag = :newValue WHERE _id = :id")
|
||||||
suspend fun updateFieldById(id: String, newValue: Boolean)
|
suspend fun updateFieldById(id: String, newValue: Boolean)
|
||||||
|
|
||||||
@@ -50,8 +51,11 @@ interface HemoCubeDao {
|
|||||||
@Query("UPDATE hemo_cube_test_table SET isCSVCreated = :newValue WHERE _id = :id")
|
@Query("UPDATE hemo_cube_test_table SET isCSVCreated = :newValue WHERE _id = :id")
|
||||||
suspend fun updateCSVFieldById(id: String, newValue: Boolean)
|
suspend fun updateCSVFieldById(id: String, newValue: Boolean)
|
||||||
|
|
||||||
@Query("SELECT * from hemo_cube_test_table WHERE molbioFlag = 0")
|
@Query("SELECT * from hemo_cube_test_table WHERE localFlag = 0")
|
||||||
fun getPendingUser(): LiveData<List<HemoCubeTestData>>
|
fun getPendingUser(): LiveData<List<HemoCubeTestData>>
|
||||||
|
|
||||||
@Update
|
@Update
|
||||||
suspend fun updateTest(hemoCubeTestData: HemoCubeTestData)
|
suspend fun updateTest(hemoCubeTestData: HemoCubeTestData)
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -19,12 +19,11 @@ import androidx.room.TypeConverters
|
|||||||
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.MolbioHemocubeData
|
|
||||||
import com.example.hpostesting.data.model.patient.UserData
|
import com.example.hpostesting.data.model.patient.UserData
|
||||||
|
|
||||||
@Database(
|
@Database(
|
||||||
entities = [UserData::class, HemoCubeTestData::class, DeviceData::class, BufferCheckData::class,MolbioHemocubeData::class],
|
entities = [UserData::class, HemoCubeTestData::class, DeviceData::class, BufferCheckData::class],
|
||||||
version = 34,
|
version = 38,
|
||||||
exportSchema = false
|
exportSchema = false
|
||||||
)
|
)
|
||||||
@TypeConverters(Converters::class)
|
@TypeConverters(Converters::class)
|
||||||
@@ -32,5 +31,4 @@ abstract class MyDatabase : RoomDatabase() {
|
|||||||
abstract fun userDao(): UserDao
|
abstract fun userDao(): UserDao
|
||||||
abstract fun hemoCubeDao(): HemoCubeDao
|
abstract fun hemoCubeDao(): HemoCubeDao
|
||||||
abstract fun hemoCubeBufferDao(): HemoCubeBufferDao
|
abstract fun hemoCubeBufferDao(): HemoCubeBufferDao
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -54,7 +54,7 @@ class LocalFileDataSourceImpl @Inject constructor() : LocalFileDataSource {
|
|||||||
"name",
|
"name",
|
||||||
"incubationTime",
|
"incubationTime",
|
||||||
"bloodGroup",
|
"bloodGroup",
|
||||||
"birthYear", // Include other fields from the data class
|
"age", // Include other fields from the data class
|
||||||
"state",
|
"state",
|
||||||
"abhaId",
|
"abhaId",
|
||||||
"userImageURL",
|
"userImageURL",
|
||||||
@@ -110,7 +110,7 @@ class LocalFileDataSourceImpl @Inject constructor() : LocalFileDataSource {
|
|||||||
data.name,
|
data.name,
|
||||||
data.incubationTime,
|
data.incubationTime,
|
||||||
data.bloodGroup,
|
data.bloodGroup,
|
||||||
data.birthYear, // Include other fields similarly
|
data.age, // Include other fields similarly
|
||||||
data.state,
|
data.state,
|
||||||
data.abhaId,
|
data.abhaId,
|
||||||
data.userImageURL,
|
data.userImageURL,
|
||||||
@@ -177,7 +177,7 @@ class LocalFileDataSourceImpl @Inject constructor() : LocalFileDataSource {
|
|||||||
"name",
|
"name",
|
||||||
"incubationTime",
|
"incubationTime",
|
||||||
"bloodGroup",
|
"bloodGroup",
|
||||||
"birthYear", // Include other fields from the data class
|
"age", // Include other fields from the data class
|
||||||
"state",
|
"state",
|
||||||
"abhaId",
|
"abhaId",
|
||||||
"userImageURL",
|
"userImageURL",
|
||||||
@@ -233,7 +233,7 @@ class LocalFileDataSourceImpl @Inject constructor() : LocalFileDataSource {
|
|||||||
data.name,
|
data.name,
|
||||||
data.incubationTime,
|
data.incubationTime,
|
||||||
data.bloodGroup,
|
data.bloodGroup,
|
||||||
data.birthYear, // Include other fields similarly
|
data.age, // Include other fields similarly
|
||||||
data.state,
|
data.state,
|
||||||
data.abhaId,
|
data.abhaId,
|
||||||
data.userImageURL,
|
data.userImageURL,
|
||||||
|
|||||||
@@ -14,16 +14,15 @@
|
|||||||
package com.example.hpostesting.data.model.molbioresult
|
package com.example.hpostesting.data.model.molbioresult
|
||||||
|
|
||||||
import com.example.hpostesting.data.model.patient.HemoCubeTestData
|
import com.example.hpostesting.data.model.patient.HemoCubeTestData
|
||||||
import com.example.hpostesting.data.model.patient.MolbioHemocubeData
|
|
||||||
|
|
||||||
data class MolbioV2Result(
|
data class MolbioV2Result(
|
||||||
// val age: Int? = 31,
|
val age: Int? = 31,
|
||||||
val analysisDate: String? = "2024-02-08 16:33:56",
|
val analysisDate: String? = "2024-02-08 16:33:56",
|
||||||
val analysisId: String? = "",
|
val analysisId: String? = "",
|
||||||
val analysisStatus: String? = "",
|
val analysisStatus: String? = "",
|
||||||
val analysisType: String? = "HPOS",
|
val analysisType: String? = "HPOS",
|
||||||
val analysisTypeMethod: String? = "",
|
val analysisTypeMethod: String? = "",
|
||||||
// val bloodGroup: String? = "",
|
val bloodGroup: String? = "",
|
||||||
val coefficients: List<Int>? = listOf(22, 22),
|
val coefficients: List<Int>? = listOf(22, 22),
|
||||||
val collectionLocation: List<Any>? = listOf(),
|
val collectionLocation: List<Any>? = listOf(),
|
||||||
val collectionTime: String? = "2024-02-08 16:33:56",
|
val collectionTime: String? = "2024-02-08 16:33:56",
|
||||||
@@ -31,12 +30,12 @@ data class MolbioV2Result(
|
|||||||
val curveFitting: String? = "Linear",
|
val curveFitting: String? = "Linear",
|
||||||
val deviceName: String? = "HPOS",
|
val deviceName: String? = "HPOS",
|
||||||
val expiryTime: String? = "2024-02-08 16:33:56",
|
val expiryTime: String? = "2024-02-08 16:33:56",
|
||||||
// val gender: String? = "",
|
val gender: String? = "",
|
||||||
val interpretation: String? = "",
|
val interpretation: String? = "",
|
||||||
val `operator`: String? = "",
|
val `operator`: String? = "",
|
||||||
val patientId: Int? = 4545,
|
val patientId: Int? = 4545,
|
||||||
val pregnancy: Boolean? = false,
|
val pregnancy: Boolean? = false,
|
||||||
val rawData: MolbioHemocubeData? = HemoCubeTestData().MolbioHemocubeData(),
|
val rawData: HemoCubeTestData? = HemoCubeTestData(),
|
||||||
val recommendation: String? = "NA",
|
val recommendation: String? = "NA",
|
||||||
val sampleId: String? = "",
|
val sampleId: String? = "",
|
||||||
val sampleType: String? = "",
|
val sampleType: String? = "",
|
||||||
|
|||||||
@@ -14,15 +14,14 @@
|
|||||||
package com.example.hpostesting.data.model.molbioresult
|
package com.example.hpostesting.data.model.molbioresult
|
||||||
|
|
||||||
import com.example.hpostesting.data.model.patient.HemoCubeTestData
|
import com.example.hpostesting.data.model.patient.HemoCubeTestData
|
||||||
import com.example.hpostesting.data.model.patient.MolbioHemocubeData
|
|
||||||
|
|
||||||
data class MolbioV2ResultData(
|
data class MolbioV2ResultData(
|
||||||
// val age: Int? = 0,
|
val age: Int? = 0,
|
||||||
val analysisDate: String? = "2024-02-08 16:33:56",
|
val analysisDate: String? = "2024-02-08 16:33:56",
|
||||||
val analysisStatus: String? = "",
|
val analysisStatus: String? = "",
|
||||||
val analysisType: String? = "",
|
val analysisType: String? = "",
|
||||||
val analysisTypeMethod: String? = "",
|
val analysisTypeMethod: String? = "",
|
||||||
// val bloodGroup: String? = "",
|
val bloodGroup: String? = "",
|
||||||
val coefficients: List<Int>? = listOf(),
|
val coefficients: List<Int>? = listOf(),
|
||||||
val collectionLocation: List<Any>? = listOf(),
|
val collectionLocation: List<Any>? = listOf(),
|
||||||
val collectionTime: String? = "2024-02-08 16:33:56",
|
val collectionTime: String? = "2024-02-08 16:33:56",
|
||||||
@@ -32,13 +31,13 @@ data class MolbioV2ResultData(
|
|||||||
val curveFitting: String? = "",
|
val curveFitting: String? = "",
|
||||||
val deviceId: Int? = 0,
|
val deviceId: Int? = 0,
|
||||||
val expiryTime: String? = "2024-02-08 16:33:56",
|
val expiryTime: String? = "2024-02-08 16:33:56",
|
||||||
// val gender: String? = "",
|
val gender: String? = "",
|
||||||
val id: Int? = 0,
|
val id: Int? = 0,
|
||||||
val interpretation: String? = "",
|
val interpretation: String? = "",
|
||||||
val `operator`: String? = "",
|
val `operator`: String? = "",
|
||||||
val patientId: Int? = 0,
|
val patientId: Int? = 0,
|
||||||
val pregnancy: Boolean? = false,
|
val pregnancy: Boolean? = false,
|
||||||
val rawData: MolbioHemocubeData? = HemoCubeTestData().MolbioHemocubeData(),
|
val rawData: HemoCubeTestData? = HemoCubeTestData(),
|
||||||
val recommendation: String? = "",
|
val recommendation: String? = "",
|
||||||
val sampleId: String? = "",
|
val sampleId: String? = "",
|
||||||
val sampleType: String? = "",
|
val sampleType: String? = "",
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ data class HemoCubeTestData(
|
|||||||
var name: String = "",
|
var name: String = "",
|
||||||
var incubationTime: String = "",
|
var incubationTime: String = "",
|
||||||
var bloodGroup: String = "",
|
var bloodGroup: String = "",
|
||||||
var birthYear: String = "",
|
var age: String = "",
|
||||||
var state: String = "",
|
var state: String = "",
|
||||||
var abhaId: String = "",
|
var abhaId: String = "",
|
||||||
var userImageURL: String = "",
|
var userImageURL: String = "",
|
||||||
@@ -106,91 +106,10 @@ data class HemoCubeTestData(
|
|||||||
var filter: String? = "",
|
var filter: String? = "",
|
||||||
var volume: String? = "",
|
var volume: String? = "",
|
||||||
var isCSVCreated: Boolean = false,
|
var isCSVCreated: Boolean = false,
|
||||||
var labName: String? = ""
|
var labName: String? = "",
|
||||||
)
|
var cuvetteSize: String? = "",
|
||||||
|
var district: String? = "",
|
||||||
fun HemoCubeTestData.MolbioHemocubeData() = MolbioHemocubeData(
|
var centerName: String? = "",
|
||||||
sampleid = sampleid,
|
var ipAddress:String?= "",
|
||||||
_id = _id,
|
var configUpdatedRecent:String?= ""
|
||||||
name = name,
|
|
||||||
incubationTime = incubationTime,
|
|
||||||
state = state,
|
|
||||||
location = location,
|
|
||||||
reportUploadTime = reportUploadTime,
|
|
||||||
testType = testType,
|
|
||||||
testTime = testTime,
|
|
||||||
testStatus = testStatus,
|
|
||||||
localFlag = localFlag,
|
|
||||||
deviceId = deviceId,
|
|
||||||
appVersion = appVersion,
|
|
||||||
deviceSerialNumber = deviceSerialNumber,
|
|
||||||
deviceType = deviceType,
|
|
||||||
kitSerial = kitSerial,
|
|
||||||
resultData = resultData,
|
|
||||||
led1Buffer = led1Buffer,
|
|
||||||
led2Buffer = led2Buffer,
|
|
||||||
led3Buffer = led3Buffer,
|
|
||||||
led4Buffer = led4Buffer,
|
|
||||||
led1Sample = led1Sample,
|
|
||||||
led2Sample = led2Sample,
|
|
||||||
led3Sample = led3Sample,
|
|
||||||
led4Sample = led4Sample,
|
|
||||||
led1Average = led1Average,
|
|
||||||
led2Average = led2Average,
|
|
||||||
led3Average = led3Average,
|
|
||||||
led4Average = led4Average,
|
|
||||||
abs1 = abs1,
|
|
||||||
abs2 = abs2,
|
|
||||||
abs3 = abs3,
|
|
||||||
abs4 = abs4,
|
|
||||||
hb3 = hb3,
|
|
||||||
hb4 = hb4,
|
|
||||||
led1Gain1 = led1Gain1,
|
|
||||||
led2Gain1 = led2Gain1,
|
|
||||||
led3Gain1 = led3Gain1,
|
|
||||||
led4Gain1 = led4Gain1,
|
|
||||||
led1Gain2 = led1Gain2,
|
|
||||||
led2Gain2 = led2Gain2,
|
|
||||||
led3Gain2 = led3Gain2,
|
|
||||||
led4Gain2 = led4Gain2,
|
|
||||||
led1Gain3 = led1Gain3,
|
|
||||||
led2Gain3 = led2Gain3,
|
|
||||||
led3Gain3 = led3Gain3,
|
|
||||||
led4Gain3 = led4Gain3,
|
|
||||||
led1Gain4 = led1Gain4,
|
|
||||||
led2Gain4 = led2Gain4,
|
|
||||||
led3Gain4 = led3Gain4,
|
|
||||||
led4Gain4 = led4Gain4,
|
|
||||||
led1Air1 = led1Air1,
|
|
||||||
led2Air1 = led2Air1,
|
|
||||||
led3Air1 = led3Air1,
|
|
||||||
led4Air1 = led4Air1,
|
|
||||||
led1Air2 = led1Air2,
|
|
||||||
led2Air2 = led2Air2,
|
|
||||||
led3Air2 = led3Air2,
|
|
||||||
led4Air2 = led4Air2,
|
|
||||||
deviceRatio = deviceRatio,
|
|
||||||
calculatedRatio = calculatedRatio,
|
|
||||||
predictedDenovixRatio = predictedDenovixRatio,
|
|
||||||
slopeRatio = slopeRatio,
|
|
||||||
coefficients = coefficients,
|
|
||||||
classificationResult = classificationResult,
|
|
||||||
prdClassification = prdClassification,
|
|
||||||
deviceRatioClass = deviceRatioClass,
|
|
||||||
slopeRatioClass = slopeRatioClass,
|
|
||||||
borderlineMethod2Class = borderlineMethod2Class,
|
|
||||||
errorMessages = errorMessages,
|
|
||||||
batteryLevel = batteryLevel,
|
|
||||||
batteryCapacity = batteryCapacity,
|
|
||||||
batteryMaxCapacity = batteryMaxCapacity,
|
|
||||||
batteryTemperature = batteryTemperature,
|
|
||||||
batteryVoltage = batteryVoltage,
|
|
||||||
molbioFlag = molbioFlag,
|
|
||||||
quickCapture = quickCapture,
|
|
||||||
solution = solution,
|
|
||||||
concentration = concentration,
|
|
||||||
filter = filter,
|
|
||||||
volume = volume,
|
|
||||||
isCSVCreated = isCSVCreated,
|
|
||||||
labName = labName
|
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -1,93 +0,0 @@
|
|||||||
package com.example.hpostesting.data.model.patient
|
|
||||||
|
|
||||||
import androidx.room.Entity
|
|
||||||
import androidx.room.PrimaryKey
|
|
||||||
|
|
||||||
@Entity(tableName = "molbio_hemo_cube_test_table")
|
|
||||||
data class MolbioHemocubeData(
|
|
||||||
@PrimaryKey(autoGenerate = true)
|
|
||||||
var sampleid: Int = 0,
|
|
||||||
var _id: String = "",
|
|
||||||
var name: String = "",
|
|
||||||
var incubationTime: String = "",
|
|
||||||
var state: String = "",
|
|
||||||
var location: UserData.Location? = null,
|
|
||||||
var reportUploadTime: String? = "",
|
|
||||||
var testType: String? = "HEMOCUBE",
|
|
||||||
var testTime: String? = "",
|
|
||||||
var testStatus: Boolean? = false,
|
|
||||||
var localFlag: Boolean = false,
|
|
||||||
var deviceId: String? = "",
|
|
||||||
var appVersion: String? = "",
|
|
||||||
var deviceSerialNumber: String = "",
|
|
||||||
var deviceType: String = "HEMOCUBE",
|
|
||||||
var kitSerial: String = "",
|
|
||||||
var resultData: String = "",
|
|
||||||
var led1Buffer: Double? = null,
|
|
||||||
var led2Buffer: Double? = null,
|
|
||||||
var led3Buffer: Double? = null,
|
|
||||||
var led4Buffer: Double? = null,
|
|
||||||
var led1Sample: Double? = null,
|
|
||||||
var led2Sample: Double? = null,
|
|
||||||
var led3Sample: Double? = null,
|
|
||||||
var led4Sample: Double? = null,
|
|
||||||
var led1Average: 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 hb3: Double? = null,
|
|
||||||
var hb4: 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 led1Air1: Double? = null,
|
|
||||||
var led2Air1: Double? = null,
|
|
||||||
var led3Air1: Double? = null,
|
|
||||||
var led4Air1: Double? = null,
|
|
||||||
var led1Air2: Double? = null,
|
|
||||||
var led2Air2: Double? = null,
|
|
||||||
var led3Air2: Double? = null,
|
|
||||||
var led4Air2: Double? = null,
|
|
||||||
var deviceRatio: Double? = null,
|
|
||||||
var calculatedRatio: Double? = null,
|
|
||||||
var predictedDenovixRatio: Double? = null,
|
|
||||||
var slopeRatio: Double? = null,
|
|
||||||
var coefficients: String? = "",
|
|
||||||
var classificationResult: String = "",
|
|
||||||
var prdClassification: String = "",
|
|
||||||
var deviceRatioClass: String = "",
|
|
||||||
var slopeRatioClass: String = "",
|
|
||||||
var borderlineMethod2Class: String = "",
|
|
||||||
var errorMessages: String = "",
|
|
||||||
var batteryLevel: String = "",
|
|
||||||
var batteryCapacity: String = "",
|
|
||||||
var batteryMaxCapacity: String = "",
|
|
||||||
var batteryTemperature: String = "",
|
|
||||||
var batteryVoltage: String = "",
|
|
||||||
var molbioFlag: Boolean = false,
|
|
||||||
var quickCapture: Boolean = false,
|
|
||||||
var solution: String? = "",
|
|
||||||
var concentration: String? = "",
|
|
||||||
var filter: String? = "",
|
|
||||||
var volume: String? = "",
|
|
||||||
var isCSVCreated: Boolean = false,
|
|
||||||
var labName: String? = ""
|
|
||||||
)
|
|
||||||
|
|
||||||
@@ -24,7 +24,7 @@ data class UserData(
|
|||||||
var name: String = "",
|
var name: String = "",
|
||||||
var incubationTime: String = "",
|
var incubationTime: String = "",
|
||||||
var gender: String = "",
|
var gender: String = "",
|
||||||
var birthYear: String = "",
|
var age: String = "",
|
||||||
var abhaId: String = "",
|
var abhaId: String = "",
|
||||||
var bloodGroup: String = "",
|
var bloodGroup: String = "",
|
||||||
var userImageURL: String = "",
|
var userImageURL: String = "",
|
||||||
@@ -60,10 +60,10 @@ data class UserData(
|
|||||||
fun UserData.toHemoCubeTestData() = HemoCubeTestData(
|
fun UserData.toHemoCubeTestData() = HemoCubeTestData(
|
||||||
_id = _id,
|
_id = _id,
|
||||||
name = name,
|
name = name,
|
||||||
bloodGroup = bloodGroup,
|
|
||||||
sampleid = sampleid,
|
sampleid = sampleid,
|
||||||
|
bloodGroup = bloodGroup,
|
||||||
incubationTime = incubationTime,
|
incubationTime = incubationTime,
|
||||||
birthYear = birthYear,
|
age = age,
|
||||||
gender = gender,
|
gender = gender,
|
||||||
state = state,
|
state = state,
|
||||||
abhaId = abhaId,
|
abhaId = abhaId,
|
||||||
|
|||||||
@@ -15,5 +15,6 @@ package com.example.hpostesting.data.model.test
|
|||||||
|
|
||||||
enum class TestType {
|
enum class TestType {
|
||||||
SICKLECERT,
|
SICKLECERT,
|
||||||
SICKLEFIND
|
SICKLEFIND,
|
||||||
|
HB_EST
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,6 +14,9 @@
|
|||||||
package com.example.hpostesting.data.repository
|
package com.example.hpostesting.data.repository
|
||||||
|
|
||||||
import android.net.Uri
|
import android.net.Uri
|
||||||
|
import android.os.Build
|
||||||
|
import android.util.Log
|
||||||
|
import androidx.annotation.RequiresApi
|
||||||
import com.example.hpostesting.util.Result
|
import com.example.hpostesting.util.Result
|
||||||
import com.example.hpostesting.data.api.MolbioAuthApi
|
import com.example.hpostesting.data.api.MolbioAuthApi
|
||||||
import com.example.hpostesting.data.api.MolbioResultApi
|
import com.example.hpostesting.data.api.MolbioResultApi
|
||||||
@@ -37,37 +40,53 @@ 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.CheckUpdateResponse
|
import com.example.hpostesting.data.model.updates.CheckUpdateResponse
|
||||||
import com.example.hpostesting.data.model.updates.DeviceUpdateRequest
|
import com.example.hpostesting.data.model.updates.DeviceUpdateRequest
|
||||||
|
import com.example.hpostesting.firebase.FirebaseManager
|
||||||
import com.google.firebase.crashlytics.ktx.crashlytics
|
import com.google.firebase.crashlytics.ktx.crashlytics
|
||||||
import com.google.firebase.firestore.FirebaseFirestore
|
import com.google.firebase.firestore.FirebaseFirestore
|
||||||
import com.google.firebase.firestore.ktx.firestore
|
|
||||||
import com.google.firebase.ktx.Firebase
|
import com.google.firebase.ktx.Firebase
|
||||||
import com.google.firebase.storage.ktx.storage
|
import com.google.firebase.storage.FirebaseStorage
|
||||||
import kotlinx.coroutines.tasks.await
|
import kotlinx.coroutines.tasks.await
|
||||||
import okhttp3.MultipartBody
|
import okhttp3.MultipartBody
|
||||||
import okhttp3.ResponseBody
|
import okhttp3.ResponseBody
|
||||||
import retrofit2.HttpException
|
|
||||||
import java.io.File
|
import java.io.File
|
||||||
import java.net.ConnectException
|
import java.net.ConnectException
|
||||||
import java.net.SocketTimeoutException
|
import java.net.SocketTimeoutException
|
||||||
|
import java.time.LocalTime
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
import javax.inject.Named
|
import javax.inject.Named
|
||||||
|
|
||||||
class NetworkException(message: String, cause: Throwable) : Exception(message, cause)
|
class NetworkException(message: String, cause: Throwable) : Exception(message, cause)
|
||||||
class ValidationException(message: String) : Exception(message)
|
|
||||||
class DatabaseRepository @Inject constructor(
|
class DatabaseRepository @Inject constructor(
|
||||||
@Named("Auth") private val molbioAuthApi: MolbioAuthApi,
|
@Named("Auth") private val molbioAuthApi: MolbioAuthApi,
|
||||||
private val molbioResultApi: MolbioResultApi,
|
private val molbioResultApi: MolbioResultApi,
|
||||||
|
private val firebaseManager: FirebaseManager,
|
||||||
) : Repository {
|
) : Repository {
|
||||||
|
|
||||||
private val db: FirebaseFirestore = Firebase.firestore
|
private val localdb: FirebaseFirestore
|
||||||
private val storage = Firebase.storage
|
get() = firebaseManager.getCurrentFirestore()
|
||||||
|
|
||||||
|
private val localStg: FirebaseStorage
|
||||||
|
get() = firebaseManager.getCurrentStorage()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// // Example function to add data to Firestore , like the basic data as test data
|
||||||
|
// @RequiresApi(Build.VERSION_CODES.O)
|
||||||
|
// fun addtodb(data: String) {
|
||||||
|
// val date = LocalTime.now()
|
||||||
|
// localdb.collection("BasicData")
|
||||||
|
// .add(mapOf("data $date" to data))
|
||||||
|
// .addOnSuccessListener {
|
||||||
|
// Log.d("UPLOAD", "Data uploaded successfully ${localdb.app.name}")
|
||||||
|
// }
|
||||||
|
// .addOnFailureListener { exception ->
|
||||||
|
// Log.d("UPLOAD", "Failed to upload data: ${exception.message} ${localdb.app.name}")
|
||||||
|
// }
|
||||||
|
// }
|
||||||
private suspend fun <T : Any> safeApiCall(apiCall: suspend () -> T): Result<T> {
|
private suspend fun <T : Any> safeApiCall(apiCall: suspend () -> T): Result<T> {
|
||||||
return try {
|
return try {
|
||||||
val response = apiCall.invoke()
|
val response = apiCall.invoke()
|
||||||
Result.Success(response)
|
Result.Success(response)
|
||||||
}catch (e: HttpException) {
|
|
||||||
Result.Error(ValidationException("Device Already Registered /"+e.message))
|
|
||||||
} catch (e: SocketTimeoutException) {
|
} catch (e: SocketTimeoutException) {
|
||||||
Result.Error(NetworkException("Network timeout", e))
|
Result.Error(NetworkException("Network timeout", e))
|
||||||
} catch (e: ConnectException) {
|
} catch (e: ConnectException) {
|
||||||
@@ -112,18 +131,28 @@ class DatabaseRepository @Inject constructor(
|
|||||||
override suspend fun addTestToDatabase(data: HemoCubeTestData?): Response<String> {
|
override suspend fun addTestToDatabase(data: HemoCubeTestData?): Response<String> {
|
||||||
return try {
|
return try {
|
||||||
val userdata =
|
val userdata =
|
||||||
db.collection("patientData").whereEqualTo("_id", data!!._id).get().await()
|
localdb.collection("patientData").whereEqualTo("_id", data!!._id).get().await()
|
||||||
if (userdata.documents.isNotEmpty()) {
|
if (userdata.documents.isNotEmpty()) {
|
||||||
userdata.documents.forEach {
|
userdata.documents.forEach {
|
||||||
db.collection("patientData").document(it.id).update("testStatus", true)
|
localdb.collection("patientData").document(it.id).update("testStatus", true)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
db.collection("testData").add(data).await()
|
localdb.collection("testData").add(data).await()
|
||||||
Response.Success(data._id)
|
Response.Success(data._id)
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
Response.Error(e)
|
Response.Error(e)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
override suspend fun addQcTestToDatabase(data: HemoCubeTestData?): Response<String> {
|
||||||
|
return try {
|
||||||
|
|
||||||
|
localdb.collection("qcData").add(data!!).await()
|
||||||
|
Response.Success(data._id)
|
||||||
|
|
||||||
|
} catch (e: Exception) {
|
||||||
|
Response.Error(e)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
override suspend fun addTestToDatabase(data: UserData?): Response<String> {
|
override suspend fun addTestToDatabase(data: UserData?): Response<String> {
|
||||||
TODO("Not yet implemented")
|
TODO("Not yet implemented")
|
||||||
@@ -131,7 +160,7 @@ class DatabaseRepository @Inject constructor(
|
|||||||
|
|
||||||
override suspend fun addTestToDatabaseforBufferCheck(data: BufferCheckData?): Response<String> {
|
override suspend fun addTestToDatabaseforBufferCheck(data: BufferCheckData?): Response<String> {
|
||||||
return try {
|
return try {
|
||||||
db.collection("buffers").add(data!!).await()
|
localdb.collection("buffers").add(data!!).await()
|
||||||
Response.Success(data.kitno)
|
Response.Success(data.kitno)
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
Firebase.crashlytics.recordException(e)
|
Firebase.crashlytics.recordException(e)
|
||||||
@@ -141,7 +170,7 @@ class DatabaseRepository @Inject constructor(
|
|||||||
|
|
||||||
override suspend fun addDiagnostics(data: DiagnosticsData?): Response<String> {
|
override suspend fun addDiagnostics(data: DiagnosticsData?): Response<String> {
|
||||||
return try {
|
return try {
|
||||||
db.collection("diagnostics").add(data!!).await()
|
localdb.collection("diagnostics").add(data!!).await()
|
||||||
Response.Success(data.deviceId)
|
Response.Success(data.deviceId)
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
Firebase.crashlytics.recordException(e)
|
Firebase.crashlytics.recordException(e)
|
||||||
@@ -149,9 +178,10 @@ class DatabaseRepository @Inject constructor(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
override suspend fun addTestJigData(data: JigData?): Response<String> {
|
override suspend fun addTestJigData(data: JigData?): Response<String> {
|
||||||
return try {
|
return try {
|
||||||
db.collection("jigs").add(data!!).await()
|
localdb.collection("jigs").add(data!!).await()
|
||||||
Response.Success(data.deviceId)
|
Response.Success(data.deviceId)
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
Firebase.crashlytics.recordException(e)
|
Firebase.crashlytics.recordException(e)
|
||||||
@@ -165,7 +195,7 @@ class DatabaseRepository @Inject constructor(
|
|||||||
try {
|
try {
|
||||||
|
|
||||||
val file = Uri.fromFile(File(filePath))
|
val file = Uri.fromFile(File(filePath))
|
||||||
val riversRef = storage.reference.child("$patientID/${file.lastPathSegment}")
|
val riversRef = localStg.reference.child("$patientID/${file.lastPathSegment}")
|
||||||
riversRef.putFile(file).await()
|
riversRef.putFile(file).await()
|
||||||
return Response.Success(true)
|
return Response.Success(true)
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
@@ -176,7 +206,7 @@ class DatabaseRepository @Inject constructor(
|
|||||||
|
|
||||||
suspend fun addToPendingQueue(pendingUploads: PendingUploads): Response<Boolean> {
|
suspend fun addToPendingQueue(pendingUploads: PendingUploads): Response<Boolean> {
|
||||||
return try {
|
return try {
|
||||||
db.collection("pendingUploads").document(pendingUploads.pendingId).set(pendingUploads)
|
localdb.collection("pendingUploads").document(pendingUploads.pendingId).set(pendingUploads)
|
||||||
.await()
|
.await()
|
||||||
|
|
||||||
Response.Success(true)
|
Response.Success(true)
|
||||||
@@ -189,7 +219,7 @@ class DatabaseRepository @Inject constructor(
|
|||||||
suspend fun getAllFromPendingQueue(): List<PendingUploads> {
|
suspend fun getAllFromPendingQueue(): List<PendingUploads> {
|
||||||
val pendingList = mutableListOf<PendingUploads>()
|
val pendingList = mutableListOf<PendingUploads>()
|
||||||
return try {
|
return try {
|
||||||
val querySnapshot = db.collection("pendingUploads").orderBy("timeAdded").get().await()
|
val querySnapshot = localdb.collection("pendingUploads").orderBy("timeAdded").get().await()
|
||||||
|
|
||||||
for (doc in querySnapshot.documents) {
|
for (doc in querySnapshot.documents) {
|
||||||
val pendingFile = doc.toObject(PendingUploads::class.java)
|
val pendingFile = doc.toObject(PendingUploads::class.java)
|
||||||
@@ -207,7 +237,7 @@ class DatabaseRepository @Inject constructor(
|
|||||||
|
|
||||||
suspend fun removeFromPendingQueue(fileName: String): Response<Boolean> {
|
suspend fun removeFromPendingQueue(fileName: String): Response<Boolean> {
|
||||||
return try {
|
return try {
|
||||||
db.collection("pendingUploads").document(fileName).delete().await()
|
localdb.collection("pendingUploads").document(fileName).delete().await()
|
||||||
|
|
||||||
Response.Success(true)
|
Response.Success(true)
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
@@ -217,11 +247,11 @@ class DatabaseRepository @Inject constructor(
|
|||||||
}
|
}
|
||||||
|
|
||||||
suspend fun getDeviceData(): List<DeviceData> {
|
suspend fun getDeviceData(): List<DeviceData> {
|
||||||
return db.collection("devices").get().await().toObjects(DeviceData::class.java)
|
return localdb.collection("devices").get().await().toObjects(DeviceData::class.java)
|
||||||
}
|
}
|
||||||
|
|
||||||
override suspend fun getDeviceDataById(deviceId: String): DeviceData? {
|
override suspend fun getDeviceDataById(deviceId: String): DeviceData? {
|
||||||
val querySnapshot = db.collection("devices").get().await()
|
val querySnapshot = localdb.collection("devices").get().await()
|
||||||
val allDeviceDataList = querySnapshot.toObjects(DeviceData::class.java)
|
val allDeviceDataList = querySnapshot.toObjects(DeviceData::class.java)
|
||||||
|
|
||||||
// Find the DeviceData object with the specified deviceId
|
// Find the DeviceData object with the specified deviceId
|
||||||
@@ -230,7 +260,7 @@ class DatabaseRepository @Inject constructor(
|
|||||||
|
|
||||||
override suspend fun getDeviceResponse(data: DeviceData?): Response<String> {
|
override suspend fun getDeviceResponse(data: DeviceData?): Response<String> {
|
||||||
return try {
|
return try {
|
||||||
db.collection("devices").add(data!!).await()
|
localdb.collection("devices").add(data!!).await()
|
||||||
Response.Success(data.deviceProvisionResponse)
|
Response.Success(data.deviceProvisionResponse)
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
Firebase.crashlytics.recordException(e)
|
Firebase.crashlytics.recordException(e)
|
||||||
@@ -240,7 +270,7 @@ class DatabaseRepository @Inject constructor(
|
|||||||
|
|
||||||
override suspend fun uploadDeviceId(data: DeviceData): Response<String>? {
|
override suspend fun uploadDeviceId(data: DeviceData): Response<String>? {
|
||||||
return try {
|
return try {
|
||||||
db.collection("devices").add(data!!).await()
|
localdb.collection("devices").add(data!!).await()
|
||||||
Response.Success(data.deviceId)
|
Response.Success(data.deviceId)
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
Firebase.crashlytics.recordException(e)
|
Firebase.crashlytics.recordException(e)
|
||||||
@@ -255,13 +285,13 @@ class DatabaseRepository @Inject constructor(
|
|||||||
override suspend fun addTestToDatabasefornew(data: HemoCubeTestData?): Response<String> {
|
override suspend fun addTestToDatabasefornew(data: HemoCubeTestData?): Response<String> {
|
||||||
return try {
|
return try {
|
||||||
val userdata =
|
val userdata =
|
||||||
db.collection("patientData").whereEqualTo("_id", data!!._id).get().await()
|
localdb.collection("patientData").whereEqualTo("_id", data!!._id).get().await()
|
||||||
if (userdata.documents.isNotEmpty()) {
|
if (userdata.documents.isNotEmpty()) {
|
||||||
userdata.documents.forEach {
|
userdata.documents.forEach {
|
||||||
db.collection("patientData").document(it.id).update("testStatus", true)
|
localdb.collection("patientData").document(it.id).update("testStatus", true)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
db.collection("testData").add(data).await()
|
localdb.collection("testData").add(data).await()
|
||||||
Response.Success(data._id)
|
Response.Success(data._id)
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
Firebase.crashlytics.recordException(e)
|
Firebase.crashlytics.recordException(e)
|
||||||
|
|||||||
@@ -38,6 +38,7 @@ import okhttp3.ResponseBody
|
|||||||
|
|
||||||
interface Repository {
|
interface Repository {
|
||||||
suspend fun addTestToDatabase(data: HemoCubeTestData?): Response<String>
|
suspend fun addTestToDatabase(data: HemoCubeTestData?): Response<String>
|
||||||
|
suspend fun addQcTestToDatabase(data: HemoCubeTestData?): Response<String>
|
||||||
suspend fun addTestToDatabasefornew(data: HemoCubeTestData?): Response<String>
|
suspend fun addTestToDatabasefornew(data: HemoCubeTestData?): Response<String>
|
||||||
|
|
||||||
suspend fun addTestToDatabase(data: UserData?): Response<String>
|
suspend fun addTestToDatabase(data: UserData?): Response<String>
|
||||||
|
|||||||
@@ -35,10 +35,14 @@ import com.example.hpostesting.domain.LogFileManager
|
|||||||
import com.example.hpostesting.domain.LogFileManagerImpl
|
import com.example.hpostesting.domain.LogFileManagerImpl
|
||||||
import com.example.hpostesting.domain.SaveRawData
|
import com.example.hpostesting.domain.SaveRawData
|
||||||
import com.example.hpostesting.domain.SaveRawDataTest
|
import com.example.hpostesting.domain.SaveRawDataTest
|
||||||
|
import com.example.hpostesting.firebase.FirebaseManager
|
||||||
import com.example.hpostesting.presentation.utils.UsbServiceListener
|
import com.example.hpostesting.presentation.utils.UsbServiceListener
|
||||||
import com.example.hpostesting.presentation.utils.UsbServiceListenerImpl
|
import com.example.hpostesting.presentation.utils.UsbServiceListenerImpl
|
||||||
|
import com.example.hpostesting.util.NetworkMonitor
|
||||||
import com.example.hpostesting.util.PropertyProvider
|
import com.example.hpostesting.util.PropertyProvider
|
||||||
import com.example.hpostesting.util.PropertyProviderImpl
|
import com.example.hpostesting.util.PropertyProviderImpl
|
||||||
|
import com.google.firebase.firestore.FirebaseFirestore
|
||||||
|
import com.google.firebase.storage.FirebaseStorage
|
||||||
import dagger.Module
|
import dagger.Module
|
||||||
import dagger.Provides
|
import dagger.Provides
|
||||||
import dagger.hilt.InstallIn
|
import dagger.hilt.InstallIn
|
||||||
@@ -53,7 +57,6 @@ import java.util.concurrent.TimeUnit
|
|||||||
import javax.inject.Named
|
import javax.inject.Named
|
||||||
import javax.inject.Singleton
|
import javax.inject.Singleton
|
||||||
|
|
||||||
|
|
||||||
@Module
|
@Module
|
||||||
@InstallIn(SingletonComponent::class)
|
@InstallIn(SingletonComponent::class)
|
||||||
object AppModule {
|
object AppModule {
|
||||||
@@ -108,22 +111,52 @@ object AppModule {
|
|||||||
return SaveRawDataTest(repository)
|
return SaveRawDataTest(repository)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Provides
|
||||||
|
@Singleton
|
||||||
|
fun provideFirebaseFirestore(): FirebaseFirestore {
|
||||||
|
return FirebaseFirestore.getInstance()
|
||||||
|
}
|
||||||
|
|
||||||
|
@Provides
|
||||||
|
@Singleton
|
||||||
|
fun provideFirebaseStorage(): FirebaseStorage {
|
||||||
|
return FirebaseStorage.getInstance()
|
||||||
|
}
|
||||||
|
|
||||||
|
@Provides
|
||||||
|
@Singleton
|
||||||
|
fun provideFirebaseManager(
|
||||||
|
@ApplicationContext context: Context,
|
||||||
|
): FirebaseManager {
|
||||||
|
return FirebaseManager(context)
|
||||||
|
}
|
||||||
|
|
||||||
@Provides
|
@Provides
|
||||||
@Singleton
|
@Singleton
|
||||||
fun provideDatabaseRepository(
|
fun provideDatabaseRepository(
|
||||||
|
firebaseManager: FirebaseManager,
|
||||||
@Named("Auth") molbioAuthApi: MolbioAuthApi,
|
@Named("Auth") molbioAuthApi: MolbioAuthApi,
|
||||||
molbioResultApi: MolbioResultApi
|
molbioResultApi: MolbioResultApi
|
||||||
): DatabaseRepository {
|
): DatabaseRepository {
|
||||||
return DatabaseRepository(molbioAuthApi = molbioAuthApi, molbioResultApi = molbioResultApi)
|
return DatabaseRepository(
|
||||||
|
firebaseManager = firebaseManager,
|
||||||
|
molbioAuthApi = molbioAuthApi,
|
||||||
|
molbioResultApi = molbioResultApi
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Provides
|
@Provides
|
||||||
@Singleton
|
@Singleton
|
||||||
fun provideRepository(
|
fun provideRepository(
|
||||||
|
firebaseManager: FirebaseManager,
|
||||||
@Named("Auth") molbioAuthApi: MolbioAuthApi,
|
@Named("Auth") molbioAuthApi: MolbioAuthApi,
|
||||||
molbioResultApi: MolbioResultApi
|
molbioResultApi: MolbioResultApi
|
||||||
): Repository {
|
): Repository {
|
||||||
return DatabaseRepository(molbioAuthApi, molbioResultApi)
|
return DatabaseRepository(
|
||||||
|
firebaseManager = firebaseManager,
|
||||||
|
molbioAuthApi = molbioAuthApi,
|
||||||
|
molbioResultApi = molbioResultApi
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Provides
|
@Provides
|
||||||
@@ -207,4 +240,13 @@ object AppModule {
|
|||||||
fun provideUsbServiceListener(context: Context): UsbServiceListener {
|
fun provideUsbServiceListener(context: Context): UsbServiceListener {
|
||||||
return UsbServiceListenerImpl(context)
|
return UsbServiceListenerImpl(context)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Provides
|
||||||
|
@Singleton
|
||||||
|
fun provideNetworkMonitor(
|
||||||
|
@ApplicationContext context: Context
|
||||||
|
): NetworkMonitor {
|
||||||
|
return NetworkMonitor(context).apply { startMonitoring() }
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,174 @@
|
|||||||
|
package com.example.hpostesting.firebase
|
||||||
|
/*
|
||||||
|
* // Copyright (c) 2024 ShanMukha Innovations Pvt. Ltd. All rights reserved.
|
||||||
|
* // Notice: All information contained herein is, and remains
|
||||||
|
* // the property of ShanMukha Innovations Pvt. Ltd. and its suppliers,
|
||||||
|
* // if any. The intellectual and technical concepts contained
|
||||||
|
* // herein are proprietary to ShanMukha Innovations Pvt. Ltd.
|
||||||
|
* // and its suppliers and may be covered by Indian and Foreign Patents,
|
||||||
|
* // patents in process, and are protected by trade secret or copyright law.
|
||||||
|
* // Dissemination of this information or reproduction of this material
|
||||||
|
* // is strictly forbidden unless prior written permission is obtained
|
||||||
|
* // from ShanMukha Innovations Pvt. Ltd.
|
||||||
|
*/
|
||||||
|
import android.content.Context
|
||||||
|
import android.content.Intent
|
||||||
|
import android.os.Process
|
||||||
|
import androidx.core.content.edit
|
||||||
|
import com.google.firebase.FirebaseApp
|
||||||
|
import com.google.firebase.FirebaseOptions
|
||||||
|
import com.google.firebase.firestore.FirebaseFirestore
|
||||||
|
import com.google.firebase.storage.FirebaseStorage
|
||||||
|
import kotlinx.coroutines.DelicateCoroutinesApi
|
||||||
|
import kotlinx.coroutines.Dispatchers
|
||||||
|
import kotlinx.coroutines.GlobalScope
|
||||||
|
import kotlinx.coroutines.delay
|
||||||
|
import kotlinx.coroutines.launch
|
||||||
|
import javax.inject.Inject
|
||||||
|
|
||||||
|
class FirebaseManager @Inject constructor(private val context: Context) {
|
||||||
|
|
||||||
|
private val sharedPreferencesServerConfig = context.getSharedPreferences("FirebaseConfigPrefs", Context.MODE_PRIVATE)
|
||||||
|
private val sharedPreferencesDev = context.getSharedPreferences("DevMode",Context.MODE_PRIVATE)
|
||||||
|
|
||||||
|
private var currentFirestore: FirebaseFirestore = FirebaseFirestore.getInstance()
|
||||||
|
private var currentStorage: FirebaseStorage = FirebaseStorage.getInstance()
|
||||||
|
var updateStatus = false
|
||||||
|
|
||||||
|
private val defaultServers = listOf(
|
||||||
|
// i have it in different place look down
|
||||||
|
firebaseConfigProd, firebaseConfigDev , firebaseConfigQaQc, firebaseConfigPreProd
|
||||||
|
)
|
||||||
|
|
||||||
|
init {
|
||||||
|
val lastSelectedServer = getLastSelectedServer()
|
||||||
|
switchServer(lastSelectedServer)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
fun setDevModeOn(state : Boolean){
|
||||||
|
sharedPreferencesDev.edit {
|
||||||
|
putBoolean( "isDevModeOn",state )
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun getDevMode(): Boolean {
|
||||||
|
return sharedPreferencesDev.getBoolean("isDevModeOn",false)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
fun getCurrentFirestore(): FirebaseFirestore = currentFirestore
|
||||||
|
fun getCurrentStorage(): FirebaseStorage = currentStorage
|
||||||
|
|
||||||
|
fun switchServer(firebaseConfig: FirebaseConfig) {
|
||||||
|
saveSelectedServer(firebaseConfig)
|
||||||
|
val firebaseApp = getOrInitializeFirebaseApp(firebaseConfig)
|
||||||
|
currentFirestore = FirebaseFirestore.getInstance(firebaseApp)
|
||||||
|
currentStorage = FirebaseStorage.getInstance(firebaseApp)
|
||||||
|
updateStatus = true
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun getOrInitializeFirebaseApp(firebaseConfig: FirebaseConfig): FirebaseApp {
|
||||||
|
val existingApp = FirebaseApp.getApps(context).find { it.name == firebaseConfig.serverName }
|
||||||
|
|
||||||
|
return if (existingApp != null) {
|
||||||
|
|
||||||
|
existingApp
|
||||||
|
} else {
|
||||||
|
|
||||||
|
val options = FirebaseOptions.Builder().setProjectId(firebaseConfig.projectId)
|
||||||
|
.setApplicationId(firebaseConfig.appId).setApiKey(firebaseConfig.apiKey)
|
||||||
|
.setStorageBucket(firebaseConfig.storageBucket).build()
|
||||||
|
|
||||||
|
FirebaseApp.initializeApp(context, options, firebaseConfig.serverName)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun saveSelectedServer(firebaseConfig: FirebaseConfig) {
|
||||||
|
with(sharedPreferencesServerConfig.edit()) {
|
||||||
|
putString("selectedServerName", firebaseConfig.serverName)
|
||||||
|
putString("projectId", firebaseConfig.projectId)
|
||||||
|
putString("appId", firebaseConfig.appId)
|
||||||
|
putString("apiKey", firebaseConfig.apiKey)
|
||||||
|
putString("storageBucket", firebaseConfig.storageBucket)
|
||||||
|
apply()
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
fun restartApp() {
|
||||||
|
if (updateStatus) {
|
||||||
|
updateStatus = false
|
||||||
|
delayedRestart(context)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun getLastSelectedServer(): FirebaseConfig {
|
||||||
|
val selectedServerName =
|
||||||
|
sharedPreferencesServerConfig.getString("selectedServerName", defaultServers.first().serverName)
|
||||||
|
val projectId = sharedPreferencesServerConfig.getString("projectId", defaultServers.first().projectId)
|
||||||
|
val appId = sharedPreferencesServerConfig.getString("appId", defaultServers.first().appId)
|
||||||
|
val apiKey = sharedPreferencesServerConfig.getString("apiKey", defaultServers.first().apiKey)
|
||||||
|
val storageBucket =
|
||||||
|
sharedPreferencesServerConfig.getString("storageBucket", defaultServers.first().storageBucket)
|
||||||
|
|
||||||
|
return FirebaseConfig(
|
||||||
|
serverName = selectedServerName ?: defaultServers.first().serverName,
|
||||||
|
projectId = projectId ?: defaultServers.first().projectId,
|
||||||
|
appId = appId ?: defaultServers.first().appId,
|
||||||
|
apiKey = apiKey ?: defaultServers.first().apiKey,
|
||||||
|
storageBucket = storageBucket ?: defaultServers.first().storageBucket
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun getAvailableServers(): List<FirebaseConfig> {
|
||||||
|
return defaultServers
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun restartApp(context: Context) {
|
||||||
|
val intent = context.packageManager.getLaunchIntentForPackage(context.packageName)
|
||||||
|
intent?.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP or Intent.FLAG_ACTIVITY_NEW_TASK)
|
||||||
|
context.startActivity(intent)
|
||||||
|
Process.killProcess(Process.myPid())
|
||||||
|
}
|
||||||
|
@OptIn(DelicateCoroutinesApi::class)
|
||||||
|
fun delayedRestart(context: Context) {
|
||||||
|
GlobalScope.launch(Dispatchers.Main) {
|
||||||
|
delay(5000L)
|
||||||
|
restartApp(context)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private val firebaseConfigDev = FirebaseConfig(
|
||||||
|
serverName = "dev",
|
||||||
|
apiKey = "AIzaSyAVdNGCev_AFX0qmuZJF6kxzRzXUTeAW5I",
|
||||||
|
appId = "1:650071678820:android:a53292637abb7c0d6c6471",
|
||||||
|
projectId = "hpos-af3cc",
|
||||||
|
storageBucket = "hpos-af3cc.appspot.com"
|
||||||
|
)
|
||||||
|
|
||||||
|
private val firebaseConfigQaQc = FirebaseConfig(
|
||||||
|
serverName = "qc-qa",
|
||||||
|
apiKey = "AIzaSyC4d4GhWHr_NMJAeBvnztQ_yQ3Qe9MAnLs",
|
||||||
|
appId = "1:1004619739289:android:3dbcefb10ea99654e5c808",
|
||||||
|
projectId = "hpos-qa",
|
||||||
|
storageBucket = "hpos-qa.appspot.com"
|
||||||
|
)
|
||||||
|
|
||||||
|
private val firebaseConfigProd = FirebaseConfig(
|
||||||
|
serverName = "prod",
|
||||||
|
apiKey = "AIzaSyA_O0oZGzy3Kiw9fiLQ3OFPME-xQJP88vs",
|
||||||
|
appId = "1:1012719870714:android:d8d7c962d96f4097de5f43",
|
||||||
|
projectId = "hpos-prod",
|
||||||
|
storageBucket = "hpos-prod.appspot.com"
|
||||||
|
)
|
||||||
|
|
||||||
|
private val firebaseConfigPreProd = FirebaseConfig(
|
||||||
|
serverName = "pre prod",
|
||||||
|
apiKey = "AIzaSyDYySi27LioZGNisP1NfnNU5inJX_0FT38",
|
||||||
|
appId = "1:121176529204:android:e6841fdac57bdc95bbed61",
|
||||||
|
projectId = "hpos-preprod",
|
||||||
|
storageBucket = "hpos-preprod.appspot.com"
|
||||||
|
)
|
||||||
@@ -1,3 +1,4 @@
|
|||||||
|
package com.example.hpostesting.firebase
|
||||||
/*
|
/*
|
||||||
* // Copyright (c) 2024 ShanMukha Innovations Pvt. Ltd. All rights reserved.
|
* // Copyright (c) 2024 ShanMukha Innovations Pvt. Ltd. All rights reserved.
|
||||||
* // Notice: All information contained herein is, and remains
|
* // Notice: All information contained herein is, and remains
|
||||||
@@ -10,9 +11,11 @@
|
|||||||
* // is strictly forbidden unless prior written permission is obtained
|
* // is strictly forbidden unless prior written permission is obtained
|
||||||
* // from ShanMukha Innovations Pvt. Ltd.
|
* // from ShanMukha Innovations Pvt. Ltd.
|
||||||
*/
|
*/
|
||||||
|
data class FirebaseConfig(
|
||||||
|
val serverName: String,
|
||||||
|
val apiKey: String,
|
||||||
|
val appId: String,
|
||||||
|
val projectId: String,
|
||||||
|
val storageBucket: String
|
||||||
|
)
|
||||||
|
|
||||||
package com.example.hpostesting.presentation.dashboard
|
|
||||||
|
|
||||||
interface ItemClickListener {
|
|
||||||
fun onClick(pos: Int)
|
|
||||||
}
|
|
||||||
@@ -19,18 +19,17 @@ import android.content.SharedPreferences
|
|||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.text.Editable
|
import android.text.Editable
|
||||||
import android.util.Log
|
import android.util.Log
|
||||||
import android.view.View
|
|
||||||
import android.widget.EditText
|
import android.widget.EditText
|
||||||
import android.widget.Toast
|
import android.widget.Toast
|
||||||
import androidx.appcompat.app.AppCompatActivity
|
import androidx.appcompat.app.AppCompatActivity
|
||||||
import com.example.hpostesting.data.constant.DataHolder
|
import com.example.hpostesting.data.constant.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.constant.LanguageManager
|
||||||
import com.example.hpostesting.presentation.dashboard.DashboardActivity
|
import com.example.hpostesting.data.model.test.TestType
|
||||||
import com.example.hpostesting.presentation.hemocube.HemocubeActivity
|
import com.example.hpostesting.presentation.main_base.DashboardActivity
|
||||||
|
import com.example.hpostesting.presentation.hb_test.HBTestActivity
|
||||||
|
import com.example.hpostesting.presentation.trueheme_test.TrueHemeTestActivity
|
||||||
import com.example.hpostesting.presentation.testRight.TestRightActivity
|
import com.example.hpostesting.presentation.testRight.TestRightActivity
|
||||||
import com.google.android.material.snackbar.Snackbar
|
|
||||||
import com.google.firebase.crashlytics.FirebaseCrashlytics
|
|
||||||
import com.journeyapps.barcodescanner.ScanContract
|
import com.journeyapps.barcodescanner.ScanContract
|
||||||
import com.journeyapps.barcodescanner.ScanIntentResult
|
import com.journeyapps.barcodescanner.ScanIntentResult
|
||||||
import com.journeyapps.barcodescanner.ScanOptions
|
import com.journeyapps.barcodescanner.ScanOptions
|
||||||
@@ -44,9 +43,13 @@ import com.zebra.scannercontrol.IDcsSdkApiDelegate
|
|||||||
import com.zebra.scannercontrol.SDKHandler
|
import com.zebra.scannercontrol.SDKHandler
|
||||||
import `in`.sminnovations.hpostesting.R
|
import `in`.sminnovations.hpostesting.R
|
||||||
import `in`.sminnovations.hpostesting.databinding.ActivityKitScanBinding
|
import `in`.sminnovations.hpostesting.databinding.ActivityKitScanBinding
|
||||||
|
import java.text.SimpleDateFormat
|
||||||
|
import java.util.Calendar
|
||||||
|
import java.util.Date
|
||||||
|
import java.util.Locale
|
||||||
|
|
||||||
class KitScanActivity : AppCompatActivity(), IDcsSdkApiDelegate {
|
class KitScanActivity : AppCompatActivity(), IDcsSdkApiDelegate {
|
||||||
|
private var fromWhere = "Home"
|
||||||
private val TAG = "KitScanActivity"
|
private val TAG = "KitScanActivity"
|
||||||
private lateinit var binding: ActivityKitScanBinding
|
private lateinit var binding: ActivityKitScanBinding
|
||||||
|
|
||||||
@@ -67,8 +70,24 @@ class KitScanActivity : AppCompatActivity(), IDcsSdkApiDelegate {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun processScannedData(contents: String) {
|
private fun processScannedData(contents: String) {//edited auto selection of cuvette size
|
||||||
binding.nameEditText.setText(contents)
|
if(contents.contains("SMI/SC/")){
|
||||||
|
with(sharedPreference.edit()) {
|
||||||
|
putString(Constants.CUVETTE_SIZE, "2mm")
|
||||||
|
apply()
|
||||||
|
}
|
||||||
|
Toast.makeText(this, "Selected cuvette size: 2mm", Toast.LENGTH_SHORT).show()
|
||||||
|
binding.nameEditText.setText(contents)
|
||||||
|
}else if(contents.contains("SMI/SC-2-D10/")){
|
||||||
|
with(sharedPreference.edit()) {
|
||||||
|
putString(Constants.CUVETTE_SIZE, "10mm")
|
||||||
|
apply()
|
||||||
|
}
|
||||||
|
Toast.makeText(this, "Selected cuvette size: 10mm", Toast.LENGTH_SHORT).show()
|
||||||
|
binding.nameEditText.setText(contents)
|
||||||
|
}else{
|
||||||
|
Toast.makeText(this, R.string.invalid_kit, Toast.LENGTH_LONG).show()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun attachBaseContext(newBase: Context?) {
|
override fun attachBaseContext(newBase: Context?) {
|
||||||
@@ -112,10 +131,36 @@ class KitScanActivity : AppCompatActivity(), IDcsSdkApiDelegate {
|
|||||||
binding = ActivityKitScanBinding.inflate(layoutInflater)
|
binding = ActivityKitScanBinding.inflate(layoutInflater)
|
||||||
sharedPreference = this.getSharedPreferences("HEMOCUBE", Context.MODE_PRIVATE)
|
sharedPreference = this.getSharedPreferences("HEMOCUBE", Context.MODE_PRIVATE)
|
||||||
setContentView(binding.root)
|
setContentView(binding.root)
|
||||||
|
binding.toolbar.title = "Kit Serial Number"
|
||||||
if (DataHolder.sampleReadCounter <= Constants.MAXIMUM_TEST_ALLOWED_BEFORE_REFERENCE && DataHolder.isReferenceTaken) {
|
fromWhere = intent.getStringExtra("fromWhere").toString()
|
||||||
DataHolder.selectedTest!!.kitSerial = DataHolder.kitSerial
|
val maxTest = if(sharedPreference.getString(Constants.CUVETTE_SIZE, "10mm").toString() == "2mm"){
|
||||||
|
Constants.MAXIMUM_TEST_ALLOWED_BEFORE_REFERENCE
|
||||||
|
}else{
|
||||||
|
Constants.MAXIMUM_TEST_ALLOWED_BEFORE_REFERENCE10MM
|
||||||
|
}
|
||||||
|
val time = timeDifference(sharedPreference.getString(Constants.KIT_TIME, "").toString())
|
||||||
|
val kitNum = sharedPreference.getString(Constants.KIT_NUMBER, "").toString()
|
||||||
|
// Toast.makeText(this@KitScanActivity,"Test MAx time"+ time+"-Test count-"+kitNum,Toast.LENGTH_SHORT).show()
|
||||||
|
// if (sharedPreference.getString(Constants.USER_ID, "").toString() == "ADMIN") {
|
||||||
|
// moveToNext()
|
||||||
|
// }else{
|
||||||
|
if (sharedPreference.getString(Constants.USER_ID, "").toString() == "ADMIN") {
|
||||||
moveToNext()
|
moveToNext()
|
||||||
|
}else{
|
||||||
|
if (DataHolder.sampleReadCounter <= maxTest && kitNum != "" && time < Constants.MAX_KIT_TIME) {
|
||||||
|
moveToNext()
|
||||||
|
} else {
|
||||||
|
Toast.makeText(this@KitScanActivity, "Limit Reached, Use New KIT for testing", Toast.LENGTH_SHORT).show()
|
||||||
|
DataHolder.sampleReadCounter = 0
|
||||||
|
DataHolder.kitSerial = ""
|
||||||
|
|
||||||
|
with(sharedPreference.edit()) {
|
||||||
|
putString(Constants.KIT_NUMBER, "")
|
||||||
|
putString(Constants.BUFFER_VALUE_1, "")
|
||||||
|
putString(Constants.BUFFER_VALUE_2, "")
|
||||||
|
apply()
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// if (checkHemoCubeKitData()) {
|
// if (checkHemoCubeKitData()) {
|
||||||
@@ -132,35 +177,31 @@ class KitScanActivity : AppCompatActivity(), IDcsSdkApiDelegate {
|
|||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
|
|
||||||
try {
|
// try {
|
||||||
if (checkHemoCubeKitData()) {
|
// if (checkHemoCubeKitData()) {
|
||||||
DataHolder.selectedTest!!.kitSerial =
|
// DataHolder.selectedTest!!.kitSerial =
|
||||||
sharedPreference.getString(Constants.KIT_NUMBER, "").toString()
|
// sharedPreference.getString(Constants.KIT_NUMBER, "").toString()
|
||||||
moveToNext()
|
// moveToNext()
|
||||||
} else {
|
// } else {
|
||||||
// Handle the case when checkHemoCubeKitData() returns false
|
// // Handle the case when checkHemoCubeKitData() returns false
|
||||||
with(sharedPreference.edit()) {
|
// with(sharedPreference.edit()) {
|
||||||
putString(Constants.KIT_NUMBER, "")
|
// putString(Constants.KIT_NUMBER, "")
|
||||||
putInt(Constants.KIT_COUNT, 0)
|
// putInt(Constants.KIT_COUNT, 0)
|
||||||
putString(Constants.BUFFER_VALUE_1, "")
|
// putString(Constants.BUFFER_VALUE_1, "")
|
||||||
putString(Constants.BUFFER_VALUE_2, "")
|
// putString(Constants.BUFFER_VALUE_2, "")
|
||||||
apply()
|
// apply()
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
} catch (e: NullPointerException) {
|
// } catch (e: NullPointerException) {
|
||||||
// Handle the NullPointerException here
|
// // Handle the NullPointerException here
|
||||||
e.printStackTrace() // You can log the exception for debugging
|
// e.printStackTrace() // You can log the exception for debugging
|
||||||
FirebaseCrashlytics.getInstance().recordException(e)
|
// FirebaseCrashlytics.getInstance().recordException(e)
|
||||||
val errorMessage = "An error occurred: ${e.message}"
|
// val errorMessage = "An error occurred: ${e.message}"
|
||||||
val rootView = findViewById<View>(android.R.id.content)
|
// val rootView = findViewById<View>(android.R.id.content)
|
||||||
Snackbar.make(rootView, errorMessage, Snackbar.LENGTH_LONG).show()
|
// Snackbar.make(rootView, errorMessage, Snackbar.LENGTH_LONG).show()
|
||||||
// Optionally, show a user-friendly error message to the user
|
// // Optionally, show a user-friendly error message to the user
|
||||||
// Toast.makeText(applicationContext, "An error occurred", Toast.LENGTH_SHORT).show()
|
// // Toast.makeText(applicationContext, "An error occurred", Toast.LENGTH_SHORT).show()
|
||||||
}
|
// }
|
||||||
|
|
||||||
|
|
||||||
binding.nameEditText.setText("SMI/SC/")
|
|
||||||
|
|
||||||
setSupportActionBar(binding.toolbar)
|
setSupportActionBar(binding.toolbar)
|
||||||
|
|
||||||
binding.btnScanNow.setOnClickListener {
|
binding.btnScanNow.setOnClickListener {
|
||||||
@@ -171,26 +212,39 @@ class KitScanActivity : AppCompatActivity(), IDcsSdkApiDelegate {
|
|||||||
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)) {
|
||||||
|
if(serialNumber.contains("SMI/SC/")){
|
||||||
Toast.makeText(
|
with(sharedPreference.edit()) {
|
||||||
applicationContext,
|
putString(Constants.CUVETTE_SIZE, "2mm")
|
||||||
R.string.kit_update,
|
apply()
|
||||||
Toast.LENGTH_LONG
|
}
|
||||||
).show()
|
Toast.makeText(this, "Selected cuvette size: 2mm", Toast.LENGTH_SHORT).show()
|
||||||
|
}else if(serialNumber.contains("SMI/SC-2-D10/")){
|
||||||
|
with(sharedPreference.edit()) {
|
||||||
|
putString(Constants.CUVETTE_SIZE, "10mm")
|
||||||
|
apply()
|
||||||
|
}
|
||||||
|
Toast.makeText(this, "Selected cuvette size: 10mm", Toast.LENGTH_SHORT).show()
|
||||||
|
}
|
||||||
|
val kitTime = SimpleDateFormat(
|
||||||
|
"yyyy-MM-dd HH:mm:ss", Locale.getDefault()
|
||||||
|
).format(Calendar.getInstance().time).toString()
|
||||||
if (DataHolder.selectedTest == null) {
|
if (DataHolder.selectedTest == null) {
|
||||||
with(sharedPreference.edit()) {
|
with(sharedPreference.edit()) {
|
||||||
putString(
|
putString(
|
||||||
Constants.KIT_NUMBER, binding.nameEditText.text.toString()
|
Constants.KIT_NUMBER, binding.nameEditText.text.toString()
|
||||||
)
|
)
|
||||||
|
putString(Constants.BUFFER_VALUE_1, "")
|
||||||
|
putString(Constants.BUFFER_VALUE_2, "")
|
||||||
|
putString(Constants.KIT_TIME, kitTime)
|
||||||
putInt(Constants.KIT_COUNT, 1)
|
putInt(Constants.KIT_COUNT, 1)
|
||||||
apply()
|
apply()
|
||||||
}
|
}
|
||||||
|
DataHolder.kitSerial = binding.nameEditText.text.toString()
|
||||||
Toast.makeText(
|
Toast.makeText(
|
||||||
applicationContext,
|
applicationContext,
|
||||||
R.string.kit_updated,
|
R.string.kit_updated,
|
||||||
Toast.LENGTH_SHORT
|
Toast.LENGTH_SHORT
|
||||||
).show()
|
).show()
|
||||||
|
|
||||||
val i = Intent(applicationContext, DashboardActivity::class.java)
|
val i = Intent(applicationContext, DashboardActivity::class.java)
|
||||||
startActivity(i)
|
startActivity(i)
|
||||||
finish()
|
finish()
|
||||||
@@ -198,6 +252,9 @@ class KitScanActivity : AppCompatActivity(), IDcsSdkApiDelegate {
|
|||||||
DataHolder.kitSerial = binding.nameEditText.text.toString()
|
DataHolder.kitSerial = binding.nameEditText.text.toString()
|
||||||
DataHolder.selectedTest?.kitSerial = binding.nameEditText.text.toString()
|
DataHolder.selectedTest?.kitSerial = binding.nameEditText.text.toString()
|
||||||
with(sharedPreference.edit()) {
|
with(sharedPreference.edit()) {
|
||||||
|
putString(Constants.BUFFER_VALUE_1, "")
|
||||||
|
putString(Constants.BUFFER_VALUE_2, "")
|
||||||
|
putString(Constants.KIT_TIME, kitTime)
|
||||||
putString(Constants.KIT_NUMBER, binding.nameEditText.text.toString())
|
putString(Constants.KIT_NUMBER, binding.nameEditText.text.toString())
|
||||||
putInt(Constants.KIT_COUNT, 1)
|
putInt(Constants.KIT_COUNT, 1)
|
||||||
apply()
|
apply()
|
||||||
@@ -208,21 +265,21 @@ class KitScanActivity : AppCompatActivity(), IDcsSdkApiDelegate {
|
|||||||
Toast.makeText(this, R.string.invalid_kit_number, Toast.LENGTH_LONG).show()
|
Toast.makeText(this, R.string.invalid_kit_number, Toast.LENGTH_LONG).show()
|
||||||
return@setOnClickListener
|
return@setOnClickListener
|
||||||
}
|
}
|
||||||
if (serialNumber.isNotEmpty() && checkDataNotNull() && isSerialValid(
|
// if (serialNumber.isNotEmpty() && checkDataNotNull() && isSerialValid(
|
||||||
serialNumber
|
// serialNumber
|
||||||
)
|
// )
|
||||||
) {
|
// ) {
|
||||||
DataHolder.kitSerial = binding.nameEditText.text.toString()
|
// DataHolder.kitSerial = binding.nameEditText.text.toString()
|
||||||
DataHolder.selectedTest?.kitSerial = binding.nameEditText.text.toString()
|
// DataHolder.selectedTest?.kitSerial = binding.nameEditText.text.toString()
|
||||||
with(sharedPreference.edit()) {
|
// with(sharedPreference.edit()) {
|
||||||
putString(Constants.KIT_NUMBER, binding.nameEditText.text.toString())
|
// putString(Constants.KIT_NUMBER, binding.nameEditText.text.toString())
|
||||||
putInt(Constants.KIT_COUNT, 1)
|
// putInt(Constants.KIT_COUNT, 1)
|
||||||
apply()
|
// apply()
|
||||||
}
|
// }
|
||||||
moveToNext()
|
// moveToNext()
|
||||||
} else {
|
// } else {
|
||||||
Toast.makeText(this, R.string.invalid_kit_number, Toast.LENGTH_LONG).show()
|
// Toast.makeText(this, R.string.invalid_kit_number, Toast.LENGTH_LONG).show()
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
//Setting up the SDK handler
|
//Setting up the SDK handler
|
||||||
@@ -281,42 +338,58 @@ class KitScanActivity : AppCompatActivity(), IDcsSdkApiDelegate {
|
|||||||
Log.d("BARCODE", result)
|
Log.d("BARCODE", result)
|
||||||
runOnUiThread {
|
runOnUiThread {
|
||||||
val editableResult: Editable = Editable.Factory.getInstance().newEditable(result)
|
val editableResult: Editable = Editable.Factory.getInstance().newEditable(result)
|
||||||
binding.nameEditText.text = editableResult
|
processScannedData(result)
|
||||||
|
// binding.nameEditText.text = editableResult
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun checkHemoCubeKitData(): Boolean {
|
// private fun checkHemoCubeKitData(): Boolean {
|
||||||
return sharedPreference.getString(Constants.KIT_NUMBER, "")
|
// return sharedPreference.getString(Constants.KIT_NUMBER, "")
|
||||||
?.isNotBlank() == true && sharedPreference.getInt(
|
// ?.isNotBlank() == true && sharedPreference.getInt(
|
||||||
Constants.KIT_COUNT, 0
|
// Constants.KIT_COUNT, 0
|
||||||
) > 0 && sharedPreference.getInt(Constants.KIT_COUNT, 0) < Constants.KIT_CAPACITY
|
// ) > 0 && sharedPreference.getInt(Constants.KIT_COUNT, 0) < Constants.KIT_CAPACITY
|
||||||
}
|
// }
|
||||||
|
|
||||||
private fun isSerialValid(s: String): Boolean {
|
private fun isSerialValid(s: String): Boolean {
|
||||||
if (s.length != 17) {
|
if (s.contains("SMI/SC/")) {
|
||||||
binding.nameEditText.error = getString(R.string.invalid_kit)
|
if(s.length != 17){
|
||||||
|
binding.nameEditText.error = "Invalid Kit Serial Number, correct example SMI/SC/000/00/000"
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
}else if(s.contains("SMI/SC-2-D10/")){
|
||||||
|
if(s.length != 27){
|
||||||
|
binding.nameEditText.error = "Invalid Kit Serial Number, correct example SMI/SC-2-D10/000000/000/000"
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
}else{
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun moveToNext() {
|
private fun moveToNext() {
|
||||||
|
if(fromWhere == "Main"){
|
||||||
|
if(DataHolder.selectedTestType == TestType.HB_EST){
|
||||||
|
val i = Intent(applicationContext, HBTestActivity::class.java)
|
||||||
|
startActivity(i)
|
||||||
|
}else{
|
||||||
|
DataHolder.deviceType.observe(this) { deviceType ->
|
||||||
|
when (deviceType) {
|
||||||
|
Constants.DEVICE_TYPE_HEMOCUBE -> {
|
||||||
|
val i = Intent(applicationContext, TrueHemeTestActivity::class.java)
|
||||||
|
startActivity(i)
|
||||||
|
}
|
||||||
|
|
||||||
DataHolder.deviceType.observe(this) { deviceType ->
|
Constants.DEVICE_TYPE_TEST_RIGHT -> {
|
||||||
when (deviceType) {
|
val i = Intent(applicationContext, TestRightActivity::class.java)
|
||||||
Constants.DEVICE_TYPE_HEMOCUBE -> {
|
startActivity(i)
|
||||||
val i = Intent(applicationContext, HemocubeActivity::class.java)
|
}
|
||||||
startActivity(i)
|
|
||||||
}
|
|
||||||
|
|
||||||
Constants.DEVICE_TYPE_TEST_RIGHT -> {
|
Constants.DEVICE_TYPE_TRUEHEME -> {
|
||||||
val i = Intent(applicationContext, TestRightActivity::class.java)
|
val i = Intent(applicationContext, TrueHemeTestActivity::class.java)
|
||||||
startActivity(i)
|
startActivity(i)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
Constants.DEVICE_TYPE_TRUEHEME -> {
|
|
||||||
val i = Intent(applicationContext, HemocubeActivity::class.java)
|
|
||||||
startActivity(i)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -352,4 +425,18 @@ class KitScanActivity : AppCompatActivity(), IDcsSdkApiDelegate {
|
|||||||
true
|
true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
private fun timeDifference(createdAt: String): Long {
|
||||||
|
val currentTime = Calendar.getInstance().time
|
||||||
|
val formatter = SimpleDateFormat("yyyy-MM-dd HH:mm:ss", Locale.getDefault())
|
||||||
|
|
||||||
|
val createdAtDate: Date = if (createdAt.isEmpty()) {
|
||||||
|
currentTime
|
||||||
|
} else {
|
||||||
|
formatter.parse(createdAt) ?: currentTime
|
||||||
|
}
|
||||||
|
|
||||||
|
val diffMillis = currentTime.time - createdAtDate.time
|
||||||
|
|
||||||
|
return diffMillis / (60 * 1000) // Convert milliseconds to minutes
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -18,6 +18,7 @@ import android.content.BroadcastReceiver
|
|||||||
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.pm.PackageManager
|
import android.content.pm.PackageManager
|
||||||
import android.hardware.usb.UsbManager
|
import android.hardware.usb.UsbManager
|
||||||
import android.location.Location
|
import android.location.Location
|
||||||
@@ -30,12 +31,11 @@ import androidx.appcompat.app.AppCompatActivity
|
|||||||
import androidx.core.app.ActivityCompat
|
import androidx.core.app.ActivityCompat
|
||||||
import androidx.core.content.ContextCompat
|
import androidx.core.content.ContextCompat
|
||||||
import androidx.core.view.get
|
import androidx.core.view.get
|
||||||
import com.example.hpostesting.data.constant.DataHolder
|
|
||||||
import com.example.hpostesting.data.constant.Constants
|
import com.example.hpostesting.data.constant.Constants
|
||||||
|
import com.example.hpostesting.data.constant.DataHolder
|
||||||
import com.example.hpostesting.data.constant.LanguageManager
|
import com.example.hpostesting.data.constant.LanguageManager
|
||||||
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.example.hpostesting.presentation.dashboard.DashboardActivity
|
import com.example.hpostesting.presentation.main_base.DashboardActivity
|
||||||
import com.google.android.gms.location.FusedLocationProviderClient
|
import com.google.android.gms.location.FusedLocationProviderClient
|
||||||
import com.google.android.gms.location.LocationCallback
|
import com.google.android.gms.location.LocationCallback
|
||||||
import com.google.android.gms.location.LocationRequest
|
import com.google.android.gms.location.LocationRequest
|
||||||
@@ -48,12 +48,12 @@ import `in`.sminnovations.hpostesting.R
|
|||||||
import `in`.sminnovations.hpostesting.databinding.ActivityMainBinding
|
import `in`.sminnovations.hpostesting.databinding.ActivityMainBinding
|
||||||
|
|
||||||
class MainActivity : AppCompatActivity() {
|
class MainActivity : AppCompatActivity() {
|
||||||
|
|
||||||
private lateinit var binding: ActivityMainBinding
|
private lateinit var binding: ActivityMainBinding
|
||||||
private var myMenu: Menu? = null
|
private var myMenu: Menu? = null
|
||||||
private val TAG = "MainActivity"
|
private val TAG = "MainActivity"
|
||||||
private lateinit var fusedLocationClient: FusedLocationProviderClient
|
private lateinit var fusedLocationClient: FusedLocationProviderClient
|
||||||
private lateinit var locationCallback: LocationCallback
|
private lateinit var locationCallback: LocationCallback
|
||||||
|
private lateinit var sharedPreference: SharedPreferences
|
||||||
|
|
||||||
private val usbReceiver = object : BroadcastReceiver() {
|
private val usbReceiver = object : BroadcastReceiver() {
|
||||||
override fun onReceive(context: Context?, intent: Intent) {
|
override fun onReceive(context: Context?, intent: Intent) {
|
||||||
@@ -73,14 +73,21 @@ class MainActivity : AppCompatActivity() {
|
|||||||
|
|
||||||
override fun onCreate(savedInstanceState: Bundle?) {
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
super.onCreate(savedInstanceState)
|
super.onCreate(savedInstanceState)
|
||||||
|
sharedPreference = getSharedPreferences("HEMOCUBE", Context.MODE_PRIVATE)
|
||||||
|
|
||||||
binding = ActivityMainBinding.inflate(layoutInflater)
|
binding = ActivityMainBinding.inflate(layoutInflater)
|
||||||
setContentView(binding.root)
|
setContentView(binding.root)
|
||||||
|
binding.myToolbar.title = "Test Type"
|
||||||
setSupportActionBar(binding.myToolbar)
|
setSupportActionBar(binding.myToolbar)
|
||||||
|
if ((sharedPreference.getString(Constants.USER_ID, "").toString() == "ADMIN")) {
|
||||||
|
binding.cvItem3.visibility = View.VISIBLE
|
||||||
|
}else{
|
||||||
|
binding.cvItem3.visibility = View.GONE
|
||||||
|
}
|
||||||
setupListeners()
|
setupListeners()
|
||||||
fusedLocationClient = LocationServices.getFusedLocationProviderClient(this)
|
fusedLocationClient = LocationServices.getFusedLocationProviderClient(this)
|
||||||
getLocation()
|
getLocation()
|
||||||
|
|
||||||
locationCallback = object : LocationCallback() {
|
locationCallback = object : LocationCallback() {
|
||||||
override fun onLocationResult(locationResult: LocationResult) {
|
override fun onLocationResult(locationResult: LocationResult) {
|
||||||
locationResult.lastLocation?.let { location ->
|
locationResult.lastLocation?.let { location ->
|
||||||
@@ -92,7 +99,6 @@ class MainActivity : AppCompatActivity() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
val usbFilter = IntentFilter().apply {
|
val usbFilter = IntentFilter().apply {
|
||||||
addAction(UsbManager.ACTION_USB_DEVICE_DETACHED)
|
addAction(UsbManager.ACTION_USB_DEVICE_DETACHED)
|
||||||
addAction(UsbManager.ACTION_USB_DEVICE_ATTACHED)
|
addAction(UsbManager.ACTION_USB_DEVICE_ATTACHED)
|
||||||
@@ -111,12 +117,13 @@ class MainActivity : AppCompatActivity() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (DataHolder.selectedTest == null) {
|
// if (DataHolder.selectedTest == null) {
|
||||||
startActivity(Intent(this, DashboardActivity::class.java))
|
// startActivity(Intent(this, DashboardActivity::class.java))
|
||||||
finish()
|
// finish()
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private fun checkAndUpdateUsbConnection() {
|
private fun checkAndUpdateUsbConnection() {
|
||||||
val availableDrivers = UsbSerialProber.getDefaultProber()
|
val availableDrivers = UsbSerialProber.getDefaultProber()
|
||||||
.findAllDrivers(getSystemService(Context.USB_SERVICE) as UsbManager)
|
.findAllDrivers(getSystemService(Context.USB_SERVICE) as UsbManager)
|
||||||
@@ -220,6 +227,7 @@ class MainActivity : AppCompatActivity() {
|
|||||||
binding.cvItem1.setOnClickListener {
|
binding.cvItem1.setOnClickListener {
|
||||||
DataHolder.selectedTestType = TestType.SICKLECERT
|
DataHolder.selectedTestType = TestType.SICKLECERT
|
||||||
val i = Intent(applicationContext, KitScanActivity::class.java)
|
val i = Intent(applicationContext, KitScanActivity::class.java)
|
||||||
|
i.putExtra("fromWhere","Main")
|
||||||
startActivity(i)
|
startActivity(i)
|
||||||
finish()
|
finish()
|
||||||
}
|
}
|
||||||
@@ -227,6 +235,14 @@ class MainActivity : AppCompatActivity() {
|
|||||||
binding.cvItem2.setOnClickListener {
|
binding.cvItem2.setOnClickListener {
|
||||||
DataHolder.selectedTestType = TestType.SICKLEFIND
|
DataHolder.selectedTestType = TestType.SICKLEFIND
|
||||||
val i = Intent(applicationContext, KitScanActivity::class.java)
|
val i = Intent(applicationContext, KitScanActivity::class.java)
|
||||||
|
i.putExtra("fromWhere","Main")
|
||||||
|
startActivity(i)
|
||||||
|
finish()
|
||||||
|
}
|
||||||
|
binding.cvItem3.setOnClickListener {
|
||||||
|
DataHolder.selectedTestType = TestType.HB_EST
|
||||||
|
val i = Intent(applicationContext, KitScanActivity::class.java)
|
||||||
|
i.putExtra("fromWhere","Main")
|
||||||
startActivity(i)
|
startActivity(i)
|
||||||
finish()
|
finish()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,7 +14,6 @@
|
|||||||
package com.example.hpostesting.presentation
|
package com.example.hpostesting.presentation
|
||||||
|
|
||||||
import android.Manifest
|
import android.Manifest
|
||||||
import android.annotation.SuppressLint
|
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
import android.content.pm.PackageManager
|
import android.content.pm.PackageManager
|
||||||
@@ -29,12 +28,11 @@ import androidx.appcompat.app.AppCompatActivity
|
|||||||
import androidx.core.content.ContextCompat
|
import androidx.core.content.ContextCompat
|
||||||
import com.example.hpostesting.data.constant.DataHolder
|
import com.example.hpostesting.data.constant.DataHolder
|
||||||
import com.example.hpostesting.data.constant.LanguageManager
|
import com.example.hpostesting.data.constant.LanguageManager
|
||||||
import com.example.hpostesting.presentation.dashboard.DashboardActivity
|
import com.example.hpostesting.presentation.main_base.DashboardActivity
|
||||||
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
|
||||||
|
|
||||||
@SuppressLint("CustomSplashScreen")
|
|
||||||
class SplashActivity : AppCompatActivity() {
|
class SplashActivity : AppCompatActivity() {
|
||||||
|
|
||||||
private lateinit var binding: ActivitySplashBinding
|
private lateinit var binding: ActivitySplashBinding
|
||||||
@@ -66,7 +64,6 @@ class SplashActivity : AppCompatActivity() {
|
|||||||
requestPermissions()
|
requestPermissions()
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressLint("HardwareIds")
|
|
||||||
private fun setupStaticConstants() {
|
private fun setupStaticConstants() {
|
||||||
DataHolder.mobileUniqueId =
|
DataHolder.mobileUniqueId =
|
||||||
Settings.Secure.getString(
|
Settings.Secure.getString(
|
||||||
|
|||||||
@@ -15,10 +15,8 @@ package com.example.hpostesting.presentation.adapter
|
|||||||
|
|
||||||
import android.annotation.SuppressLint
|
import android.annotation.SuppressLint
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.content.Intent
|
|
||||||
import android.content.IntentFilter
|
|
||||||
import android.content.res.Resources
|
import android.content.res.Resources
|
||||||
import android.os.BatteryManager
|
import android.provider.ContactsContract.Data
|
||||||
import android.view.LayoutInflater
|
import android.view.LayoutInflater
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
@@ -38,7 +36,7 @@ import java.util.Calendar
|
|||||||
import java.util.Date
|
import java.util.Date
|
||||||
import java.util.Locale
|
import java.util.Locale
|
||||||
|
|
||||||
class OfflineUserListAdapter(private val view: View, private val batLevel: Int, private val fromWhere:String) :
|
class OfflineUserListAdapter(private val view: View, private val batLevel: Int,private val fromWhere:String) :
|
||||||
RecyclerView.Adapter<OfflineUserListAdapter.OfflineUserListViewHolder>() {
|
RecyclerView.Adapter<OfflineUserListAdapter.OfflineUserListViewHolder>() {
|
||||||
|
|
||||||
inner class OfflineUserListViewHolder(val binding: OfflineUserListViewBinding) :
|
inner class OfflineUserListViewHolder(val binding: OfflineUserListViewBinding) :
|
||||||
@@ -75,7 +73,7 @@ class OfflineUserListAdapter(private val view: View, private val batLevel: Int,
|
|||||||
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 = "Sample ID: ${userList._id}"
|
||||||
bloodGroup.text = "Blood group: ${userList.bloodGroup}"
|
bloodGroup.text = "Blood group: ${userList.bloodGroup}"
|
||||||
time.text = "Time: ${isBetween15And30Minutes(userList.incubationTime)} \n Started at: ${
|
time.text = "Time: ${isBetween15And30Minutes(userList.incubationTime)} \n Started at: ${
|
||||||
SimpleDateFormat("HH:mm:ss").format(
|
SimpleDateFormat("HH:mm:ss").format(
|
||||||
@@ -91,11 +89,9 @@ class OfflineUserListAdapter(private val view: View, private val batLevel: Int,
|
|||||||
} else {
|
} else {
|
||||||
teststatus.text = view.context.getString(R.string.test_pending)
|
teststatus.text = view.context.getString(R.string.test_pending)
|
||||||
}
|
}
|
||||||
if(fromWhere == "Home"){
|
if(fromWhere == "Home") {
|
||||||
userCard.setOnClickListener {
|
userCard.setOnClickListener {
|
||||||
var batLevel = 50F
|
if (false) {
|
||||||
batLevel = getBatteryLevel()!!.toFloat()
|
|
||||||
if (batLevel < Constants.MINIMUM_BATTERY_LEVEL) {
|
|
||||||
Toast.makeText(
|
Toast.makeText(
|
||||||
view.context,
|
view.context,
|
||||||
view.context.getString(R.string.low_battery_warning),
|
view.context.getString(R.string.low_battery_warning),
|
||||||
@@ -118,23 +114,22 @@ class OfflineUserListAdapter(private val view: View, private val batLevel: Int,
|
|||||||
view.context.getString(R.string.incubation_not_completed),
|
view.context.getString(R.string.incubation_not_completed),
|
||||||
Toast.LENGTH_SHORT
|
Toast.LENGTH_SHORT
|
||||||
).show()
|
).show()
|
||||||
} else
|
} else if (isBetween15And30Minutes(userList.incubationTime) > Constants.INCUBATION_TIME_MAX) {
|
||||||
if (isBetween15And30Minutes(userList.incubationTime) > Constants.INCUBATION_TIME_MAX) {
|
Toast.makeText(
|
||||||
Toast.makeText(
|
view.context,
|
||||||
view.context,
|
view.context.getString(R.string.incubation_crossed_30_minutes),
|
||||||
view.context.getString(R.string.incubation_crossed_30_minutes),
|
Toast.LENGTH_SHORT
|
||||||
Toast.LENGTH_SHORT
|
).show()
|
||||||
).show()
|
} else {
|
||||||
} else {
|
DataHolder.selectedTest = UserData(
|
||||||
DataHolder.selectedTest = UserData(
|
|
||||||
sampleid = userList.sampleid,
|
sampleid = userList.sampleid,
|
||||||
_id = userList._id,
|
_id = userList._id,
|
||||||
bloodGroup = userList.bloodGroup,
|
bloodGroup = userList.bloodGroup,
|
||||||
incubationTime = userList.incubationTime
|
incubationTime = userList.incubationTime
|
||||||
)
|
)
|
||||||
view.findNavController()
|
view.findNavController()
|
||||||
.navigate(R.id.action_nav_home_to_mainActivity)
|
.navigate(R.id.action_nav_home_to_mainActivity)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
Toast.makeText(
|
Toast.makeText(
|
||||||
view.context,
|
view.context,
|
||||||
@@ -146,8 +141,6 @@ class OfflineUserListAdapter(private val view: View, private val batLevel: Int,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -177,25 +170,4 @@ class OfflineUserListAdapter(private val view: View, private val batLevel: Int,
|
|||||||
Toast.LENGTH_SHORT
|
Toast.LENGTH_SHORT
|
||||||
).show()
|
).show()
|
||||||
}
|
}
|
||||||
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
|
|
||||||
}
|
|
||||||
private val batteryStatus: Intent? =
|
|
||||||
IntentFilter(Intent.ACTION_BATTERY_CHANGED).let { ifilter ->
|
|
||||||
view.context.registerReceiver(null, ifilter)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -29,7 +29,7 @@ import androidx.recyclerview.widget.RecyclerView
|
|||||||
import com.bumptech.glide.Glide
|
import com.bumptech.glide.Glide
|
||||||
import com.example.hpostesting.data.constant.DataHolder
|
import com.example.hpostesting.data.constant.DataHolder
|
||||||
import com.example.hpostesting.data.model.patient.UserData
|
import com.example.hpostesting.data.model.patient.UserData
|
||||||
import com.example.hpostesting.presentation.hemocube.HemoCubeViewModel
|
import com.example.hpostesting.presentation.trueheme_test.TrueHemeTestViewModel
|
||||||
import com.firebase.ui.firestore.FirestoreRecyclerAdapter
|
import com.firebase.ui.firestore.FirestoreRecyclerAdapter
|
||||||
import com.firebase.ui.firestore.FirestoreRecyclerOptions
|
import com.firebase.ui.firestore.FirestoreRecyclerOptions
|
||||||
import com.google.firebase.firestore.FirebaseFirestore
|
import com.google.firebase.firestore.FirebaseFirestore
|
||||||
@@ -41,9 +41,8 @@ import java.util.Date
|
|||||||
import java.util.Locale
|
import java.util.Locale
|
||||||
|
|
||||||
class UserListAdapter(
|
class UserListAdapter(
|
||||||
|
|
||||||
private val context: Context,
|
private val context: Context,
|
||||||
private val hemoCubeViewModel: HemoCubeViewModel,
|
private val trueHemeTestViewModel: TrueHemeTestViewModel,
|
||||||
options: FirestoreRecyclerOptions<UserData>,
|
options: FirestoreRecyclerOptions<UserData>,
|
||||||
private val view: View,
|
private val view: View,
|
||||||
private val batLevel: Int,
|
private val batLevel: Int,
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ import androidx.fragment.app.Fragment
|
|||||||
import com.example.hpostesting.data.constant.DataHolder
|
import com.example.hpostesting.data.constant.DataHolder
|
||||||
import com.example.hpostesting.data.constant.Constants
|
import com.example.hpostesting.data.constant.Constants
|
||||||
import com.example.hpostesting.data.model.patient.UserData
|
import com.example.hpostesting.data.model.patient.UserData
|
||||||
import com.example.hpostesting.presentation.hemocube.HemocubeActivity
|
import com.example.hpostesting.presentation.trueheme_test.TrueHemeTestActivity
|
||||||
import `in`.sminnovations.hpostesting.databinding.FragmentAssuranceControlsBinding
|
import `in`.sminnovations.hpostesting.databinding.FragmentAssuranceControlsBinding
|
||||||
import java.time.Instant
|
import java.time.Instant
|
||||||
|
|
||||||
@@ -259,7 +259,7 @@ class AssuranceControlsFragment : Fragment() {
|
|||||||
apply()
|
apply()
|
||||||
}
|
}
|
||||||
|
|
||||||
val i = Intent(requireContext(), HemocubeActivity::class.java)
|
val i = Intent(requireContext(), TrueHemeTestActivity::class.java)
|
||||||
startActivity(i)
|
startActivity(i)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ package com.example.hpostesting.presentation.autodac
|
|||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.content.SharedPreferences
|
import android.content.SharedPreferences
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
|
import android.text.method.ScrollingMovementMethod
|
||||||
import android.view.LayoutInflater
|
import android.view.LayoutInflater
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
@@ -36,13 +37,14 @@ import java.util.Calendar
|
|||||||
import java.util.Locale
|
import java.util.Locale
|
||||||
|
|
||||||
class AutoDacFragment : Fragment() {
|
class AutoDacFragment : Fragment() {
|
||||||
|
private var readClick = false
|
||||||
|
private var testStatusCode = 0.0
|
||||||
private lateinit var binding: FragmentAutoDacBinding
|
private lateinit var binding: FragmentAutoDacBinding
|
||||||
private val autoDacViewModel: AutoDacViewModel by activityViewModels()
|
private val autoDacViewModel: AutoDacViewModel by activityViewModels()
|
||||||
private lateinit var sharedPreferences: SharedPreferences
|
private lateinit var sharedPreferences: SharedPreferences
|
||||||
private var currentDeviceData: DeviceData? = null
|
private var currentDeviceData: DeviceData? = null
|
||||||
private var resultData: String = ""
|
private var resultData: String = ""
|
||||||
private val messages = MutableLiveData<String>()
|
// private val messages = MutableLiveData<String>()
|
||||||
private var startListening = MutableLiveData(false)
|
private var startListening = MutableLiveData(false)
|
||||||
|
|
||||||
override fun onCreateView(
|
override fun onCreateView(
|
||||||
@@ -64,14 +66,25 @@ class AutoDacFragment : Fragment() {
|
|||||||
binding.btnSubmit.visibility = View.GONE
|
binding.btnSubmit.visibility = View.GONE
|
||||||
listenToHemoCube()
|
listenToHemoCube()
|
||||||
getDeviceId()
|
getDeviceId()
|
||||||
|
binding.tvSubtitle4.movementMethod = ScrollingMovementMethod()
|
||||||
binding.btnSubmit.setOnClickListener {
|
binding.btnSubmit.setOnClickListener {
|
||||||
|
resultData += "Calibrating the device...\n"
|
||||||
|
autoDacViewModel.messages.postValue(resultData)
|
||||||
|
testStatusCode = 0.5
|
||||||
binding.btnSubmit.visibility = View.GONE
|
binding.btnSubmit.visibility = View.GONE
|
||||||
runAutoDacCommand()
|
runJCommand()
|
||||||
}
|
}
|
||||||
binding.btnReadDac.setOnClickListener {
|
binding.btnReadDac.setOnClickListener {
|
||||||
|
readClick = true
|
||||||
binding.btnReadDac.visibility = View.GONE
|
binding.btnReadDac.visibility = View.GONE
|
||||||
readCurrentDACValuesCommand()
|
runECommand()
|
||||||
}
|
}
|
||||||
|
if (sharedPreferences.getString(Constants.USER_ID, "").toString() == "ADMIN") {
|
||||||
|
binding.btnReadDac.visibility = View.VISIBLE
|
||||||
|
}else{
|
||||||
|
binding.btnReadDac.visibility = View.GONE
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun observeViewModel() {
|
private fun observeViewModel() {
|
||||||
@@ -80,7 +93,7 @@ class AutoDacFragment : Fragment() {
|
|||||||
currentDeviceData = it
|
currentDeviceData = it
|
||||||
}
|
}
|
||||||
|
|
||||||
messages.observe(viewLifecycleOwner) {
|
autoDacViewModel.messages.observe(viewLifecycleOwner) {
|
||||||
binding.tvSubtitle4.text = it
|
binding.tvSubtitle4.text = it
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -114,8 +127,33 @@ class AutoDacFragment : Fragment() {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
private fun runJCommand() {
|
||||||
|
autoDacViewModel.progressBar.postValue(true)
|
||||||
|
(activity as AutoDacActivity).mService.sendAndListenToHemoCube(
|
||||||
|
HemoCubeCommands.J_COMMAND,
|
||||||
|
object : UsbServiceListener {
|
||||||
|
override fun onUsbRead(data: ByteArray?) {
|
||||||
|
}
|
||||||
|
|
||||||
private fun runAutoDacCommand() {
|
override fun onUsbError(e: Exception?) {
|
||||||
|
autoDacViewModel.progressBar.postValue(false)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
private fun runDCommand() {
|
||||||
|
autoDacViewModel.progressBar.postValue(true)
|
||||||
|
(activity as AutoDacActivity).mService.sendAndListenToHemoCube(
|
||||||
|
HemoCubeCommands.DIAGNOSTICS_COMMAND,
|
||||||
|
object : UsbServiceListener {
|
||||||
|
override fun onUsbRead(data: ByteArray?) {
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onUsbError(e: Exception?) {
|
||||||
|
autoDacViewModel.progressBar.postValue(false)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
private fun runCCommand() {
|
||||||
autoDacViewModel.progressBar.postValue(true)
|
autoDacViewModel.progressBar.postValue(true)
|
||||||
(activity as AutoDacActivity).mService.sendAndListenToHemoCube(
|
(activity as AutoDacActivity).mService.sendAndListenToHemoCube(
|
||||||
HemoCubeCommands.AUTO_DAC_COMMAND,
|
HemoCubeCommands.AUTO_DAC_COMMAND,
|
||||||
@@ -128,6 +166,33 @@ class AutoDacFragment : Fragment() {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
private fun runGCommand() {
|
||||||
|
autoDacViewModel.progressBar.postValue(true)
|
||||||
|
(activity as AutoDacActivity).mService.sendAndListenToHemoCube(
|
||||||
|
HemoCubeCommands.SET_AUTO_DAC_TO_EPROM_COMMAND,
|
||||||
|
object : UsbServiceListener {
|
||||||
|
override fun onUsbRead(data: ByteArray?) {
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onUsbError(e: Exception?) {
|
||||||
|
autoDacViewModel.progressBar.postValue(false)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
private fun runECommand() {
|
||||||
|
autoDacViewModel.progressBar.postValue(true)
|
||||||
|
(activity as AutoDacActivity).mService.sendAndListenToHemoCube(
|
||||||
|
HemoCubeCommands.LOAD_DAC_VALUES,
|
||||||
|
object : UsbServiceListener {
|
||||||
|
override fun onUsbRead(data: ByteArray?) {
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onUsbError(e: Exception?) {
|
||||||
|
autoDacViewModel.progressBar.postValue(false)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
private fun setAutoDacValuesCommand() {
|
private fun setAutoDacValuesCommand() {
|
||||||
autoDacViewModel.progressBar.postValue(true)
|
autoDacViewModel.progressBar.postValue(true)
|
||||||
@@ -168,10 +233,12 @@ class AutoDacFragment : Fragment() {
|
|||||||
override fun onUsbRead(data: ByteArray?) {
|
override fun onUsbRead(data: ByteArray?) {
|
||||||
data?.let {
|
data?.let {
|
||||||
val stringData = String(it)
|
val stringData = String(it)
|
||||||
autoDacViewModel.messages.postValue(stringData)
|
|
||||||
fullReadOutput.append(stringData)
|
fullReadOutput.append(stringData)
|
||||||
resultData += stringData
|
resultData += stringData
|
||||||
binding.tvSubtitle4.text = resultData
|
if (sharedPreferences.getString(Constants.USER_ID, "").toString() == "ADMIN") {
|
||||||
|
autoDacViewModel.messages.postValue(resultData)
|
||||||
|
}
|
||||||
|
// binding.tvSubtitle4.text = resultData
|
||||||
if (stringData.contains("SN")) {
|
if (stringData.contains("SN")) {
|
||||||
val slData = stringData.split(" ")
|
val slData = stringData.split(" ")
|
||||||
if (slData.size > 1) {
|
if (slData.size > 1) {
|
||||||
@@ -186,10 +253,56 @@ class AutoDacFragment : Fragment() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (resultData.contains("#JC") && testStatusCode < 1.0) {
|
||||||
if (resultData.contains("#CC")) {
|
testStatusCode = 1.1
|
||||||
|
runDCommand()
|
||||||
|
}
|
||||||
|
if (resultData.contains("#DC") && testStatusCode < 1.2) {
|
||||||
|
testStatusCode = 1.3
|
||||||
|
if(validateDacValues()){
|
||||||
|
if (sharedPreferences.getString(Constants.USER_ID, "").toString() == "ADMIN") {
|
||||||
|
resultData += "Calibrating the device, Please wait...\n"
|
||||||
|
}else{
|
||||||
|
resultData = "Calibrating the device, Please wait...\n"
|
||||||
|
}
|
||||||
|
autoDacViewModel.messages.postValue(resultData)
|
||||||
|
runCCommand()
|
||||||
|
}else{
|
||||||
|
activity?.runOnUiThread {
|
||||||
|
if (sharedPreferences.getString(Constants.USER_ID, "").toString() == "ADMIN") {
|
||||||
|
resultData += "Calibration failed!\nContact us for help at support@sminnovations.in"
|
||||||
|
}else{
|
||||||
|
resultData = "Calibration failed!\nContact us for help at support@sminnovations.in"
|
||||||
|
}
|
||||||
|
autoDacViewModel.messages.postValue(resultData)
|
||||||
|
binding.btnReadDac.visibility = View.GONE
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (resultData.contains("#GC") && testStatusCode < 1.6) {
|
||||||
|
testStatusCode = 1.7
|
||||||
|
runECommand()
|
||||||
|
}
|
||||||
|
if (resultData.contains("#EC") && testStatusCode < 1.8) {
|
||||||
|
testStatusCode = 1.9
|
||||||
|
if (sharedPreferences.getString(Constants.USER_ID, "").toString() == "ADMIN") {
|
||||||
|
resultData += "Calibration Completed\n"
|
||||||
|
}else{
|
||||||
|
resultData = "Calibration Completed\n"
|
||||||
|
}
|
||||||
|
autoDacViewModel.messages.postValue(resultData)
|
||||||
|
activity?.runOnUiThread {
|
||||||
|
Toast.makeText(requireActivity(), "Calibration completed", Toast.LENGTH_LONG).show()
|
||||||
|
binding.ivCheck.visibility = View.VISIBLE
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (resultData.contains("#EC") && readClick && testStatusCode < 2.1) {
|
||||||
|
testStatusCode = 2.2
|
||||||
|
readCurrentDACValuesCommand()
|
||||||
|
}
|
||||||
|
if (resultData.contains("#CC") && testStatusCode < 1.4) {
|
||||||
|
testStatusCode = 1.5
|
||||||
setAutoDacValuesCommand()
|
setAutoDacValuesCommand()
|
||||||
|
|
||||||
autoDacViewModel.addAutoDacDataToDb(
|
autoDacViewModel.addAutoDacDataToDb(
|
||||||
DiagnosticsData(
|
DiagnosticsData(
|
||||||
deviceId = sharedPreferences.getString(Constants.DEVICE_ID, "")
|
deviceId = sharedPreferences.getString(Constants.DEVICE_ID, "")
|
||||||
@@ -212,9 +325,7 @@ class AutoDacFragment : Fragment() {
|
|||||||
).format(Calendar.getInstance().time)
|
).format(Calendar.getInstance().time)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
activity?.runOnUiThread {
|
|
||||||
binding.ivCheck.visibility = View.VISIBLE
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (resultData.contains("#WC")) {
|
if (resultData.contains("#WC")) {
|
||||||
@@ -230,6 +341,27 @@ class AutoDacFragment : Fragment() {
|
|||||||
Firebase.crashlytics.recordException(e)
|
Firebase.crashlytics.recordException(e)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
fun extractSubstring(input: String): String {
|
||||||
|
val regex = "#CS(.*?)#CC".toRegex()
|
||||||
|
val matchResult = regex.find(input)
|
||||||
|
return matchResult?.groups?.get(1)?.value?.trim() ?: ""
|
||||||
|
}
|
||||||
|
private fun validateDacValues(): Boolean {
|
||||||
|
val pattern = Regex("(LED:\\d+)__DAC:(\\d+)__ADC:(\\d+)")
|
||||||
|
val matches = pattern.findAll(resultData)
|
||||||
|
for (match in matches) {
|
||||||
|
val ledName = match.groupValues[1]
|
||||||
|
val xValue = match.groupValues[2].toDouble()
|
||||||
|
val yValue = match.groupValues[3].toDouble()
|
||||||
|
|
||||||
|
if(xValue == 3200.0){
|
||||||
|
if(yValue < 500.0){
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
fun parseData(inputData: List<String>): List<Pair<String, String>> {
|
fun parseData(inputData: List<String>): List<Pair<String, String>> {
|
||||||
val pattern = Regex("([A-Z]+)\\s(\\d+)")
|
val pattern = Regex("([A-Z]+)\\s(\\d+)")
|
||||||
|
|||||||
@@ -29,8 +29,8 @@ 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.presentation.utils.UsbServiceListener
|
import com.example.hpostesting.presentation.utils.UsbServiceListener
|
||||||
import com.example.hpostesting.presentation.dashboard.DashboardActivity
|
import com.example.hpostesting.presentation.main_base.DashboardActivity
|
||||||
import com.example.hpostesting.presentation.hemocube.HemoCubeViewModel
|
import com.example.hpostesting.presentation.trueheme_test.TrueHemeTestViewModel
|
||||||
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
|
||||||
@@ -44,7 +44,7 @@ import kotlin.math.log10
|
|||||||
class HemoCubeBufferCheckFragment : Fragment() {
|
class HemoCubeBufferCheckFragment : Fragment() {
|
||||||
|
|
||||||
private lateinit var binding: FragmentHemoCubeReferenceBinding
|
private lateinit var binding: FragmentHemoCubeReferenceBinding
|
||||||
private val hemoCubeViewModel: HemoCubeViewModel by activityViewModels()
|
private val trueHemeTestViewModel: TrueHemeTestViewModel by activityViewModels()
|
||||||
private lateinit var sharedPreferences: SharedPreferences
|
private lateinit var sharedPreferences: SharedPreferences
|
||||||
private var currentDeviceData: DeviceData? = null
|
private var currentDeviceData: DeviceData? = null
|
||||||
private var resultData: String = ""
|
private var resultData: String = ""
|
||||||
@@ -123,13 +123,13 @@ class HemoCubeBufferCheckFragment : Fragment() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun observeViewModel() {
|
private fun observeViewModel() {
|
||||||
hemoCubeViewModel.deviceData.observe(viewLifecycleOwner) {
|
trueHemeTestViewModel.deviceData.observe(viewLifecycleOwner) {
|
||||||
currentDeviceData = it
|
currentDeviceData = it
|
||||||
}
|
}
|
||||||
|
|
||||||
hemoCubeViewModel.networkStatusLiveData.observe(viewLifecycleOwner) { isNetworkAvailable ->
|
trueHemeTestViewModel.networkStatusLiveData.observe(viewLifecycleOwner) { isNetworkAvailable ->
|
||||||
if (isNetworkAvailable) {
|
if (isNetworkAvailable) {
|
||||||
hemoCubeViewModel.getDeviceData(sharedPreferences.getString(Constants.USER_ID, ""))
|
trueHemeTestViewModel.getDeviceData(sharedPreferences.getString(Constants.USER_ID, ""))
|
||||||
} else {
|
} else {
|
||||||
Toast.makeText(
|
Toast.makeText(
|
||||||
requireContext(), R.string.internt_not, Toast.LENGTH_SHORT
|
requireContext(), R.string.internt_not, Toast.LENGTH_SHORT
|
||||||
@@ -137,7 +137,7 @@ class HemoCubeBufferCheckFragment : Fragment() {
|
|||||||
}
|
}
|
||||||
isOnline = isNetworkAvailable
|
isOnline = isNetworkAvailable
|
||||||
}
|
}
|
||||||
hemoCubeViewModel.fireBaseUpload.observe(viewLifecycleOwner) { result ->
|
trueHemeTestViewModel.fireBaseUpload.observe(viewLifecycleOwner) { result ->
|
||||||
if (result == "Success") {
|
if (result == "Success") {
|
||||||
showToast(R.string.kit_uploaded)
|
showToast(R.string.kit_uploaded)
|
||||||
}
|
}
|
||||||
@@ -152,11 +152,11 @@ class HemoCubeBufferCheckFragment : Fragment() {
|
|||||||
binding.progressBar.visibility = View.GONE
|
binding.progressBar.visibility = View.GONE
|
||||||
}
|
}
|
||||||
|
|
||||||
hemoCubeViewModel.messages.observe(viewLifecycleOwner) {
|
trueHemeTestViewModel.messages.observe(viewLifecycleOwner) {
|
||||||
binding.tvSubtitle4.text = it
|
binding.tvSubtitle4.text = it
|
||||||
}
|
}
|
||||||
|
|
||||||
hemoCubeViewModel.deviceMessages.observe(viewLifecycleOwner) {
|
trueHemeTestViewModel.deviceMessages.observe(viewLifecycleOwner) {
|
||||||
binding.tvDeviceMessages.text = it
|
binding.tvDeviceMessages.text = it
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -192,7 +192,7 @@ class HemoCubeBufferCheckFragment : Fragment() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
resultData += stringData
|
resultData += stringData
|
||||||
hemoCubeViewModel.deviceMessages.postValue(resultData)
|
trueHemeTestViewModel.deviceMessages.postValue(resultData)
|
||||||
|
|
||||||
when {
|
when {
|
||||||
stringData.contains("SN") -> {
|
stringData.contains("SN") -> {
|
||||||
@@ -209,11 +209,11 @@ class HemoCubeBufferCheckFragment : Fragment() {
|
|||||||
binding.tvSubtitle4.visibility = View.VISIBLE
|
binding.tvSubtitle4.visibility = View.VISIBLE
|
||||||
binding.btnPlacebuffer.visibility = View.VISIBLE
|
binding.btnPlacebuffer.visibility = View.VISIBLE
|
||||||
}
|
}
|
||||||
hemoCubeViewModel.messages.postValue("Start")
|
trueHemeTestViewModel.messages.postValue("Start")
|
||||||
}
|
}
|
||||||
|
|
||||||
stringData.contains("#BS") -> {
|
stringData.contains("#BS") -> {
|
||||||
hemoCubeViewModel.messages.postValue("Buffer Started")
|
trueHemeTestViewModel.messages.postValue("Buffer Started")
|
||||||
}
|
}
|
||||||
|
|
||||||
stringData.contains("#BC") -> {
|
stringData.contains("#BC") -> {
|
||||||
@@ -232,7 +232,7 @@ class HemoCubeBufferCheckFragment : Fragment() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
stringData.contains("#SC") -> {
|
stringData.contains("#SC") -> {
|
||||||
hemoCubeViewModel.messages.postValue("Sample Completed \nGathering data")
|
trueHemeTestViewModel.messages.postValue("Sample Completed \nGathering data")
|
||||||
fetchResult()
|
fetchResult()
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -351,7 +351,7 @@ class HemoCubeBufferCheckFragment : Fragment() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
val prdClassification = absorbanceBasedClassification(_predictedDenovixRatio)
|
val prdClassification = absorbanceBasedClassification(_predictedDenovixRatio)
|
||||||
hemoCubeViewModel.messages.postValue(prdClassification)
|
trueHemeTestViewModel.messages.postValue(prdClassification)
|
||||||
|
|
||||||
val bufferData = BufferCheckData(
|
val bufferData = BufferCheckData(
|
||||||
_id = UUID.randomUUID().toString(),
|
_id = UUID.randomUUID().toString(),
|
||||||
@@ -385,15 +385,15 @@ class HemoCubeBufferCheckFragment : Fragment() {
|
|||||||
testTime = SimpleDateFormat(
|
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),
|
||||||
batteryLevel = hemoCubeViewModel.getBatteryLevel().toString(),
|
batteryLevel = trueHemeTestViewModel.getBatteryLevel().toString(),
|
||||||
batteryCapacity = hemoCubeViewModel.getBatteryCapacity(requireContext()).toString(),
|
batteryCapacity = trueHemeTestViewModel.getBatteryCapacity(requireContext()).toString(),
|
||||||
batteryMaxCapacity = hemoCubeViewModel.getBatteryMaxCapacity(requireContext())
|
batteryMaxCapacity = trueHemeTestViewModel.getBatteryMaxCapacity(requireContext())
|
||||||
.toString(),
|
.toString(),
|
||||||
batteryTemperature = hemoCubeViewModel.getBatteryTemperature().toString(),
|
batteryTemperature = trueHemeTestViewModel.getBatteryTemperature().toString(),
|
||||||
batteryVoltage = hemoCubeViewModel.getBatteryVoltage(requireContext()).toString()
|
batteryVoltage = trueHemeTestViewModel.getBatteryVoltage(requireContext()).toString()
|
||||||
)
|
)
|
||||||
|
|
||||||
hemoCubeViewModel.uploadHemoCubeResultToDatabaseForBufferCheck(isOnline, bufferData)
|
trueHemeTestViewModel.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
|
||||||
@@ -404,7 +404,7 @@ class HemoCubeBufferCheckFragment : Fragment() {
|
|||||||
|
|
||||||
private fun findResult(calculatedRatio: Double?): String {
|
private fun findResult(calculatedRatio: Double?): String {
|
||||||
try {
|
try {
|
||||||
hemoCubeViewModel.messages.postValue("result classification")
|
trueHemeTestViewModel.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.05) return "Inconclusive. Very low Absorbance - Repeat test with Higher Blood Volume"
|
||||||
if (calculatedRatio in 0.05..0.155) return "Normal"
|
if (calculatedRatio in 0.05..0.155) return "Normal"
|
||||||
@@ -426,7 +426,7 @@ class HemoCubeBufferCheckFragment : Fragment() {
|
|||||||
|
|
||||||
private fun absorbanceBasedClassification(predictedDenovixRatio: Double?): String {
|
private fun absorbanceBasedClassification(predictedDenovixRatio: Double?): String {
|
||||||
try {
|
try {
|
||||||
hemoCubeViewModel.messages.postValue("result classification")
|
trueHemeTestViewModel.messages.postValue("result classification")
|
||||||
if (predictedDenovixRatio != null) {
|
if (predictedDenovixRatio != null) {
|
||||||
if (predictedDenovixRatio in 0.0..0.16) return "Kit Passed"
|
if (predictedDenovixRatio in 0.0..0.16) return "Kit Passed"
|
||||||
if (predictedDenovixRatio in 0.16..0.165) return "Kit Passed"
|
if (predictedDenovixRatio in 0.16..0.165) return "Kit Passed"
|
||||||
@@ -482,20 +482,20 @@ class HemoCubeBufferCheckFragment : Fragment() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun getDeviceInfo() {
|
private fun getDeviceInfo() {
|
||||||
hemoCubeViewModel.progressBar.postValue(true)
|
trueHemeTestViewModel.progressBar.postValue(true)
|
||||||
(activity as HemocubeBufferCheckActivity).mService.sendAndListenToHemoCube(
|
(activity as HemocubeBufferCheckActivity).mService.sendAndListenToHemoCube(
|
||||||
HemoCubeCommands.DEVICE_CONFIGURATION_COMMAND,
|
HemoCubeCommands.DEVICE_CONFIGURATION_COMMAND,
|
||||||
object : UsbServiceListener {
|
object : UsbServiceListener {
|
||||||
override fun onUsbRead(data: ByteArray?) {
|
override fun onUsbRead(data: ByteArray?) {
|
||||||
data?.let {
|
data?.let {
|
||||||
val stringData = String(it)
|
val stringData = String(it)
|
||||||
hemoCubeViewModel.messages.postValue(stringData)
|
trueHemeTestViewModel.messages.postValue(stringData)
|
||||||
binding.tvSubtitle4.text = stringData
|
binding.tvSubtitle4.text = stringData
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onUsbError(e: Exception?) {
|
override fun onUsbError(e: Exception?) {
|
||||||
hemoCubeViewModel.progressBar.postValue(false)
|
trueHemeTestViewModel.progressBar.postValue(false)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ import androidx.core.view.get
|
|||||||
import com.example.hpostesting.data.constant.DataHolder
|
import com.example.hpostesting.data.constant.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.constant.LanguageManager
|
||||||
import com.example.hpostesting.presentation.hemocube.HemoCubeViewModel
|
import com.example.hpostesting.presentation.trueheme_test.TrueHemeTestViewModel
|
||||||
import com.example.hpostesting.util.UsbService
|
import com.example.hpostesting.util.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
|
||||||
@@ -47,7 +47,7 @@ import `in`.sminnovations.hpostesting.databinding.ActivityHemocubeBinding
|
|||||||
@AndroidEntryPoint
|
@AndroidEntryPoint
|
||||||
open class HemocubeBufferCheckActivity : AppCompatActivity() {
|
open class HemocubeBufferCheckActivity : AppCompatActivity() {
|
||||||
private lateinit var binding: ActivityHemocubeBinding
|
private lateinit var binding: ActivityHemocubeBinding
|
||||||
private val viewModel by viewModels<HemoCubeViewModel>()
|
private val viewModel by viewModels<TrueHemeTestViewModel>()
|
||||||
private var myMenu: Menu? = null
|
private var myMenu: Menu? = null
|
||||||
|
|
||||||
private lateinit var mDriver: UsbSerialDriver
|
private lateinit var mDriver: UsbSerialDriver
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ import com.example.hpostesting.data.constant.HemoCubeCommands
|
|||||||
import com.example.hpostesting.data.model.calibration.CalibrationData
|
import com.example.hpostesting.data.model.calibration.CalibrationData
|
||||||
import com.example.hpostesting.data.model.patient.DeviceData
|
import com.example.hpostesting.data.model.patient.DeviceData
|
||||||
import com.example.hpostesting.presentation.utils.UsbServiceListener
|
import com.example.hpostesting.presentation.utils.UsbServiceListener
|
||||||
import com.example.hpostesting.presentation.dashboard.DashboardActivity
|
import com.example.hpostesting.presentation.main_base.DashboardActivity
|
||||||
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.databinding.FragmentCalibrationBinding
|
import `in`.sminnovations.hpostesting.databinding.FragmentCalibrationBinding
|
||||||
|
|||||||
@@ -1,137 +0,0 @@
|
|||||||
/*
|
|
||||||
* // Copyright (c) 2024 ShanMukha Innovations Pvt. Ltd. All rights reserved.
|
|
||||||
* // Notice: All information contained herein is, and remains
|
|
||||||
* // the property of ShanMukha Innovations Pvt. Ltd. and its suppliers,
|
|
||||||
* // if any. The intellectual and technical concepts contained
|
|
||||||
* // herein are proprietary to ShanMukha Innovations Pvt. Ltd.
|
|
||||||
* // and its suppliers and may be covered by Indian and Foreign Patents,
|
|
||||||
* // patents in process, and are protected by trade secret or copyright law.
|
|
||||||
* // Dissemination of this information or reproduction of this material
|
|
||||||
* // is strictly forbidden unless prior written permission is obtained
|
|
||||||
* // from ShanMukha Innovations Pvt. Ltd.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package com.example.hpostesting.presentation.dashboard
|
|
||||||
|
|
||||||
import android.content.Context
|
|
||||||
import android.content.SharedPreferences
|
|
||||||
import android.content.pm.PackageManager
|
|
||||||
import android.os.Bundle
|
|
||||||
import android.view.LayoutInflater
|
|
||||||
import android.view.View
|
|
||||||
import android.view.ViewGroup
|
|
||||||
import android.widget.Toast
|
|
||||||
import androidx.appcompat.app.AppCompatActivity
|
|
||||||
import androidx.fragment.app.Fragment
|
|
||||||
import androidx.preference.ListPreference
|
|
||||||
import androidx.preference.Preference
|
|
||||||
import androidx.preference.PreferenceFragmentCompat
|
|
||||||
import com.example.hpostesting.data.constant.Constants
|
|
||||||
import com.example.hpostesting.data.constant.DataHolder
|
|
||||||
import com.example.hpostesting.data.constant.LanguageManager
|
|
||||||
import com.example.hpostesting.data.model.TestState
|
|
||||||
import com.example.hpostesting.data.model.patient.toHemoCubeTestData
|
|
||||||
import `in`.sminnovations.hpostesting.R
|
|
||||||
import `in`.sminnovations.hpostesting.databinding.FragmentHemoCubeReferenceBinding
|
|
||||||
import `in`.sminnovations.hpostesting.databinding.FragmentSlideshowBinding
|
|
||||||
|
|
||||||
private var isLanguageChanged = false
|
|
||||||
|
|
||||||
class SlideshowFragment : Fragment(){
|
|
||||||
private lateinit var binding: FragmentSlideshowBinding
|
|
||||||
private lateinit var sharedPreferences: SharedPreferences
|
|
||||||
override fun onCreateView(
|
|
||||||
inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?,
|
|
||||||
): View {
|
|
||||||
binding = FragmentSlideshowBinding.inflate(inflater, container, false)
|
|
||||||
sharedPreferences =
|
|
||||||
requireContext().getSharedPreferences("HEMOCUBE", Context.MODE_PRIVATE)
|
|
||||||
return binding.root
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
|
||||||
super.onViewCreated(view, savedInstanceState)
|
|
||||||
|
|
||||||
binding.nameEditText.setText(sharedPreferences.getString(Constants.LABNAME,""))
|
|
||||||
|
|
||||||
|
|
||||||
binding.btnGo.setOnClickListener {
|
|
||||||
var labname = binding.nameEditText.text.toString()
|
|
||||||
DataHolder.hemoCubeTestData?.apply {
|
|
||||||
this.labName = labname
|
|
||||||
}
|
|
||||||
|
|
||||||
with(sharedPreferences.edit()) {
|
|
||||||
putString(Constants.LABNAME, labname)
|
|
||||||
apply()
|
|
||||||
}
|
|
||||||
|
|
||||||
Toast.makeText(
|
|
||||||
requireContext(),
|
|
||||||
"Lab Name is Added successfully.",
|
|
||||||
Toast.LENGTH_SHORT
|
|
||||||
).show()
|
|
||||||
}
|
|
||||||
childFragmentManager.beginTransaction().replace(binding.container.id,PrefsFragment()).commit()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
class PrefsFragment: PreferenceFragmentCompat(){
|
|
||||||
override fun onCreatePreferences(savedInstanceState: Bundle?, rootKey: String?) {
|
|
||||||
val preferenceScreen = preferenceManager.createPreferenceScreen(requireContext())
|
|
||||||
|
|
||||||
val languagePreference = ListPreference(requireContext())
|
|
||||||
languagePreference.key = "language_preference"
|
|
||||||
languagePreference.title = getString(R.string.app_language)
|
|
||||||
languagePreference.summary = getString(R.string.select_language)
|
|
||||||
languagePreference.entries = arrayOf("English", "Kannada", "Hindi")
|
|
||||||
languagePreference.entryValues = arrayOf("en", "kn", "hi")
|
|
||||||
languagePreference.setDefaultValue("en")
|
|
||||||
|
|
||||||
languagePreference.onPreferenceChangeListener =
|
|
||||||
Preference.OnPreferenceChangeListener { _, newValue ->
|
|
||||||
val languageCode = newValue as String
|
|
||||||
updateLanguage(requireContext(), languageCode)
|
|
||||||
true
|
|
||||||
}
|
|
||||||
|
|
||||||
preferenceScreen.addPreference(languagePreference)
|
|
||||||
setPreferenceScreen(preferenceScreen)
|
|
||||||
|
|
||||||
// App Version Preference
|
|
||||||
val appVersionPreference = Preference(requireContext())
|
|
||||||
appVersionPreference.title = "App Version"
|
|
||||||
appVersionPreference.summary =
|
|
||||||
getAppVersion(requireContext()) + " [ " + getAppEnvironment(requireContext()) + " ]"
|
|
||||||
|
|
||||||
preferenceScreen.addPreference(languagePreference)
|
|
||||||
preferenceScreen.addPreference(appVersionPreference)
|
|
||||||
setPreferenceScreen(preferenceScreen)
|
|
||||||
if (isLanguageChanged) {
|
|
||||||
Toast.makeText(requireContext(), R.string.language_update, Toast.LENGTH_SHORT).show()
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
private fun updateLanguage(context: Context, languageCode: String) {
|
|
||||||
LanguageManager.persistLanguagePreference(context, languageCode)
|
|
||||||
LanguageManager.setLocale(context, languageCode)
|
|
||||||
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"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun getAppEnvironment(context: Context): String {
|
|
||||||
return try {
|
|
||||||
val pInfo = context.packageManager.getPackageInfo(context.packageName, 0)
|
|
||||||
pInfo.packageName.substringAfterLast('.')
|
|
||||||
} catch (e: PackageManager.NameNotFoundException) {
|
|
||||||
"N/A"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,331 +0,0 @@
|
|||||||
/*
|
|
||||||
* // Copyright (c) 2024 ShanMukha Innovations Pvt. Ltd. All rights reserved.
|
|
||||||
* // Notice: All information contained herein is, and remains
|
|
||||||
* // the property of ShanMukha Innovations Pvt. Ltd. and its suppliers,
|
|
||||||
* // if any. The intellectual and technical concepts contained
|
|
||||||
* // herein are proprietary to ShanMukha Innovations Pvt. Ltd.
|
|
||||||
* // and its suppliers and may be covered by Indian and Foreign Patents,
|
|
||||||
* // patents in process, and are protected by trade secret or copyright law.
|
|
||||||
* // Dissemination of this information or reproduction of this material
|
|
||||||
* // is strictly forbidden unless prior written permission is obtained
|
|
||||||
* // from ShanMukha Innovations Pvt. Ltd.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package com.example.hpostesting.presentation.dashboard.ui
|
|
||||||
|
|
||||||
import android.annotation.SuppressLint
|
|
||||||
import android.content.Context
|
|
||||||
import android.content.SharedPreferences
|
|
||||||
import android.net.ConnectivityManager
|
|
||||||
import android.net.NetworkCapabilities
|
|
||||||
import android.os.Build
|
|
||||||
import android.os.Bundle
|
|
||||||
import android.util.Log
|
|
||||||
import android.view.LayoutInflater
|
|
||||||
import android.view.View
|
|
||||||
import android.view.ViewGroup
|
|
||||||
import android.widget.Toast
|
|
||||||
import androidx.annotation.RequiresApi
|
|
||||||
import androidx.fragment.app.Fragment
|
|
||||||
import androidx.fragment.app.activityViewModels
|
|
||||||
import androidx.navigation.fragment.findNavController
|
|
||||||
import com.example.hpostesting.data.constant.Constants
|
|
||||||
import com.example.hpostesting.data.constant.DataHolder
|
|
||||||
import com.example.hpostesting.data.model.login.LoginRequest
|
|
||||||
import com.example.hpostesting.presentation.hemocube.HemoCubeViewModel
|
|
||||||
import `in`.sminnovations.hpostesting.R
|
|
||||||
import `in`.sminnovations.hpostesting.databinding.FragmentLoginBinding
|
|
||||||
import kotlinx.coroutines.Dispatchers
|
|
||||||
import kotlinx.coroutines.GlobalScope
|
|
||||||
import kotlinx.coroutines.launch
|
|
||||||
import java.net.HttpURLConnection
|
|
||||||
import java.net.URL
|
|
||||||
import java.util.Scanner
|
|
||||||
|
|
||||||
|
|
||||||
class LoginFragment : Fragment() {
|
|
||||||
private val LOCATION_PERMISSION_REQUEST_CODE = 1001
|
|
||||||
// private lateinit var locationManager: LocationManager
|
|
||||||
// var latitude = 0.0
|
|
||||||
// var longitude = 0.0
|
|
||||||
var TAG = "LoginFragmentCheck"
|
|
||||||
private var _binding: FragmentLoginBinding? = null
|
|
||||||
private val binding get() = _binding!!
|
|
||||||
private lateinit var sharedPreference: SharedPreferences
|
|
||||||
private val hemoCubeViewModel: HemoCubeViewModel by activityViewModels()
|
|
||||||
override fun onCreateView(
|
|
||||||
inflater: LayoutInflater, container: ViewGroup?,
|
|
||||||
savedInstanceState: Bundle?,
|
|
||||||
): View {
|
|
||||||
_binding = FragmentLoginBinding.inflate(inflater, container, false)
|
|
||||||
sharedPreference =
|
|
||||||
requireContext().getSharedPreferences("HEMOCUBE", Context.MODE_PRIVATE)
|
|
||||||
return binding.root
|
|
||||||
}
|
|
||||||
|
|
||||||
@RequiresApi(Build.VERSION_CODES.M)
|
|
||||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
|
||||||
super.onViewCreated(view, savedInstanceState)
|
|
||||||
init()
|
|
||||||
if(isInternetAvailable()){
|
|
||||||
getPublicIpAddr { ipAddress ->
|
|
||||||
DataHolder.ipAddress = ipAddress
|
|
||||||
}
|
|
||||||
Log.d("ipaddress",DataHolder.ipAddress)
|
|
||||||
}
|
|
||||||
|
|
||||||
// getPublicIpAddr { ipAddress ->
|
|
||||||
// DataHolder.ipAddress = ipAddress
|
|
||||||
// }
|
|
||||||
// locationManager = requireActivity().getSystemService(Context.LOCATION_SERVICE) as LocationManager
|
|
||||||
|
|
||||||
// // Check for location permission
|
|
||||||
// if (ContextCompat.checkSelfPermission(requireContext(),
|
|
||||||
// Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED && ContextCompat.checkSelfPermission(requireContext(),
|
|
||||||
// Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
|
|
||||||
// // Permission is not granted, request it
|
|
||||||
// ActivityCompat.requestPermissions(requireActivity(),
|
|
||||||
// arrayOf(Manifest.permission.ACCESS_COARSE_LOCATION,Manifest.permission.ACCESS_FINE_LOCATION),
|
|
||||||
// LOCATION_PERMISSION_REQUEST_CODE)
|
|
||||||
// } else {
|
|
||||||
// // Permission is granted, fetch location
|
|
||||||
// checkLocation()
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// if (isNetworkProviderAvailable()) {
|
|
||||||
// Toast.makeText(requireContext(), "Network provider is available", Toast.LENGTH_SHORT).show()
|
|
||||||
// } else {
|
|
||||||
// Toast.makeText(requireContext(), "Network provider is not available", Toast.LENGTH_SHORT).show()
|
|
||||||
// }
|
|
||||||
}
|
|
||||||
|
|
||||||
// private fun isNetworkProviderAvailable(): Boolean {
|
|
||||||
//
|
|
||||||
// return locationManager.isProviderEnabled(LocationManager.NETWORK_PROVIDER)
|
|
||||||
// }
|
|
||||||
private fun init() {
|
|
||||||
if (isUserLoggedIn()) {
|
|
||||||
navigateToHomeFragment()
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
binding.btnLogin.setOnClickListener {
|
|
||||||
// Toast.makeText(requireContext(), "$latitude/$longitude",Toast.LENGTH_SHORT).show()
|
|
||||||
|
|
||||||
val loginId = binding.loginId.text.toString()
|
|
||||||
val password = binding.password.text.toString()
|
|
||||||
|
|
||||||
if (loginId.isNotBlank() && password.isNotBlank()) {
|
|
||||||
performLogin(loginId, password)
|
|
||||||
var Password = sharedPreference.getString(Constants.DEVICE_PASSWORD_API, "").toString()
|
|
||||||
var UserID = sharedPreference.getString(Constants.DEVICE_ID_API, "").toString()
|
|
||||||
hemoCubeViewModel.login(createLoginRequestData(UserID, Password))
|
|
||||||
} else {
|
|
||||||
if (loginId.isBlank()) {
|
|
||||||
binding.loginId.error = R.string.enter_proper_login_id.toString()
|
|
||||||
}
|
|
||||||
if (password.isBlank()) {
|
|
||||||
binding.password.error = R.string.enter_proper_password.toString()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
private fun createLoginRequestData(userID: String, password: String): LoginRequest {
|
|
||||||
|
|
||||||
val pInfo = requireActivity().packageManager.getPackageInfo(
|
|
||||||
requireActivity().packageName, 0
|
|
||||||
)
|
|
||||||
val version = pInfo.versionName
|
|
||||||
var labname = sharedPreference.getString(Constants.LABNAME,"")
|
|
||||||
return LoginRequest(
|
|
||||||
password = password, serialNumber = userID, username = userID, version = version, lab = labname,location = DataHolder.ipAddress.toString()
|
|
||||||
)
|
|
||||||
}
|
|
||||||
private fun isUserLoggedIn(): Boolean {
|
|
||||||
return sharedPreference.getString(Constants.USER_ID, "")?.isNotBlank() == true
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun navigateToHomeFragment() {
|
|
||||||
findNavController().navigate(R.id.action_loginFragment_to_homeFragment)
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun performLogin(loginId: String, password: String) {
|
|
||||||
val matchingId = Constants.STATICID.firstOrNull { it == loginId }
|
|
||||||
if (matchingId != null) {
|
|
||||||
if (password == Constants.password) {
|
|
||||||
saveUserId(loginId)
|
|
||||||
navigateToHomeFragment()
|
|
||||||
return
|
|
||||||
} else {
|
|
||||||
Toast.makeText(requireContext(), R.string.wrong_password, Toast.LENGTH_SHORT).show()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Toast.makeText(requireContext(), R.string.wrong_user_id, Toast.LENGTH_SHORT).show()
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun saveUserId(userId: String) {
|
|
||||||
with(sharedPreference.edit()) {
|
|
||||||
putString(Constants.USER_ID, userId)
|
|
||||||
apply()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onDestroyView() {
|
|
||||||
super.onDestroyView()
|
|
||||||
_binding = null
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Check if we can get our location */
|
|
||||||
// @SuppressLint("MissingPermission")
|
|
||||||
// fun checkLocation() {
|
|
||||||
//
|
|
||||||
// val locationManager = requireActivity().getSystemService(Context.LOCATION_SERVICE) as LocationManager
|
|
||||||
// val locationProviderWifi = LocationManager.NETWORK_PROVIDER
|
|
||||||
// val locationProviderGPS = LocationManager.FUSED_PROVIDER
|
|
||||||
// val locationListenerNetwork: LocationListener
|
|
||||||
// val locationListenerGPS: LocationListener
|
|
||||||
// var gps_enabled = false
|
|
||||||
// var network_enabled = false
|
|
||||||
// Log.d(TAG,"PRoveider"+locationManager.allProviders.toString())
|
|
||||||
// //check wifi
|
|
||||||
//
|
|
||||||
// //check wifi
|
|
||||||
// val connectivityManager = requireActivity().getSystemService(Context.CONNECTIVITY_SERVICE) as ConnectivityManager
|
|
||||||
// val mWifi = connectivityManager.getNetworkInfo(ConnectivityManager.TYPE_WIFI)
|
|
||||||
//
|
|
||||||
// if (mWifi!!.isConnected) {
|
|
||||||
// Log.d(TAG, "Wifi connected")
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// //check gps and wifi availability
|
|
||||||
//
|
|
||||||
// //check gps and wifi availability
|
|
||||||
// try {
|
|
||||||
// gps_enabled = locationManager.isProviderEnabled(LocationManager.GPS_PROVIDER)
|
|
||||||
// } catch (ex: java.lang.Exception) {
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// try {
|
|
||||||
// network_enabled =
|
|
||||||
// locationManager.isProviderEnabled(LocationManager.NETWORK_PROVIDER)
|
|
||||||
// } catch (ex: java.lang.Exception) {
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// if (!gps_enabled) {
|
|
||||||
// Log.d(TAG, "GPS: Missing")
|
|
||||||
// }
|
|
||||||
// if (!network_enabled) {
|
|
||||||
// Log.d(TAG, "Network: Missing")
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// /* Location change listeners */
|
|
||||||
//
|
|
||||||
// /* Location change listeners */try {
|
|
||||||
// // Define a listener that responds to gps location updates
|
|
||||||
// locationListenerGPS = object : LocationListener {
|
|
||||||
// override fun onLocationChanged(location: Location) {
|
|
||||||
// Log.d(
|
|
||||||
// TAG,
|
|
||||||
// "GPS: Latitude: " + location.latitude + ", Longitude = " + location.longitude
|
|
||||||
// )
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// override fun onStatusChanged(provider: String, status: Int, extras: Bundle) {
|
|
||||||
// Log.d(TAG, "GPS location found 1")
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// override fun onProviderEnabled(provider: String) {
|
|
||||||
// Log.d(TAG, "GPS location found 2")
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// override fun onProviderDisabled(provider: String) {
|
|
||||||
// Log.d(TAG, "GPS location found 3")
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// locationManager.requestLocationUpdates(
|
|
||||||
// locationProviderGPS,
|
|
||||||
// 0,
|
|
||||||
// 0f,
|
|
||||||
// locationListenerGPS
|
|
||||||
// )
|
|
||||||
// } catch (e: java.lang.Exception) {
|
|
||||||
// Log.e(TAG, "Location Exception GPS: " + e.message)
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// try {
|
|
||||||
// // Define a listener that responds to wifi location updates
|
|
||||||
// locationListenerNetwork = object : LocationListener {
|
|
||||||
// override fun onLocationChanged(location: Location) {
|
|
||||||
// Log.d(
|
|
||||||
// TAG,
|
|
||||||
// "NW: Latitude: " + location.latitude + ", Longitude = " + location.longitude
|
|
||||||
// )
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// override fun onStatusChanged(provider: String, status: Int, extras: Bundle) {
|
|
||||||
// Log.d(TAG, "location found 1")
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// override fun onProviderEnabled(provider: String) {
|
|
||||||
// Log.d(TAG, "location found 2")
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// override fun onProviderDisabled(provider: String) {
|
|
||||||
// Log.d(TAG, "location found 3")
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// locationManager.requestLocationUpdates(
|
|
||||||
// locationProviderWifi,
|
|
||||||
// 0,
|
|
||||||
// 0f,
|
|
||||||
// locationListenerNetwork
|
|
||||||
// )
|
|
||||||
// } catch (e: java.lang.Exception) {
|
|
||||||
// Log.e(TAG, "Location Exception: " + e.message)
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// }
|
|
||||||
|
|
||||||
// override fun onRequestPermissionsResult(requestCode: Int, permissions: Array<out String>, grantResults: IntArray) {
|
|
||||||
// super.onRequestPermissionsResult(requestCode, permissions, grantResults)
|
|
||||||
// if (requestCode == LOCATION_PERMISSION_REQUEST_CODE) {
|
|
||||||
// if (grantResults.isNotEmpty() && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
|
|
||||||
// // Permission granted, fetch location
|
|
||||||
// checkLocation()
|
|
||||||
// } else {
|
|
||||||
// // Permission denied
|
|
||||||
// Toast.makeText(requireContext(), "Location permission denied", Toast.LENGTH_SHORT).show()
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
private fun getPublicIpAddr(callback: (String) -> Unit) {
|
|
||||||
try {
|
|
||||||
GlobalScope.launch(Dispatchers.IO) {
|
|
||||||
val url = URL("https://api.ipify.org")
|
|
||||||
val conn = url.openConnection() as HttpURLConnection
|
|
||||||
try {
|
|
||||||
conn.connect()
|
|
||||||
if (conn.responseCode == HttpURLConnection.HTTP_OK) {
|
|
||||||
val scanner = Scanner(conn.inputStream)
|
|
||||||
scanner.useDelimiter("\\A")
|
|
||||||
if (scanner.hasNext()) {
|
|
||||||
val ipAddress = scanner.next()
|
|
||||||
callback(ipAddress)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} finally {
|
|
||||||
conn.disconnect()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}catch (e: Exception){
|
|
||||||
Log.e(TAG,e.toString())
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@SuppressLint("NewApi")
|
|
||||||
private fun isInternetAvailable(): Boolean {
|
|
||||||
val connectivityManager = requireActivity().getSystemService(Context.CONNECTIVITY_SERVICE) as ConnectivityManager
|
|
||||||
val network = connectivityManager.activeNetwork ?: return false
|
|
||||||
val networkCapabilities = connectivityManager.getNetworkCapabilities(network) ?: return false
|
|
||||||
return networkCapabilities.hasCapability(NetworkCapabilities.NET_CAPABILITY_INTERNET)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,26 +0,0 @@
|
|||||||
/*
|
|
||||||
* // Copyright (c) 2024 ShanMukha Innovations Pvt. Ltd. All rights reserved.
|
|
||||||
* // Notice: All information contained herein is, and remains
|
|
||||||
* // the property of ShanMukha Innovations Pvt. Ltd. and its suppliers,
|
|
||||||
* // if any. The intellectual and technical concepts contained
|
|
||||||
* // herein are proprietary to ShanMukha Innovations Pvt. Ltd.
|
|
||||||
* // and its suppliers and may be covered by Indian and Foreign Patents,
|
|
||||||
* // patents in process, and are protected by trade secret or copyright law.
|
|
||||||
* // Dissemination of this information or reproduction of this material
|
|
||||||
* // is strictly forbidden unless prior written permission is obtained
|
|
||||||
* // from ShanMukha Innovations Pvt. Ltd.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package com.example.hpostesting.presentation.dashboard.ui.gallery
|
|
||||||
|
|
||||||
import androidx.lifecycle.LiveData
|
|
||||||
import androidx.lifecycle.MutableLiveData
|
|
||||||
import androidx.lifecycle.ViewModel
|
|
||||||
|
|
||||||
class mGalleryViewModel : ViewModel() {
|
|
||||||
|
|
||||||
private val _text = MutableLiveData<String>().apply {
|
|
||||||
value = "This is gallery Fragment"
|
|
||||||
}
|
|
||||||
val text: LiveData<String> = _text
|
|
||||||
}
|
|
||||||
@@ -1,26 +0,0 @@
|
|||||||
/*
|
|
||||||
* // Copyright (c) 2024 ShanMukha Innovations Pvt. Ltd. All rights reserved.
|
|
||||||
* // Notice: All information contained herein is, and remains
|
|
||||||
* // the property of ShanMukha Innovations Pvt. Ltd. and its suppliers,
|
|
||||||
* // if any. The intellectual and technical concepts contained
|
|
||||||
* // herein are proprietary to ShanMukha Innovations Pvt. Ltd.
|
|
||||||
* // and its suppliers and may be covered by Indian and Foreign Patents,
|
|
||||||
* // patents in process, and are protected by trade secret or copyright law.
|
|
||||||
* // Dissemination of this information or reproduction of this material
|
|
||||||
* // is strictly forbidden unless prior written permission is obtained
|
|
||||||
* // from ShanMukha Innovations Pvt. Ltd.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package com.example.hpostesting.presentation.dashboard.ui.slideshow
|
|
||||||
|
|
||||||
import androidx.lifecycle.LiveData
|
|
||||||
import androidx.lifecycle.MutableLiveData
|
|
||||||
import androidx.lifecycle.ViewModel
|
|
||||||
|
|
||||||
class SlideshowViewModel : ViewModel() {
|
|
||||||
|
|
||||||
private val _text = MutableLiveData<String>().apply {
|
|
||||||
value = "This is slideshow Fragment"
|
|
||||||
}
|
|
||||||
val text: LiveData<String> = _text
|
|
||||||
}
|
|
||||||
@@ -29,6 +29,7 @@ import android.os.Bundle
|
|||||||
import android.os.IBinder
|
import android.os.IBinder
|
||||||
import android.util.Log
|
import android.util.Log
|
||||||
import android.view.Menu
|
import android.view.Menu
|
||||||
|
import android.view.MenuItem
|
||||||
import android.widget.Toast
|
import android.widget.Toast
|
||||||
import androidx.activity.viewModels
|
import androidx.activity.viewModels
|
||||||
import androidx.appcompat.app.AppCompatActivity
|
import androidx.appcompat.app.AppCompatActivity
|
||||||
@@ -105,8 +106,7 @@ class DeviceActivity : AppCompatActivity(), DeviceCommunicationHandler {
|
|||||||
super.onCreate(savedInstanceState)
|
super.onCreate(savedInstanceState)
|
||||||
binding = ActivityDeviceBinding.inflate(layoutInflater)
|
binding = ActivityDeviceBinding.inflate(layoutInflater)
|
||||||
setContentView(binding.root)
|
setContentView(binding.root)
|
||||||
// setSupportActionBar(binding.myToolbar)
|
binding.myToolbar.title = "Device Information"
|
||||||
supportActionBar?.setDisplayHomeAsUpEnabled(true)
|
|
||||||
setupListener()
|
setupListener()
|
||||||
connectUsb(false)
|
connectUsb(false)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,14 +26,14 @@ import androidx.lifecycle.MutableLiveData
|
|||||||
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.presentation.utils.UsbServiceListener
|
import com.example.hpostesting.presentation.utils.UsbServiceListener
|
||||||
import com.example.hpostesting.presentation.hemocube.HemoCubeViewModel
|
import com.example.hpostesting.presentation.trueheme_test.TrueHemeTestViewModel
|
||||||
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.databinding.FragmentDeviceBinding
|
import `in`.sminnovations.hpostesting.databinding.FragmentDeviceBinding
|
||||||
|
|
||||||
class DeviceFragment : Fragment() {
|
class DeviceFragment : Fragment() {
|
||||||
private lateinit var binding: FragmentDeviceBinding
|
private lateinit var binding: FragmentDeviceBinding
|
||||||
private val deviceViewModel: HemoCubeViewModel by activityViewModels()
|
private val deviceViewModel: TrueHemeTestViewModel by activityViewModels()
|
||||||
private lateinit var sharedPreferences: SharedPreferences
|
private lateinit var sharedPreferences: SharedPreferences
|
||||||
private var deviceId = ""
|
private var deviceId = ""
|
||||||
private var startListening = MutableLiveData(false)
|
private var startListening = MutableLiveData(false)
|
||||||
@@ -141,7 +141,8 @@ class DeviceFragment : Fragment() {
|
|||||||
val lines = resultData.split("\n")
|
val lines = resultData.split("\n")
|
||||||
var temp = lines[2]
|
var temp = lines[2]
|
||||||
val temp1 = resultData.substringAfter("#AS").substringBefore("#AC")
|
val temp1 = resultData.substringAfter("#AS").substringBefore("#AC")
|
||||||
binding.tvSubtitleNew.text = "Device ID : "+hardwareId+"\nTemperature : $temp\n"+temp1
|
binding.tvSubtitleNew.text =
|
||||||
|
"Device ID : $hardwareId\nTemperature : $temp\n$temp1"
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,7 +17,6 @@ import android.content.Context
|
|||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
import android.content.SharedPreferences
|
import android.content.SharedPreferences
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.os.Environment
|
|
||||||
import android.provider.Settings
|
import android.provider.Settings
|
||||||
import android.util.Log
|
import android.util.Log
|
||||||
import android.view.LayoutInflater
|
import android.view.LayoutInflater
|
||||||
@@ -34,13 +33,11 @@ import com.example.hpostesting.data.model.deviceprovision.DeviceProvisionRequest
|
|||||||
import com.example.hpostesting.data.model.patient.DeviceData
|
import com.example.hpostesting.data.model.patient.DeviceData
|
||||||
import com.example.hpostesting.encryption.Encryption
|
import com.example.hpostesting.encryption.Encryption
|
||||||
import com.example.hpostesting.presentation.utils.UsbServiceListener
|
import com.example.hpostesting.presentation.utils.UsbServiceListener
|
||||||
import com.example.hpostesting.presentation.dashboard.DashboardActivity
|
import com.example.hpostesting.presentation.main_base.DashboardActivity
|
||||||
import com.google.android.gms.ads.identifier.AdvertisingIdClient
|
|
||||||
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.databinding.FragmentDeviceProvisionBinding
|
import `in`.sminnovations.hpostesting.databinding.FragmentDeviceProvisionBinding
|
||||||
import java.io.File
|
import java.io.File
|
||||||
import java.io.FileOutputStream
|
|
||||||
|
|
||||||
class DeviceProvisionFragment : Fragment() {
|
class DeviceProvisionFragment : Fragment() {
|
||||||
private var resultData: String = ""
|
private var resultData: String = ""
|
||||||
@@ -118,12 +115,7 @@ class DeviceProvisionFragment : Fragment() {
|
|||||||
)
|
)
|
||||||
apply()
|
apply()
|
||||||
}
|
}
|
||||||
startActivity(
|
|
||||||
Intent(
|
|
||||||
requireContext(),
|
|
||||||
DashboardActivity::class.java
|
|
||||||
)
|
|
||||||
)
|
|
||||||
Toast.makeText(
|
Toast.makeText(
|
||||||
activity, "Device registered successfully", Toast.LENGTH_LONG
|
activity, "Device registered successfully", Toast.LENGTH_LONG
|
||||||
).show()
|
).show()
|
||||||
@@ -148,7 +140,13 @@ class DeviceProvisionFragment : Fragment() {
|
|||||||
// viewModel.addDeviceId(DeviceData(deviceId = sharedPreferences.getString(Constants.DEVICE_ID, "").toString()))
|
// viewModel.addDeviceId(DeviceData(deviceId = sharedPreferences.getString(Constants.DEVICE_ID, "").toString()))
|
||||||
Log.e("idpass", response.toString())
|
Log.e("idpass", response.toString())
|
||||||
Log.e("idpass", response.data.data?.credentials?.username.toString())
|
Log.e("idpass", response.data.data?.credentials?.username.toString())
|
||||||
Log.e("idpass", deviceProvisionResponse)
|
// Log.e("idpass", deviceProvisionResponse)
|
||||||
|
startActivity(
|
||||||
|
Intent(
|
||||||
|
requireContext(),
|
||||||
|
DashboardActivity::class.java
|
||||||
|
)
|
||||||
|
)
|
||||||
} else {
|
} else {
|
||||||
Toast.makeText(
|
Toast.makeText(
|
||||||
activity,
|
activity,
|
||||||
@@ -161,11 +159,10 @@ class DeviceProvisionFragment : Fragment() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
is Result.Error -> {
|
is Result.Error -> {
|
||||||
Log.d("deviceProvisionResponse", response.exception.toString())
|
|
||||||
response.exception.let { message ->
|
response.exception.let { message ->
|
||||||
Toast.makeText(
|
Toast.makeText(
|
||||||
activity,
|
activity,
|
||||||
"An error occurred in device provision: ${message.message}",
|
"An error occurred in device provision: $message",
|
||||||
Toast.LENGTH_LONG
|
Toast.LENGTH_LONG
|
||||||
).show()
|
).show()
|
||||||
}
|
}
|
||||||
@@ -248,11 +245,15 @@ class DeviceProvisionFragment : Fragment() {
|
|||||||
|
|
||||||
private fun encryptAndSaveToFile(username: String, password: String) {
|
private fun encryptAndSaveToFile(username: String, password: String) {
|
||||||
val messageToEncrypt = "$username\n$password"
|
val messageToEncrypt = "$username\n$password"
|
||||||
val encryptionKey =
|
val encryptionKey = Settings.Secure.getString(requireContext().contentResolver, Settings.Secure.ANDROID_ID)
|
||||||
Settings.Secure.getString(context?.contentResolver, Settings.Secure.ANDROID_ID)
|
|
||||||
val encryptedString = Encryption.encrypt(messageToEncrypt, encryptionKey)
|
val encryptedString = Encryption.encrypt(messageToEncrypt, encryptionKey)
|
||||||
Log.d("DEVICE ID/encryptionKey", encryptionKey)
|
Log.d("DEVICE ID/encryptionKey", encryptionKey)
|
||||||
val target = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS)
|
val target = File(requireContext().getExternalFilesDir(null), "HPOSDocuments")
|
||||||
|
if (!target.exists()) {
|
||||||
|
target.mkdirs() // Create the directory if it doesn't exist
|
||||||
|
}
|
||||||
|
|
||||||
|
// val target = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS)
|
||||||
val file = File(target, "credentials.txt")
|
val file = File(target, "credentials.txt")
|
||||||
|
|
||||||
if (!file.exists()) {
|
if (!file.exists()) {
|
||||||
|
|||||||
@@ -30,13 +30,10 @@ import androidx.fragment.app.activityViewModels
|
|||||||
import androidx.lifecycle.MutableLiveData
|
import androidx.lifecycle.MutableLiveData
|
||||||
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.constant.TestStatus
|
|
||||||
import com.example.hpostesting.data.model.devicediagnostics.AdditionalDetails
|
import com.example.hpostesting.data.model.devicediagnostics.AdditionalDetails
|
||||||
import com.example.hpostesting.data.model.devicediagnostics.DeviceDiagnosticsRequest
|
import com.example.hpostesting.data.model.devicediagnostics.DeviceDiagnosticsRequest
|
||||||
import com.example.hpostesting.data.model.diagnostics.DiagnosticsData
|
import com.example.hpostesting.data.model.diagnostics.DiagnosticsData
|
||||||
import com.example.hpostesting.data.model.patient.DeviceData
|
import com.example.hpostesting.data.model.patient.DeviceData
|
||||||
import com.example.hpostesting.presentation.autodac.AutoDacActivity
|
|
||||||
import com.example.hpostesting.presentation.hemocube.HemocubeActivity
|
|
||||||
import com.example.hpostesting.presentation.utils.UsbServiceListener
|
import com.example.hpostesting.presentation.utils.UsbServiceListener
|
||||||
import com.example.hpostesting.util.Result
|
import com.example.hpostesting.util.Result
|
||||||
import com.example.hpostesting.util.Result.Success
|
import com.example.hpostesting.util.Result.Success
|
||||||
@@ -51,10 +48,10 @@ import java.util.Locale
|
|||||||
|
|
||||||
class DiagnosticsFragment : Fragment() {
|
class DiagnosticsFragment : Fragment() {
|
||||||
// Initialize variables to store LED DAC values
|
// Initialize variables to store LED DAC values
|
||||||
var led1Dac: Int? = null
|
var led1Dac: Double? = null
|
||||||
var led2Dac: Int? = null
|
var led2Dac: Double? = null
|
||||||
var led3Dac: Int? = null
|
var led3Dac: Double? = null
|
||||||
var led4Dac: Int? = null
|
var led4Dac: Double? = null
|
||||||
private var currentProgress = 0
|
private var currentProgress = 0
|
||||||
private val targetProgress = 95 // Target progress value
|
private val targetProgress = 95 // Target progress value
|
||||||
private val delayBetweenIncrements = 1500
|
private val delayBetweenIncrements = 1500
|
||||||
@@ -190,8 +187,8 @@ class DiagnosticsFragment : Fragment() {
|
|||||||
// data?.let {
|
// data?.let {
|
||||||
// val stringData = String(it)
|
// val stringData = String(it)
|
||||||
// diagnosticsViewModel.messages.postValue(stringData)
|
// diagnosticsViewModel.messages.postValue(stringData)
|
||||||
// binding.tvSubtitle4.text = stringData
|
// binding.tvSubtitle4.text = stringData
|
||||||
// }
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onUsbError(e: Exception?) {
|
override fun onUsbError(e: Exception?) {
|
||||||
@@ -240,7 +237,7 @@ class DiagnosticsFragment : Fragment() {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun listenToHemoCube() {
|
private fun listenToHemoCube() {
|
||||||
diagnosticsViewModel.messages.postValue("Place cuvette filled with buffer\n and click on start")
|
diagnosticsViewModel.messages.postValue("Place cuvette filled with buffer\n and click on start")
|
||||||
val fullReadOutput = StringBuilder()
|
val fullReadOutput = StringBuilder()
|
||||||
startListening.postValue(true)
|
startListening.postValue(true)
|
||||||
@@ -254,7 +251,7 @@ class DiagnosticsFragment : Fragment() {
|
|||||||
fullReadOutput.append(stringData)
|
fullReadOutput.append(stringData)
|
||||||
handleUsbData(stringData)
|
handleUsbData(stringData)
|
||||||
|
|
||||||
// binding.tvSubtitle4.text = resultData
|
// binding.tvSubtitle4.text = resultData
|
||||||
|
|
||||||
// if (stringData.contains("SN")) {
|
// if (stringData.contains("SN")) {
|
||||||
// val slData = stringData.split(" ")
|
// val slData = stringData.split(" ")
|
||||||
@@ -319,7 +316,7 @@ class DiagnosticsFragment : Fragment() {
|
|||||||
private fun handleUsbData(stringData: String) {
|
private fun handleUsbData(stringData: String) {
|
||||||
resultData += stringData
|
resultData += stringData
|
||||||
if (sharedPreferences.getString(Constants.USER_ID, "").toString() == "ADMIN") {
|
if (sharedPreferences.getString(Constants.USER_ID, "").toString() == "ADMIN") {
|
||||||
currentResultData += stringData
|
currentResultData += stringData
|
||||||
}
|
}
|
||||||
|
|
||||||
when {
|
when {
|
||||||
@@ -354,7 +351,7 @@ class DiagnosticsFragment : Fragment() {
|
|||||||
(resultData.contains("#RC") && this.testStatusCode < 1.8) -> {
|
(resultData.contains("#RC") && this.testStatusCode < 1.8) -> {
|
||||||
this.testStatusCode = 1.9
|
this.testStatusCode = 1.9
|
||||||
activity?.runOnUiThread {
|
activity?.runOnUiThread {
|
||||||
finalCalculation()
|
finalCalculation()
|
||||||
setProgress(100)
|
setProgress(100)
|
||||||
binding.progressBarHor.visibility = View.GONE
|
binding.progressBarHor.visibility = View.GONE
|
||||||
currentResultData += "\nIf you are facing any issues while using the device \n Contact us for help at support@sminnovations.in"
|
currentResultData += "\nIf you are facing any issues while using the device \n Contact us for help at support@sminnovations.in"
|
||||||
@@ -383,11 +380,38 @@ class DiagnosticsFragment : Fragment() {
|
|||||||
if (!ledDataMap.containsKey(ledName)) {
|
if (!ledDataMap.containsKey(ledName)) {
|
||||||
ledDataMap[ledName] = mutableListOf()
|
ledDataMap[ledName] = mutableListOf()
|
||||||
}
|
}
|
||||||
if ((ledDataMap[ledName]?.size ?: 0) < 6) {
|
if ((ledDataMap[ledName]?.size ?: 0) < 7) {
|
||||||
ledDataMap[ledName]?.add(xValue to yValue)
|
if(xValue != 0.0){
|
||||||
|
ledDataMap[ledName]?.add(xValue to yValue)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// ledDataMap[ledName]?.add(xValue to yValue)
|
// ledDataMap[ledName]?.add(xValue to yValue)
|
||||||
}
|
}
|
||||||
|
// var valuesAdded = 0 // Track the number of values added
|
||||||
|
//
|
||||||
|
// for (match in matches) {
|
||||||
|
// val ledName = match.groupValues[1]
|
||||||
|
// val xValue = match.groupValues[2].toDouble()
|
||||||
|
// val yValue = match.groupValues[3].toDouble()
|
||||||
|
//
|
||||||
|
// // Add x and y values to the corresponding lists based on the LED name
|
||||||
|
// if (!ledDataMap.containsKey(ledName)) {
|
||||||
|
// ledDataMap[ledName] = mutableListOf()
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// // Check if we have already added one value, then add the next six
|
||||||
|
// if (valuesAdded > 0 && (ledDataMap[ledName]?.size ?: 0) < 6) {
|
||||||
|
// ledDataMap[ledName]?.add(xValue to yValue)
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// // Increase the count of values added
|
||||||
|
// valuesAdded++
|
||||||
|
//
|
||||||
|
// // Break the loop if we have added 6 values
|
||||||
|
// if (valuesAdded >= 7) {
|
||||||
|
// break
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
// String array to store pass or fail messages for each LED
|
// String array to store pass or fail messages for each LED
|
||||||
val results = mutableListOf<String>()
|
val results = mutableListOf<String>()
|
||||||
@@ -401,7 +425,7 @@ class DiagnosticsFragment : Fragment() {
|
|||||||
// Find LED DAC values using regex
|
// Find LED DAC values using regex
|
||||||
regex.findAll(resultData).forEach {
|
regex.findAll(resultData).forEach {
|
||||||
val (led, dac) = it.destructured
|
val (led, dac) = it.destructured
|
||||||
val dacValue = dac.toInt()
|
val dacValue = dac.toDouble()
|
||||||
|
|
||||||
when (led.toInt()) {
|
when (led.toInt()) {
|
||||||
1 -> led1Dac = dacValue
|
1 -> led1Dac = dacValue
|
||||||
@@ -446,12 +470,20 @@ class DiagnosticsFragment : Fragment() {
|
|||||||
// Calculation for ADC value
|
// Calculation for ADC value
|
||||||
val adcValue = when (ledName) {
|
val adcValue = when (ledName) {
|
||||||
"LED:1" -> 22000.0
|
"LED:1" -> 22000.0
|
||||||
"LED:2", "LED:3" -> 18000.0
|
"LED:2"-> 18000.0
|
||||||
|
"LED:3" -> 18000.0
|
||||||
"LED:4" -> 22000.0
|
"LED:4" -> 22000.0
|
||||||
else -> 0.0
|
else -> 0.0
|
||||||
}
|
}
|
||||||
|
val ledValue = when (ledName) {
|
||||||
|
"LED:1" -> led1Dac
|
||||||
|
"LED:2" -> led2Dac
|
||||||
|
"LED:3" -> led3Dac
|
||||||
|
"LED:4" -> led4Dac
|
||||||
|
else -> 0.0
|
||||||
|
}
|
||||||
val dacValue = calculateDAC(adcValue, slope, constant)
|
val dacValue = calculateDAC(adcValue, slope, constant)
|
||||||
val resultDAC = dacValue - led1Dac!!
|
val resultDAC = dacValue - ledValue!!
|
||||||
if(resultDAC < 200){
|
if(resultDAC < 200){
|
||||||
currentResultData += "$ledName DAC LEVEL PASS (✓)\n"
|
currentResultData += "$ledName DAC LEVEL PASS (✓)\n"
|
||||||
println("$ledName DAC LEVEL PASS")
|
println("$ledName DAC LEVEL PASS")
|
||||||
@@ -464,7 +496,7 @@ class DiagnosticsFragment : Fragment() {
|
|||||||
return message
|
return message
|
||||||
}
|
}
|
||||||
|
|
||||||
fun calculateDAC(adc: Double, slope: Double, constant: Double): Double {
|
private fun calculateDAC(adc: Double, slope: Double, constant: Double): Double {
|
||||||
return (adc - constant) / slope
|
return (adc - constant) / slope
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -13,10 +13,6 @@
|
|||||||
|
|
||||||
package com.example.hpostesting.presentation.diagnostics
|
package com.example.hpostesting.presentation.diagnostics
|
||||||
|
|
||||||
import android.content.Context
|
|
||||||
import android.content.Intent
|
|
||||||
import android.content.IntentFilter
|
|
||||||
import android.os.BatteryManager
|
|
||||||
import androidx.lifecycle.MutableLiveData
|
import androidx.lifecycle.MutableLiveData
|
||||||
import androidx.lifecycle.ViewModel
|
import androidx.lifecycle.ViewModel
|
||||||
import androidx.lifecycle.viewModelScope
|
import androidx.lifecycle.viewModelScope
|
||||||
@@ -34,7 +30,7 @@ import javax.inject.Inject
|
|||||||
@HiltViewModel
|
@HiltViewModel
|
||||||
class DiagnosticsViewModel @Inject constructor(
|
class DiagnosticsViewModel @Inject constructor(
|
||||||
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)
|
||||||
@@ -43,10 +39,10 @@ class DiagnosticsViewModel @Inject constructor(
|
|||||||
val deviceData = MutableLiveData<DeviceData?>()
|
val deviceData = MutableLiveData<DeviceData?>()
|
||||||
val fireBaseUpload = MutableLiveData<String>()
|
val fireBaseUpload = MutableLiveData<String>()
|
||||||
val deviceDiagnosticsResponse = MutableLiveData<Result<DeviceDiagnosticsResponse>>()
|
val deviceDiagnosticsResponse = MutableLiveData<Result<DeviceDiagnosticsResponse>>()
|
||||||
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 addDiagnosticsDataToDb(data: DiagnosticsData) {
|
fun addDiagnosticsDataToDb(data: DiagnosticsData) {
|
||||||
viewModelScope.launch {
|
viewModelScope.launch {
|
||||||
try {
|
try {
|
||||||
@@ -79,71 +75,71 @@ class DiagnosticsViewModel @Inject constructor(
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
fun getBatteryLevel(): Float? {
|
// fun getBatteryLevel(): Float? {
|
||||||
val batteryPct: Float? = batteryStatus?.let { intent ->
|
// val batteryPct: Float? = batteryStatus?.let { intent ->
|
||||||
val level: Int =
|
// val level: Int =
|
||||||
intent.getIntExtra(
|
// intent.getIntExtra(
|
||||||
BatteryManager.EXTRA_LEVEL,
|
// BatteryManager.EXTRA_LEVEL,
|
||||||
-1
|
// -1
|
||||||
)
|
// )
|
||||||
val scale: Int =
|
// val scale: Int =
|
||||||
intent.getIntExtra(
|
// intent.getIntExtra(
|
||||||
BatteryManager.EXTRA_SCALE,
|
// BatteryManager.EXTRA_SCALE,
|
||||||
-1
|
// -1
|
||||||
)
|
// )
|
||||||
level * 100 / scale.toFloat()
|
// level * 100 / scale.toFloat()
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
return batteryPct
|
// return batteryPct
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
fun getBatteryTemperature(): Float? {
|
// fun getBatteryTemperature(): Float? {
|
||||||
val batteryTemp: Float? = batteryStatus?.let { intent ->
|
// val batteryTemp: Float? = batteryStatus?.let { intent ->
|
||||||
val temperature = intent.getIntExtra(
|
// val temperature = intent.getIntExtra(
|
||||||
BatteryManager.EXTRA_TEMPERATURE,
|
// BatteryManager.EXTRA_TEMPERATURE,
|
||||||
0
|
// 0
|
||||||
)
|
// )
|
||||||
temperature.toFloat() / 10
|
// temperature.toFloat() / 10
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
return batteryTemp
|
// return batteryTemp
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
fun getBatteryVoltage(context: Context): Float {
|
// fun getBatteryVoltage(context: Context): Float {
|
||||||
val batteryIntent =
|
// val batteryIntent =
|
||||||
context.registerReceiver(
|
// context.registerReceiver(
|
||||||
null,
|
// null,
|
||||||
IntentFilter(Intent.ACTION_BATTERY_CHANGED)
|
// IntentFilter(Intent.ACTION_BATTERY_CHANGED)
|
||||||
)
|
// )
|
||||||
val voltage = batteryIntent?.getIntExtra(
|
// val voltage = batteryIntent?.getIntExtra(
|
||||||
BatteryManager.EXTRA_VOLTAGE,
|
// BatteryManager.EXTRA_VOLTAGE,
|
||||||
0
|
// 0
|
||||||
) ?: 0
|
// ) ?: 0
|
||||||
|
//
|
||||||
// milli-volts to volts
|
// // milli-volts to volts
|
||||||
return voltage.toFloat() / 1000
|
// return voltage.toFloat() / 1000
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
|
//
|
||||||
fun getBatteryCapacity(context: Context): Int {
|
// fun getBatteryCapacity(context: Context): Int {
|
||||||
val batteryManager =
|
// val batteryManager =
|
||||||
context.getSystemService(Context.BATTERY_SERVICE) as BatteryManager
|
// context.getSystemService(Context.BATTERY_SERVICE) as BatteryManager
|
||||||
val currentCapacity =
|
// val currentCapacity =
|
||||||
batteryManager.getIntProperty(BatteryManager.BATTERY_PROPERTY_CHARGE_COUNTER)
|
// batteryManager.getIntProperty(BatteryManager.BATTERY_PROPERTY_CHARGE_COUNTER)
|
||||||
|
//
|
||||||
return currentCapacity
|
// return currentCapacity
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
fun getBatteryMaxCapacity(context: Context): Float {
|
// fun getBatteryMaxCapacity(context: Context): Float {
|
||||||
val batteryManager = context.getSystemService(Context.BATTERY_SERVICE) as BatteryManager
|
// val batteryManager = context.getSystemService(Context.BATTERY_SERVICE) as BatteryManager
|
||||||
val designCapacity =
|
// val designCapacity =
|
||||||
batteryManager.getIntProperty(BatteryManager.BATTERY_PROPERTY_CAPACITY)
|
// batteryManager.getIntProperty(BatteryManager.BATTERY_PROPERTY_CAPACITY)
|
||||||
val currentCapacity =
|
// val currentCapacity =
|
||||||
batteryManager.getIntProperty(BatteryManager.BATTERY_PROPERTY_CHARGE_COUNTER)
|
// batteryManager.getIntProperty(BatteryManager.BATTERY_PROPERTY_CHARGE_COUNTER)
|
||||||
|
//
|
||||||
// Calculate the estimated maximum battery capacity in mAh
|
// // Calculate the estimated maximum battery capacity in mAh
|
||||||
val maxCapacity = currentCapacity.toFloat() / designCapacity.toFloat() * 100
|
// val maxCapacity = currentCapacity.toFloat() / designCapacity.toFloat() * 100
|
||||||
|
//
|
||||||
return maxCapacity
|
// return maxCapacity
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,207 @@
|
|||||||
|
/*
|
||||||
|
* // Copyright (c) 2024 ShanMukha Innovations Pvt. Ltd. All rights reserved.
|
||||||
|
* // Notice: All information contained herein is, and remains
|
||||||
|
* // the property of ShanMukha Innovations Pvt. Ltd. and its suppliers,
|
||||||
|
* // if any. The intellectual and technical concepts contained
|
||||||
|
* // herein are proprietary to ShanMukha Innovations Pvt. Ltd.
|
||||||
|
* // and its suppliers and may be covered by Indian and Foreign Patents,
|
||||||
|
* // patents in process, and are protected by trade secret or copyright law.
|
||||||
|
* // Dissemination of this information or reproduction of this material
|
||||||
|
* // is strictly forbidden unless prior written permission is obtained
|
||||||
|
* // from ShanMukha Innovations Pvt. Ltd.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.example.hpostesting.presentation.hb_test
|
||||||
|
|
||||||
|
import android.annotation.SuppressLint
|
||||||
|
import android.app.PendingIntent
|
||||||
|
import android.content.BroadcastReceiver
|
||||||
|
import android.content.ComponentName
|
||||||
|
import android.content.Context
|
||||||
|
import android.content.Intent
|
||||||
|
import android.content.IntentFilter
|
||||||
|
import android.content.ServiceConnection
|
||||||
|
import android.hardware.usb.UsbDevice
|
||||||
|
import android.hardware.usb.UsbDeviceConnection
|
||||||
|
import android.hardware.usb.UsbManager
|
||||||
|
import android.os.Bundle
|
||||||
|
import android.os.IBinder
|
||||||
|
import android.util.Log
|
||||||
|
import android.view.Menu
|
||||||
|
import android.widget.Toast
|
||||||
|
import androidx.activity.viewModels
|
||||||
|
import androidx.appcompat.app.AppCompatActivity
|
||||||
|
import androidx.core.content.ContextCompat
|
||||||
|
import androidx.core.view.get
|
||||||
|
import com.example.hpostesting.data.constant.Constants
|
||||||
|
import com.example.hpostesting.data.constant.DataHolder
|
||||||
|
import com.example.hpostesting.data.constant.LanguageManager
|
||||||
|
import com.example.hpostesting.data.repository.DatabaseRepository
|
||||||
|
import com.example.hpostesting.firebase.FirebaseManager
|
||||||
|
import com.example.hpostesting.util.UsbService
|
||||||
|
import com.hoho.android.usbserial.driver.UsbSerialDriver
|
||||||
|
import com.hoho.android.usbserial.driver.UsbSerialProber
|
||||||
|
import dagger.hilt.android.AndroidEntryPoint
|
||||||
|
import `in`.sminnovations.hpostesting.R
|
||||||
|
import `in`.sminnovations.hpostesting.databinding.ActivityHbTestBinding
|
||||||
|
import javax.inject.Inject
|
||||||
|
|
||||||
|
@AndroidEntryPoint
|
||||||
|
class HBTestActivity : AppCompatActivity() {
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
lateinit var databaseRepository: DatabaseRepository
|
||||||
|
private lateinit var binding: ActivityHbTestBinding
|
||||||
|
val viewModel: HBTestViewModel by viewModels()
|
||||||
|
private var myMenu: Menu? = null
|
||||||
|
|
||||||
|
private lateinit var mDriver: UsbSerialDriver
|
||||||
|
private var mConnection: UsbDeviceConnection? = null
|
||||||
|
lateinit var mService: UsbService
|
||||||
|
|
||||||
|
private val TAG = "HemoCube"
|
||||||
|
|
||||||
|
private val broadcastReceiver = object : BroadcastReceiver() {
|
||||||
|
override fun onReceive(context: Context, intent: Intent) {
|
||||||
|
|
||||||
|
synchronized(this) {
|
||||||
|
val device: UsbDevice? = intent.getParcelableExtra(UsbManager.EXTRA_DEVICE)
|
||||||
|
|
||||||
|
if (intent.getBooleanExtra(UsbManager.EXTRA_PERMISSION_GRANTED, false)) {
|
||||||
|
device?.apply {
|
||||||
|
connectUsb(true)
|
||||||
|
DataHolder.usbConnected.postValue(true)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
onErrorReported("permission denied for device")
|
||||||
|
DataHolder.usbConnected.postValue(true)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private val connection = object : ServiceConnection {
|
||||||
|
override fun onServiceConnected(className: ComponentName, service: IBinder) {
|
||||||
|
val binder = service as UsbService.UsbServiceBinder
|
||||||
|
mService = binder.getService()
|
||||||
|
viewModel.isServiceConnected = true
|
||||||
|
mConnection.let { mService.connect(mDriver, mConnection!!) }
|
||||||
|
moveToNext()
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onServiceDisconnected(arg0: ComponentName) {
|
||||||
|
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?) {
|
||||||
|
super.onCreate(savedInstanceState)
|
||||||
|
val firebaseManager = FirebaseManager(this)
|
||||||
|
val lastSelectedServer = firebaseManager.getLastSelectedServer()
|
||||||
|
// switchFirebaseServer(lastSelectedServer)
|
||||||
|
Log.d("CURRENT SERVR......","server : ${lastSelectedServer.serverName}")
|
||||||
|
binding = ActivityHbTestBinding.inflate(layoutInflater)
|
||||||
|
setContentView(binding.root)
|
||||||
|
// setSupportActionBar(binding.myToolbar)
|
||||||
|
supportActionBar?.setDisplayHomeAsUpEnabled(true)
|
||||||
|
setupListener()
|
||||||
|
connectUsb(false)
|
||||||
|
|
||||||
|
}
|
||||||
|
// private fun switchFirebaseServer(config: FirebaseConfig) {
|
||||||
|
// val (newFirestore, newStorage) = firebaseManager.switchFirestoreServer(config)
|
||||||
|
// databaseRepository.switchServer(newFirestore, newStorage)
|
||||||
|
//// Toast.makeText(this, "server switched", Toast.LENGTH_SHORT).show()// Update repository with new Firestore and Storage
|
||||||
|
// }
|
||||||
|
private fun setupListener() {
|
||||||
|
DataHolder.usbConnected.observe(this) {
|
||||||
|
Log.d("USB OBSERVE", "HemoCube called -> $it")
|
||||||
|
if (it) {
|
||||||
|
myMenu?.get(0)?.icon =
|
||||||
|
ContextCompat.getDrawable(this, R.drawable.ic_baseline_usb_24)
|
||||||
|
} else {
|
||||||
|
myMenu?.get(0)?.icon =
|
||||||
|
ContextCompat.getDrawable(this, R.drawable.ic_baseline_usb_off_24)
|
||||||
|
Toast.makeText(this, "Device is Disconnected", Toast.LENGTH_SHORT).show()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
open fun connectUsb(permissionGranted: Boolean) {
|
||||||
|
Log.d(TAG, "connectUsb() called, permission variable = $permissionGranted")
|
||||||
|
val manager = getSystemService(Context.USB_SERVICE) as UsbManager
|
||||||
|
val availableDrivers = UsbSerialProber.getDefaultProber().findAllDrivers(manager)
|
||||||
|
|
||||||
|
if (availableDrivers.isEmpty()) {
|
||||||
|
onErrorReported("No Device is Connected")
|
||||||
|
} else {
|
||||||
|
mDriver = availableDrivers[0]
|
||||||
|
mConnection = manager.openDevice(mDriver.device)
|
||||||
|
|
||||||
|
if (mConnection == null) {
|
||||||
|
requestUserPermission(manager, mDriver.device)
|
||||||
|
} else {
|
||||||
|
setupService()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun onErrorReported(msg: String) {
|
||||||
|
Toast.makeText(this, msg, Toast.LENGTH_SHORT).show()
|
||||||
|
if (!isFinishing) onBackPressed()
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private fun moveToNext() {
|
||||||
|
if (supportFragmentManager.isDestroyed) return
|
||||||
|
|
||||||
|
supportFragmentManager.beginTransaction().replace(binding.fgHbTest.id, HBTestFragment())
|
||||||
|
.commit()
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressLint("MutableImplicitPendingIntent")
|
||||||
|
private fun requestUserPermission(manager: UsbManager, device: UsbDevice) {
|
||||||
|
val mPendingIntent: PendingIntent
|
||||||
|
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.S) {
|
||||||
|
mPendingIntent = PendingIntent.getBroadcast(
|
||||||
|
this, 0, Intent(Constants.HEMOCUBE_USB_PERMISSION), PendingIntent.FLAG_MUTABLE
|
||||||
|
)
|
||||||
|
} else {
|
||||||
|
mPendingIntent = PendingIntent.getBroadcast(
|
||||||
|
this,
|
||||||
|
0,
|
||||||
|
Intent(Constants.HEMOCUBE_USB_PERMISSION),
|
||||||
|
PendingIntent.FLAG_ONE_SHOT or PendingIntent.FLAG_IMMUTABLE
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
val filter = IntentFilter(Constants.HEMOCUBE_USB_PERMISSION)
|
||||||
|
registerReceiver(broadcastReceiver, filter)
|
||||||
|
manager.requestPermission(device, mPendingIntent)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun setupService() {
|
||||||
|
val intent = Intent(this, UsbService::class.java)
|
||||||
|
bindService(intent, connection, Context.BIND_AUTO_CREATE)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onCreateOptionsMenu(menu: Menu?): Boolean {
|
||||||
|
menuInflater.inflate(R.menu.my_menu, menu)
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onDestroy() {
|
||||||
|
super.onDestroy()
|
||||||
|
if (viewModel.isServiceConnected) {
|
||||||
|
mService.disconnect()
|
||||||
|
unbindService(connection)
|
||||||
|
viewModel.isServiceConnected = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,399 @@
|
|||||||
|
/*
|
||||||
|
* // Copyright (c) 2024 ShanMukha Innovations Pvt. Ltd. All rights reserved.
|
||||||
|
* // Notice: All information contained herein is, and remains
|
||||||
|
* // the property of ShanMukha Innovations Pvt. Ltd. and its suppliers,
|
||||||
|
* // if any. The intellectual and technical concepts contained
|
||||||
|
* // herein are proprietary to ShanMukha Innovations Pvt. Ltd.
|
||||||
|
* // and its suppliers and may be covered by Indian and Foreign Patents,
|
||||||
|
* // patents in process, and are protected by trade secret or copyright law.
|
||||||
|
* // Dissemination of this information or reproduction of this material
|
||||||
|
* // is strictly forbidden unless prior written permission is obtained
|
||||||
|
* // from ShanMukha Innovations Pvt. Ltd.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.example.hpostesting.presentation.hb_test
|
||||||
|
|
||||||
|
import android.content.Context
|
||||||
|
import android.content.SharedPreferences
|
||||||
|
import android.os.Bundle
|
||||||
|
import android.text.method.ScrollingMovementMethod
|
||||||
|
import android.view.LayoutInflater
|
||||||
|
import android.view.View
|
||||||
|
import android.view.ViewGroup
|
||||||
|
import android.widget.Toast
|
||||||
|
import androidx.fragment.app.Fragment
|
||||||
|
import androidx.fragment.app.activityViewModels
|
||||||
|
import androidx.lifecycle.MutableLiveData
|
||||||
|
import com.example.hpostesting.data.constant.Constants
|
||||||
|
import com.example.hpostesting.data.constant.DataHolder
|
||||||
|
import com.example.hpostesting.data.constant.HemoCubeCommands
|
||||||
|
import com.example.hpostesting.data.model.diagnostics.DiagnosticsData
|
||||||
|
import com.example.hpostesting.data.model.patient.DeviceData
|
||||||
|
import com.example.hpostesting.data.model.patient.HemoCubeTestData
|
||||||
|
import com.example.hpostesting.presentation.utils.UsbServiceListener
|
||||||
|
import com.google.firebase.crashlytics.ktx.crashlytics
|
||||||
|
import com.google.firebase.ktx.Firebase
|
||||||
|
import `in`.sminnovations.hpostesting.R
|
||||||
|
import `in`.sminnovations.hpostesting.databinding.FragmentAutoDacBinding
|
||||||
|
import `in`.sminnovations.hpostesting.databinding.FragmentHbTestBinding
|
||||||
|
import java.text.SimpleDateFormat
|
||||||
|
import java.util.Calendar
|
||||||
|
import java.util.Locale
|
||||||
|
import kotlin.math.log10
|
||||||
|
|
||||||
|
class HBTestFragment : Fragment() {
|
||||||
|
private var isUsingExistingBuffer = false
|
||||||
|
private var led1Average = 0.0
|
||||||
|
private var led3Average = 0.0
|
||||||
|
private var led2Average = 0.0
|
||||||
|
private var led4Average = 0.0
|
||||||
|
private var led1SampleForDevice = 0.0
|
||||||
|
private var led2SampleForDevice = 0.0
|
||||||
|
private var led3SampleForDevice = 0.0
|
||||||
|
private var led4SampleForDevice = 0.0
|
||||||
|
private var led1BufferForDevice = 0.0
|
||||||
|
private var led2BufferForDevice = 0.0
|
||||||
|
private var led3BufferForDevice = 0.0
|
||||||
|
private var led4BufferForDevice = 0.0
|
||||||
|
private var x = 0.0
|
||||||
|
private var deviceId = ""
|
||||||
|
private var hbEst = 0.0
|
||||||
|
private var testStatusCode = 0.0
|
||||||
|
private var testDetails: HemoCubeTestData = HemoCubeTestData()
|
||||||
|
private lateinit var binding: FragmentHbTestBinding
|
||||||
|
private val hBTestViewModel: HBTestViewModel by activityViewModels()
|
||||||
|
private lateinit var sharedPreferences: SharedPreferences
|
||||||
|
private var currentDeviceData: DeviceData? = null
|
||||||
|
private var resultData: String = ""
|
||||||
|
// private val messages = MutableLiveData<String>()
|
||||||
|
private var startListening = MutableLiveData(false)
|
||||||
|
|
||||||
|
override fun onCreateView(
|
||||||
|
inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?,
|
||||||
|
): View {
|
||||||
|
binding = FragmentHbTestBinding.inflate(inflater, container, false)
|
||||||
|
sharedPreferences =
|
||||||
|
requireContext().getSharedPreferences("HEMOCUBE", Context.MODE_PRIVATE)
|
||||||
|
return binding.root
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||||
|
super.onViewCreated(view, savedInstanceState)
|
||||||
|
initViews()
|
||||||
|
observeViewModel()
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun initViews() {
|
||||||
|
binding.btnSubmit.visibility = View.GONE
|
||||||
|
listenToHemoCube()
|
||||||
|
getDeviceId()
|
||||||
|
binding.tvSubtitle4.movementMethod = ScrollingMovementMethod()
|
||||||
|
binding.btnSubmit.setOnClickListener {
|
||||||
|
hBTestViewModel.messages.postValue(resultData)
|
||||||
|
binding.btnSubmit.visibility = View.GONE
|
||||||
|
testDetails.localFlag = false
|
||||||
|
testDetails.testStatus = true
|
||||||
|
testDetails.deviceId = deviceId
|
||||||
|
testDetails._id = DataHolder.sampleId
|
||||||
|
testDetails.kitSerial = DataHolder.kitSerial
|
||||||
|
testDetails.classificationResult = "HB: $hbEst"
|
||||||
|
testDetails.hb3 = x
|
||||||
|
testDetails.hb4 = hbEst
|
||||||
|
testDetails.age = DataHolder.age
|
||||||
|
testDetails.bloodGroup = DataHolder.bloodGroup
|
||||||
|
testDetails.led1Buffer = led1BufferForDevice
|
||||||
|
testDetails.led2Buffer = led2BufferForDevice
|
||||||
|
testDetails.led3Buffer = led3BufferForDevice
|
||||||
|
testDetails.led4Buffer = led4BufferForDevice
|
||||||
|
testDetails.led1Sample = led1SampleForDevice
|
||||||
|
testDetails.led2Sample = led2SampleForDevice
|
||||||
|
testDetails.led3Sample = led3SampleForDevice
|
||||||
|
testDetails.led4Sample = led4SampleForDevice
|
||||||
|
testDetails.led1Average = led1Average
|
||||||
|
testDetails.led2Average = led2Average
|
||||||
|
testDetails.led3Average = led3Average
|
||||||
|
testDetails.led4Average = led4Average
|
||||||
|
testDetails.testType = "HB Est"
|
||||||
|
testDetails.testTime = SimpleDateFormat(
|
||||||
|
"yyyy-MM-dd HH:mm:ss", Locale.getDefault()
|
||||||
|
).format(Calendar.getInstance().time)
|
||||||
|
hBTestViewModel.uploadFirebaseQc(testDetails)
|
||||||
|
}
|
||||||
|
binding.btnBuffer.setOnClickListener {
|
||||||
|
binding.btnBuffer.visibility = View.GONE
|
||||||
|
binding.btnSample.isEnabled = false
|
||||||
|
binding.btnSample.isClickable = false
|
||||||
|
hBTestViewModel.messages.postValue("Buffer Started")
|
||||||
|
runBCommand()
|
||||||
|
}
|
||||||
|
binding.btnSample.setOnClickListener {
|
||||||
|
hBTestViewModel.messages.postValue("Sample Started")
|
||||||
|
binding.btnSample.visibility = View.GONE
|
||||||
|
binding.btnBuffer.visibility = View.GONE
|
||||||
|
runSCommand()
|
||||||
|
}
|
||||||
|
if (isBufferValueAvailable()) {
|
||||||
|
isUsingExistingBuffer = true
|
||||||
|
binding.btnBuffer.text = "Refresh Buffer"
|
||||||
|
binding.btnSample.isEnabled = true
|
||||||
|
binding.btnSample.isClickable = true
|
||||||
|
}else{
|
||||||
|
binding.btnBuffer.text = "Start Buffer"
|
||||||
|
binding.btnSample.isEnabled = false
|
||||||
|
binding.btnSample.isClickable = false
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun observeViewModel() {
|
||||||
|
|
||||||
|
hBTestViewModel.deviceData.observe(viewLifecycleOwner) {
|
||||||
|
currentDeviceData = it
|
||||||
|
}
|
||||||
|
|
||||||
|
hBTestViewModel.messages.observe(viewLifecycleOwner) {
|
||||||
|
binding.tvSubtitle4.text = it
|
||||||
|
}
|
||||||
|
|
||||||
|
hBTestViewModel.fireBaseUpload.observe(viewLifecycleOwner) { result ->
|
||||||
|
if (result == "Success") {
|
||||||
|
showToast("Data uploaded successfully")
|
||||||
|
requireActivity().finish()
|
||||||
|
}
|
||||||
|
if (result == "Local") {
|
||||||
|
showToast("Data uploading failed, note it down manually")
|
||||||
|
}
|
||||||
|
|
||||||
|
binding.progressBar.visibility = View.GONE
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun getDeviceId() {
|
||||||
|
hBTestViewModel.progressBar.postValue(true)
|
||||||
|
(activity as HBTestActivity).mService.sendAndListenToHemoCube(
|
||||||
|
HemoCubeCommands.DEVICE_CONFIGURATION_COMMAND,
|
||||||
|
object : UsbServiceListener {
|
||||||
|
override fun onUsbRead(data: ByteArray?) {
|
||||||
|
data?.let {
|
||||||
|
val stringData = String(it)
|
||||||
|
//deviceId = stringData
|
||||||
|
hBTestViewModel.messages.postValue(stringData)
|
||||||
|
binding.tvSubtitle4.text = stringData
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onUsbError(e: Exception?) {
|
||||||
|
hBTestViewModel.progressBar.postValue(false)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
private fun runBCommand() {
|
||||||
|
hBTestViewModel.progressBar.postValue(true)
|
||||||
|
(activity as HBTestActivity).mService.sendAndListenToHemoCube(
|
||||||
|
HemoCubeCommands.START_BUFFER_COMMAND,
|
||||||
|
object : UsbServiceListener {
|
||||||
|
override fun onUsbRead(data: ByteArray?) {
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onUsbError(e: Exception?) {
|
||||||
|
hBTestViewModel.progressBar.postValue(false)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
private fun runSCommand() {
|
||||||
|
hBTestViewModel.progressBar.postValue(true)
|
||||||
|
(activity as HBTestActivity).mService.sendAndListenToHemoCube(
|
||||||
|
HemoCubeCommands.START_SAMPLE,
|
||||||
|
object : UsbServiceListener {
|
||||||
|
override fun onUsbRead(data: ByteArray?) {
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onUsbError(e: Exception?) {
|
||||||
|
hBTestViewModel.progressBar.postValue(false)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
private fun runPCommand() {
|
||||||
|
hBTestViewModel.progressBar.postValue(true)
|
||||||
|
(activity as HBTestActivity).mService.sendAndListenToHemoCube(
|
||||||
|
HemoCubeCommands.PRINT_COMMAND,
|
||||||
|
object : UsbServiceListener {
|
||||||
|
override fun onUsbRead(data: ByteArray?) {
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onUsbError(e: Exception?) {
|
||||||
|
hBTestViewModel.progressBar.postValue(false)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
fun extractV2HardwareId(input: String): String? {
|
||||||
|
val pattern = Regex("SNS\\s*(.*?)\\s*SNE")
|
||||||
|
val matchResult: MatchResult? = pattern.find(input)
|
||||||
|
|
||||||
|
return matchResult?.groups?.get(1)?.value
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun listenToHemoCube() {
|
||||||
|
|
||||||
|
val fullReadOutput = StringBuilder()
|
||||||
|
startListening.postValue(true)
|
||||||
|
|
||||||
|
try {
|
||||||
|
(activity as HBTestActivity).mService.listenToHemoCube(object :
|
||||||
|
UsbServiceListener {
|
||||||
|
override fun onUsbRead(data: ByteArray?) {
|
||||||
|
data?.let {
|
||||||
|
val stringData = String(it)
|
||||||
|
fullReadOutput.append(stringData)
|
||||||
|
resultData += stringData
|
||||||
|
hBTestViewModel.messages.postValue(resultData)
|
||||||
|
// binding.tvSubtitle4.text = resultData
|
||||||
|
if (stringData.contains("SNE")) {
|
||||||
|
val slData = stringData.split(" ")
|
||||||
|
if (slData.size > 1) {
|
||||||
|
val hardwareId = slData[1].trim()
|
||||||
|
deviceId = extractV2HardwareId(resultData).toString()
|
||||||
|
hBTestViewModel.messages.postValue("Place buffer and click below button to start test")
|
||||||
|
// with(sharedPreferences.edit()) {
|
||||||
|
// putString(Constants.DEVICE_ID, hardwareId)
|
||||||
|
// apply()
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
activity?.runOnUiThread {
|
||||||
|
binding.btnBuffer.visibility = View.VISIBLE
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (resultData.contains("#BC") && testStatusCode < 1.0) {
|
||||||
|
testStatusCode = 1.1
|
||||||
|
resultData += getString(R.string.buffer_completed)
|
||||||
|
hBTestViewModel.messages.postValue(resultData)
|
||||||
|
activity?.runOnUiThread {
|
||||||
|
binding.btnSample.visibility = View.VISIBLE
|
||||||
|
binding.btnSample.isEnabled = true
|
||||||
|
binding.btnSample.isClickable = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (resultData.contains("#SC") && testStatusCode < 1.3) {
|
||||||
|
testStatusCode = 1.4
|
||||||
|
resultData +=getString(R.string.sample_completed) + "\n" + getString(R.string.gathering_data)
|
||||||
|
hBTestViewModel.messages.postValue(resultData)
|
||||||
|
activity?.runOnUiThread {
|
||||||
|
binding.btnSubmit.visibility = View.VISIBLE
|
||||||
|
runPCommand()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (resultData.contains("REND") && testStatusCode < 1.5) {
|
||||||
|
testStatusCode = 1.6
|
||||||
|
runResult()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onUsbError(e: Exception?) {
|
||||||
|
hBTestViewModel.progressBar.postValue(false)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
} catch (e: Exception) {
|
||||||
|
Firebase.crashlytics.recordException(e)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun runResult() {
|
||||||
|
resultData += "\nFetching results...\n"
|
||||||
|
hBTestViewModel.messages.postValue(resultData)
|
||||||
|
|
||||||
|
val resultLines = resultData.split("\\s+(?=LB|LS)".toRegex())
|
||||||
|
var bufferIntensity = resultLines[1].split(' ')[1].trim()
|
||||||
|
led1BufferForDevice = if (isUsingExistingBuffer) {
|
||||||
|
sharedPreferences.getString(Constants.BUFFER_VALUE_1, "")?.toDoubleOrNull()!!
|
||||||
|
} else {
|
||||||
|
bufferIntensity.toDoubleOrNull()!!
|
||||||
|
}
|
||||||
|
|
||||||
|
bufferIntensity = resultLines[2].split(' ')[1].trim()
|
||||||
|
led2BufferForDevice = if (isUsingExistingBuffer) {
|
||||||
|
sharedPreferences.getString(Constants.BUFFER_VALUE_2, "")?.toDoubleOrNull()!!
|
||||||
|
} else {
|
||||||
|
bufferIntensity.toDoubleOrNull()!!
|
||||||
|
}
|
||||||
|
|
||||||
|
bufferIntensity = resultLines[3].split(' ')[1].trim()
|
||||||
|
led3BufferForDevice = if (isUsingExistingBuffer) {
|
||||||
|
sharedPreferences.getString(Constants.BUFFER_VALUE_3, "")?.toDoubleOrNull()!!
|
||||||
|
} else {
|
||||||
|
bufferIntensity.toDoubleOrNull()!!
|
||||||
|
}
|
||||||
|
|
||||||
|
bufferIntensity = resultLines[4].split(' ')[1].trim()
|
||||||
|
led4BufferForDevice = if (isUsingExistingBuffer) {
|
||||||
|
sharedPreferences.getString(Constants.BUFFER_VALUE_4, "")?.toDoubleOrNull()!!
|
||||||
|
} else {
|
||||||
|
bufferIntensity.toDoubleOrNull()!!
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
led1SampleForDevice = resultLines[5].split(' ')[1].trim().toDoubleOrNull()!!
|
||||||
|
led2SampleForDevice = resultLines[6].split(' ')[1].trim().toDoubleOrNull()!!
|
||||||
|
led3SampleForDevice = resultLines[7].split(' ')[1].trim().toDoubleOrNull()!!
|
||||||
|
led4SampleForDevice = resultLines[8].split(' ')[1].split('\r')[0].trim().toDoubleOrNull()!!
|
||||||
|
|
||||||
|
led1Average = log10(led1BufferForDevice.div(led1SampleForDevice))
|
||||||
|
led2Average = log10(led2BufferForDevice.div(led2SampleForDevice))
|
||||||
|
led3Average = log10(led3BufferForDevice.div(led3SampleForDevice))
|
||||||
|
led4Average = log10(led4BufferForDevice.div(led4SampleForDevice))
|
||||||
|
|
||||||
|
x = led1Average - led3Average
|
||||||
|
|
||||||
|
hbEst = (7.347 * x * x) + (12.704 * x) + 0.9033
|
||||||
|
|
||||||
|
resultData +="\n Result: HB EST: $hbEst"
|
||||||
|
if (!isUsingExistingBuffer) {
|
||||||
|
with(sharedPreferences.edit()) {
|
||||||
|
putString(Constants.BUFFER_VALUE_1, led1BufferForDevice.toString())
|
||||||
|
putString(Constants.BUFFER_VALUE_2, led2BufferForDevice.toString())
|
||||||
|
putString(Constants.BUFFER_VALUE_3, led3BufferForDevice.toString())
|
||||||
|
putString(Constants.BUFFER_VALUE_4, led4BufferForDevice.toString())
|
||||||
|
apply()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
hBTestViewModel.messages.postValue(resultData)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
private fun showToast(message: String) {
|
||||||
|
Toast.makeText(requireContext(), message, Toast.LENGTH_SHORT).show()
|
||||||
|
}
|
||||||
|
private fun isBufferValueAvailable(): Boolean {
|
||||||
|
return try {
|
||||||
|
if (sharedPreferences.getString(
|
||||||
|
Constants.BUFFER_VALUE_1, ""
|
||||||
|
) != "" && sharedPreferences.getString(Constants.BUFFER_VALUE_2, "") != ""
|
||||||
|
&& sharedPreferences.getString(Constants.BUFFER_VALUE_3, "") != ""
|
||||||
|
&& sharedPreferences.getString(Constants.BUFFER_VALUE_4, "") != ""
|
||||||
|
) {
|
||||||
|
sharedPreferences.getString(Constants.BUFFER_VALUE_1, "")
|
||||||
|
?.toDouble()!! > 0.0 && sharedPreferences.getString(
|
||||||
|
Constants.BUFFER_VALUE_2,
|
||||||
|
""
|
||||||
|
)
|
||||||
|
?.toDouble()!! > 0.0 && sharedPreferences.getString(
|
||||||
|
Constants.BUFFER_VALUE_3,
|
||||||
|
""
|
||||||
|
)
|
||||||
|
?.toDouble()!! > 0.0 && sharedPreferences.getString(
|
||||||
|
Constants.BUFFER_VALUE_4,
|
||||||
|
""
|
||||||
|
)
|
||||||
|
?.toDouble()!! > 0.0
|
||||||
|
} else {
|
||||||
|
false
|
||||||
|
}
|
||||||
|
} catch (e: Exception) {
|
||||||
|
showToast("error_exist")
|
||||||
|
false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,87 @@
|
|||||||
|
/*
|
||||||
|
* // Copyright (c) 2024 ShanMukha Innovations Pvt. Ltd. All rights reserved.
|
||||||
|
* // Notice: All information contained herein is, and remains
|
||||||
|
* // the property of ShanMukha Innovations Pvt. Ltd. and its suppliers,
|
||||||
|
* // if any. The intellectual and technical concepts contained
|
||||||
|
* // herein are proprietary to ShanMukha Innovations Pvt. Ltd.
|
||||||
|
* // and its suppliers and may be covered by Indian and Foreign Patents,
|
||||||
|
* // patents in process, and are protected by trade secret or copyright law.
|
||||||
|
* // Dissemination of this information or reproduction of this material
|
||||||
|
* // is strictly forbidden unless prior written permission is obtained
|
||||||
|
* // from ShanMukha Innovations Pvt. Ltd.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.example.hpostesting.presentation.hb_test
|
||||||
|
|
||||||
|
import android.content.Context
|
||||||
|
import android.content.SharedPreferences
|
||||||
|
import android.util.Log
|
||||||
|
import androidx.lifecycle.MutableLiveData
|
||||||
|
import androidx.lifecycle.ViewModel
|
||||||
|
import androidx.lifecycle.viewModelScope
|
||||||
|
import com.example.hpostesting.data.dao.HemoCubeDao
|
||||||
|
import com.example.hpostesting.data.model.Response
|
||||||
|
import com.example.hpostesting.data.model.diagnostics.DiagnosticsData
|
||||||
|
import com.example.hpostesting.data.model.patient.DeviceData
|
||||||
|
import com.example.hpostesting.data.model.patient.HemoCubeTestData
|
||||||
|
import com.example.hpostesting.data.repository.Repository
|
||||||
|
import dagger.hilt.android.lifecycle.HiltViewModel
|
||||||
|
import kotlinx.coroutines.launch
|
||||||
|
import javax.inject.Inject
|
||||||
|
|
||||||
|
@HiltViewModel
|
||||||
|
class HBTestViewModel @Inject constructor(
|
||||||
|
private val hemoCubeDao: HemoCubeDao,
|
||||||
|
private val repository: Repository,
|
||||||
|
context: Context,
|
||||||
|
) : ViewModel() {
|
||||||
|
var isServiceConnected = false
|
||||||
|
val progressBar = MutableLiveData(false)
|
||||||
|
val messages = MutableLiveData<String>()
|
||||||
|
private val sharedPreference: SharedPreferences =
|
||||||
|
context.getSharedPreferences("HEMOCUBE", Context.MODE_PRIVATE)
|
||||||
|
|
||||||
|
val deviceData = MutableLiveData<DeviceData?>()
|
||||||
|
val fireBaseUpload = MutableLiveData<String>()
|
||||||
|
fun uploadFirebaseQc(testDetails: HemoCubeTestData){
|
||||||
|
viewModelScope.launch {
|
||||||
|
try {
|
||||||
|
when (val response = repository.addTestToDatabase(testDetails)) {
|
||||||
|
is Response.Success -> {
|
||||||
|
Log.i("Testdb", "Data uploaded to Firestore successfully")
|
||||||
|
fireBaseUpload.postValue("Success")
|
||||||
|
testDetails.localFlag = true
|
||||||
|
hemoCubeDao.updateTest(testDetails)
|
||||||
|
}
|
||||||
|
|
||||||
|
is Response.Error -> {
|
||||||
|
Log.e("Testdb", "Error uploading data to Firestore: $response")
|
||||||
|
fireBaseUpload.postValue("Error")
|
||||||
|
hemoCubeDao.updateTest(testDetails)
|
||||||
|
}
|
||||||
|
|
||||||
|
else -> {}
|
||||||
|
}
|
||||||
|
} catch (e: Exception) {
|
||||||
|
fireBaseUpload.postValue("Error")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
fun addAutoDacDataToDb(data: DiagnosticsData) {
|
||||||
|
viewModelScope.launch {
|
||||||
|
try {
|
||||||
|
when (val response = repository.addDiagnostics(data)) {
|
||||||
|
is Response.Success -> {
|
||||||
|
fireBaseUpload.postValue("Success")
|
||||||
|
}
|
||||||
|
|
||||||
|
is Response.Error -> {
|
||||||
|
fireBaseUpload.postValue("Error")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (e: Exception) {
|
||||||
|
fireBaseUpload.postValue("Error")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -11,15 +11,13 @@
|
|||||||
* // from ShanMukha Innovations Pvt. Ltd.
|
* // from ShanMukha Innovations Pvt. Ltd.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.example.hpostesting.presentation.dashboard
|
package com.example.hpostesting.presentation.main_base
|
||||||
|
|
||||||
import android.content.Intent
|
|
||||||
import android.net.Uri
|
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
|
import androidx.fragment.app.Fragment
|
||||||
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 `in`.sminnovations.hpostesting.databinding.FragmentAboutBinding
|
import `in`.sminnovations.hpostesting.databinding.FragmentAboutBinding
|
||||||
|
|
||||||
class AboutFragment : Fragment() {
|
class AboutFragment : Fragment() {
|
||||||
@@ -34,13 +32,14 @@ class AboutFragment : Fragment() {
|
|||||||
|
|
||||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||||
super.onViewCreated(view, savedInstanceState)
|
super.onViewCreated(view, savedInstanceState)
|
||||||
|
|
||||||
// binding.linkClick.setOnClickListener {
|
// binding.linkClick.setOnClickListener {
|
||||||
// val url = "https://sminnovations.in/"
|
// val url = "https://sminnovations.in/"
|
||||||
// val intent = Intent(Intent.ACTION_VIEW)
|
// val intent = Intent(Intent.ACTION_VIEW)
|
||||||
// intent.data = Uri.parse(url)
|
// intent.data = Uri.parse(url)
|
||||||
// startActivity(intent)
|
// startActivity(intent)
|
||||||
// }
|
// }
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -11,7 +11,7 @@
|
|||||||
* // from ShanMukha Innovations Pvt. Ltd.
|
* // from ShanMukha Innovations Pvt. Ltd.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.example.hpostesting.presentation.dashboard
|
package com.example.hpostesting.presentation.main_base
|
||||||
|
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.os.BatteryManager
|
import android.os.BatteryManager
|
||||||
@@ -23,12 +23,16 @@ import android.view.ViewGroup
|
|||||||
import androidx.fragment.app.Fragment
|
import androidx.fragment.app.Fragment
|
||||||
import androidx.fragment.app.activityViewModels
|
import androidx.fragment.app.activityViewModels
|
||||||
import com.example.hpostesting.presentation.adapter.OfflineUserListAdapter
|
import com.example.hpostesting.presentation.adapter.OfflineUserListAdapter
|
||||||
import com.example.hpostesting.presentation.hemocube.HemoCubeViewModel
|
import com.example.hpostesting.presentation.trueheme_test.TrueHemeTestViewModel
|
||||||
import `in`.sminnovations.hpostesting.databinding.FragmentActivitiesBinding
|
import `in`.sminnovations.hpostesting.databinding.FragmentActivitiesBinding
|
||||||
|
import java.text.SimpleDateFormat
|
||||||
|
import java.util.Calendar
|
||||||
|
import java.util.Date
|
||||||
|
import java.util.Locale
|
||||||
|
|
||||||
class ActivitiesFragment : Fragment() {
|
class ActivitiesFragment : Fragment() {
|
||||||
private lateinit var binding: FragmentActivitiesBinding
|
private lateinit var binding: FragmentActivitiesBinding
|
||||||
private val hemoCubeViewModel: HemoCubeViewModel by activityViewModels()
|
private val trueHemeTestViewModel: TrueHemeTestViewModel by activityViewModels()
|
||||||
private lateinit var adapter: OfflineUserListAdapter
|
private lateinit var adapter: OfflineUserListAdapter
|
||||||
|
|
||||||
override fun onCreateView(
|
override fun onCreateView(
|
||||||
@@ -42,9 +46,15 @@ class ActivitiesFragment : Fragment() {
|
|||||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||||
super.onViewCreated(view, savedInstanceState)
|
super.onViewCreated(view, savedInstanceState)
|
||||||
|
|
||||||
hemoCubeViewModel.allPendingUserToUpload.observe(viewLifecycleOwner) { userData ->
|
trueHemeTestViewModel.allPendingUserToUpload.observe(viewLifecycleOwner) { userData ->
|
||||||
|
|
||||||
if (userData.isNotEmpty()) {
|
if (userData.isNotEmpty()) {
|
||||||
|
userData.forEach { user ->
|
||||||
|
if((isBetween15And30Minutes(user.incubationTime) > 30 || isBetween15And30Minutes(user.incubationTime) < 0 ) && user.testStatus == false){
|
||||||
|
trueHemeTestViewModel.deleteByStatus()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
binding.rvOrderOffline.visibility = View.VISIBLE
|
binding.rvOrderOffline.visibility = View.VISIBLE
|
||||||
binding.noDataText.visibility = View.GONE
|
binding.noDataText.visibility = View.GONE
|
||||||
val bm =
|
val bm =
|
||||||
@@ -60,5 +70,16 @@ class ActivitiesFragment : Fragment() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
private fun isBetween15And30Minutes(createdAt: String): Long {
|
||||||
|
val formatter = SimpleDateFormat("yyyy-MM-dd HH:mm:ss", Locale.getDefault())
|
||||||
|
val createdAtDate: Date = formatter.parse(createdAt)!!
|
||||||
|
|
||||||
|
val currentTime = Calendar.getInstance().time
|
||||||
|
|
||||||
|
val diffMillis = currentTime.time - createdAtDate.time
|
||||||
|
|
||||||
|
return diffMillis / (60 * 1000)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
package com.example.hpostesting.presentation.main_base
|
||||||
|
|
||||||
|
import com.example.hpostesting.data.constant.Constants.FIREBASE_INTEGRATION
|
||||||
|
import com.example.hpostesting.data.constant.Constants.MOLBIO_INTEGRATION
|
||||||
|
|
||||||
|
class AppVersionTapManager {
|
||||||
|
|
||||||
|
private var tapCount = 0
|
||||||
|
private val maxTapCount = 5
|
||||||
|
val shouldEnable = FIREBASE_INTEGRATION && !MOLBIO_INTEGRATION
|
||||||
|
val notEnable = MOLBIO_INTEGRATION && !FIREBASE_INTEGRATION
|
||||||
|
|
||||||
|
fun registerTap(onMaxTapsReached: () -> Unit) {
|
||||||
|
tapCount++
|
||||||
|
if (tapCount >= maxTapCount && shouldEnable) {
|
||||||
|
onMaxTapsReached()
|
||||||
|
reset()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private fun reset() {
|
||||||
|
tapCount = 0
|
||||||
|
}
|
||||||
|
}
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -11,7 +11,7 @@
|
|||||||
* // from ShanMukha Innovations Pvt. Ltd.
|
* // from ShanMukha Innovations Pvt. Ltd.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.example.hpostesting.presentation.dashboard
|
package com.example.hpostesting.presentation.main_base
|
||||||
|
|
||||||
import android.annotation.SuppressLint
|
import android.annotation.SuppressLint
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
@@ -23,7 +23,6 @@ import android.os.Build
|
|||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.util.Log
|
import android.util.Log
|
||||||
import android.view.Menu
|
import android.view.Menu
|
||||||
import android.widget.Toast
|
|
||||||
import androidx.activity.viewModels
|
import androidx.activity.viewModels
|
||||||
import androidx.appcompat.app.AppCompatActivity
|
import androidx.appcompat.app.AppCompatActivity
|
||||||
import androidx.core.content.FileProvider
|
import androidx.core.content.FileProvider
|
||||||
@@ -33,25 +32,22 @@ 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.util.Result
|
|
||||||
import com.example.hpostesting.data.constant.Constants
|
import com.example.hpostesting.data.constant.Constants
|
||||||
import com.example.hpostesting.data.constant.DataHolder
|
|
||||||
import com.example.hpostesting.data.constant.LanguageManager
|
import com.example.hpostesting.data.constant.LanguageManager
|
||||||
import com.example.hpostesting.data.model.login.LoginRequest
|
|
||||||
import com.example.hpostesting.data.model.updates.DeviceUpdateRequest
|
import com.example.hpostesting.data.model.updates.DeviceUpdateRequest
|
||||||
import com.example.hpostesting.presentation.utils.NatsManager
|
import com.example.hpostesting.data.repository.DatabaseRepository
|
||||||
import com.example.hpostesting.presentation.hemocube.HemoCubeViewModel
|
import com.example.hpostesting.firebase.FirebaseManager
|
||||||
|
import com.example.hpostesting.presentation.trueheme_test.TrueHemeTestViewModel
|
||||||
import com.example.hpostesting.presentation.jig.JigActivity
|
import com.example.hpostesting.presentation.jig.JigActivity
|
||||||
|
import com.example.hpostesting.presentation.utils.NatsManager
|
||||||
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.FirebaseAppDistributionException
|
|
||||||
import com.google.firebase.crashlytics.FirebaseCrashlytics
|
|
||||||
import dagger.hilt.android.AndroidEntryPoint
|
import dagger.hilt.android.AndroidEntryPoint
|
||||||
import `in`.sminnovations.hpostesting.BuildConfig
|
import `in`.sminnovations.hpostesting.BuildConfig
|
||||||
import `in`.sminnovations.hpostesting.R
|
import `in`.sminnovations.hpostesting.R
|
||||||
import `in`.sminnovations.hpostesting.databinding.ActivityDashboardBinding
|
import `in`.sminnovations.hpostesting.databinding.ActivityDashboardBinding
|
||||||
import java.io.File
|
import java.io.File
|
||||||
import java.security.MessageDigest
|
import java.security.MessageDigest
|
||||||
|
import javax.inject.Inject
|
||||||
|
|
||||||
interface NatsMessageCallback {
|
interface NatsMessageCallback {
|
||||||
fun onMessageReceived(topic: String, message: String)
|
fun onMessageReceived(topic: String, message: String)
|
||||||
@@ -64,7 +60,8 @@ open interface IDataCollector: NatsMessageCallback {
|
|||||||
|
|
||||||
@AndroidEntryPoint
|
@AndroidEntryPoint
|
||||||
class DashboardActivity : AppCompatActivity(), IDataCollector {
|
class DashboardActivity : AppCompatActivity(), IDataCollector {
|
||||||
|
@Inject
|
||||||
|
lateinit var databaseRepository: DatabaseRepository
|
||||||
val TAG = "DashboardActivity"
|
val TAG = "DashboardActivity"
|
||||||
private var isRegistered = false
|
private var isRegistered = false
|
||||||
private lateinit var appBarConfiguration: AppBarConfiguration
|
private lateinit var appBarConfiguration: AppBarConfiguration
|
||||||
@@ -72,16 +69,18 @@ class DashboardActivity : AppCompatActivity(), IDataCollector {
|
|||||||
lateinit var sharedPreferences: SharedPreferences
|
lateinit var sharedPreferences: SharedPreferences
|
||||||
var responses: String = ""
|
var responses: String = ""
|
||||||
lateinit var nats: NatsManager
|
lateinit var nats: NatsManager
|
||||||
|
|
||||||
private var downloadId: Long = 0
|
private var downloadId: Long = 0
|
||||||
// TODO: Remove hemocube viewmodel
|
// TODO: Remove hemocube viewmodel
|
||||||
private val hemocubeViewModel: HemoCubeViewModel by viewModels()
|
private val hemocubeViewModel: TrueHemeTestViewModel by viewModels()
|
||||||
private lateinit var sharedPreference: SharedPreferences
|
|
||||||
override fun attachBaseContext(newBase: Context?) {
|
override fun attachBaseContext(newBase: Context?) {
|
||||||
val languageCode = LanguageManager.getSavedLanguage(newBase!!)
|
val languageCode = LanguageManager.getSavedLanguage(newBase!!)
|
||||||
LanguageManager.setLocale(newBase, languageCode)
|
LanguageManager.setLocale(newBase, languageCode)
|
||||||
super.attachBaseContext(newBase)
|
super.attachBaseContext(newBase)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
override fun onMessageReceived(topic: String, message: String) {
|
override fun onMessageReceived(topic: String, message: String) {
|
||||||
// Handle incoming messages from NATS
|
// Handle incoming messages from NATS
|
||||||
|
|
||||||
@@ -91,16 +90,24 @@ class DashboardActivity : AppCompatActivity(), IDataCollector {
|
|||||||
@SuppressLint("SetWorldReadable")
|
@SuppressLint("SetWorldReadable")
|
||||||
override fun onCreate(savedInstanceState: Bundle?) {
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
super.onCreate(savedInstanceState)
|
super.onCreate(savedInstanceState)
|
||||||
|
val firebaseManager = FirebaseManager(this)
|
||||||
binding = ActivityDashboardBinding.inflate(layoutInflater)
|
binding = ActivityDashboardBinding.inflate(layoutInflater)
|
||||||
sharedPreferences = this.getSharedPreferences("HEMOCUBE", Context.MODE_PRIVATE)
|
sharedPreferences = this.getSharedPreferences("HEMOCUBE", Context.MODE_PRIVATE)
|
||||||
setContentView(binding.root)
|
setContentView(binding.root)
|
||||||
setSupportActionBar(binding.appBarDashboard.toolbar)
|
setSupportActionBar(binding.appBarDashboard.toolbar)
|
||||||
nats = NatsManager(this)
|
nats = NatsManager(this)
|
||||||
|
|
||||||
|
val currentServer = firebaseManager.getLastSelectedServer().serverName
|
||||||
|
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||||
nats.connect()
|
nats.connect()
|
||||||
}
|
}
|
||||||
val versionName = getAppVersion(this@DashboardActivity) + " [ " + getAppEnvironment(this@DashboardActivity) + " ]"
|
val savedKitSerial = sharedPreferences.getString(Constants.KIT_NUMBER, "")
|
||||||
|
|
||||||
|
Log.d("DashboardActivity", "Saved Kit Serial: $savedKitSerial")
|
||||||
|
// Toast.makeText(this, "Saved Kit Serial: $savedKitSerial", Toast.LENGTH_SHORT).show()
|
||||||
|
|
||||||
|
val versionName = getAppVersion(this@DashboardActivity) + " [ " + getAppEnvironment(this@DashboardActivity) +"->"+currentServer+"]"
|
||||||
binding.appBarDashboard.versionName.text = versionName
|
binding.appBarDashboard.versionName.text = versionName
|
||||||
|
|
||||||
|
|
||||||
@@ -122,8 +129,8 @@ class DashboardActivity : AppCompatActivity(), IDataCollector {
|
|||||||
input.copyTo(output)
|
input.copyTo(output)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
hemocubeViewModel.deviceUpdateheader.observe(this){
|
hemocubeViewModel.deviceUpdateheader.observe(this){
|
||||||
val apkFile = File(getExternalFilesDir("Downloads"), "update.apk")
|
val apkFile = File(getExternalFilesDir("Downloads"), "update.apk")
|
||||||
val expectedChecksum = it.get("Checksum") // Provide your expected checksum here
|
val expectedChecksum = it.get("Checksum") // Provide your expected checksum here
|
||||||
@@ -158,6 +165,12 @@ class DashboardActivity : AppCompatActivity(), IDataCollector {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// fun sendData(data:String){ this was used to send the basic data for server validation
|
||||||
|
// databaseRepository.addtodb(data)
|
||||||
|
// Toast.makeText(this, "data uploaded", Toast.LENGTH_SHORT).show()
|
||||||
|
// }
|
||||||
|
|
||||||
|
|
||||||
override fun onCreateOptionsMenu(menu: Menu): Boolean {
|
override fun onCreateOptionsMenu(menu: Menu): Boolean {
|
||||||
// Inflate the menu; this adds items to the action bar if it is present.
|
// Inflate the menu; this adds items to the action bar if it is present.
|
||||||
menuInflater.inflate(R.menu.dashboard, menu)
|
menuInflater.inflate(R.menu.dashboard, menu)
|
||||||
@@ -223,41 +236,41 @@ class DashboardActivity : AppCompatActivity(), IDataCollector {
|
|||||||
override fun onResume() {
|
override fun onResume() {
|
||||||
super.onResume()
|
super.onResume()
|
||||||
|
|
||||||
val firebaseAppDistribution = FirebaseAppDistribution.getInstance()
|
// val firebaseAppDistribution = FirebaseAppDistribution.getInstance()
|
||||||
firebaseAppDistribution.updateIfNewReleaseAvailable()
|
// firebaseAppDistribution.updateIfNewReleaseAvailable()
|
||||||
.addOnProgressListener { updateProgress ->
|
// .addOnProgressListener { updateProgress ->
|
||||||
|
//
|
||||||
if (updateProgress.apkBytesDownloaded > 0) {
|
// if (updateProgress.apkBytesDownloaded > 0) {
|
||||||
Toast.makeText(
|
// Toast.makeText(
|
||||||
this,
|
// this,
|
||||||
"${updateProgress.updateStatus}. ${updateProgress.apkBytesDownloaded / 1048576} /${updateProgress.apkFileTotalBytes / 1048576} MB",
|
// "${updateProgress.updateStatus}. ${updateProgress.apkBytesDownloaded / 1048576} /${updateProgress.apkFileTotalBytes / 1048576} MB",
|
||||||
Toast.LENGTH_SHORT
|
// Toast.LENGTH_SHORT
|
||||||
).show()
|
// ).show()
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
.addOnFailureListener { e ->
|
// .addOnFailureListener { e ->
|
||||||
// (Optional) Handle errors.
|
// // (Optional) Handle errors.
|
||||||
if (e is FirebaseAppDistributionException) {
|
// if (e is FirebaseAppDistributionException) {
|
||||||
when (e.errorCode) {
|
// when (e.errorCode) {
|
||||||
FirebaseAppDistributionException.Status.NOT_IMPLEMENTED -> {
|
// FirebaseAppDistributionException.Status.NOT_IMPLEMENTED -> {
|
||||||
// SDK did nothing. This is expected when building for Play.
|
// // SDK did nothing. This is expected when building for Play.
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
else -> {
|
// else -> {
|
||||||
// Handle other errors.
|
// // Handle other errors.
|
||||||
Toast.makeText(
|
// Toast.makeText(
|
||||||
this,
|
// this,
|
||||||
"AppDistribution error, status: ${e.errorCode}",
|
// "AppDistribution error, status: ${e.errorCode}",
|
||||||
Toast.LENGTH_SHORT
|
// Toast.LENGTH_SHORT
|
||||||
).show()
|
// ).show()
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
FirebaseCrashlytics.getInstance().recordException(e)
|
// FirebaseCrashlytics.getInstance().recordException(e)
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
.addOnSuccessListener {
|
// .addOnSuccessListener {
|
||||||
// Toast.makeText(this, "App Update: Success!", Toast.LENGTH_SHORT).show()
|
//// Toast.makeText(this, "App Update: Success!", Toast.LENGTH_SHORT).show()
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun setConnect(connect: Boolean) {
|
override fun setConnect(connect: Boolean) {
|
||||||
@@ -276,13 +289,14 @@ class DashboardActivity : AppCompatActivity(), IDataCollector {
|
|||||||
|
|
||||||
private fun createDeviceUpdateRequestData(): DeviceUpdateRequest {
|
private fun createDeviceUpdateRequestData(): DeviceUpdateRequest {
|
||||||
return DeviceUpdateRequest(
|
return DeviceUpdateRequest(
|
||||||
serial_no = sharedPreference.getString(Constants.DEVICE_ID, "")
|
serial_no = sharedPreferences.getString(Constants.DEVICE_ID, "")
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
private fun getAppVersion(context: Context): String {
|
private fun getAppVersion(context: Context): String {
|
||||||
return try {
|
return try {
|
||||||
val pInfo = context.packageManager.getPackageInfo(context.packageName, 0)
|
val pInfo = context.packageManager.getPackageInfo(context.packageName, 0)
|
||||||
pInfo.versionName
|
pInfo.versionName
|
||||||
|
|
||||||
} catch (e: PackageManager.NameNotFoundException) {
|
} catch (e: PackageManager.NameNotFoundException) {
|
||||||
"N/A"
|
"N/A"
|
||||||
}
|
}
|
||||||
@@ -11,7 +11,7 @@
|
|||||||
* // from ShanMukha Innovations Pvt. Ltd.
|
* // from ShanMukha Innovations Pvt. Ltd.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.example.hpostesting.presentation.dashboard
|
package com.example.hpostesting.presentation.main_base
|
||||||
|
|
||||||
import android.annotation.SuppressLint
|
import android.annotation.SuppressLint
|
||||||
import android.content.ComponentName
|
import android.content.ComponentName
|
||||||
@@ -28,15 +28,16 @@ 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.main_base.ui.PasswordResetActivity
|
||||||
import com.example.hpostesting.presentation.deviceinfo.DeviceActivity
|
import com.example.hpostesting.presentation.deviceinfo.DeviceActivity
|
||||||
import com.example.hpostesting.presentation.deviceprovision.DeviceProvisionActivity
|
import com.example.hpostesting.presentation.deviceprovision.DeviceProvisionActivity
|
||||||
import com.example.hpostesting.presentation.diagnostics.DiagnosticsActivity
|
import com.example.hpostesting.presentation.diagnostics.DiagnosticsActivity
|
||||||
import com.example.hpostesting.presentation.hemocube.HemoCubeViewModel
|
import com.example.hpostesting.presentation.trueheme_test.TrueHemeTestViewModel
|
||||||
import com.example.hpostesting.presentation.usb_teminal.UsbTerminalActivity
|
import com.example.hpostesting.presentation.usb_teminal.UsbTerminalActivity
|
||||||
import `in`.sminnovations.hpostesting.databinding.FragmentGalleryBinding
|
import `in`.sminnovations.hpostesting.databinding.FragmentGalleryBinding
|
||||||
|
|
||||||
|
|
||||||
class GalleryFragment : Fragment() {
|
class PanelFragment : Fragment() {
|
||||||
|
|
||||||
private var _binding: FragmentGalleryBinding? = null
|
private var _binding: FragmentGalleryBinding? = null
|
||||||
private lateinit var sharedPreferences: SharedPreferences
|
private lateinit var sharedPreferences: SharedPreferences
|
||||||
@@ -48,7 +49,7 @@ class GalleryFragment : Fragment() {
|
|||||||
|
|
||||||
private lateinit var sharedPreference: SharedPreferences
|
private lateinit var sharedPreference: SharedPreferences
|
||||||
|
|
||||||
private val hemoCubeViewModel: HemoCubeViewModel by activityViewModels()
|
private val trueHemeTestViewModel: TrueHemeTestViewModel by activityViewModels()
|
||||||
|
|
||||||
@SuppressLint("SetTextI18n")
|
@SuppressLint("SetTextI18n")
|
||||||
override fun onCreateView(
|
override fun onCreateView(
|
||||||
@@ -86,9 +87,12 @@ class GalleryFragment : Fragment() {
|
|||||||
binding.btnUsbTerminal.visibility = View.VISIBLE
|
binding.btnUsbTerminal.visibility = View.VISIBLE
|
||||||
binding.btnSubmit.visibility = View.VISIBLE
|
binding.btnSubmit.visibility = View.VISIBLE
|
||||||
binding.btnDeviceInfo.visibility = View.VISIBLE
|
binding.btnDeviceInfo.visibility = View.VISIBLE
|
||||||
|
binding.btnResetPassword.visibility = View.VISIBLE
|
||||||
|
binding.btnUpdateValues.visibility = View.VISIBLE
|
||||||
}else{
|
}else{
|
||||||
|
binding.btnResetPassword.visibility = View.GONE
|
||||||
binding.btnDeviceProvision.visibility = View.GONE
|
binding.btnDeviceProvision.visibility = View.GONE
|
||||||
binding.btnAutoDac.visibility = View.GONE
|
binding.btnAutoDac.visibility = View.VISIBLE
|
||||||
binding.btnDeviceProvision.visibility = View.GONE
|
binding.btnDeviceProvision.visibility = View.GONE
|
||||||
binding.btnDiagnostics.visibility = View.VISIBLE
|
binding.btnDiagnostics.visibility = View.VISIBLE
|
||||||
binding.btnFiles.visibility = View.GONE
|
binding.btnFiles.visibility = View.GONE
|
||||||
@@ -97,11 +101,18 @@ class GalleryFragment : Fragment() {
|
|||||||
binding.btnUsbTerminal.visibility = View.GONE
|
binding.btnUsbTerminal.visibility = View.GONE
|
||||||
binding.btnSubmit.visibility = View.GONE
|
binding.btnSubmit.visibility = View.GONE
|
||||||
binding.btnDeviceInfo.visibility = View.VISIBLE
|
binding.btnDeviceInfo.visibility = View.VISIBLE
|
||||||
|
binding.btnUpdateValues.visibility = View.GONE
|
||||||
}
|
}
|
||||||
|
|
||||||
|
binding.btnResetPassword.setOnClickListener{
|
||||||
|
startActivity(Intent(requireContext(), PasswordResetActivity::class.java))
|
||||||
|
}
|
||||||
binding.btnDeviceProvision.setOnClickListener {
|
binding.btnDeviceProvision.setOnClickListener {
|
||||||
startActivity(Intent(requireContext(), DeviceProvisionActivity::class.java))
|
startActivity(Intent(requireContext(), DeviceProvisionActivity::class.java))
|
||||||
}
|
}
|
||||||
|
binding.btnUpdateValues.setOnClickListener {
|
||||||
|
startActivity(Intent(requireContext(), UpdateValuesActivity::class.java))
|
||||||
|
}
|
||||||
binding.btnUsbTerminal.setOnClickListener {
|
binding.btnUsbTerminal.setOnClickListener {
|
||||||
startActivity(Intent(requireContext(), UsbTerminalActivity::class.java))
|
startActivity(Intent(requireContext(), UsbTerminalActivity::class.java))
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,342 @@
|
|||||||
|
/*
|
||||||
|
* // Copyright (c) 2024 ShanMukha Innovations Pvt. Ltd. All rights reserved.
|
||||||
|
* // Notice: All information contained herein is, and remains
|
||||||
|
* // the property of ShanMukha Innovations Pvt. Ltd. and its suppliers,
|
||||||
|
* // if any. The intellectual and technical concepts contained
|
||||||
|
* // herein are proprietary to ShanMukha Innovations Pvt. Ltd.
|
||||||
|
* // and its suppliers and may be covered by Indian and Foreign Patents,
|
||||||
|
* // patents in process, and are protected by trade secret or copyright law.
|
||||||
|
* // Dissemination of this information or reproduction of this material
|
||||||
|
* // is strictly forbidden unless prior written permission is obtained
|
||||||
|
* // from ShanMukha Innovations Pvt. Ltd.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.example.hpostesting.presentation.main_base
|
||||||
|
|
||||||
|
import android.content.Context
|
||||||
|
import android.content.SharedPreferences
|
||||||
|
import android.content.pm.PackageManager
|
||||||
|
import android.os.Bundle
|
||||||
|
import android.view.LayoutInflater
|
||||||
|
import android.view.View
|
||||||
|
import android.view.ViewGroup
|
||||||
|
import android.widget.AdapterView
|
||||||
|
import android.widget.ArrayAdapter
|
||||||
|
import android.widget.Toast
|
||||||
|
import androidx.core.content.ContextCompat
|
||||||
|
import androidx.fragment.app.Fragment
|
||||||
|
import androidx.preference.ListPreference
|
||||||
|
import androidx.preference.Preference
|
||||||
|
import androidx.preference.PreferenceFragmentCompat
|
||||||
|
import androidx.preference.PreferenceManager
|
||||||
|
import androidx.preference.SwitchPreferenceCompat
|
||||||
|
import com.example.hpostesting.data.constant.Constants
|
||||||
|
import com.example.hpostesting.data.constant.Constants.FIREBASE_INTEGRATION
|
||||||
|
import com.example.hpostesting.data.constant.Constants.MOLBIO_INTEGRATION
|
||||||
|
import com.example.hpostesting.data.constant.DataHolder
|
||||||
|
import com.example.hpostesting.data.constant.LanguageManager
|
||||||
|
import com.example.hpostesting.data.repository.DatabaseRepository
|
||||||
|
import com.example.hpostesting.firebase.FirebaseConfig
|
||||||
|
import com.example.hpostesting.firebase.FirebaseManager
|
||||||
|
import com.google.android.material.dialog.MaterialAlertDialogBuilder
|
||||||
|
import `in`.sminnovations.hpostesting.R
|
||||||
|
import `in`.sminnovations.hpostesting.databinding.FragmentSlideshowBinding
|
||||||
|
|
||||||
|
|
||||||
|
private var isLanguageChanged = false
|
||||||
|
|
||||||
|
class SlideshowFragment : Fragment() {
|
||||||
|
private var selectedItem = "10mm"
|
||||||
|
private val values = arrayOf("10mm", "2mm")
|
||||||
|
private lateinit var binding: FragmentSlideshowBinding
|
||||||
|
private lateinit var sharedPreferences: SharedPreferences
|
||||||
|
|
||||||
|
override fun onCreateView(
|
||||||
|
inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?,
|
||||||
|
): View {
|
||||||
|
binding = FragmentSlideshowBinding.inflate(inflater, container, false)
|
||||||
|
sharedPreferences = requireContext().getSharedPreferences("HEMOCUBE", Context.MODE_PRIVATE)
|
||||||
|
return binding.root
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||||
|
super.onViewCreated(view, savedInstanceState)
|
||||||
|
|
||||||
|
binding.nameEditText.setText(sharedPreferences.getString(Constants.LABNAME, ""))
|
||||||
|
selectedItem = sharedPreferences.getString(Constants.CUVETTE_SIZE, "10mm").toString()
|
||||||
|
binding.btnGo.setOnClickListener {
|
||||||
|
var labname = binding.nameEditText.text.toString()
|
||||||
|
DataHolder.hemoCubeTestData?.apply {
|
||||||
|
this.labName = labname
|
||||||
|
}
|
||||||
|
with(sharedPreferences.edit()) {
|
||||||
|
putString(Constants.LABNAME, labname)
|
||||||
|
apply()
|
||||||
|
}
|
||||||
|
|
||||||
|
Toast.makeText(
|
||||||
|
requireContext(), "Lab Name is Added successfully.", Toast.LENGTH_SHORT
|
||||||
|
).show()
|
||||||
|
}
|
||||||
|
val adapter = ArrayAdapter(requireContext(), android.R.layout.simple_spinner_item, values)
|
||||||
|
adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item)
|
||||||
|
val pos: Int
|
||||||
|
if (selectedItem == "10mm") {
|
||||||
|
pos = 0
|
||||||
|
} else {
|
||||||
|
pos = 1
|
||||||
|
}
|
||||||
|
|
||||||
|
binding.spinnerCuvette.adapter = adapter
|
||||||
|
binding.spinnerCuvette.onItemSelectedListener =
|
||||||
|
object : AdapterView.OnItemSelectedListener {
|
||||||
|
override fun onItemSelected(
|
||||||
|
parent: AdapterView<*>?, view: View?, position: Int, id: Long
|
||||||
|
) {
|
||||||
|
// Handle item selection here
|
||||||
|
selectedItem = values[position]
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onNothingSelected(parent: AdapterView<*>?) {
|
||||||
|
// Do nothing here
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
binding.spinnerCuvette.setSelection(pos)
|
||||||
|
binding.btnAddSize.setOnClickListener {
|
||||||
|
with(sharedPreferences.edit()) {
|
||||||
|
putString(Constants.CUVETTE_SIZE, selectedItem)
|
||||||
|
apply()
|
||||||
|
}
|
||||||
|
Toast.makeText(
|
||||||
|
requireContext(), "Selected cuvette size: $selectedItem", Toast.LENGTH_SHORT
|
||||||
|
).show()
|
||||||
|
}
|
||||||
|
|
||||||
|
childFragmentManager.beginTransaction().replace(binding.container.id, PrefsFragment())
|
||||||
|
.commit()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class PrefsFragment : PreferenceFragmentCompat() {
|
||||||
|
private lateinit var tapManager: AppVersionTapManager
|
||||||
|
private lateinit var serverPreference: Preference
|
||||||
|
private lateinit var currentServerPreference: Preference
|
||||||
|
lateinit var firebaseManager: FirebaseManager
|
||||||
|
private var topDevMode = false
|
||||||
|
lateinit var databaseRepository: DatabaseRepository
|
||||||
|
|
||||||
|
override fun onCreatePreferences(savedInstanceState: Bundle?, rootKey: String?) {
|
||||||
|
firebaseManager = FirebaseManager(requireContext())
|
||||||
|
databaseRepository = (activity as DashboardActivity).databaseRepository
|
||||||
|
tapManager = AppVersionTapManager()
|
||||||
|
topDevMode = firebaseManager.getDevMode()
|
||||||
|
val sharedPreference =
|
||||||
|
requireContext().getSharedPreferences("HEMOCUBE", Context.MODE_PRIVATE)
|
||||||
|
val preferenceScreen = preferenceManager.createPreferenceScreen(requireContext())
|
||||||
|
val currentServer = firebaseManager.getLastSelectedServer().serverName
|
||||||
|
|
||||||
|
|
||||||
|
// Language Preference
|
||||||
|
val languagePreference = ListPreference(requireContext()).apply {
|
||||||
|
key = "language_preference"
|
||||||
|
title = getString(R.string.app_language)
|
||||||
|
summary = getString(R.string.select_language)
|
||||||
|
entries = arrayOf("English", "Kannada", "Hindi")
|
||||||
|
entryValues = arrayOf("en", "kn", "hi")
|
||||||
|
setDefaultValue("en")
|
||||||
|
icon = ContextCompat.getDrawable(requireContext(), R.drawable.baseline_translate_24)
|
||||||
|
onPreferenceChangeListener = Preference.OnPreferenceChangeListener { _, newValue ->
|
||||||
|
val languageCode = newValue as String
|
||||||
|
updateLanguage(requireContext(), languageCode)
|
||||||
|
true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
val servers = firebaseManager.getAvailableServers()
|
||||||
|
val serverNames = servers.map { it.serverName }.toTypedArray()
|
||||||
|
|
||||||
|
val serverSelectorPreference = CustomDialogPreference(requireContext()).apply {
|
||||||
|
key = "server_preference"
|
||||||
|
title = "Select the Server"
|
||||||
|
summary = "Current server: $currentServer"
|
||||||
|
setEntries(serverNames)
|
||||||
|
setEntryValues(serverNames)
|
||||||
|
setValue(currentServer)
|
||||||
|
icon = ContextCompat.getDrawable(requireContext(), R.drawable.baseline_cloud_sync_24)
|
||||||
|
setOnPreferenceChangeListener { newValue ->
|
||||||
|
val preferenceConfig = servers.find { it.serverName == newValue }
|
||||||
|
switchFirebaseServer(preferenceConfig!!)
|
||||||
|
true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add preferences to screen
|
||||||
|
preferenceScreen.addPreference(languagePreference)
|
||||||
|
preferenceScreen.addPreference(languagePreference)
|
||||||
|
|
||||||
|
|
||||||
|
val developerToggle = SwitchPreferenceCompat(requireContext()).apply {
|
||||||
|
title = "Developer Options"
|
||||||
|
summary = "Enable or disable developer options"
|
||||||
|
icon =
|
||||||
|
ContextCompat.getDrawable(requireContext(), R.drawable.baseline_developer_mode_24)
|
||||||
|
key = "developer_options" // Unique key for SharedPreferences
|
||||||
|
|
||||||
|
// Load toggle state from SharedPreferences
|
||||||
|
isChecked = firebaseManager.getDevMode()
|
||||||
|
|
||||||
|
setOnPreferenceChangeListener { _, newValue ->
|
||||||
|
val isEnabled = newValue as Boolean
|
||||||
|
firebaseManager.setDevModeOn(isEnabled)
|
||||||
|
|
||||||
|
if (!isEnabled) {
|
||||||
|
preferenceScreen.removePreference(this)
|
||||||
|
preferenceScreen.removePreference(serverSelectorPreference)
|
||||||
|
}
|
||||||
|
if (!firebaseManager.getDevMode() && currentServer != "prod"){
|
||||||
|
val prodConfig = servers.find { it.serverName == "prod" }
|
||||||
|
switchFirebaseServer(prodConfig!!)
|
||||||
|
}
|
||||||
|
true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
val shouldEnableCurrentServerVersion = FIREBASE_INTEGRATION && !MOLBIO_INTEGRATION
|
||||||
|
val appVersionPreference = Preference(requireContext()).apply {
|
||||||
|
title = "App Version"
|
||||||
|
summary =
|
||||||
|
getAppVersion(requireContext()) + " [ " + getAppEnvironment(requireContext()) + "->" + if (shouldEnableCurrentServerVersion) currentServer else "molbio"+ "]"
|
||||||
|
icon = ContextCompat.getDrawable(requireContext(), R.drawable.baseline_info_24)
|
||||||
|
|
||||||
|
setOnPreferenceClickListener {
|
||||||
|
tapManager.registerTap {
|
||||||
|
firebaseManager.setDevModeOn(true)
|
||||||
|
|
||||||
|
val devConfig = servers.find { it.serverName == "dev" }
|
||||||
|
if (firebaseManager.getDevMode() && currentServer != "dev") {
|
||||||
|
Toast.makeText(requireContext(), "Now you are a Developer", Toast.LENGTH_SHORT).show()
|
||||||
|
Toast.makeText(requireContext(), "Setting Up developer Environmnet", Toast.LENGTH_SHORT).show()
|
||||||
|
switchFirebaseServer(devConfig!!)
|
||||||
|
}
|
||||||
|
|
||||||
|
if (preferenceScreen.findPreference<SwitchPreferenceCompat>("developer_options") == null) {
|
||||||
|
preferenceScreen.addPreference(developerToggle)
|
||||||
|
}
|
||||||
|
if (preferenceScreen.findPreference<ListPreference>("server_preference") == null) {
|
||||||
|
preferenceScreen.addPreference(serverSelectorPreference)
|
||||||
|
}
|
||||||
|
|
||||||
|
developerToggle.isChecked = true
|
||||||
|
updateServerPreference(currentServer)
|
||||||
|
}
|
||||||
|
true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
preferenceScreen.addPreference(appVersionPreference)
|
||||||
|
if (firebaseManager.getDevMode()) {
|
||||||
|
developerToggle.isChecked = true // Ensure it's checked
|
||||||
|
preferenceScreen.addPreference(developerToggle)
|
||||||
|
preferenceScreen.addPreference(serverSelectorPreference)
|
||||||
|
}
|
||||||
|
|
||||||
|
setPreferenceScreen(preferenceScreen)
|
||||||
|
|
||||||
|
if (isLanguageChanged) {
|
||||||
|
Toast.makeText(requireContext(), R.string.language_update, Toast.LENGTH_SHORT).show()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private fun updateServerPreference(newServer: String) {
|
||||||
|
(findPreference<CustomDialogPreference>("server_preference"))?.let { pref ->
|
||||||
|
pref.setValue(newServer)
|
||||||
|
pref.summary = "Current server: $newServer"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun switchFirebaseServer(firebaseConfig: FirebaseConfig) {
|
||||||
|
firebaseManager.switchServer(firebaseConfig)
|
||||||
|
Toast.makeText(
|
||||||
|
requireContext(),
|
||||||
|
"Switched to ${firebaseConfig.serverName}, Please wait for few seconds",
|
||||||
|
Toast.LENGTH_SHORT
|
||||||
|
).show()
|
||||||
|
Toast.makeText(requireContext(), "Restart needed restarting the app", Toast.LENGTH_SHORT)
|
||||||
|
.show()
|
||||||
|
firebaseManager.restartApp()
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun updateLanguage(context: Context, languageCode: String) {
|
||||||
|
LanguageManager.persistLanguagePreference(context, languageCode)
|
||||||
|
LanguageManager.setLocale(context, languageCode)
|
||||||
|
requireActivity().recreate()
|
||||||
|
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"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun getAppEnvironment(context: Context): String {
|
||||||
|
return try {
|
||||||
|
val pInfo = context.packageManager.getPackageInfo(context.packageName, 0)
|
||||||
|
pInfo.packageName.substringAfterLast('.')
|
||||||
|
} catch (e: PackageManager.NameNotFoundException) {
|
||||||
|
"N/A"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// CustomDialogPreference.kt
|
||||||
|
class CustomDialogPreference(context: Context) : Preference(context) {
|
||||||
|
private var entries: Array<String> = arrayOf()
|
||||||
|
private var entryValues: Array<String> = arrayOf()
|
||||||
|
private var currentValue: String = ""
|
||||||
|
private var onValueChangeListener: ((String) -> Boolean)? = null
|
||||||
|
|
||||||
|
fun setEntries(entries: Array<String>) {
|
||||||
|
this.entries = entries
|
||||||
|
}
|
||||||
|
|
||||||
|
fun setEntryValues(values: Array<String>) {
|
||||||
|
this.entryValues = values
|
||||||
|
}
|
||||||
|
|
||||||
|
fun setValue(value: String) {
|
||||||
|
currentValue = value
|
||||||
|
persistString(value)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun setOnPreferenceChangeListener(listener: (String) -> Boolean) {
|
||||||
|
onValueChangeListener = listener
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onClick() {
|
||||||
|
val builder = MaterialAlertDialogBuilder(context)
|
||||||
|
builder.setTitle(title)
|
||||||
|
|
||||||
|
builder.setSingleChoiceItems(entries, entries.indexOf(currentValue)) { dialog, which ->
|
||||||
|
val newValue = entryValues[which]
|
||||||
|
if (onValueChangeListener?.invoke(newValue) == true) {
|
||||||
|
setValue(newValue)
|
||||||
|
dialog.dismiss()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
builder.setNegativeButton("Cancel") { dialog, _ ->
|
||||||
|
dialog.dismiss()
|
||||||
|
}
|
||||||
|
|
||||||
|
builder.show()
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,45 @@
|
|||||||
|
/*
|
||||||
|
* // Copyright (c) 2024 ShanMukha Innovations Pvt. Ltd. All rights reserved.
|
||||||
|
* // Notice: All information contained herein is, and remains
|
||||||
|
* // the property of ShanMukha Innovations Pvt. Ltd. and its suppliers,
|
||||||
|
* // if any. The intellectual and technical concepts contained
|
||||||
|
* // herein are proprietary to ShanMukha Innovations Pvt. Ltd.
|
||||||
|
* // and its suppliers and may be covered by Indian and Foreign Patents,
|
||||||
|
* // patents in process, and are protected by trade secret or copyright law.
|
||||||
|
* // Dissemination of this information or reproduction of this material
|
||||||
|
* // is strictly forbidden unless prior written permission is obtained
|
||||||
|
* // from ShanMukha Innovations Pvt. Ltd.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.example.hpostesting.presentation.main_base
|
||||||
|
|
||||||
|
import android.content.Context
|
||||||
|
import android.content.SharedPreferences
|
||||||
|
import android.os.Bundle
|
||||||
|
import androidx.appcompat.app.AppCompatActivity
|
||||||
|
import com.example.hpostesting.data.constant.Constants
|
||||||
|
import `in`.sminnovations.hpostesting.databinding.ActivityUpdateValuesBinding
|
||||||
|
|
||||||
|
class UpdateValuesActivity : AppCompatActivity() {
|
||||||
|
private lateinit var binding: ActivityUpdateValuesBinding
|
||||||
|
lateinit var sharedPreferences: SharedPreferences
|
||||||
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
|
super.onCreate(savedInstanceState)
|
||||||
|
binding = ActivityUpdateValuesBinding.inflate(layoutInflater)
|
||||||
|
sharedPreferences = this.getSharedPreferences("HEMOCUBE", Context.MODE_PRIVATE)
|
||||||
|
setContentView(binding.root)
|
||||||
|
binding.btnSubmit.setOnClickListener {
|
||||||
|
saveStringToPreferences(Constants.ABS2LED1MMLL, binding.et2mmled1Ll.text.toString())
|
||||||
|
saveStringToPreferences(Constants.ABS2LED1MMUL, binding.et2mmled1Ul.text.toString())
|
||||||
|
saveStringToPreferences(Constants.ABS2LED2MMLL, binding.et2mmled2Ll.text.toString())
|
||||||
|
saveStringToPreferences(Constants.ABS2LED2MMUL, binding.et2mmled2Ul.text.toString())
|
||||||
|
saveStringToPreferences(Constants.ABS10LED1MMLL, binding.et10mmled1Ll.text.toString())
|
||||||
|
saveStringToPreferences(Constants.ABS10LED1MMUL, binding.et10mmled1Ul.text.toString())
|
||||||
|
saveStringToPreferences(Constants.ABS10LED2MMLL, binding.et10mmled2Ll.text.toString())
|
||||||
|
saveStringToPreferences(Constants.ABS10LED2MMUL, binding.et10mmled2Ul.text.toString())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private fun saveStringToPreferences(key: String, value: String) {
|
||||||
|
sharedPreferences.edit().putString(key, value).apply()
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,371 @@
|
|||||||
|
/*
|
||||||
|
* // Copyright (c) 2024 ShanMukha Innovations Pvt. Ltd. All rights reserved.
|
||||||
|
* // Notice: All information contained herein is, and remains
|
||||||
|
* // the property of ShanMukha Innovations Pvt. Ltd. and its suppliers,
|
||||||
|
* // if any. The intellectual and technical concepts contained
|
||||||
|
* // herein are proprietary to ShanMukha Innovations Pvt. Ltd.
|
||||||
|
* // and its suppliers and may be covered by Indian and Foreign Patents,
|
||||||
|
* // patents in process, and are protected by trade secret or copyright law.
|
||||||
|
* // Dissemination of this information or reproduction of this material
|
||||||
|
* // is strictly forbidden unless prior written permission is obtained
|
||||||
|
* // from ShanMukha Innovations Pvt. Ltd.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.example.hpostesting.presentation.main_base.ui
|
||||||
|
|
||||||
|
import com.example.hpostesting.util.SecureStorage
|
||||||
|
import android.accounts.Account
|
||||||
|
import android.accounts.AccountManager
|
||||||
|
import android.annotation.SuppressLint
|
||||||
|
import android.content.Context
|
||||||
|
import android.content.SharedPreferences
|
||||||
|
import android.location.Location
|
||||||
|
import android.location.LocationListener
|
||||||
|
import android.location.LocationManager
|
||||||
|
import android.net.ConnectivityManager
|
||||||
|
import android.net.NetworkCapabilities
|
||||||
|
import android.os.Build
|
||||||
|
import android.os.Bundle
|
||||||
|
import android.util.Log
|
||||||
|
import android.view.LayoutInflater
|
||||||
|
import android.view.View
|
||||||
|
import android.view.ViewGroup
|
||||||
|
import android.widget.ArrayAdapter
|
||||||
|
import android.widget.Toast
|
||||||
|
import androidx.annotation.RequiresApi
|
||||||
|
import androidx.fragment.app.Fragment
|
||||||
|
import androidx.navigation.fragment.findNavController
|
||||||
|
import com.example.hpostesting.data.constant.Constants
|
||||||
|
import com.example.hpostesting.data.constant.DataHolder
|
||||||
|
import com.example.hpostesting.util.AppInitializer
|
||||||
|
import `in`.sminnovations.hpostesting.R
|
||||||
|
import `in`.sminnovations.hpostesting.databinding.FragmentLoginBinding
|
||||||
|
import kotlinx.coroutines.Dispatchers
|
||||||
|
import kotlinx.coroutines.GlobalScope
|
||||||
|
import kotlinx.coroutines.launch
|
||||||
|
import java.net.HttpURLConnection
|
||||||
|
import java.net.URL
|
||||||
|
import java.util.Scanner
|
||||||
|
|
||||||
|
|
||||||
|
class LoginFragment : Fragment() {
|
||||||
|
var latitude = 0.0
|
||||||
|
var longitude = 0.0
|
||||||
|
private lateinit var accountManager: AccountManager
|
||||||
|
private lateinit var secureStorage: SecureStorage
|
||||||
|
var TAG = "LoginFragmentCheck"
|
||||||
|
private var _binding: FragmentLoginBinding? = null
|
||||||
|
private val binding get() = _binding!!
|
||||||
|
private lateinit var sharedPreference: SharedPreferences
|
||||||
|
override fun onCreateView(
|
||||||
|
inflater: LayoutInflater, container: ViewGroup?,
|
||||||
|
savedInstanceState: Bundle?,
|
||||||
|
): View {
|
||||||
|
_binding = FragmentLoginBinding.inflate(inflater, container, false)
|
||||||
|
sharedPreference =
|
||||||
|
requireContext().getSharedPreferences("HEMOCUBE", Context.MODE_PRIVATE)
|
||||||
|
accountManager = AccountManager.get(requireActivity())
|
||||||
|
secureStorage = SecureStorage(requireActivity())
|
||||||
|
|
||||||
|
// Initialize user roles and credentials if not already done
|
||||||
|
AppInitializer.initialize(requireActivity())
|
||||||
|
return binding.root
|
||||||
|
}
|
||||||
|
|
||||||
|
@RequiresApi(Build.VERSION_CODES.M)
|
||||||
|
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||||
|
super.onViewCreated(view, savedInstanceState)
|
||||||
|
init()
|
||||||
|
|
||||||
|
// if(isInternetAvailable()){
|
||||||
|
// getPublicIpAddr { ipAddress ->
|
||||||
|
// DataHolder.ipAddress = ipAddress
|
||||||
|
// }
|
||||||
|
// Log.d("ipaddress",DataHolder.ipAddress)
|
||||||
|
// }
|
||||||
|
setupAutoCompleteTextView()
|
||||||
|
//checkLocation()
|
||||||
|
}
|
||||||
|
override fun onResume() {
|
||||||
|
super.onResume()
|
||||||
|
setupAutoCompleteTextView()
|
||||||
|
}
|
||||||
|
private fun setupAutoCompleteTextView() {
|
||||||
|
val districts = resources.getStringArray(R.array.district)
|
||||||
|
val adapter = ArrayAdapter(requireContext(), android.R.layout.simple_dropdown_item_1line, districts)
|
||||||
|
binding.etDistrict.setAdapter(adapter)
|
||||||
|
|
||||||
|
// Only set the default text if it's empty to avoid resetting user selection
|
||||||
|
if (binding.etDistrict.text.isEmpty()) {
|
||||||
|
binding.etDistrict.setText("Other", false)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private fun init() {
|
||||||
|
if (isUserLoggedIn()) {
|
||||||
|
navigateToHomeFragment()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
binding.btnLogin.setOnClickListener {
|
||||||
|
// Toast.makeText(requireContext(), "$latitude/$longitude",Toast.LENGTH_SHORT).show()
|
||||||
|
val loginId = binding.loginId.text.toString().trim()
|
||||||
|
val password = binding.password.text.toString().trim()
|
||||||
|
|
||||||
|
if (loginId.isNotBlank() && password.isNotBlank()) {
|
||||||
|
performLogin(loginId, password)
|
||||||
|
} else {
|
||||||
|
if (loginId.isBlank()) {
|
||||||
|
binding.loginId.error = R.string.enter_proper_login_id.toString()
|
||||||
|
Log.d("LoginFragment","enter proper login id")
|
||||||
|
}
|
||||||
|
if (password.isBlank()) {
|
||||||
|
binding.password.error = R.string.enter_proper_password.toString()
|
||||||
|
Log.d("LoginFragment","enter proper password")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun isUserLoggedIn(): Boolean {
|
||||||
|
return sharedPreference.getString(Constants.USER_ID, "")?.isNotBlank() == true
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun navigateToHomeFragment() {
|
||||||
|
Log.d("LoginFragment","Login Successful")
|
||||||
|
findNavController().navigate(R.id.action_loginFragment_to_homeFragment)
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun performLogin(loginId: String, password: String) {
|
||||||
|
if (validateCredentials(loginId, password)) {
|
||||||
|
addAccount(loginId, password)
|
||||||
|
val role = getRoleForUser(loginId)
|
||||||
|
saveUserId(role)
|
||||||
|
navigateToHomeFragment()
|
||||||
|
return
|
||||||
|
} else {
|
||||||
|
Toast.makeText(requireActivity(), "Invalid credentials", Toast.LENGTH_SHORT).show()
|
||||||
|
}
|
||||||
|
// val matchingId = Constants.STATICID.firstOrNull { it == loginId }
|
||||||
|
// if (matchingId != null) {
|
||||||
|
// if (password == Constants.password) {
|
||||||
|
// saveUserId(loginId)
|
||||||
|
// navigateToHomeFragment()
|
||||||
|
// return
|
||||||
|
// } else {
|
||||||
|
// Log.d("LoginFragment","wrong password")
|
||||||
|
// Toast.makeText(requireContext(), R.string.wrong_password, Toast.LENGTH_SHORT).show()
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// Log.d("LoginFragment","wrong password")
|
||||||
|
// Toast.makeText(requireContext(), R.string.wrong_user_id, Toast.LENGTH_SHORT).show()
|
||||||
|
}
|
||||||
|
private fun getRoleForUser(username: String): String {
|
||||||
|
// Replace this with your actual logic to determine the role for the user
|
||||||
|
return when (username) {
|
||||||
|
"FACTORY" -> "FACTORY"
|
||||||
|
"ADMIN" -> "ADMIN"
|
||||||
|
"PQUSER" -> "PQUSER"
|
||||||
|
"QCUSER" -> "QCUSER"
|
||||||
|
else -> "HPOSUSER"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private fun validateCredentials(username: String, password: String): Boolean {
|
||||||
|
var storedPassword = secureStorage.getPassword()
|
||||||
|
// if (!checkUserName(binding.etName.text.toString())) {
|
||||||
|
// binding.etName.error = "Name field can't be empty or less than 3 characters"
|
||||||
|
// return false
|
||||||
|
// }
|
||||||
|
if (!checkCenterName(binding.centerName.text.toString())) {
|
||||||
|
binding.centerName.error = "Center name can't be empty or less than 3 characters"
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
if(username == "ADMIN"){
|
||||||
|
storedPassword = secureStorage.getAdminPassword()
|
||||||
|
}
|
||||||
|
return storedPassword != null &&
|
||||||
|
password == storedPassword &&
|
||||||
|
(username == "HPOSUSER" || username == "ADMIN" || username == "FACTORY" || username == "PQUSER" || username == "QCUSER")
|
||||||
|
}
|
||||||
|
private fun addAccount(username: String, password: String) {
|
||||||
|
val account = Account(username, "com.example.account")
|
||||||
|
accountManager.addAccountExplicitly(account, password, null)
|
||||||
|
}
|
||||||
|
private fun saveUserId(userId: String) {
|
||||||
|
with(sharedPreference.edit()) {
|
||||||
|
putString(Constants.USER_ID, userId)
|
||||||
|
apply()
|
||||||
|
}
|
||||||
|
DataHolder.centerName = binding.centerName.text.toString()
|
||||||
|
DataHolder.district = binding.etDistrict.text.toString()
|
||||||
|
with(sharedPreference.edit()) {
|
||||||
|
putString(Constants.CENTER_NAME, binding.centerName.text.toString().lowercase().trim())
|
||||||
|
putString(Constants.DISTRICT, binding.etDistrict.text.toString())
|
||||||
|
apply()
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onDestroyView() {
|
||||||
|
super.onDestroyView()
|
||||||
|
_binding = null
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Check if we can get our location */
|
||||||
|
@SuppressLint("MissingPermission")
|
||||||
|
fun checkLocation() {
|
||||||
|
// Get the location manager
|
||||||
|
val locationManager = requireActivity().getSystemService(Context.LOCATION_SERVICE) as LocationManager
|
||||||
|
val locationProviderWifi = LocationManager.NETWORK_PROVIDER
|
||||||
|
val locationProviderGPS = LocationManager.GPS_PROVIDER
|
||||||
|
val locationListenerNetwork: LocationListener
|
||||||
|
val locationListenerGPS: LocationListener
|
||||||
|
var gps_enabled = false
|
||||||
|
var network_enabled = false
|
||||||
|
|
||||||
|
//check wifi
|
||||||
|
val connectivityManager = requireActivity().getSystemService(Context.CONNECTIVITY_SERVICE) as ConnectivityManager
|
||||||
|
val mWifi = connectivityManager.getNetworkInfo(ConnectivityManager.TYPE_WIFI)
|
||||||
|
if (mWifi!!.isConnected) {
|
||||||
|
Log.d(TAG, "Wifi connected")
|
||||||
|
}
|
||||||
|
|
||||||
|
//check gps and wifi availability
|
||||||
|
try {
|
||||||
|
gps_enabled = locationManager.isProviderEnabled(LocationManager.GPS_PROVIDER)
|
||||||
|
} catch (ex: Exception) {
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
network_enabled = locationManager.isProviderEnabled(LocationManager.NETWORK_PROVIDER)
|
||||||
|
} catch (ex: Exception) {
|
||||||
|
}
|
||||||
|
if (!gps_enabled) {
|
||||||
|
Log.d(TAG, "GPS: Missing")
|
||||||
|
}else{
|
||||||
|
// getPublicIpAddr { ipAddress ->
|
||||||
|
// // Do something with the ipAddress
|
||||||
|
// Log.d(TAG, "GPS: PRESENT"+ipAddress)
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
if (!network_enabled) {
|
||||||
|
Log.d(TAG, "Network: Missing")
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Location change listeners */try {
|
||||||
|
Log.d(TAG, "GPS: PRESENT TRy")
|
||||||
|
// Define a listener that responds to gps location updates
|
||||||
|
locationListenerGPS = object : LocationListener {
|
||||||
|
override fun onLocationChanged(location: Location) {
|
||||||
|
Log.d(TAG, "GPS: PRESENT loc")
|
||||||
|
Log.d(
|
||||||
|
TAG,
|
||||||
|
"GPS: Latitude: " + location.latitude + ", Longitude = " + location.longitude
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onStatusChanged(provider: String, status: Int, extras: Bundle) {
|
||||||
|
Log.d(TAG, "GP location found 1")
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onProviderEnabled(provider: String) {
|
||||||
|
Log.d(TAG, "GP location found 2")
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onProviderDisabled(provider: String) {
|
||||||
|
Log.d(TAG, "GP location found 3")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
locationManager.requestLocationUpdates(locationProviderGPS, 0, 0f, locationListenerGPS)
|
||||||
|
Log.d(TAG, "GPS: PRESENT Req")
|
||||||
|
} catch (e: Exception) {
|
||||||
|
Log.e(TAG, "Location Exception: " + e.message)
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
// Define a listener that responds to wifi location updates
|
||||||
|
locationListenerNetwork = object : LocationListener {
|
||||||
|
override fun onLocationChanged(location: Location) {
|
||||||
|
Log.d(
|
||||||
|
TAG,
|
||||||
|
"NW: Latitude: " + location.latitude + ", Longitude = " + location.longitude
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onStatusChanged(provider: String, status: Int, extras: Bundle) {
|
||||||
|
Log.d(TAG, "location found 1")
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onProviderEnabled(provider: String) {
|
||||||
|
Log.d(TAG, "location found 2")
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onProviderDisabled(provider: String) {
|
||||||
|
Log.d(TAG, "location found 3")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
locationManager.requestLocationUpdates(
|
||||||
|
locationProviderWifi,
|
||||||
|
0,
|
||||||
|
0f,
|
||||||
|
locationListenerNetwork
|
||||||
|
)
|
||||||
|
} catch (e: Exception) {
|
||||||
|
Log.e(TAG, "NW Location Exception: " + e.message)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// fun getPublicIpAddr(callback: (String) -> Unit) {
|
||||||
|
// GlobalScope.launch(Dispatchers.IO) {
|
||||||
|
// val url = URL("https://api.ipify.org")
|
||||||
|
// val conn = url.openConnection() as HttpURLConnection
|
||||||
|
// try {
|
||||||
|
// conn.connect()
|
||||||
|
// if (conn.responseCode == HttpURLConnection.HTTP_OK) {
|
||||||
|
// val scanner = Scanner(conn.inputStream)
|
||||||
|
// scanner.useDelimiter("\\A")
|
||||||
|
// if (scanner.hasNext()) {
|
||||||
|
// val ipAddress = scanner.next()
|
||||||
|
// callback(ipAddress)
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// } finally {
|
||||||
|
// conn.disconnect()
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
private fun getPublicIpAddr(callback: (String) -> Unit) {
|
||||||
|
try {
|
||||||
|
GlobalScope.launch(Dispatchers.IO) {
|
||||||
|
val url = URL("https://api.ipify.org")
|
||||||
|
val conn = url.openConnection() as HttpURLConnection
|
||||||
|
try {
|
||||||
|
conn.connect()
|
||||||
|
if (conn.responseCode == HttpURLConnection.HTTP_OK) {
|
||||||
|
val scanner = Scanner(conn.inputStream)
|
||||||
|
scanner.useDelimiter("\\A")
|
||||||
|
if (scanner.hasNext()) {
|
||||||
|
val ipAddress = scanner.next()
|
||||||
|
callback(ipAddress)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} finally {
|
||||||
|
conn.disconnect()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}catch (e: Exception){
|
||||||
|
Log.e(TAG,e.toString())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@SuppressLint("NewApi")
|
||||||
|
private fun isInternetAvailable(): Boolean {
|
||||||
|
val connectivityManager = requireActivity().getSystemService(Context.CONNECTIVITY_SERVICE) as ConnectivityManager
|
||||||
|
val network = connectivityManager.activeNetwork ?: return false
|
||||||
|
val networkCapabilities = connectivityManager.getNetworkCapabilities(network) ?: return false
|
||||||
|
return networkCapabilities.hasCapability(NetworkCapabilities.NET_CAPABILITY_INTERNET)
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun checkUserName(userName: String): Boolean {
|
||||||
|
return userName.isNotEmpty() && userName.length >= 3
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun checkCenterName(centerName: String): Boolean {
|
||||||
|
return centerName.isNotEmpty() && centerName.length >= 3
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,42 @@
|
|||||||
|
package com.example.hpostesting.presentation.main_base.ui
|
||||||
|
|
||||||
|
import com.example.hpostesting.util.SecureStorage
|
||||||
|
import android.os.Bundle
|
||||||
|
import android.widget.Button
|
||||||
|
import android.widget.EditText
|
||||||
|
import android.widget.Toast
|
||||||
|
import androidx.appcompat.app.AppCompatActivity
|
||||||
|
import `in`.sminnovations.hpostesting.R
|
||||||
|
|
||||||
|
class PasswordResetActivity : AppCompatActivity() {
|
||||||
|
|
||||||
|
private lateinit var editTextNewPassword: EditText
|
||||||
|
private lateinit var buttonResetPassword: Button
|
||||||
|
|
||||||
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
|
super.onCreate(savedInstanceState)
|
||||||
|
setContentView(R.layout.activity_password_reset)
|
||||||
|
|
||||||
|
editTextNewPassword = findViewById(R.id.editTextNewPassword)
|
||||||
|
buttonResetPassword = findViewById(R.id.buttonResetPassword)
|
||||||
|
|
||||||
|
buttonResetPassword.setOnClickListener {
|
||||||
|
val newPassword = editTextNewPassword.text.toString().trim()
|
||||||
|
if (newPassword.isNotEmpty()) {
|
||||||
|
resetPassword(newPassword)
|
||||||
|
} else {
|
||||||
|
Toast.makeText(this, "Please enter a new password", Toast.LENGTH_SHORT).show()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun resetPassword(newPassword: String) {
|
||||||
|
// Implement password reset logic here
|
||||||
|
// For example, you can store the new password securely
|
||||||
|
// and update it in the authentication system
|
||||||
|
val secureStorage = SecureStorage(this)
|
||||||
|
secureStorage.storePassword(newPassword)
|
||||||
|
Toast.makeText(this, "Password reset successfully", Toast.LENGTH_SHORT).show()
|
||||||
|
finish()
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -13,7 +13,7 @@
|
|||||||
|
|
||||||
package com.example.hpostesting.presentation.testRight
|
package com.example.hpostesting.presentation.testRight
|
||||||
|
|
||||||
import com.example.hpostesting.presentation.dashboard.DashboardActivity
|
import com.example.hpostesting.presentation.main_base.DashboardActivity
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
import android.content.SharedPreferences
|
import android.content.SharedPreferences
|
||||||
@@ -112,14 +112,14 @@ class TestRightResults : Fragment() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun updateResults() {
|
private fun updateResults() {
|
||||||
if (viewModel.testDetails?.name == "" && viewModel.testDetails?.birthYear == "") {
|
if (viewModel.testDetails?.name == "" && viewModel.testDetails?.age == "") {
|
||||||
binding.tvName.visibility = View.GONE
|
binding.tvName.visibility = View.GONE
|
||||||
binding.tvAge.visibility = View.GONE
|
binding.tvAge.visibility = View.GONE
|
||||||
} else {
|
} else {
|
||||||
binding.tvName.text = getString(R.string.name_in_textview, viewModel.testDetails?.name)
|
binding.tvName.text = getString(R.string.name_in_textview, viewModel.testDetails?.name)
|
||||||
binding.tvAge.text = getString(
|
binding.tvAge.text = getString(
|
||||||
R.string.age_in_textview,
|
R.string.age_in_textview,
|
||||||
viewModel.testDetails?.birthYear?.toInt()?.calculateAgeFromYOB().toString()
|
viewModel.testDetails?.age?.toInt()?.calculateAgeFromYOB().toString()
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -19,7 +19,6 @@ import androidx.lifecycle.MutableLiveData
|
|||||||
import androidx.lifecycle.ViewModel
|
import androidx.lifecycle.ViewModel
|
||||||
import androidx.lifecycle.viewModelScope
|
import androidx.lifecycle.viewModelScope
|
||||||
import com.example.hpostesting.data.constant.DataHolder
|
import com.example.hpostesting.data.constant.DataHolder
|
||||||
import com.example.hpostesting.util.NetworkStatusLiveData
|
|
||||||
import com.example.hpostesting.data.constant.Constants
|
import com.example.hpostesting.data.constant.Constants
|
||||||
import com.example.hpostesting.data.dao.UserDao
|
import com.example.hpostesting.data.dao.UserDao
|
||||||
import com.example.hpostesting.data.model.CalculationVariableForTest
|
import com.example.hpostesting.data.model.CalculationVariableForTest
|
||||||
@@ -36,6 +35,7 @@ import com.example.hpostesting.domain.SaveRawDataTest
|
|||||||
import com.example.hpostesting.domain.SickleFindResultCaluculationWithMaxImpl
|
import com.example.hpostesting.domain.SickleFindResultCaluculationWithMaxImpl
|
||||||
import com.example.hpostesting.domain.TestRightResultCalculation
|
import com.example.hpostesting.domain.TestRightResultCalculation
|
||||||
import com.example.hpostesting.util.MyUtils
|
import com.example.hpostesting.util.MyUtils
|
||||||
|
import com.example.hpostesting.util.NetworkMonitor
|
||||||
import com.google.firebase.storage.FirebaseStorage
|
import com.google.firebase.storage.FirebaseStorage
|
||||||
import dagger.hilt.android.lifecycle.HiltViewModel
|
import dagger.hilt.android.lifecycle.HiltViewModel
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
@@ -55,10 +55,10 @@ class TestRightViewModel @Inject constructor(
|
|||||||
private val saveRawDataTest: SaveRawDataTest,
|
private val saveRawDataTest: SaveRawDataTest,
|
||||||
private val repository: DatabaseRepository,
|
private val repository: DatabaseRepository,
|
||||||
private val userDao: UserDao,
|
private val userDao: UserDao,
|
||||||
|
networkMonitor: NetworkMonitor,
|
||||||
context: Context?
|
context: Context?
|
||||||
) : ViewModel() {
|
) : ViewModel() {
|
||||||
|
|
||||||
|
|
||||||
var isServiceConnected = false
|
var isServiceConnected = false
|
||||||
val progressBar = MutableLiveData(false)
|
val progressBar = MutableLiveData(false)
|
||||||
|
|
||||||
@@ -69,9 +69,8 @@ class TestRightViewModel @Inject constructor(
|
|||||||
|
|
||||||
var testDetails = DataHolder.selectedTest
|
var testDetails = DataHolder.selectedTest
|
||||||
|
|
||||||
private val _networkStatusLiveData = context?.let { NetworkStatusLiveData(it) }
|
private var _networkStatusLiveData = networkMonitor.isConnected
|
||||||
val networkStatusLiveData: NetworkStatusLiveData?
|
val networkStatusLiveData = _networkStatusLiveData
|
||||||
get() = _networkStatusLiveData
|
|
||||||
|
|
||||||
val allUserData = userDao.getAll()
|
val allUserData = userDao.getAll()
|
||||||
|
|
||||||
@@ -82,6 +81,11 @@ class TestRightViewModel @Inject constructor(
|
|||||||
|
|
||||||
val calculationVariableList = ArrayList<CalculationVariableForTest>()
|
val calculationVariableList = ArrayList<CalculationVariableForTest>()
|
||||||
|
|
||||||
|
init {
|
||||||
|
networkMonitor.startMonitoring()
|
||||||
|
_networkStatusLiveData = networkMonitor.isConnected
|
||||||
|
}
|
||||||
|
|
||||||
fun mapDeviceConstants(string: String) {
|
fun mapDeviceConstants(string: String) {
|
||||||
if (string.isNotEmpty()) {
|
if (string.isNotEmpty()) {
|
||||||
val listOfStrings = string.split(",")
|
val listOfStrings = string.split(",")
|
||||||
@@ -485,7 +489,7 @@ class TestRightViewModel @Inject constructor(
|
|||||||
|
|
||||||
val csvUri = csvUploadTask.storage.downloadUrl.await().toString()
|
val csvUri = csvUploadTask.storage.downloadUrl.await().toString()
|
||||||
val logUri = logUploadTask.storage.downloadUrl.await().toString()
|
val logUri = logUploadTask.storage.downloadUrl.await().toString()
|
||||||
val serialNumber = Constants.STATICID.firstOrNull { it == deviceSerialNumber }
|
// val serialNumber = Constants.STATICID.firstOrNull { it == deviceSerialNumber }
|
||||||
testDetails?.csvPath = csvUri
|
testDetails?.csvPath = csvUri
|
||||||
testDetails?.reportPath = logUri
|
testDetails?.reportPath = logUri
|
||||||
|
|
||||||
|
|||||||
@@ -36,8 +36,8 @@ import androidx.core.view.get
|
|||||||
import com.example.hpostesting.data.constant.DataHolder
|
import com.example.hpostesting.data.constant.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.constant.LanguageManager
|
||||||
import com.example.hpostesting.presentation.hemocube.HemoCubeFragment
|
import com.example.hpostesting.presentation.trueheme_test.TrueHemeTestFragment
|
||||||
import com.example.hpostesting.presentation.hemocube.HemoCubeViewModel
|
import com.example.hpostesting.presentation.trueheme_test.TrueHemeTestViewModel
|
||||||
import com.example.hpostesting.util.UsbService
|
import com.example.hpostesting.util.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
|
||||||
@@ -48,7 +48,7 @@ import `in`.sminnovations.hpostesting.databinding.ActivityHemocubeBinding
|
|||||||
@AndroidEntryPoint
|
@AndroidEntryPoint
|
||||||
class TrueHemeActivity : AppCompatActivity() {
|
class TrueHemeActivity : AppCompatActivity() {
|
||||||
private lateinit var binding: ActivityHemocubeBinding
|
private lateinit var binding: ActivityHemocubeBinding
|
||||||
private val viewModel by viewModels<HemoCubeViewModel>()
|
private val viewModel by viewModels<TrueHemeTestViewModel>()
|
||||||
private var myMenu: Menu? = null
|
private var myMenu: Menu? = null
|
||||||
|
|
||||||
private lateinit var mDriver: UsbSerialDriver
|
private lateinit var mDriver: UsbSerialDriver
|
||||||
@@ -177,14 +177,14 @@ class TrueHemeActivity : AppCompatActivity() {
|
|||||||
private fun moveToNext() {
|
private fun moveToNext() {
|
||||||
if (supportFragmentManager.isDestroyed) return
|
if (supportFragmentManager.isDestroyed) return
|
||||||
|
|
||||||
supportFragmentManager.beginTransaction().replace(binding.fghemocube.id, HemoCubeFragment())
|
supportFragmentManager.beginTransaction().replace(binding.fghemocube.id, TrueHemeTestFragment())
|
||||||
.commit()
|
.commit()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
override fun onBackPressed() {
|
override fun onBackPressed() {
|
||||||
val fragment = supportFragmentManager.findFragmentById(R.id.fghemocube)
|
val fragment = supportFragmentManager.findFragmentById(R.id.fghemocube)
|
||||||
if (fragment is HemoCubeFragment) {
|
if (fragment is TrueHemeTestFragment) {
|
||||||
fragment.handleBackButtonPress()
|
fragment.handleBackButtonPress()
|
||||||
} else {
|
} else {
|
||||||
super.onBackPressed()
|
super.onBackPressed()
|
||||||
|
|||||||
@@ -36,8 +36,8 @@ import com.example.hpostesting.data.model.TestState
|
|||||||
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.data.model.patient.toHemoCubeTestData
|
||||||
import com.example.hpostesting.presentation.utils.UsbServiceListener
|
import com.example.hpostesting.presentation.utils.UsbServiceListener
|
||||||
import com.example.hpostesting.presentation.dashboard.DashboardActivity
|
import com.example.hpostesting.presentation.main_base.DashboardActivity
|
||||||
import com.example.hpostesting.presentation.hemocube.HemocubeActivity
|
import com.example.hpostesting.presentation.trueheme_test.TrueHemeTestActivity
|
||||||
import com.example.hpostesting.presentation.utils.MyDialogListener
|
import com.example.hpostesting.presentation.utils.MyDialogListener
|
||||||
import com.example.hpostesting.presentation.utils.UIUtils
|
import com.example.hpostesting.presentation.utils.UIUtils
|
||||||
import com.google.firebase.crashlytics.ktx.crashlytics
|
import com.google.firebase.crashlytics.ktx.crashlytics
|
||||||
@@ -336,7 +336,7 @@ class TrueHemeFragment : Fragment() {
|
|||||||
startListening.postValue(true)
|
startListening.postValue(true)
|
||||||
|
|
||||||
try {
|
try {
|
||||||
(activity as HemocubeActivity).mService.listenToHemoCube(object : UsbServiceListener {
|
(activity as TrueHemeTestActivity).mService.listenToHemoCube(object : UsbServiceListener {
|
||||||
override fun onUsbRead(data: ByteArray?) {
|
override fun onUsbRead(data: ByteArray?) {
|
||||||
data?.let {
|
data?.let {
|
||||||
val stringData = String(it)
|
val stringData = String(it)
|
||||||
@@ -357,7 +357,7 @@ class TrueHemeFragment : Fragment() {
|
|||||||
|
|
||||||
private fun getDeviceInfo() {
|
private fun getDeviceInfo() {
|
||||||
hemoCubeViewModel.progressBar.postValue(true)
|
hemoCubeViewModel.progressBar.postValue(true)
|
||||||
(activity as HemocubeActivity).mService.sendAndListenToHemoCube(
|
(activity as TrueHemeTestActivity).mService.sendAndListenToHemoCube(
|
||||||
HemoCubeCommands.DEVICE_CONFIGURATION_COMMAND,
|
HemoCubeCommands.DEVICE_CONFIGURATION_COMMAND,
|
||||||
object : UsbServiceListener {
|
object : UsbServiceListener {
|
||||||
override fun onUsbRead(data: ByteArray?) {
|
override fun onUsbRead(data: ByteArray?) {
|
||||||
@@ -1067,7 +1067,7 @@ class TrueHemeFragment : Fragment() {
|
|||||||
binding.btnPlacebuffer.visibility = View.GONE
|
binding.btnPlacebuffer.visibility = View.GONE
|
||||||
}
|
}
|
||||||
|
|
||||||
(activity as HemocubeActivity).mService.sendAndListenToHemoCube(
|
(activity as TrueHemeTestActivity).mService.sendAndListenToHemoCube(
|
||||||
HemoCubeCommands.START_BUFFER_COMMAND,
|
HemoCubeCommands.START_BUFFER_COMMAND,
|
||||||
object : UsbServiceListener {
|
object : UsbServiceListener {
|
||||||
override fun onUsbRead(data: ByteArray?) {}
|
override fun onUsbRead(data: ByteArray?) {}
|
||||||
@@ -1081,7 +1081,7 @@ class TrueHemeFragment : Fragment() {
|
|||||||
private fun startSampleProcess() {
|
private fun startSampleProcess() {
|
||||||
hemoCubeViewModel.progressBar.postValue(true)
|
hemoCubeViewModel.progressBar.postValue(true)
|
||||||
|
|
||||||
(activity as HemocubeActivity).mService.sendAndListenToHemoCube(
|
(activity as TrueHemeTestActivity).mService.sendAndListenToHemoCube(
|
||||||
HemoCubeCommands.START_SAMPLE,
|
HemoCubeCommands.START_SAMPLE,
|
||||||
object : UsbServiceListener {
|
object : UsbServiceListener {
|
||||||
override fun onUsbRead(data: ByteArray?) {}
|
override fun onUsbRead(data: ByteArray?) {}
|
||||||
@@ -1095,7 +1095,7 @@ class TrueHemeFragment : Fragment() {
|
|||||||
private fun sendFirstGainCommand() {
|
private fun sendFirstGainCommand() {
|
||||||
hemoCubeViewModel.progressBar.postValue(true)
|
hemoCubeViewModel.progressBar.postValue(true)
|
||||||
|
|
||||||
(activity as HemocubeActivity).mService.sendAndListenToHemoCube(
|
(activity as TrueHemeTestActivity).mService.sendAndListenToHemoCube(
|
||||||
HemoCubeCommands.FIRST_GAIN_COMMAND,
|
HemoCubeCommands.FIRST_GAIN_COMMAND,
|
||||||
object : UsbServiceListener {
|
object : UsbServiceListener {
|
||||||
override fun onUsbRead(data: ByteArray?) {}
|
override fun onUsbRead(data: ByteArray?) {}
|
||||||
@@ -1109,7 +1109,7 @@ class TrueHemeFragment : Fragment() {
|
|||||||
private fun sendSecondGainCommand() {
|
private fun sendSecondGainCommand() {
|
||||||
hemoCubeViewModel.progressBar.postValue(true)
|
hemoCubeViewModel.progressBar.postValue(true)
|
||||||
|
|
||||||
(activity as HemocubeActivity).mService.sendAndListenToHemoCube(
|
(activity as TrueHemeTestActivity).mService.sendAndListenToHemoCube(
|
||||||
HemoCubeCommands.SECOND_GAIN_COMMAND,
|
HemoCubeCommands.SECOND_GAIN_COMMAND,
|
||||||
object : UsbServiceListener {
|
object : UsbServiceListener {
|
||||||
override fun onUsbRead(data: ByteArray?) {}
|
override fun onUsbRead(data: ByteArray?) {}
|
||||||
@@ -1123,7 +1123,7 @@ class TrueHemeFragment : Fragment() {
|
|||||||
private fun sendThirdGainCommand() {
|
private fun sendThirdGainCommand() {
|
||||||
hemoCubeViewModel.progressBar.postValue(true)
|
hemoCubeViewModel.progressBar.postValue(true)
|
||||||
|
|
||||||
(activity as HemocubeActivity).mService.sendAndListenToHemoCube(
|
(activity as TrueHemeTestActivity).mService.sendAndListenToHemoCube(
|
||||||
HemoCubeCommands.THIRD_GAIN_COMMAND,
|
HemoCubeCommands.THIRD_GAIN_COMMAND,
|
||||||
object : UsbServiceListener {
|
object : UsbServiceListener {
|
||||||
override fun onUsbRead(data: ByteArray?) {}
|
override fun onUsbRead(data: ByteArray?) {}
|
||||||
@@ -1137,7 +1137,7 @@ class TrueHemeFragment : Fragment() {
|
|||||||
private fun sendForthGainCommand() {
|
private fun sendForthGainCommand() {
|
||||||
hemoCubeViewModel.progressBar.postValue(true)
|
hemoCubeViewModel.progressBar.postValue(true)
|
||||||
|
|
||||||
(activity as HemocubeActivity).mService.sendAndListenToHemoCube(
|
(activity as TrueHemeTestActivity).mService.sendAndListenToHemoCube(
|
||||||
HemoCubeCommands.FORTH_GAIN_COMMAND,
|
HemoCubeCommands.FORTH_GAIN_COMMAND,
|
||||||
object : UsbServiceListener {
|
object : UsbServiceListener {
|
||||||
override fun onUsbRead(data: ByteArray?) {}
|
override fun onUsbRead(data: ByteArray?) {}
|
||||||
@@ -1151,7 +1151,7 @@ class TrueHemeFragment : Fragment() {
|
|||||||
private fun fetchResult() {
|
private fun fetchResult() {
|
||||||
hemoCubeViewModel.progressBar.postValue(true)
|
hemoCubeViewModel.progressBar.postValue(true)
|
||||||
|
|
||||||
(activity as HemocubeActivity).mService.sendAndListenToHemoCube(
|
(activity as TrueHemeTestActivity).mService.sendAndListenToHemoCube(
|
||||||
HemoCubeCommands.PRINT_COMMAND,
|
HemoCubeCommands.PRINT_COMMAND,
|
||||||
object : UsbServiceListener {
|
object : UsbServiceListener {
|
||||||
override fun onUsbRead(data: ByteArray?) {}
|
override fun onUsbRead(data: ByteArray?) {}
|
||||||
@@ -1170,7 +1170,7 @@ class TrueHemeFragment : Fragment() {
|
|||||||
|
|
||||||
private fun reconnect() {
|
private fun reconnect() {
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||||
(activity as HemocubeActivity).reconnectDevice()
|
(activity as TrueHemeTestActivity).reconnectDevice()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -25,11 +25,8 @@ import androidx.lifecycle.viewModelScope
|
|||||||
import androidx.work.ExistingPeriodicWorkPolicy
|
import androidx.work.ExistingPeriodicWorkPolicy
|
||||||
import androidx.work.PeriodicWorkRequestBuilder
|
import androidx.work.PeriodicWorkRequestBuilder
|
||||||
import androidx.work.WorkManager
|
import androidx.work.WorkManager
|
||||||
import com.example.hpostesting.util.CsvWriter
|
|
||||||
import com.example.hpostesting.data.constant.DataHolder
|
|
||||||
import com.example.hpostesting.util.NetworkStatusLiveData
|
|
||||||
import com.example.hpostesting.util.Result
|
|
||||||
import com.example.hpostesting.data.constant.Constants
|
import com.example.hpostesting.data.constant.Constants
|
||||||
|
import com.example.hpostesting.data.constant.DataHolder
|
||||||
import com.example.hpostesting.data.dao.HemoCubeBufferDao
|
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.datasource.LocalFileDataSource
|
import com.example.hpostesting.data.datasource.LocalFileDataSource
|
||||||
@@ -43,14 +40,15 @@ import com.example.hpostesting.data.model.molbioresult.MolbioV2ResultResponse
|
|||||||
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.MolbioHemocubeData
|
|
||||||
import com.example.hpostesting.data.model.patient.toHemoCubeTestData
|
import com.example.hpostesting.data.model.patient.toHemoCubeTestData
|
||||||
import com.example.hpostesting.data.model.updates.CheckUpdateRequest
|
import com.example.hpostesting.data.model.updates.CheckUpdateRequest
|
||||||
import com.example.hpostesting.data.model.updates.CheckUpdateResponse
|
import com.example.hpostesting.data.model.updates.CheckUpdateResponse
|
||||||
import com.example.hpostesting.data.model.updates.DeviceUpdateRequest
|
|
||||||
import com.example.hpostesting.data.repository.Repository
|
import com.example.hpostesting.data.repository.Repository
|
||||||
import com.example.hpostesting.domain.CheckUpdateWorker
|
import com.example.hpostesting.domain.CheckUpdateWorker
|
||||||
import com.example.hpostesting.domain.LogFileManager
|
import com.example.hpostesting.domain.LogFileManager
|
||||||
|
import com.example.hpostesting.util.CsvWriter
|
||||||
|
import com.example.hpostesting.util.NetworkMonitor
|
||||||
|
import com.example.hpostesting.util.Result
|
||||||
import dagger.hilt.android.lifecycle.HiltViewModel
|
import dagger.hilt.android.lifecycle.HiltViewModel
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
import okhttp3.MediaType.Companion.toMediaTypeOrNull
|
import okhttp3.MediaType.Companion.toMediaTypeOrNull
|
||||||
@@ -71,21 +69,22 @@ class TrueHemeViewModel @Inject constructor(
|
|||||||
private val repository: Repository,
|
private val repository: Repository,
|
||||||
private val logFileManager: LogFileManager,
|
private val logFileManager: LogFileManager,
|
||||||
private val localFileDataSource: LocalFileDataSource,
|
private val localFileDataSource: LocalFileDataSource,
|
||||||
|
networkMonitor: NetworkMonitor,
|
||||||
context: Context,
|
context: Context,
|
||||||
) : ViewModel() {
|
) : ViewModel() {
|
||||||
var isServiceConnected = false
|
var isServiceConnected = false
|
||||||
val progressBar = MutableLiveData(false)
|
val progressBar = MutableLiveData(false)
|
||||||
private val testDetails = DataHolder.selectedTest?.toHemoCubeTestData()
|
private val testDetails = DataHolder.selectedTest?.toHemoCubeTestData()
|
||||||
private val testDetailsmolbio = DataHolder.hemoCubeTestData?.MolbioHemocubeData()
|
|
||||||
val messages = MutableLiveData<String>()
|
val messages = MutableLiveData<String>()
|
||||||
private val sharedPreference =
|
private val sharedPreference = context.getSharedPreferences("HEMOCUBE", Context.MODE_PRIVATE)
|
||||||
context.getSharedPreferences("HEMOCUBE", Context.MODE_PRIVATE)
|
|
||||||
|
|
||||||
private val workManager = WorkManager.getInstance(context)
|
private val workManager = WorkManager.getInstance(context)
|
||||||
|
// init {
|
||||||
// init {
|
// startPeriodicCheckUpdate()
|
||||||
// startPeriodicCheckUpdate()
|
// }
|
||||||
// }
|
init {
|
||||||
|
networkMonitor.startMonitoring()
|
||||||
|
}
|
||||||
|
|
||||||
val loginResponse = MutableLiveData<Result<LoginResponse>>()
|
val loginResponse = MutableLiveData<Result<LoginResponse>>()
|
||||||
|
|
||||||
@@ -99,7 +98,7 @@ class TrueHemeViewModel @Inject constructor(
|
|||||||
|
|
||||||
// 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 = networkMonitor.isConnected
|
||||||
val allUserData = hemoCubeDao.getAll()
|
val allUserData = hemoCubeDao.getAll()
|
||||||
val allKitTestData = hemoCubeBufferDao.getAll()
|
val allKitTestData = hemoCubeBufferDao.getAll()
|
||||||
val deviceData = MutableLiveData<DeviceData?>()
|
val deviceData = MutableLiveData<DeviceData?>()
|
||||||
@@ -161,12 +160,12 @@ class TrueHemeViewModel @Inject constructor(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun deviceUpdate(deviceUpdateRequest: DeviceUpdateRequest) = viewModelScope.launch {
|
// fun deviceUpdate(deviceUpdateRequest: DeviceUpdateRequest) = viewModelScope.launch {
|
||||||
deviceUpdate.postValue(Result.Loading())
|
// deviceUpdate.postValue(Result.Loading())
|
||||||
repository.deviceUpdate(deviceUpdateRequest).let {
|
// repository.deviceUpdate(deviceUpdateRequest).let {
|
||||||
// deviceUpdate.postValue(it)
|
// deviceUpdate.postValue(it)
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
fun startPeriodicCheckUpdate() {
|
fun startPeriodicCheckUpdate() {
|
||||||
val periodicRequest = PeriodicWorkRequestBuilder<CheckUpdateWorker>(
|
val periodicRequest = PeriodicWorkRequestBuilder<CheckUpdateWorker>(
|
||||||
@@ -183,7 +182,7 @@ class TrueHemeViewModel @Inject constructor(
|
|||||||
val logFile = logFileManager.createLogFile().let { file ->
|
val logFile = logFileManager.createLogFile().let { file ->
|
||||||
val requestBody = file?.asRequestBody("multipart/form-data".toMediaTypeOrNull())
|
val requestBody = file?.asRequestBody("multipart/form-data".toMediaTypeOrNull())
|
||||||
val multipartFile =
|
val multipartFile =
|
||||||
requestBody?.let { MultipartBody.Part.createFormData("logFile", file?.name, it) }
|
requestBody?.let { MultipartBody.Part.createFormData("logFile", file.name, it) }
|
||||||
multipartFile?.let { partFile ->
|
multipartFile?.let { partFile ->
|
||||||
repository.uploadLogs(partFile).let { result ->
|
repository.uploadLogs(partFile).let { result ->
|
||||||
uploadLogs.postValue(result)
|
uploadLogs.postValue(result)
|
||||||
@@ -195,37 +194,35 @@ class TrueHemeViewModel @Inject constructor(
|
|||||||
fun uploadHemoCubeResultToDatabaseForBufferCheck(
|
fun uploadHemoCubeResultToDatabaseForBufferCheck(
|
||||||
isOnline: Boolean,
|
isOnline: Boolean,
|
||||||
bufferCheckData: BufferCheckData,
|
bufferCheckData: BufferCheckData,
|
||||||
) =
|
) = viewModelScope.launch {
|
||||||
viewModelScope.launch {
|
if (isOnline) {
|
||||||
if (isOnline) {
|
try {
|
||||||
try {
|
when (val response = repository.addTestToDatabaseforBufferCheck(bufferCheckData)) {
|
||||||
when (val response =
|
is Response.Success -> {
|
||||||
repository.addTestToDatabaseforBufferCheck(bufferCheckData)) {
|
Log.i("Testdb", "Data uploaded to Firestore successfully")
|
||||||
is Response.Success -> {
|
fireBaseUpload.postValue("Success")
|
||||||
Log.i("Testdb", "Data uploaded to Firestore successfully")
|
bufferCheckData.localFlag = true
|
||||||
fireBaseUpload.postValue("Success")
|
hemoCubeBufferDao.insertAll(bufferCheckData)
|
||||||
bufferCheckData.localFlag = true
|
|
||||||
hemoCubeBufferDao.insertAll(bufferCheckData)
|
|
||||||
}
|
|
||||||
|
|
||||||
is Response.Error -> {
|
|
||||||
Log.e("Testdb", "Error uploading data to Firestore: $response")
|
|
||||||
fireBaseUpload.postValue("Error")
|
|
||||||
bufferCheckData.localFlag = true
|
|
||||||
hemoCubeBufferDao.insertAll(bufferCheckData)
|
|
||||||
}
|
|
||||||
|
|
||||||
else -> {}
|
|
||||||
}
|
}
|
||||||
} catch (e: Exception) {
|
|
||||||
Log.e("Testdb", "Exception during data upload: ${e.message}")
|
is Response.Error -> {
|
||||||
fireBaseUpload.postValue("Error")
|
Log.e("Testdb", "Error uploading data to Firestore: $response")
|
||||||
|
fireBaseUpload.postValue("Error")
|
||||||
|
bufferCheckData.localFlag = true
|
||||||
|
hemoCubeBufferDao.insertAll(bufferCheckData)
|
||||||
|
}
|
||||||
|
|
||||||
|
else -> {}
|
||||||
}
|
}
|
||||||
} else {
|
} catch (e: Exception) {
|
||||||
hemoCubeBufferDao.insertAll(bufferCheckData)
|
Log.e("Testdb", "Exception during data upload: ${e.message}")
|
||||||
fireBaseUpload.postValue("Local")
|
fireBaseUpload.postValue("Error")
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
hemoCubeBufferDao.insertAll(bufferCheckData)
|
||||||
|
fireBaseUpload.postValue("Local")
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
fun bulkAddResultKitTestToDb(bufferCheckData: BufferCheckData) {
|
fun bulkAddResultKitTestToDb(bufferCheckData: BufferCheckData) {
|
||||||
viewModelScope.launch {
|
viewModelScope.launch {
|
||||||
@@ -289,7 +286,7 @@ class TrueHemeViewModel @Inject constructor(
|
|||||||
testDetails?.coefficients = DataHolder.hemoCubeTestData?.coefficients
|
testDetails?.coefficients = DataHolder.hemoCubeTestData?.coefficients
|
||||||
testDetails?.incubationTime = DataHolder.hemoCubeTestData?.incubationTime.toString()
|
testDetails?.incubationTime = DataHolder.hemoCubeTestData?.incubationTime.toString()
|
||||||
testDetails?.name = DataHolder.hemoCubeTestData?.name.toString()
|
testDetails?.name = DataHolder.hemoCubeTestData?.name.toString()
|
||||||
testDetails?.birthYear = DataHolder.hemoCubeTestData?.birthYear.toString()
|
testDetails?.age = DataHolder.hemoCubeTestData?.age.toString()
|
||||||
testDetails?.userImageURL = DataHolder.hemoCubeTestData?.userImageURL.toString()
|
testDetails?.userImageURL = DataHolder.hemoCubeTestData?.userImageURL.toString()
|
||||||
testDetails?.classificationResult = DataHolder.hemoCubeTestData?.classificationResult!!
|
testDetails?.classificationResult = DataHolder.hemoCubeTestData?.classificationResult!!
|
||||||
testDetails?.prdClassification = DataHolder.hemoCubeTestData?.prdClassification.toString()
|
testDetails?.prdClassification = DataHolder.hemoCubeTestData?.prdClassification.toString()
|
||||||
@@ -323,12 +320,12 @@ class TrueHemeViewModel @Inject constructor(
|
|||||||
}
|
}
|
||||||
Log.i("Testdb", "Data uploaded to Firestore successfully")
|
Log.i("Testdb", "Data uploaded to Firestore successfully")
|
||||||
fireBaseUpload.postValue("Success")
|
fireBaseUpload.postValue("Success")
|
||||||
testDetailsmolbio!!.localFlag = true
|
testDetails.localFlag = true
|
||||||
uploadResult(
|
uploadResult(
|
||||||
MolbioV2ResultRequest(
|
MolbioV2ResultRequest(
|
||||||
mutableListOf(
|
mutableListOf(
|
||||||
MolbioV2Result(
|
MolbioV2Result(
|
||||||
rawData = testDetailsmolbio,
|
rawData = testDetails,
|
||||||
analysisId = testDetails._id,
|
analysisId = testDetails._id,
|
||||||
analysisDate = testDetails.testTime,
|
analysisDate = testDetails.testTime,
|
||||||
analysisStatus = testDetails.classificationResult,
|
analysisStatus = testDetails.classificationResult,
|
||||||
@@ -398,8 +395,7 @@ class TrueHemeViewModel @Inject constructor(
|
|||||||
viewModelScope.launch {
|
viewModelScope.launch {
|
||||||
try {
|
try {
|
||||||
|
|
||||||
when (val response =
|
when (val response = repository.addTestToDatabaseforBufferCheck(bufferCheckData)) {
|
||||||
repository.addTestToDatabaseforBufferCheck(bufferCheckData)) {
|
|
||||||
is Response.Success -> {
|
is Response.Success -> {
|
||||||
Log.i("Testdb", "Data uploaded to Firestore successfully")
|
Log.i("Testdb", "Data uploaded to Firestore successfully")
|
||||||
fireBaseUpload.postValue("Success")
|
fireBaseUpload.postValue("Success")
|
||||||
@@ -417,10 +413,9 @@ class TrueHemeViewModel @Inject constructor(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun updateBufferLocalFlag(bufferId: String) =
|
private fun updateBufferLocalFlag(bufferId: String) = viewModelScope.launch {
|
||||||
viewModelScope.launch {
|
hemoCubeBufferDao.updateFieldById(id = bufferId, true)
|
||||||
hemoCubeBufferDao.updateFieldById(id = bufferId, true)
|
}
|
||||||
}
|
|
||||||
|
|
||||||
fun getLocalUserDataForCsv(context: Context): Boolean {
|
fun getLocalUserDataForCsv(context: Context): Boolean {
|
||||||
val localUserDataLiveData: LiveData<List<HemoCubeTestData>> = hemoCubeDao.getAll()
|
val localUserDataLiveData: LiveData<List<HemoCubeTestData>> = hemoCubeDao.getAll()
|
||||||
@@ -436,7 +431,7 @@ class TrueHemeViewModel @Inject constructor(
|
|||||||
userData._id,
|
userData._id,
|
||||||
userData.name,
|
userData.name,
|
||||||
userData.bloodGroup,
|
userData.bloodGroup,
|
||||||
userData.birthYear,
|
userData.age,
|
||||||
userData.classificationResult,
|
userData.classificationResult,
|
||||||
userData.testTime.toString(),
|
userData.testTime.toString(),
|
||||||
userData.userImageURL
|
userData.userImageURL
|
||||||
@@ -457,16 +452,12 @@ class TrueHemeViewModel @Inject constructor(
|
|||||||
|
|
||||||
fun getBatteryLevel(): Float? {
|
fun getBatteryLevel(): Float? {
|
||||||
val batteryPct: Float? = batteryStatus?.let { intent ->
|
val batteryPct: Float? = batteryStatus?.let { intent ->
|
||||||
val level: Int =
|
val level: Int = intent.getIntExtra(
|
||||||
intent.getIntExtra(
|
BatteryManager.EXTRA_LEVEL, -1
|
||||||
BatteryManager.EXTRA_LEVEL,
|
)
|
||||||
-1
|
val scale: Int = intent.getIntExtra(
|
||||||
)
|
BatteryManager.EXTRA_SCALE, -1
|
||||||
val scale: Int =
|
)
|
||||||
intent.getIntExtra(
|
|
||||||
BatteryManager.EXTRA_SCALE,
|
|
||||||
-1
|
|
||||||
)
|
|
||||||
level * 100 / scale.toFloat()
|
level * 100 / scale.toFloat()
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -476,8 +467,7 @@ class TrueHemeViewModel @Inject constructor(
|
|||||||
fun getBatteryTemperature(): Float? {
|
fun getBatteryTemperature(): Float? {
|
||||||
val batteryTemp: Float? = batteryStatus?.let { intent ->
|
val batteryTemp: Float? = batteryStatus?.let { intent ->
|
||||||
val temperature = intent.getIntExtra(
|
val temperature = intent.getIntExtra(
|
||||||
BatteryManager.EXTRA_TEMPERATURE,
|
BatteryManager.EXTRA_TEMPERATURE, 0
|
||||||
0
|
|
||||||
)
|
)
|
||||||
temperature.toFloat() / 10
|
temperature.toFloat() / 10
|
||||||
}
|
}
|
||||||
@@ -486,14 +476,11 @@ class TrueHemeViewModel @Inject constructor(
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun getBatteryVoltage(context: Context): Float {
|
fun getBatteryVoltage(context: Context): Float {
|
||||||
val batteryIntent =
|
val batteryIntent = context.registerReceiver(
|
||||||
context.registerReceiver(
|
null, IntentFilter(Intent.ACTION_BATTERY_CHANGED)
|
||||||
null,
|
)
|
||||||
IntentFilter(Intent.ACTION_BATTERY_CHANGED)
|
|
||||||
)
|
|
||||||
val voltage = batteryIntent?.getIntExtra(
|
val voltage = batteryIntent?.getIntExtra(
|
||||||
BatteryManager.EXTRA_VOLTAGE,
|
BatteryManager.EXTRA_VOLTAGE, 0
|
||||||
0
|
|
||||||
) ?: 0
|
) ?: 0
|
||||||
|
|
||||||
// milli-volts to volts
|
// milli-volts to volts
|
||||||
@@ -502,8 +489,7 @@ class TrueHemeViewModel @Inject constructor(
|
|||||||
|
|
||||||
|
|
||||||
fun getBatteryCapacity(context: Context): Int {
|
fun getBatteryCapacity(context: Context): Int {
|
||||||
val batteryManager =
|
val batteryManager = context.getSystemService(Context.BATTERY_SERVICE) as BatteryManager
|
||||||
context.getSystemService(Context.BATTERY_SERVICE) as BatteryManager
|
|
||||||
val currentCapacity =
|
val currentCapacity =
|
||||||
batteryManager.getIntProperty(BatteryManager.BATTERY_PROPERTY_CHARGE_COUNTER)
|
batteryManager.getIntProperty(BatteryManager.BATTERY_PROPERTY_CHARGE_COUNTER)
|
||||||
|
|
||||||
@@ -512,8 +498,7 @@ class TrueHemeViewModel @Inject constructor(
|
|||||||
|
|
||||||
fun getBatteryMaxCapacity(context: Context): Float {
|
fun getBatteryMaxCapacity(context: Context): Float {
|
||||||
val batteryManager = context.getSystemService(Context.BATTERY_SERVICE) as BatteryManager
|
val batteryManager = context.getSystemService(Context.BATTERY_SERVICE) as BatteryManager
|
||||||
val designCapacity =
|
val designCapacity = batteryManager.getIntProperty(BatteryManager.BATTERY_PROPERTY_CAPACITY)
|
||||||
batteryManager.getIntProperty(BatteryManager.BATTERY_PROPERTY_CAPACITY)
|
|
||||||
val currentCapacity =
|
val currentCapacity =
|
||||||
batteryManager.getIntProperty(BatteryManager.BATTERY_PROPERTY_CHARGE_COUNTER)
|
batteryManager.getIntProperty(BatteryManager.BATTERY_PROPERTY_CHARGE_COUNTER)
|
||||||
|
|
||||||
@@ -530,8 +515,7 @@ class TrueHemeViewModel @Inject constructor(
|
|||||||
hemoCubeTestData.forEach { data ->
|
hemoCubeTestData.forEach { data ->
|
||||||
data.localFlag = true
|
data.localFlag = true
|
||||||
hemoCubeDao.updateCSVFieldById(
|
hemoCubeDao.updateCSVFieldById(
|
||||||
data._id,
|
data._id, true
|
||||||
true
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,7 +11,7 @@
|
|||||||
* // from ShanMukha Innovations Pvt. Ltd.
|
* // from ShanMukha Innovations Pvt. Ltd.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.example.hpostesting.presentation.hemocube
|
package com.example.hpostesting.presentation.trueheme_test
|
||||||
|
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
@@ -11,7 +11,7 @@
|
|||||||
* // from ShanMukha Innovations Pvt. Ltd.
|
* // from ShanMukha Innovations Pvt. Ltd.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.example.hpostesting.presentation.hemocube
|
package com.example.hpostesting.presentation.trueheme_test
|
||||||
|
|
||||||
import android.annotation.SuppressLint
|
import android.annotation.SuppressLint
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
@@ -33,7 +33,7 @@ import java.util.Locale
|
|||||||
|
|
||||||
class DigitalCardFragment : Fragment() {
|
class DigitalCardFragment : Fragment() {
|
||||||
private lateinit var binding: FragmentDigitalCardBinding
|
private lateinit var binding: FragmentDigitalCardBinding
|
||||||
private val hemoCubeViewModel: HemoCubeViewModel by activityViewModels()
|
private val trueHemeTestViewModel: TrueHemeTestViewModel by activityViewModels()
|
||||||
private lateinit var sharedPreferences: SharedPreferences
|
private lateinit var sharedPreferences: SharedPreferences
|
||||||
private val testDetails = DataHolder.selectedTest?.toHemoCubeTestData()
|
private val testDetails = DataHolder.selectedTest?.toHemoCubeTestData()
|
||||||
|
|
||||||
@@ -57,7 +57,7 @@ class DigitalCardFragment : Fragment() {
|
|||||||
binding.progressBar.visibility = View.VISIBLE
|
binding.progressBar.visibility = View.VISIBLE
|
||||||
}
|
}
|
||||||
Log.d("DigitalCardFragment", "Name: ${DataHolder.hemoCubeTestData?.name}")
|
Log.d("DigitalCardFragment", "Name: ${DataHolder.hemoCubeTestData?.name}")
|
||||||
Log.d("DigitalCardFragment", "DOB: ${testDetails?.birthYear}")
|
Log.d("DigitalCardFragment", "DOB: ${testDetails?.age}")
|
||||||
Log.d("DigitalCardFragment", "Gender: ${testDetails?.gender}")
|
Log.d("DigitalCardFragment", "Gender: ${testDetails?.gender}")
|
||||||
Log.d("DigitalCardFragment", "State: ${testDetails?.state}")
|
Log.d("DigitalCardFragment", "State: ${testDetails?.state}")
|
||||||
Log.d("DigitalCardFragment", "ABHA ID: ${testDetails?.abhaId}")
|
Log.d("DigitalCardFragment", "ABHA ID: ${testDetails?.abhaId}")
|
||||||
@@ -67,7 +67,7 @@ class DigitalCardFragment : Fragment() {
|
|||||||
activity?.runOnUiThread {
|
activity?.runOnUiThread {
|
||||||
binding.progressBar.visibility = View.GONE
|
binding.progressBar.visibility = View.GONE
|
||||||
binding.name.text = "Name: ${DataHolder.hemoCubeTestData?.name}"
|
binding.name.text = "Name: ${DataHolder.hemoCubeTestData?.name}"
|
||||||
binding.dob.text = "DOB: ${testDetails?.birthYear}"
|
binding.dob.text = "DOB: ${testDetails?.age}"
|
||||||
binding.gender.text = "Gender: ${testDetails?.gender}"
|
binding.gender.text = "Gender: ${testDetails?.gender}"
|
||||||
binding.State.text = "State: ${testDetails?.state}"
|
binding.State.text = "State: ${testDetails?.state}"
|
||||||
binding.abhaid.text = "ABHA ID: ${testDetails?.abhaId}"
|
binding.abhaid.text = "ABHA ID: ${testDetails?.abhaId}"
|
||||||
@@ -11,7 +11,7 @@
|
|||||||
* // from ShanMukha Innovations Pvt. Ltd.
|
* // from ShanMukha Innovations Pvt. Ltd.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.example.hpostesting.presentation.hemocube
|
package com.example.hpostesting.presentation.trueheme_test
|
||||||
|
|
||||||
import android.annotation.SuppressLint
|
import android.annotation.SuppressLint
|
||||||
import android.app.PendingIntent
|
import android.app.PendingIntent
|
||||||
@@ -21,6 +21,7 @@ import android.content.Context
|
|||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
import android.content.IntentFilter
|
import android.content.IntentFilter
|
||||||
import android.content.ServiceConnection
|
import android.content.ServiceConnection
|
||||||
|
import android.content.SharedPreferences
|
||||||
import android.hardware.usb.UsbDevice
|
import android.hardware.usb.UsbDevice
|
||||||
import android.hardware.usb.UsbDeviceConnection
|
import android.hardware.usb.UsbDeviceConnection
|
||||||
import android.hardware.usb.UsbManager
|
import android.hardware.usb.UsbManager
|
||||||
@@ -35,8 +36,8 @@ 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 androidx.core.view.get
|
import androidx.core.view.get
|
||||||
import com.example.hpostesting.data.constant.DataHolder
|
|
||||||
import com.example.hpostesting.data.constant.Constants
|
import com.example.hpostesting.data.constant.Constants
|
||||||
|
import com.example.hpostesting.data.constant.DataHolder
|
||||||
import com.example.hpostesting.data.constant.LanguageManager
|
import com.example.hpostesting.data.constant.LanguageManager
|
||||||
import com.example.hpostesting.util.UsbService
|
import com.example.hpostesting.util.UsbService
|
||||||
import com.hoho.android.usbserial.driver.UsbSerialDriver
|
import com.hoho.android.usbserial.driver.UsbSerialDriver
|
||||||
@@ -46,11 +47,11 @@ import `in`.sminnovations.hpostesting.R
|
|||||||
import `in`.sminnovations.hpostesting.databinding.ActivityHemocubeBinding
|
import `in`.sminnovations.hpostesting.databinding.ActivityHemocubeBinding
|
||||||
|
|
||||||
@AndroidEntryPoint
|
@AndroidEntryPoint
|
||||||
open class HemocubeActivity : AppCompatActivity() {
|
open class TrueHemeTestActivity : AppCompatActivity() {
|
||||||
private lateinit var binding: ActivityHemocubeBinding
|
private lateinit var binding: ActivityHemocubeBinding
|
||||||
private val viewModel by viewModels<HemoCubeViewModel>()
|
private val viewModel by viewModels<TrueHemeTestViewModel>()
|
||||||
private var myMenu: Menu? = null
|
private var myMenu: Menu? = null
|
||||||
|
lateinit var sharedPreferences: SharedPreferences
|
||||||
private lateinit var mDriver: UsbSerialDriver
|
private lateinit var mDriver: UsbSerialDriver
|
||||||
private var mConnection: UsbDeviceConnection? = null
|
private var mConnection: UsbDeviceConnection? = null
|
||||||
lateinit var mService: UsbService
|
lateinit var mService: UsbService
|
||||||
@@ -70,6 +71,7 @@ open class HemocubeActivity : AppCompatActivity() {
|
|||||||
DataHolder.usbConnected.postValue(true)
|
DataHolder.usbConnected.postValue(true)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
Log.d("HemoCubeActivity", "permission denied for device")
|
||||||
onErrorReported("permission denied for device")
|
onErrorReported("permission denied for device")
|
||||||
DataHolder.usbConnected.postValue(true)
|
DataHolder.usbConnected.postValue(true)
|
||||||
}
|
}
|
||||||
@@ -115,10 +117,12 @@ open class HemocubeActivity : AppCompatActivity() {
|
|||||||
if (it) {
|
if (it) {
|
||||||
myMenu?.get(0)?.icon =
|
myMenu?.get(0)?.icon =
|
||||||
ContextCompat.getDrawable(this, R.drawable.ic_baseline_usb_24)
|
ContextCompat.getDrawable(this, R.drawable.ic_baseline_usb_24)
|
||||||
|
Log.d("HemoCubeActivity", "Device is Connected")
|
||||||
} else {
|
} else {
|
||||||
myMenu?.get(0)?.icon =
|
myMenu?.get(0)?.icon =
|
||||||
ContextCompat.getDrawable(this, R.drawable.ic_baseline_usb_off_24)
|
ContextCompat.getDrawable(this, R.drawable.ic_baseline_usb_off_24)
|
||||||
Toast.makeText(this, "Device is Disconnected", Toast.LENGTH_SHORT).show()
|
Toast.makeText(this, "Device is Disconnected", Toast.LENGTH_SHORT).show()
|
||||||
|
Log.d("HemoCubeActivity", "Device is Disconnected")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -130,8 +134,10 @@ open class HemocubeActivity : AppCompatActivity() {
|
|||||||
val availableDrivers = UsbSerialProber.getDefaultProber().findAllDrivers(manager)
|
val availableDrivers = UsbSerialProber.getDefaultProber().findAllDrivers(manager)
|
||||||
|
|
||||||
if (availableDrivers.isEmpty()) {
|
if (availableDrivers.isEmpty()) {
|
||||||
|
Log.d("HemoCubeActivity", "No Device is Connected")
|
||||||
onErrorReported("No Device is Connected")
|
onErrorReported("No Device is Connected")
|
||||||
} else {
|
} else {
|
||||||
|
Log.d("HemoCubeActivity", "Device available")
|
||||||
mDriver = availableDrivers[0]
|
mDriver = availableDrivers[0]
|
||||||
mConnection = manager.openDevice(mDriver.device)
|
mConnection = manager.openDevice(mDriver.device)
|
||||||
|
|
||||||
@@ -186,19 +192,30 @@ open class HemocubeActivity : AppCompatActivity() {
|
|||||||
private fun moveToNext() {
|
private fun moveToNext() {
|
||||||
if (supportFragmentManager.isDestroyed) return
|
if (supportFragmentManager.isDestroyed) return
|
||||||
|
|
||||||
supportFragmentManager.beginTransaction().replace(binding.fghemocube.id, HemoCubeFragment())
|
supportFragmentManager.beginTransaction().replace(binding.fghemocube.id, TrueHemeTestFragment())
|
||||||
.commit()
|
.commit()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
override fun onBackPressed() {
|
// override fun onBackPressed() {
|
||||||
val fragment = supportFragmentManager.findFragmentById(R.id.fghemocube)
|
// val fragment = supportFragmentManager.findFragmentById(R.id.fghemocube)
|
||||||
if (fragment is HemoCubeFragment) {
|
// if (fragment is HemoCubeFragment) {
|
||||||
fragment.handleBackButtonPress()
|
// fragment.handleBackButtonPress()
|
||||||
} else {
|
// } else {
|
||||||
super.onBackPressed()
|
// super.onBackPressed()
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
override fun onBackPressed() {
|
||||||
|
val fragment = supportFragmentManager.findFragmentById(R.id.fghemocube)
|
||||||
|
if (fragment is TrueHemeTestFragment) {
|
||||||
|
if (fragment.handleBackButtonPress()) {
|
||||||
|
// If the fragment handled the back press, return to avoid calling super.onBackPressed
|
||||||
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// If the fragment did not handle the back press, call the superclass method
|
||||||
|
super.onBackPressed()
|
||||||
|
}
|
||||||
|
|
||||||
fun onErrorReported(msg: String) {
|
fun onErrorReported(msg: String) {
|
||||||
Toast.makeText(this, msg, Toast.LENGTH_SHORT).show()
|
Toast.makeText(this, msg, Toast.LENGTH_SHORT).show()
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -11,7 +11,7 @@
|
|||||||
* // from ShanMukha Innovations Pvt. Ltd.
|
* // from ShanMukha Innovations Pvt. Ltd.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.example.hpostesting.presentation.hemocube
|
package com.example.hpostesting.presentation.trueheme_test
|
||||||
|
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
@@ -27,7 +27,6 @@ import androidx.work.PeriodicWorkRequestBuilder
|
|||||||
import androidx.work.WorkManager
|
import androidx.work.WorkManager
|
||||||
import com.example.hpostesting.util.CsvWriter
|
import com.example.hpostesting.util.CsvWriter
|
||||||
import com.example.hpostesting.data.constant.DataHolder
|
import com.example.hpostesting.data.constant.DataHolder
|
||||||
import com.example.hpostesting.util.NetworkStatusLiveData
|
|
||||||
import com.example.hpostesting.util.Result
|
import com.example.hpostesting.util.Result
|
||||||
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.HemoCubeBufferDao
|
||||||
@@ -43,7 +42,6 @@ import com.example.hpostesting.data.model.molbioresult.MolbioV2ResultResponse
|
|||||||
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.MolbioHemocubeData
|
|
||||||
import com.example.hpostesting.data.model.patient.toHemoCubeTestData
|
import com.example.hpostesting.data.model.patient.toHemoCubeTestData
|
||||||
import com.example.hpostesting.data.model.updates.CheckUpdateRequest
|
import com.example.hpostesting.data.model.updates.CheckUpdateRequest
|
||||||
import com.example.hpostesting.data.model.updates.CheckUpdateResponse
|
import com.example.hpostesting.data.model.updates.CheckUpdateResponse
|
||||||
@@ -51,8 +49,8 @@ import com.example.hpostesting.data.model.updates.DeviceUpdateRequest
|
|||||||
import com.example.hpostesting.data.repository.Repository
|
import com.example.hpostesting.data.repository.Repository
|
||||||
import com.example.hpostesting.domain.CheckUpdateWorker
|
import com.example.hpostesting.domain.CheckUpdateWorker
|
||||||
import com.example.hpostesting.domain.LogFileManager
|
import com.example.hpostesting.domain.LogFileManager
|
||||||
|
import com.example.hpostesting.util.NetworkMonitor
|
||||||
import dagger.hilt.android.lifecycle.HiltViewModel
|
import dagger.hilt.android.lifecycle.HiltViewModel
|
||||||
import kotlinx.coroutines.CoroutineExceptionHandler
|
|
||||||
import kotlinx.coroutines.Dispatchers
|
import kotlinx.coroutines.Dispatchers
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
import okhttp3.Headers
|
import okhttp3.Headers
|
||||||
@@ -68,18 +66,19 @@ import javax.inject.Inject
|
|||||||
|
|
||||||
@Suppress("MemberVisibilityCanBePrivate")
|
@Suppress("MemberVisibilityCanBePrivate")
|
||||||
@HiltViewModel
|
@HiltViewModel
|
||||||
class HemoCubeViewModel @Inject constructor(
|
class TrueHemeTestViewModel @Inject constructor(
|
||||||
private val hemoCubeDao: HemoCubeDao,
|
val hemoCubeDao: HemoCubeDao,
|
||||||
private val hemoCubeBufferDao: HemoCubeBufferDao,
|
private val hemoCubeBufferDao: HemoCubeBufferDao,
|
||||||
private val repository: Repository,
|
private val repository: Repository,
|
||||||
private val logFileManager: LogFileManager,
|
private val logFileManager: LogFileManager,
|
||||||
private val localFileDataSource: LocalFileDataSource,
|
private val localFileDataSource: LocalFileDataSource,
|
||||||
|
networkMonitor: NetworkMonitor,
|
||||||
context: Context,
|
context: Context,
|
||||||
) : ViewModel() {
|
) : ViewModel() {
|
||||||
|
private var testUpload: Boolean = false
|
||||||
var isServiceConnected = false
|
var isServiceConnected = false
|
||||||
val progressBar = MutableLiveData(false)
|
val progressBar = MutableLiveData(false)
|
||||||
private val testDetails = DataHolder.selectedTest?.toHemoCubeTestData()
|
private val testDetails = DataHolder.selectedTest?.toHemoCubeTestData()
|
||||||
private val testDetailsmolbio = DataHolder.hemoCubeTestData?.MolbioHemocubeData()
|
|
||||||
val messages = MutableLiveData<String>()
|
val messages = MutableLiveData<String>()
|
||||||
private val sharedPreference =
|
private val sharedPreference =
|
||||||
context.getSharedPreferences("HEMOCUBE", Context.MODE_PRIVATE)
|
context.getSharedPreferences("HEMOCUBE", Context.MODE_PRIVATE)
|
||||||
@@ -89,6 +88,9 @@ class HemoCubeViewModel @Inject constructor(
|
|||||||
// init {
|
// init {
|
||||||
// startPeriodicCheckUpdate()
|
// startPeriodicCheckUpdate()
|
||||||
// }
|
// }
|
||||||
|
init {
|
||||||
|
networkMonitor.startMonitoring()
|
||||||
|
}
|
||||||
|
|
||||||
val loginResponse = MutableLiveData<Result<LoginResponse>>()
|
val loginResponse = MutableLiveData<Result<LoginResponse>>()
|
||||||
|
|
||||||
@@ -105,7 +107,7 @@ class HemoCubeViewModel @Inject constructor(
|
|||||||
|
|
||||||
// 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 =networkMonitor.isConnected
|
||||||
val allUserData = hemoCubeDao.getAll()
|
val allUserData = hemoCubeDao.getAll()
|
||||||
val allLocalData = hemoCubeDao.getAll()
|
val allLocalData = hemoCubeDao.getAll()
|
||||||
val allPendingUserToUpload = hemoCubeDao.getPendingUser()
|
val allPendingUserToUpload = hemoCubeDao.getPendingUser()
|
||||||
@@ -125,7 +127,7 @@ class HemoCubeViewModel @Inject constructor(
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun uploadHemoCubeResultToDatabase(
|
fun uploadHemoCubeResultToDatabase(
|
||||||
isOnline: Boolean, testStatus: Boolean, kitSerial: String?,
|
isOnline: Boolean, testStatus: Boolean, kitSerial: String?,quickCapture:Boolean
|
||||||
) = viewModelScope.launch {
|
) = viewModelScope.launch {
|
||||||
if (kitSerial != null) {
|
if (kitSerial != null) {
|
||||||
testDetails?.kitSerial = kitSerial
|
testDetails?.kitSerial = kitSerial
|
||||||
@@ -135,19 +137,84 @@ class HemoCubeViewModel @Inject constructor(
|
|||||||
try {
|
try {
|
||||||
if (isOnline) {
|
if (isOnline) {
|
||||||
parseData()
|
parseData()
|
||||||
addResultTestToDb()
|
//addResultTestToDb(quickCapture)
|
||||||
|
if(Constants.FIREBASE_INTEGRATION){
|
||||||
|
addResultTestToDb(quickCapture)
|
||||||
|
}else{
|
||||||
|
uploadToMolbio()
|
||||||
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
parseData()
|
parseData()
|
||||||
|
val kitCount = sharedPreference.getInt(Constants.KIT_COUNT, 0)
|
||||||
|
with(sharedPreference.edit()) {
|
||||||
|
putInt(Constants.KIT_COUNT, kitCount.plus(1))
|
||||||
|
apply()
|
||||||
|
}
|
||||||
|
// addResultTestToDb(quickCapture,isOnline)
|
||||||
testDetails?.testTime = SimpleDateFormat(
|
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)
|
||||||
|
testDetails?.localFlag = false
|
||||||
hemoCubeDao.updateTest(testDetails!!)
|
hemoCubeDao.updateTest(testDetails!!)
|
||||||
fireBaseUpload.postValue("Local")
|
fireBaseUpload.postValue("Local")
|
||||||
|
|
||||||
|
// parseData()
|
||||||
|
// addResultTestToDb(quickCapture)
|
||||||
|
// testDetails?.testTime = SimpleDateFormat(
|
||||||
|
// "yyyy-MM-dd HH:mm:ss", Locale.getDefault()
|
||||||
|
// ).format(Calendar.getInstance().time)
|
||||||
|
// hemoCubeDao.updateTest(testDetails!!)
|
||||||
|
// fireBaseUpload.postValue("Local")
|
||||||
}
|
}
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
Log.e("Testdb", "Upload failed: ${e.message}")
|
Log.e("Testdb", "Upload failed: ${e.message}")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
fun uploadToMolbio(){
|
||||||
|
if (Constants.MOLBIO_INTEGRATION) {
|
||||||
|
testDetails!!.testStatus = true
|
||||||
|
testDetails.localFlag = true
|
||||||
|
val kitCount = sharedPreference.getInt(Constants.KIT_COUNT, 0)
|
||||||
|
with(sharedPreference.edit()) {
|
||||||
|
putInt(Constants.KIT_COUNT, kitCount.plus(1))
|
||||||
|
apply()
|
||||||
|
}
|
||||||
|
fireBaseUpload.postValue("Success")
|
||||||
|
testDetails.reportUploadTime = SimpleDateFormat(
|
||||||
|
"yyyy-MM-dd HH:mm:ss", Locale.getDefault()
|
||||||
|
).format(Calendar.getInstance().time)
|
||||||
|
val currentTimeFormatted = SimpleDateFormat(
|
||||||
|
"yyyy-MM-dd'T'HH:mm:ssZZZZZ",
|
||||||
|
Locale.getDefault()
|
||||||
|
).format(Calendar.getInstance().time)
|
||||||
|
// Sanitize testDetails before using it in the API call
|
||||||
|
val sanitizedTestDetails = sanitizeDoubleValues(testDetails)
|
||||||
|
|
||||||
|
// Now, use sanitizedTestDetails for the API call
|
||||||
|
uploadResult(
|
||||||
|
MolbioV2ResultRequest(
|
||||||
|
mutableListOf(
|
||||||
|
MolbioV2Result(
|
||||||
|
rawData = sanitizedTestDetails,
|
||||||
|
analysisId = sanitizedTestDetails._id,
|
||||||
|
analysisDate = currentTimeFormatted,
|
||||||
|
analysisStatus = sanitizedTestDetails.classificationResult,
|
||||||
|
thresholds = Constants.BUFFER_INTENSITY_THRESHOLDS[sanitizedTestDetails.deviceId]?.toString(),
|
||||||
|
interpretation = sanitizedTestDetails.classificationResult,
|
||||||
|
testId = sanitizedTestDetails._id,
|
||||||
|
testTime = currentTimeFormatted,
|
||||||
|
collectionTime = currentTimeFormatted,
|
||||||
|
expiryTime = currentTimeFormatted,
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
viewModelScope.launch {
|
||||||
|
hemoCubeDao.updateTest(testDetails)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
fun login(loginRequest: LoginRequest) = viewModelScope.launch {
|
fun login(loginRequest: LoginRequest) = viewModelScope.launch {
|
||||||
loginResponse.postValue(Result.Loading())
|
loginResponse.postValue(Result.Loading())
|
||||||
@@ -172,7 +239,7 @@ class HemoCubeViewModel @Inject constructor(
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
fun sendDataToMolbio() = viewModelScope.launch(Dispatchers.IO + coroutineExceptionHandler) {
|
fun sendDataToMolbio() = viewModelScope.launch(Dispatchers.IO) {
|
||||||
|
|
||||||
Log.d("molbio","getting in sendMolbio")
|
Log.d("molbio","getting in sendMolbio")
|
||||||
val resultList = MolbioV2ResultRequest(mutableListOf())
|
val resultList = MolbioV2ResultRequest(mutableListOf())
|
||||||
@@ -189,7 +256,7 @@ class HemoCubeViewModel @Inject constructor(
|
|||||||
?: "defaultThreshold" // Handle possible nulls safely
|
?: "defaultThreshold" // Handle possible nulls safely
|
||||||
resultList.results?.add(
|
resultList.results?.add(
|
||||||
MolbioV2Result(
|
MolbioV2Result(
|
||||||
rawData = userData.MolbioHemocubeData(),
|
rawData = userData,
|
||||||
analysisId = userData._id,
|
analysisId = userData._id,
|
||||||
analysisDate = currentTimeFormatted,
|
analysisDate = currentTimeFormatted,
|
||||||
analysisStatus = userData.classificationResult
|
analysisStatus = userData.classificationResult
|
||||||
@@ -223,16 +290,20 @@ class HemoCubeViewModel @Inject constructor(
|
|||||||
is Result.Success -> {
|
is Result.Success -> {
|
||||||
it.data.data?.forEach { id ->
|
it.data.data?.forEach { id ->
|
||||||
id.rawData?.let { it1 ->
|
id.rawData?.let { it1 ->
|
||||||
|
updateLocalFlag(it1._id)
|
||||||
updateMolbioFlag(
|
updateMolbioFlag(
|
||||||
it1._id
|
it1._id
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
fireBaseBulkUpload.postValue("Success")
|
||||||
}
|
}
|
||||||
is Result.Error -> {
|
is Result.Error -> {
|
||||||
|
fireBaseBulkUpload.postValue("Error")
|
||||||
Log.d("result","result upload error")
|
Log.d("result","result upload error")
|
||||||
}
|
}
|
||||||
else -> {
|
else -> {
|
||||||
|
fireBaseBulkUpload.postValue("Error")
|
||||||
Log.d("result","result upload else")
|
Log.d("result","result upload else")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -240,7 +311,7 @@ class HemoCubeViewModel @Inject constructor(
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
fun sendDataToFirebase() = viewModelScope.launch ( Dispatchers.IO + coroutineExceptionHandler ) {
|
fun sendDataToFirebase() = viewModelScope.launch ( Dispatchers.IO ) {
|
||||||
val pendingData = hemoCubeDao.getFirebasePending()
|
val pendingData = hemoCubeDao.getFirebasePending()
|
||||||
pendingData.forEach{
|
pendingData.forEach{
|
||||||
userData ->
|
userData ->
|
||||||
@@ -250,7 +321,12 @@ class HemoCubeViewModel @Inject constructor(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if(testUpload){
|
||||||
|
fireBaseBulkUpload.postValue("Success")
|
||||||
|
}
|
||||||
|
// else{
|
||||||
|
// fireBaseBulkUpload.postValue("Error")
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -267,7 +343,6 @@ class HemoCubeViewModel @Inject constructor(
|
|||||||
repository.deviceUpdate(deviceUpdateRequest).let {
|
repository.deviceUpdate(deviceUpdateRequest).let {
|
||||||
deviceUpdate.postValue(it.body())
|
deviceUpdate.postValue(it.body())
|
||||||
deviceUpdateheader.postValue(it.headers())
|
deviceUpdateheader.postValue(it.headers())
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -402,7 +477,7 @@ class HemoCubeViewModel @Inject constructor(
|
|||||||
testDetails?.coefficients = DataHolder.hemoCubeTestData?.coefficients
|
testDetails?.coefficients = DataHolder.hemoCubeTestData?.coefficients
|
||||||
testDetails?.incubationTime = DataHolder.hemoCubeTestData?.incubationTime.toString()
|
testDetails?.incubationTime = DataHolder.hemoCubeTestData?.incubationTime.toString()
|
||||||
testDetails?.name = DataHolder.hemoCubeTestData?.name.toString()
|
testDetails?.name = DataHolder.hemoCubeTestData?.name.toString()
|
||||||
testDetails?.birthYear = DataHolder.hemoCubeTestData?.birthYear.toString()
|
testDetails?.age = DataHolder.hemoCubeTestData?.age.toString()
|
||||||
testDetails?.userImageURL = DataHolder.hemoCubeTestData?.userImageURL.toString()
|
testDetails?.userImageURL = DataHolder.hemoCubeTestData?.userImageURL.toString()
|
||||||
testDetails?.classificationResult = DataHolder.hemoCubeTestData?.classificationResult!!
|
testDetails?.classificationResult = DataHolder.hemoCubeTestData?.classificationResult!!
|
||||||
testDetails?.prdClassification = DataHolder.hemoCubeTestData?.prdClassification.toString()
|
testDetails?.prdClassification = DataHolder.hemoCubeTestData?.prdClassification.toString()
|
||||||
@@ -421,73 +496,95 @@ class HemoCubeViewModel @Inject constructor(
|
|||||||
testDetails?.volume = DataHolder.hemoCubeTestData?.volume
|
testDetails?.volume = DataHolder.hemoCubeTestData?.volume
|
||||||
testDetails?.filter = DataHolder.hemoCubeTestData?.filter
|
testDetails?.filter = DataHolder.hemoCubeTestData?.filter
|
||||||
testDetails?.labName = DataHolder.hemoCubeTestData?.labName
|
testDetails?.labName = DataHolder.hemoCubeTestData?.labName
|
||||||
|
testDetails?.cuvetteSize = sharedPreference.getString(Constants.CUVETTE_SIZE, "").toString()
|
||||||
|
testDetails?.centerName = sharedPreference.getString(Constants.CENTER_NAME, "").toString()
|
||||||
|
testDetails?.district = sharedPreference.getString(Constants.DISTRICT, "").toString()
|
||||||
|
testDetails?.ipAddress = sharedPreference.getString(Constants.IP_ADDRESS, "").toString()
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun addResultTestToDb() {
|
private fun addResultTestToDb(quickCapture: Boolean) {
|
||||||
viewModelScope.launch {
|
viewModelScope.launch {
|
||||||
try {
|
try {
|
||||||
testDetails!!.reportUploadTime = SimpleDateFormat(
|
testDetails!!.quickCapture = quickCapture
|
||||||
|
testDetails.testStatus = true
|
||||||
|
testDetails.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)
|
||||||
val currentTimeFormatted = SimpleDateFormat(
|
val currentTimeFormatted = SimpleDateFormat(
|
||||||
"yyyy-MM-dd'T'HH:mm:ssZZZZZ",
|
"yyyy-MM-dd'T'HH:mm:ssZZZZZ",
|
||||||
Locale.getDefault()
|
Locale.getDefault()
|
||||||
).format(Calendar.getInstance().time)
|
).format(Calendar.getInstance().time)
|
||||||
if(Constants.FIREBASE_INTEGRATION) {
|
if(quickCapture){
|
||||||
when (val response = repository.addTestToDatabase(testDetails)) {
|
when (val response = repository.addQcTestToDatabase(testDetails)) {
|
||||||
is Response.Success -> {
|
is Response.Success -> {
|
||||||
val kitCount = sharedPreference.getInt(Constants.KIT_COUNT, 0)
|
val kitCount = sharedPreference.getInt(Constants.KIT_COUNT, 0)
|
||||||
with(sharedPreference.edit()) {
|
with(sharedPreference.edit()) {
|
||||||
putInt(Constants.KIT_COUNT, kitCount.plus(1))
|
putInt(Constants.KIT_COUNT, kitCount.plus(1))
|
||||||
apply()
|
apply()
|
||||||
|
}
|
||||||
|
Log.i("Testdb", "Data uploaded to Firestore successfully")
|
||||||
|
fireBaseUpload.postValue("Success")
|
||||||
|
testDetails.localFlag = true
|
||||||
|
hemoCubeDao.updateTest(testDetails)
|
||||||
}
|
}
|
||||||
Log.i("Testdb", "Data uploaded to Firestore successfully")
|
|
||||||
fireBaseUpload.postValue("Success")
|
|
||||||
testDetails.localFlag = true
|
|
||||||
|
|
||||||
hemoCubeDao.updateTest(testDetails)
|
is Response.Error -> {
|
||||||
|
Log.e("Testdb", "Error uploading data to Firestore: $response")
|
||||||
|
fireBaseUpload.postValue("Error")
|
||||||
|
hemoCubeDao.updateTest(testDetails)
|
||||||
|
}
|
||||||
|
|
||||||
|
else -> {}
|
||||||
}
|
}
|
||||||
|
}else{
|
||||||
|
when (val response = repository.addTestToDatabase(testDetails)) {
|
||||||
|
is Response.Success -> {
|
||||||
|
testDetails.localFlag = true
|
||||||
|
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")
|
||||||
|
fireBaseUpload.postValue("Success")
|
||||||
|
|
||||||
is Response.Error -> {
|
if (Constants.MOLBIO_INTEGRATION) {
|
||||||
Log.e("Testdb", "Error uploading data to Firestore: $response")
|
// Sanitize testDetails before using it in the API call
|
||||||
fireBaseUpload.postValue("Error")
|
val sanitizedTestDetails = sanitizeDoubleValues(testDetails)
|
||||||
hemoCubeDao.updateTest(testDetails)
|
|
||||||
}
|
|
||||||
|
|
||||||
else -> {}
|
// Now, use sanitizedTestDetails for the API call
|
||||||
}
|
uploadResult(
|
||||||
}
|
MolbioV2ResultRequest(
|
||||||
if (Constants.MOLBIO_INTEGRATION) {
|
mutableListOf(
|
||||||
val kitCount = sharedPreference.getInt(Constants.KIT_COUNT, 0)
|
MolbioV2Result(
|
||||||
with(sharedPreference.edit()) {
|
rawData = sanitizedTestDetails,
|
||||||
putInt(Constants.KIT_COUNT, kitCount.plus(1))
|
analysisId = sanitizedTestDetails._id,
|
||||||
apply()
|
analysisDate = currentTimeFormatted,
|
||||||
}
|
analysisStatus = sanitizedTestDetails.classificationResult,
|
||||||
// Sanitize testDetails before using it in the API call
|
thresholds = Constants.BUFFER_INTENSITY_THRESHOLDS[sanitizedTestDetails.deviceId]?.toString(),
|
||||||
val sanitizedTestDetails = testDetailsmolbio?.let { sanitizeDoubleValues(it) }
|
interpretation = sanitizedTestDetails.classificationResult,
|
||||||
|
testId = sanitizedTestDetails._id,
|
||||||
// Now, use sanitizedTestDetails for the API call
|
testTime = currentTimeFormatted,
|
||||||
uploadResult(
|
collectionTime = currentTimeFormatted,
|
||||||
MolbioV2ResultRequest(
|
expiryTime = currentTimeFormatted,
|
||||||
mutableListOf(
|
)
|
||||||
MolbioV2Result(
|
)
|
||||||
rawData = sanitizedTestDetails,
|
)
|
||||||
analysisId = sanitizedTestDetails!!._id,
|
|
||||||
analysisDate = currentTimeFormatted,
|
|
||||||
analysisStatus = sanitizedTestDetails.classificationResult,
|
|
||||||
thresholds = Constants.BUFFER_INTENSITY_THRESHOLDS[sanitizedTestDetails.deviceId]?.toString(),
|
|
||||||
interpretation = sanitizedTestDetails.classificationResult,
|
|
||||||
testId = sanitizedTestDetails._id,
|
|
||||||
testTime = currentTimeFormatted,
|
|
||||||
collectionTime = currentTimeFormatted,
|
|
||||||
expiryTime = currentTimeFormatted,
|
|
||||||
)
|
)
|
||||||
)
|
}
|
||||||
)
|
hemoCubeDao.updateTest(testDetails)
|
||||||
)
|
}
|
||||||
hemoCubeDao.updateTest(testDetails)
|
|
||||||
|
is Response.Error -> {
|
||||||
|
Log.e("Testdb", "Error uploading data to Firestore: $response")
|
||||||
|
fireBaseUpload.postValue("Error")
|
||||||
|
hemoCubeDao.updateTest(testDetails)
|
||||||
|
}
|
||||||
|
|
||||||
|
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")
|
||||||
@@ -502,28 +599,29 @@ class HemoCubeViewModel @Inject constructor(
|
|||||||
).format(Calendar.getInstance().time)
|
).format(Calendar.getInstance().time)
|
||||||
when (repository.addTestToDatabase(userData)) {
|
when (repository.addTestToDatabase(userData)) {
|
||||||
is Response.Success -> {
|
is Response.Success -> {
|
||||||
fireBaseBulkUpload.postValue("Success")
|
testUpload = true
|
||||||
|
userData.localFlag = true
|
||||||
updateLocalFlag(userData._id)
|
updateLocalFlag(userData._id)
|
||||||
}
|
}
|
||||||
|
|
||||||
else -> {
|
else -> {
|
||||||
fireBaseBulkUpload.postValue("Error")
|
testUpload = false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun sanitizeDoubleValues(molbiohemocubeData: MolbioHemocubeData): MolbioHemocubeData {
|
fun sanitizeDoubleValues(hemoCubeTestData: HemoCubeTestData): HemoCubeTestData {
|
||||||
molbiohemocubeData::class.java.declaredFields.forEach { field ->
|
hemoCubeTestData::class.java.declaredFields.forEach { field ->
|
||||||
if (field.type == Double::class.javaObjectType || field.type == Double::class.javaPrimitiveType) {
|
if (field.type == Double::class.javaObjectType || field.type == Double::class.javaPrimitiveType) {
|
||||||
field.isAccessible = true
|
field.isAccessible = true
|
||||||
val value = field.get(molbiohemocubeData) as Double?
|
val value = field.get(hemoCubeTestData) as Double?
|
||||||
if (value != null && (value.isInfinite() || value.isNaN())) {
|
if (value != null && (value.isInfinite() || value.isNaN())) {
|
||||||
field.set(molbiohemocubeData, 0.0) // Replace with a suitable default value
|
field.set(hemoCubeTestData, 0.0) // Replace with a suitable default value
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return molbiohemocubeData
|
return hemoCubeTestData
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun updateLocalFlag(userId: String) = viewModelScope.launch {
|
private fun updateLocalFlag(userId: String) = viewModelScope.launch {
|
||||||
@@ -538,7 +636,6 @@ class HemoCubeViewModel @Inject constructor(
|
|||||||
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)
|
||||||
}
|
}
|
||||||
@@ -573,6 +670,10 @@ class HemoCubeViewModel @Inject constructor(
|
|||||||
viewModelScope.launch {
|
viewModelScope.launch {
|
||||||
hemoCubeBufferDao.updateFieldById(id = bufferId, true)
|
hemoCubeBufferDao.updateFieldById(id = bufferId, true)
|
||||||
}
|
}
|
||||||
|
fun deleteByStatus() = viewModelScope.launch {
|
||||||
|
hemoCubeDao.deleteByStatus()
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
fun getLocalUserDataForCsv(context: Context): Boolean {
|
fun getLocalUserDataForCsv(context: Context): Boolean {
|
||||||
val localUserDataLiveData: LiveData<List<HemoCubeTestData>> = hemoCubeDao.getAll()
|
val localUserDataLiveData: LiveData<List<HemoCubeTestData>> = hemoCubeDao.getAll()
|
||||||
@@ -588,7 +689,7 @@ class HemoCubeViewModel @Inject constructor(
|
|||||||
userData._id,
|
userData._id,
|
||||||
userData.name,
|
userData.name,
|
||||||
userData.bloodGroup,
|
userData.bloodGroup,
|
||||||
userData.birthYear,
|
userData.age,
|
||||||
userData.classificationResult,
|
userData.classificationResult,
|
||||||
userData.testTime.toString(),
|
userData.testTime.toString(),
|
||||||
userData.userImageURL
|
userData.userImageURL
|
||||||
@@ -694,7 +795,11 @@ class HemoCubeViewModel @Inject constructor(
|
|||||||
"yyyy-MM-dd HH:mm:ss", Locale.getDefault()
|
"yyyy-MM-dd HH:mm:ss", Locale.getDefault()
|
||||||
).format(Calendar.getInstance().time)
|
).format(Calendar.getInstance().time)
|
||||||
}
|
}
|
||||||
val coroutineExceptionHandler = CoroutineExceptionHandler{_, throwable ->
|
fun updateLocalData() {
|
||||||
throwable.printStackTrace()
|
viewModelScope.launch {
|
||||||
|
parseData()
|
||||||
|
hemoCubeDao.updateTest(testDetails!!)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -18,7 +18,7 @@ import android.os.Build
|
|||||||
import android.util.Log
|
import android.util.Log
|
||||||
import androidx.annotation.RequiresApi
|
import androidx.annotation.RequiresApi
|
||||||
import com.example.hpostesting.data.constant.Constants
|
import com.example.hpostesting.data.constant.Constants
|
||||||
import com.example.hpostesting.presentation.dashboard.DashboardActivity
|
import com.example.hpostesting.presentation.main_base.DashboardActivity
|
||||||
import io.nats.client.AuthHandler
|
import io.nats.client.AuthHandler
|
||||||
import io.nats.client.Connection
|
import io.nats.client.Connection
|
||||||
import io.nats.client.Message
|
import io.nats.client.Message
|
||||||
@@ -139,7 +139,7 @@ class NatsManager(datacollector: DashboardActivity) {
|
|||||||
if (nc?.status == Connection.Status.CONNECTED) {
|
if (nc?.status == Connection.Status.CONNECTED) {
|
||||||
Log.d("NATSCONNECTION", "NATS is successfully connected.")
|
Log.d("NATSCONNECTION", "NATS is successfully connected.")
|
||||||
nc?.subscribe("device.hpos.${deviceId}.ping")
|
nc?.subscribe("device.hpos.${deviceId}.ping")
|
||||||
// Log.d(TAG, "Nats subscribed with ping-"+d)
|
// Log.d(TAG, "Nats subscribed with ping-"+d)
|
||||||
nc?.publish(
|
nc?.publish(
|
||||||
"server.hpos.${deviceId}.ping",
|
"server.hpos.${deviceId}.ping",
|
||||||
"ALIVE".toByteArray(StandardCharsets.UTF_8)
|
"ALIVE".toByteArray(StandardCharsets.UTF_8)
|
||||||
|
|||||||
@@ -0,0 +1,14 @@
|
|||||||
|
package com.example.hpostesting.util
|
||||||
|
|
||||||
|
import android.content.Context
|
||||||
|
|
||||||
|
object AppInitializer {
|
||||||
|
fun initialize(context: Context) {
|
||||||
|
val secureStorage = SecureStorage(context)
|
||||||
|
if (secureStorage.getPassword() == null || secureStorage.getAdminPassword() == null) {
|
||||||
|
// Store the shared password securely
|
||||||
|
secureStorage.storePassword("SMI@12345")
|
||||||
|
secureStorage.storeAdminPassword("SMI@Admin$")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,44 @@
|
|||||||
|
package com.example.hpostesting.util
|
||||||
|
|
||||||
|
import android.accounts.AbstractAccountAuthenticator
|
||||||
|
import android.accounts.Account
|
||||||
|
import android.accounts.AccountAuthenticatorResponse
|
||||||
|
import android.accounts.NetworkErrorException
|
||||||
|
import android.content.Context
|
||||||
|
import android.os.Bundle
|
||||||
|
|
||||||
|
class MyAuthenticator(context: Context) : AbstractAccountAuthenticator(context) {
|
||||||
|
override fun editProperties(response: AccountAuthenticatorResponse?, accountType: String?): Bundle {
|
||||||
|
throw UnsupportedOperationException()
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun addAccount(response: AccountAuthenticatorResponse?, accountType: String?, authTokenType: String?, requiredFeatures: Array<out String>?, options: Bundle?): Bundle? {
|
||||||
|
// Add your logic to add an account
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun confirmCredentials(response: AccountAuthenticatorResponse?, account: Account?, options: Bundle?): Bundle? {
|
||||||
|
// Add your logic to confirm credentials
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun getAuthToken(response: AccountAuthenticatorResponse?, account: Account?, authTokenType: String?, options: Bundle?): Bundle? {
|
||||||
|
// Add your logic to get an authentication token
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun getAuthTokenLabel(authTokenType: String?): String? {
|
||||||
|
// Label for the auth token type
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun updateCredentials(response: AccountAuthenticatorResponse?, account: Account?, authTokenType: String?, options: Bundle?): Bundle? {
|
||||||
|
// Add your logic to update credentials
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun hasFeatures(response: AccountAuthenticatorResponse?, account: Account?, features: Array<out String>?): Bundle? {
|
||||||
|
// Add your logic to check for specific account features
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
package com.example.hpostesting.util
|
||||||
|
|
||||||
|
import android.app.Service
|
||||||
|
import android.content.Intent
|
||||||
|
import android.os.IBinder
|
||||||
|
|
||||||
|
class MyAuthenticatorService : Service() {
|
||||||
|
override fun onBind(intent: Intent?): IBinder? {
|
||||||
|
val authenticator = MyAuthenticator(this)
|
||||||
|
return authenticator.iBinder
|
||||||
|
}
|
||||||
|
}
|
||||||
117
app/src/main/java/com/example/hpostesting/util/NetworkChecker.kt
Normal file
117
app/src/main/java/com/example/hpostesting/util/NetworkChecker.kt
Normal file
@@ -0,0 +1,117 @@
|
|||||||
|
package com.example.hpostesting.util
|
||||||
|
|
||||||
|
import android.annotation.SuppressLint
|
||||||
|
import android.content.Context
|
||||||
|
import android.net.ConnectivityManager
|
||||||
|
import android.net.Network
|
||||||
|
import android.net.NetworkCapabilities
|
||||||
|
import android.net.NetworkRequest
|
||||||
|
import androidx.lifecycle.LiveData
|
||||||
|
import androidx.lifecycle.MutableLiveData
|
||||||
|
import dagger.hilt.android.qualifiers.ApplicationContext
|
||||||
|
import kotlinx.coroutines.CoroutineScope
|
||||||
|
import kotlinx.coroutines.Dispatchers
|
||||||
|
import kotlinx.coroutines.SupervisorJob
|
||||||
|
import kotlinx.coroutines.cancel
|
||||||
|
import kotlinx.coroutines.delay
|
||||||
|
import kotlinx.coroutines.isActive
|
||||||
|
import kotlinx.coroutines.launch
|
||||||
|
import java.net.HttpURLConnection
|
||||||
|
import java.net.URL
|
||||||
|
import javax.inject.Inject
|
||||||
|
import javax.inject.Singleton
|
||||||
|
|
||||||
|
|
||||||
|
@Singleton
|
||||||
|
class NetworkMonitor @Inject constructor(
|
||||||
|
@ApplicationContext private val context: Context
|
||||||
|
) {
|
||||||
|
private var isMonitoringStarted = false
|
||||||
|
private val connectivityManager =
|
||||||
|
context.getSystemService(Context.CONNECTIVITY_SERVICE) as ConnectivityManager
|
||||||
|
|
||||||
|
private val _isConnected = MutableLiveData(false)
|
||||||
|
val isConnected: LiveData<Boolean> get() = _isConnected
|
||||||
|
|
||||||
|
private val networkScope = CoroutineScope(SupervisorJob() + Dispatchers.IO)
|
||||||
|
|
||||||
|
private val networkCallback = object : ConnectivityManager.NetworkCallback() {
|
||||||
|
override fun onAvailable(network: Network) {
|
||||||
|
performPingCheck()
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onLost(network: Network) {
|
||||||
|
_isConnected.postValue(false)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onCapabilitiesChanged(
|
||||||
|
network: Network, networkCapabilities: NetworkCapabilities
|
||||||
|
) {
|
||||||
|
// Recheck connectivity when capabilities change (e.g., network becomes validated)
|
||||||
|
performPingCheck()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressLint("NewApi")
|
||||||
|
fun startMonitoring() {
|
||||||
|
if (isMonitoringStarted) return // Already started, do nothing.
|
||||||
|
isMonitoringStarted = true
|
||||||
|
// Check initial connectivity status
|
||||||
|
val network = connectivityManager.activeNetwork
|
||||||
|
val capabilities = connectivityManager.getNetworkCapabilities(network)
|
||||||
|
val isInitiallyConnected = capabilities?.hasCapability(NetworkCapabilities.NET_CAPABILITY_INTERNET) == true
|
||||||
|
|
||||||
|
if (isInitiallyConnected) {
|
||||||
|
performPingCheck()
|
||||||
|
} else {
|
||||||
|
_isConnected.postValue(false)
|
||||||
|
}
|
||||||
|
|
||||||
|
val networkRequest =
|
||||||
|
NetworkRequest.Builder().addCapability(NetworkCapabilities.NET_CAPABILITY_INTERNET)
|
||||||
|
.build()
|
||||||
|
|
||||||
|
connectivityManager.registerNetworkCallback(networkRequest, networkCallback)
|
||||||
|
// Start periodic checks:
|
||||||
|
startPeriodicPingCheck()
|
||||||
|
}
|
||||||
|
|
||||||
|
fun stopMonitoring() { // never needed to call
|
||||||
|
try {
|
||||||
|
connectivityManager.unregisterNetworkCallback(networkCallback)
|
||||||
|
} catch (_: IllegalArgumentException) {
|
||||||
|
// Ignore if callback was not registered
|
||||||
|
}
|
||||||
|
networkScope.cancel()
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun performPingCheck() {
|
||||||
|
networkScope.launch {
|
||||||
|
try {
|
||||||
|
val url = URL("https://www.google.com")
|
||||||
|
val connection = url.openConnection() as HttpURLConnection
|
||||||
|
connection.connectTimeout = 2000
|
||||||
|
connection.readTimeout = 2000
|
||||||
|
connection.setRequestProperty("Connection", "close")
|
||||||
|
connection.connect()
|
||||||
|
|
||||||
|
// Consider any 2xx response as successful
|
||||||
|
val isReachable = connection.responseCode in 200..299
|
||||||
|
_isConnected.postValue(isReachable)
|
||||||
|
connection.disconnect()
|
||||||
|
} catch (e: Exception) {
|
||||||
|
_isConnected.postValue(false)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun startPeriodicPingCheck(intervalMillis: Long = 1 * 60_000L) {
|
||||||
|
networkScope.launch {
|
||||||
|
while (isActive) {
|
||||||
|
performPingCheck()
|
||||||
|
delay(intervalMillis)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -1,75 +0,0 @@
|
|||||||
/*
|
|
||||||
* // Copyright (c) 2024 ShanMukha Innovations Pvt. Ltd. All rights reserved.
|
|
||||||
* // Notice: All information contained herein is, and remains
|
|
||||||
* // the property of ShanMukha Innovations Pvt. Ltd. and its suppliers,
|
|
||||||
* // if any. The intellectual and technical concepts contained
|
|
||||||
* // herein are proprietary to ShanMukha Innovations Pvt. Ltd.
|
|
||||||
* // and its suppliers and may be covered by Indian and Foreign Patents,
|
|
||||||
* // patents in process, and are protected by trade secret or copyright law.
|
|
||||||
* // Dissemination of this information or reproduction of this material
|
|
||||||
* // is strictly forbidden unless prior written permission is obtained
|
|
||||||
* // from ShanMukha Innovations Pvt. Ltd.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package com.example.hpostesting.util
|
|
||||||
|
|
||||||
|
|
||||||
import android.content.Context
|
|
||||||
import android.net.ConnectivityManager
|
|
||||||
import android.net.Network
|
|
||||||
import android.net.NetworkCapabilities
|
|
||||||
import android.net.NetworkRequest
|
|
||||||
import android.os.Build
|
|
||||||
import androidx.annotation.RequiresApi
|
|
||||||
import androidx.lifecycle.LiveData
|
|
||||||
|
|
||||||
class NetworkStatusLiveData(context: Context) : LiveData<Boolean>() {
|
|
||||||
|
|
||||||
private val connectivityManager: ConnectivityManager =
|
|
||||||
context.applicationContext.getSystemService(Context.CONNECTIVITY_SERVICE) as ConnectivityManager
|
|
||||||
|
|
||||||
private val networkCallback = object : ConnectivityManager.NetworkCallback() {
|
|
||||||
override fun onAvailable(network: Network) {
|
|
||||||
postValue(true)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onLost(network: Network) {
|
|
||||||
postValue(false)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@RequiresApi(Build.VERSION_CODES.M)
|
|
||||||
override fun onActive() {
|
|
||||||
super.onActive()
|
|
||||||
postValue(isNetworkAvailable())
|
|
||||||
registerNetworkCallback()
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onInactive() {
|
|
||||||
super.onInactive()
|
|
||||||
unregisterNetworkCallback()
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun registerNetworkCallback() {
|
|
||||||
val networkRequest = NetworkRequest.Builder()
|
|
||||||
.addTransportType(NetworkCapabilities.TRANSPORT_CELLULAR)
|
|
||||||
.addTransportType(NetworkCapabilities.TRANSPORT_WIFI)
|
|
||||||
.addTransportType(NetworkCapabilities.TRANSPORT_ETHERNET)
|
|
||||||
.build()
|
|
||||||
|
|
||||||
connectivityManager.registerNetworkCallback(networkRequest, networkCallback)
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun unregisterNetworkCallback() {
|
|
||||||
connectivityManager.unregisterNetworkCallback(networkCallback)
|
|
||||||
}
|
|
||||||
|
|
||||||
@RequiresApi(Build.VERSION_CODES.M)
|
|
||||||
private fun isNetworkAvailable(): Boolean {
|
|
||||||
val network = connectivityManager.activeNetwork
|
|
||||||
val networkCapabilities = connectivityManager.getNetworkCapabilities(network)
|
|
||||||
return networkCapabilities != null &&
|
|
||||||
networkCapabilities.hasCapability(NetworkCapabilities.NET_CAPABILITY_INTERNET) &&
|
|
||||||
networkCapabilities.hasCapability(NetworkCapabilities.NET_CAPABILITY_VALIDATED)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,33 @@
|
|||||||
|
package com.example.hpostesting.util
|
||||||
|
|
||||||
|
import android.content.Context
|
||||||
|
import androidx.security.crypto.EncryptedSharedPreferences
|
||||||
|
import androidx.security.crypto.MasterKey
|
||||||
|
|
||||||
|
class SecureStorage(context: Context) {
|
||||||
|
private val masterKey = MasterKey.Builder(context)
|
||||||
|
.setKeyScheme(MasterKey.KeyScheme.AES256_GCM)
|
||||||
|
.build()
|
||||||
|
|
||||||
|
private val sharedPreferences = EncryptedSharedPreferences.create(
|
||||||
|
context,
|
||||||
|
"secure_prefs",
|
||||||
|
masterKey,
|
||||||
|
EncryptedSharedPreferences.PrefKeyEncryptionScheme.AES256_SIV,
|
||||||
|
EncryptedSharedPreferences.PrefValueEncryptionScheme.AES256_GCM
|
||||||
|
)
|
||||||
|
|
||||||
|
fun storePassword(password: String) {
|
||||||
|
sharedPreferences.edit().putString("shared_password", password).apply()
|
||||||
|
}
|
||||||
|
fun storeAdminPassword(password: String) {
|
||||||
|
sharedPreferences.edit().putString("admin_password", password).apply()
|
||||||
|
}
|
||||||
|
fun getAdminPassword(): String? {
|
||||||
|
return sharedPreferences.getString("admin_password", null)
|
||||||
|
}
|
||||||
|
fun getPassword(): String? {
|
||||||
|
return sharedPreferences.getString("shared_password", null)
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
BIN
app/src/main/res/drawable-v24/internet.png
Normal file
BIN
app/src/main/res/drawable-v24/internet.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 12 KiB |
BIN
app/src/main/res/drawable-v24/off.png
Normal file
BIN
app/src/main/res/drawable-v24/off.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 12 KiB |
5
app/src/main/res/drawable/baseline_cloud_24.xml
Normal file
5
app/src/main/res/drawable/baseline_cloud_24.xml
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android" android:height="24dp" android:tint="#000000" android:viewportHeight="24" android:viewportWidth="24" android:width="24dp">
|
||||||
|
|
||||||
|
<path android:fillColor="@android:color/white" android:pathData="M19.35,10.04C18.67,6.59 15.64,4 12,4 9.11,4 6.6,5.64 5.35,8.04 2.34,8.36 0,10.91 0,14c0,3.31 2.69,6 6,6h13c2.76,0 5,-2.24 5,-5 0,-2.64 -2.05,-4.78 -4.65,-4.96z"/>
|
||||||
|
|
||||||
|
</vector>
|
||||||
5
app/src/main/res/drawable/baseline_cloud_done_24.xml
Normal file
5
app/src/main/res/drawable/baseline_cloud_done_24.xml
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android" android:height="24dp" android:tint="#000000" android:viewportHeight="24" android:viewportWidth="24" android:width="24dp">
|
||||||
|
|
||||||
|
<path android:fillColor="@android:color/white" android:pathData="M19.35,10.04C18.67,6.59 15.64,4 12,4 9.11,4 6.6,5.64 5.35,8.04 2.34,8.36 0,10.91 0,14c0,3.31 2.69,6 6,6h13c2.76,0 5,-2.24 5,-5 0,-2.64 -2.05,-4.78 -4.65,-4.96zM10,17l-3.5,-3.5 1.41,-1.41L10,14.17 15.18,9l1.41,1.41L10,17z"/>
|
||||||
|
|
||||||
|
</vector>
|
||||||
5
app/src/main/res/drawable/baseline_cloud_sync_24.xml
Normal file
5
app/src/main/res/drawable/baseline_cloud_sync_24.xml
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android" android:height="24dp" android:tint="#000000" android:viewportHeight="24" android:viewportWidth="24" android:width="24dp">
|
||||||
|
|
||||||
|
<path android:fillColor="@android:color/white" android:pathData="M21.5,14.98c-0.02,0 -0.03,0 -0.05,0.01C21.2,13.3 19.76,12 18,12c-1.4,0 -2.6,0.83 -3.16,2.02C13.26,14.1 12,15.4 12,17c0,1.66 1.34,3 3,3l6.5,-0.02c1.38,0 2.5,-1.12 2.5,-2.5S22.88,14.98 21.5,14.98zM10,4.26v2.09C7.67,7.18 6,9.39 6,12c0,1.77 0.78,3.34 2,4.44V14h2v6H4v-2h2.73C5.06,16.54 4,14.4 4,12C4,8.27 6.55,5.15 10,4.26zM20,6h-2.73c1.43,1.26 2.41,3.01 2.66,5l-2.02,0C17.68,9.64 16.98,8.45 16,7.56V10h-2V4h6V6z"/>
|
||||||
|
|
||||||
|
</vector>
|
||||||
5
app/src/main/res/drawable/baseline_developer_mode_24.xml
Normal file
5
app/src/main/res/drawable/baseline_developer_mode_24.xml
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android" android:height="24dp" android:tint="#000000" android:viewportHeight="24" android:viewportWidth="24" android:width="24dp">
|
||||||
|
|
||||||
|
<path android:fillColor="@android:color/white" android:pathData="M7,5h10v2h2L19,3c0,-1.1 -0.9,-1.99 -2,-1.99L7,1c-1.1,0 -2,0.9 -2,2v4h2L7,5zM15.41,16.59L20,12l-4.59,-4.59L14,8.83 17.17,12 14,15.17l1.41,1.42zM10,15.17L6.83,12 10,8.83 8.59,7.41 4,12l4.59,4.59L10,15.17zM17,19L7,19v-2L5,17v4c0,1.1 0.9,2 2,2h10c1.1,0 2,-0.9 2,-2v-4h-2v2z"/>
|
||||||
|
|
||||||
|
</vector>
|
||||||
5
app/src/main/res/drawable/baseline_info_24.xml
Normal file
5
app/src/main/res/drawable/baseline_info_24.xml
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android" android:height="24dp" android:tint="#000000" android:viewportHeight="24" android:viewportWidth="24" android:width="24dp">
|
||||||
|
|
||||||
|
<path android:fillColor="@android:color/white" android:pathData="M12,2C6.48,2 2,6.48 2,12s4.48,10 10,10 10,-4.48 10,-10S17.52,2 12,2zM13,17h-2v-6h2v6zM13,9h-2L11,7h2v2z"/>
|
||||||
|
|
||||||
|
</vector>
|
||||||
5
app/src/main/res/drawable/baseline_translate_24.xml
Normal file
5
app/src/main/res/drawable/baseline_translate_24.xml
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android" android:height="24dp" android:tint="#000000" android:viewportHeight="24" android:viewportWidth="24" android:width="24dp">
|
||||||
|
|
||||||
|
<path android:fillColor="@android:color/white" android:pathData="M12.87,15.07l-2.54,-2.51 0.03,-0.03c1.74,-1.94 2.98,-4.17 3.71,-6.53L17,6L17,4h-7L10,2L8,2v2L1,4v1.99h11.17C11.5,7.92 10.44,9.75 9,11.35 8.07,10.32 7.3,9.19 6.69,8h-2c0.73,1.63 1.73,3.17 2.98,4.56l-5.09,5.02L4,19l5,-5 3.11,3.11 0.76,-2.04zM18.5,10h-2L12,22h2l1.12,-3h4.75L21,22h2l-4.5,-12zM15.88,17l1.62,-4.33L19.12,17h-3.24z"/>
|
||||||
|
|
||||||
|
</vector>
|
||||||
BIN
app/src/main/res/drawable/verified.gif
Normal file
BIN
app/src/main/res/drawable/verified.gif
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 201 KiB |
BIN
app/src/main/res/drawable/virtual_lab.gif
Normal file
BIN
app/src/main/res/drawable/virtual_lab.gif
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 828 KiB |
@@ -23,18 +23,18 @@
|
|||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent">
|
android:layout_height="match_parent">
|
||||||
|
|
||||||
<!-- <androidx.appcompat.widget.Toolbar-->
|
<androidx.appcompat.widget.Toolbar
|
||||||
<!-- android:id="@+id/my_toolbar"-->
|
android:id="@+id/my_toolbar"
|
||||||
<!-- android:layout_width="match_parent"-->
|
android:layout_width="match_parent"
|
||||||
<!-- android:layout_height="?attr/actionBarSize"-->
|
android:layout_height="?attr/actionBarSize"
|
||||||
<!-- android:background="?attr/colorPrimary"-->
|
android:background="?attr/colorPrimary"
|
||||||
<!-- app:titleTextColor="#FFFFFF"-->
|
app:titleTextColor="#FFFFFF"
|
||||||
<!-- android:elevation="4dp"-->
|
android:elevation="4dp"
|
||||||
<!-- app:menu="@menu/my_menu"-->
|
app:menu="@menu/my_menu"
|
||||||
<!-- android:theme="@style/ToolbarTheme"-->
|
android:theme="@style/ToolbarTheme"
|
||||||
<!-- app:popupTheme="@style/ThemeOverlay.AppCompat.Light"-->
|
app:popupTheme="@style/ThemeOverlay.AppCompat.Light"
|
||||||
<!-- app:layout_constraintStart_toStartOf="parent"-->
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
<!-- app:layout_constraintTop_toTopOf="parent"/>-->
|
app:layout_constraintTop_toTopOf="parent"/>
|
||||||
|
|
||||||
<FrameLayout
|
<FrameLayout
|
||||||
android:id="@+id/fg_device"
|
android:id="@+id/fg_device"
|
||||||
|
|||||||
53
app/src/main/res/layout/activity_hb_test.xml
Normal file
53
app/src/main/res/layout/activity_hb_test.xml
Normal file
@@ -0,0 +1,53 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
|
||||||
|
<!--
|
||||||
|
~ // Copyright (c) 2024 ShanMukha Innovations Pvt. Ltd. All rights reserved.
|
||||||
|
~ // Notice: All information contained herein is, and remains
|
||||||
|
~ // the property of ShanMukha Innovations Pvt. Ltd. and its suppliers,
|
||||||
|
~ // if any. The intellectual and technical concepts contained
|
||||||
|
~ // herein are proprietary to ShanMukha Innovations Pvt. Ltd.
|
||||||
|
~ // and its suppliers and may be covered by Indian and Foreign Patents,
|
||||||
|
~ // patents in process, and are protected by trade secret or copyright law.
|
||||||
|
~ // Dissemination of this information or reproduction of this material
|
||||||
|
~ // is strictly forbidden unless prior written permission is obtained
|
||||||
|
~ // from ShanMukha Innovations Pvt. Ltd.
|
||||||
|
-->
|
||||||
|
|
||||||
|
<layout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools">
|
||||||
|
|
||||||
|
|
||||||
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
|
android:id="@+id/cl_parent"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent">
|
||||||
|
|
||||||
|
<!-- <androidx.appcompat.widget.Toolbar-->
|
||||||
|
<!-- android:id="@+id/my_toolbar"-->
|
||||||
|
<!-- android:layout_width="match_parent"-->
|
||||||
|
<!-- android:layout_height="?attr/actionBarSize"-->
|
||||||
|
<!-- android:background="?attr/colorPrimary"-->
|
||||||
|
<!-- app:titleTextColor="#FFFFFF"-->
|
||||||
|
<!-- android:elevation="4dp"-->
|
||||||
|
<!-- app:menu="@menu/my_menu"-->
|
||||||
|
<!-- android:theme="@style/ToolbarTheme"-->
|
||||||
|
<!-- app:popupTheme="@style/ThemeOverlay.AppCompat.Light"-->
|
||||||
|
<!-- app:layout_constraintStart_toStartOf="parent"-->
|
||||||
|
<!-- app:layout_constraintTop_toTopOf="parent"/>-->
|
||||||
|
|
||||||
|
<FrameLayout
|
||||||
|
android:id="@+id/fg_hb_test"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
>
|
||||||
|
|
||||||
|
</FrameLayout>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
|
</layout>
|
||||||
@@ -17,7 +17,7 @@
|
|||||||
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=".presentation.KitScanActivity">
|
>
|
||||||
|
|
||||||
<com.google.android.material.appbar.AppBarLayout
|
<com.google.android.material.appbar.AppBarLayout
|
||||||
android:id="@+id/app_bar_layout"
|
android:id="@+id/app_bar_layout"
|
||||||
@@ -45,6 +45,7 @@
|
|||||||
android:layout_marginHorizontal="24dp"
|
android:layout_marginHorizontal="24dp"
|
||||||
android:layout_marginTop="16dp"
|
android:layout_marginTop="16dp"
|
||||||
android:text="@string/scan_qr_code_of_the_kit"
|
android:text="@string/scan_qr_code_of_the_kit"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toBottomOf="@id/app_bar_layout" />
|
app:layout_constraintTop_toBottomOf="@id/app_bar_layout" />
|
||||||
|
|
||||||
@@ -58,6 +59,7 @@
|
|||||||
android:textColor="@color/black"
|
android:textColor="@color/black"
|
||||||
app:backgroundTint="@color/blue_app_light"
|
app:backgroundTint="@color/blue_app_light"
|
||||||
app:cornerRadius="100dp"
|
app:cornerRadius="100dp"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toBottomOf="@+id/tv_title" />
|
app:layout_constraintTop_toBottomOf="@+id/tv_title" />
|
||||||
|
|
||||||
@@ -128,7 +130,7 @@
|
|||||||
android:id="@+id/name_edit_text"
|
android:id="@+id/name_edit_text"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:maxLength="17"
|
android:maxLength="27"
|
||||||
android:inputType="text"
|
android:inputType="text"
|
||||||
android:hint="@string/serial_number" />
|
android:hint="@string/serial_number" />
|
||||||
|
|
||||||
|
|||||||
@@ -92,6 +92,7 @@
|
|||||||
android:layout_marginStart="16dp"
|
android:layout_marginStart="16dp"
|
||||||
android:layout_marginEnd="16dp"
|
android:layout_marginEnd="16dp"
|
||||||
app:cardElevation="8dp"
|
app:cardElevation="8dp"
|
||||||
|
android:visibility="gone"
|
||||||
app:layout_constraintBottom_toBottomOf="@+id/cv_item1"
|
app:layout_constraintBottom_toBottomOf="@+id/cv_item1"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintStart_toEndOf="@id/cv_item1"
|
app:layout_constraintStart_toEndOf="@id/cv_item1"
|
||||||
@@ -132,6 +133,7 @@
|
|||||||
android:id="@+id/cv_item3"
|
android:id="@+id/cv_item3"
|
||||||
android:layout_width="128dp"
|
android:layout_width="128dp"
|
||||||
android:layout_height="128dp"
|
android:layout_height="128dp"
|
||||||
|
android:visibility="gone"
|
||||||
android:layout_marginTop="32dp"
|
android:layout_marginTop="32dp"
|
||||||
android:layout_marginStart="16dp"
|
android:layout_marginStart="16dp"
|
||||||
app:cardElevation="8dp"
|
app:cardElevation="8dp"
|
||||||
@@ -178,6 +180,7 @@
|
|||||||
android:layout_marginStart="16dp"
|
android:layout_marginStart="16dp"
|
||||||
android:layout_marginEnd="16dp"
|
android:layout_marginEnd="16dp"
|
||||||
app:cardElevation="8dp"
|
app:cardElevation="8dp"
|
||||||
|
android:visibility="gone"
|
||||||
app:layout_constraintTop_toTopOf="@id/cv_item3"
|
app:layout_constraintTop_toTopOf="@id/cv_item3"
|
||||||
app:layout_constraintBottom_toBottomOf="@id/cv_item3"
|
app:layout_constraintBottom_toBottomOf="@id/cv_item3"
|
||||||
app:layout_constraintStart_toEndOf="@id/cv_item3"
|
app:layout_constraintStart_toEndOf="@id/cv_item3"
|
||||||
|
|||||||
35
app/src/main/res/layout/activity_password_reset.xml
Normal file
35
app/src/main/res/layout/activity_password_reset.xml
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:padding="16dp">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="Reset Password"
|
||||||
|
android:textStyle="bold"
|
||||||
|
android:textColor="@color/black"
|
||||||
|
android:textSize="27sp"
|
||||||
|
android:layout_marginTop="15dp"/>
|
||||||
|
|
||||||
|
<EditText
|
||||||
|
android:id="@+id/editTextNewPassword"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:textColor="@color/black"
|
||||||
|
android:layout_marginTop="30dp"
|
||||||
|
android:textSize="20sp"
|
||||||
|
android:hint="Enter new password"
|
||||||
|
android:inputType="textPassword" />
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/buttonResetPassword"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="20dp"
|
||||||
|
android:textColor="@color/white"
|
||||||
|
android:text="Reset Password" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
136
app/src/main/res/layout/activity_update_values.xml
Normal file
136
app/src/main/res/layout/activity_update_values.xml
Normal file
@@ -0,0 +1,136 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!--
|
||||||
|
~ // Copyright (c) 2024 ShanMukha Innovations Pvt. Ltd. All rights reserved.
|
||||||
|
~ // Notice: All information contained herein is, and remains
|
||||||
|
~ // the property of ShanMukha Innovations Pvt. Ltd. and its suppliers,
|
||||||
|
~ // if any. The intellectual and technical concepts contained
|
||||||
|
~ // herein are proprietary to ShanMukha Innovations Pvt. Ltd.
|
||||||
|
~ // and its suppliers and may be covered by Indian and Foreign Patents,
|
||||||
|
~ // patents in process, and are protected by trade secret or copyright law.
|
||||||
|
~ // Dissemination of this information or reproduction of this material
|
||||||
|
~ // is strictly forbidden unless prior written permission is obtained
|
||||||
|
~ // from ShanMukha Innovations Pvt. Ltd.
|
||||||
|
-->
|
||||||
|
|
||||||
|
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
tools:context="com.example.hpostesting.presentation.diagnostics.DiagnosticsFragment">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/tv_subtitle2"
|
||||||
|
style="@style/title2"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginHorizontal="24dp"
|
||||||
|
android:layout_marginTop="16dp"
|
||||||
|
android:textSize="20sp"
|
||||||
|
android:textColor="@color/black"
|
||||||
|
android:textStyle="bold"
|
||||||
|
android:text="Update values of ABS Limits"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toBottomOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:id="@+id/main_ll"
|
||||||
|
style="@style/title1_1"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginHorizontal="24dp"
|
||||||
|
android:layout_marginTop="16dp"
|
||||||
|
android:orientation="vertical"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toBottomOf="@id/tv_subtitle2">
|
||||||
|
|
||||||
|
<EditText
|
||||||
|
android:id="@+id/et_2mmled1_ll"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:hint="2mm Led 1 lower limit"
|
||||||
|
android:inputType="numberDecimal" />
|
||||||
|
<EditText
|
||||||
|
android:id="@+id/et_2mmled1_ul"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="5dp"
|
||||||
|
android:hint="2mm Led 1 upper limit"
|
||||||
|
android:inputType="numberDecimal" />
|
||||||
|
|
||||||
|
<EditText
|
||||||
|
android:id="@+id/et_2mmled2_ll"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="5dp"
|
||||||
|
android:hint="2mm Led 2 lower limit"
|
||||||
|
android:inputType="numberDecimal" />
|
||||||
|
|
||||||
|
<EditText
|
||||||
|
android:id="@+id/et_2mmled2_ul"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="5dp"
|
||||||
|
android:hint="2mm Led 2 upper limit"
|
||||||
|
android:inputType="numberDecimal" />
|
||||||
|
<EditText
|
||||||
|
android:id="@+id/et_10mmled1_ll"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="5dp"
|
||||||
|
android:hint="10mm Led 1 lower limit"
|
||||||
|
android:inputType="numberDecimal" />
|
||||||
|
<EditText
|
||||||
|
android:id="@+id/et_10mmled1_ul"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="5dp"
|
||||||
|
android:hint="10mm Led 1 upper limit"
|
||||||
|
android:inputType="numberDecimal" />
|
||||||
|
<EditText
|
||||||
|
android:id="@+id/et_10mmled2_ll"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="5dp"
|
||||||
|
android:hint="10mm Led 2 lower limit"
|
||||||
|
android:inputType="numberDecimal" />
|
||||||
|
<EditText
|
||||||
|
android:id="@+id/et_10mmled2_ul"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="5dp"
|
||||||
|
android:hint="10mm Led 2 upper limit"
|
||||||
|
android:inputType="numberDecimal" />
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/btn_submit"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginHorizontal="16dp"
|
||||||
|
android:layout_marginTop="24dp"
|
||||||
|
android:gravity="center"
|
||||||
|
android:text="@string/submit"
|
||||||
|
android:textColor="@color/white"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toBottomOf="@id/main_ll" />
|
||||||
|
|
||||||
|
<ProgressBar
|
||||||
|
android:id="@+id/progressBar"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_centerInParent="true"
|
||||||
|
android:elevation="12dp"
|
||||||
|
android:indeterminate="true"
|
||||||
|
android:indeterminateDrawable="@drawable/progressbar_drawable"
|
||||||
|
android:visibility="gone"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
|
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
@@ -11,6 +11,7 @@
|
|||||||
~ // is strictly forbidden unless prior written permission is obtained
|
~ // is strictly forbidden unless prior written permission is obtained
|
||||||
~ // from ShanMukha Innovations Pvt. Ltd.
|
~ // from ShanMukha Innovations Pvt. Ltd.
|
||||||
-->
|
-->
|
||||||
|
|
||||||
<ScrollView
|
<ScrollView
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
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"
|
||||||
@@ -19,28 +20,29 @@
|
|||||||
android:layout_height="match_parent">
|
android:layout_height="match_parent">
|
||||||
|
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:orientation="vertical"
|
|
||||||
android:layout_height="wrap_content">
|
|
||||||
<ImageView
|
|
||||||
android:layout_width="150dp"
|
|
||||||
android:layout_height="150dp"
|
|
||||||
android:layout_gravity="center"
|
|
||||||
android:layout_marginTop="20dp"
|
|
||||||
android:src="@drawable/smi_logo"
|
|
||||||
android:contentDescription="@string/smi" />
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/titleText"
|
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:orientation="vertical"
|
||||||
android:text="@string/smi_desp"
|
android:layout_height="wrap_content">
|
||||||
android:layout_marginTop="12dp"
|
<ImageView
|
||||||
android:layout_marginEnd="12dp"
|
android:layout_width="150dp"
|
||||||
android:layout_marginStart="12dp"
|
android:layout_height="150dp"
|
||||||
android:textSize="18sp"
|
android:layout_gravity="center"
|
||||||
android:textColor="@color/black"
|
android:layout_marginTop="20dp"
|
||||||
/>
|
android:src="@drawable/smi_logo"
|
||||||
|
android:contentDescription="@string/smi" />
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/titleText"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@string/smi_desp"
|
||||||
|
android:layout_marginTop="12dp"
|
||||||
|
android:layout_marginEnd="12dp"
|
||||||
|
android:layout_marginStart="12dp"
|
||||||
|
android:textSize="18sp"
|
||||||
|
android:textColor="@color/black"
|
||||||
|
/>
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/link_click"
|
android:id="@+id/link_click"
|
||||||
android:clickable="true"
|
android:clickable="true"
|
||||||
@@ -54,4 +56,4 @@
|
|||||||
android:textColor="@color/red"
|
android:textColor="@color/red"
|
||||||
android:focusable="true" />
|
android:focusable="true" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
</ScrollView>
|
</ScrollView>
|
||||||
|
|||||||
@@ -38,7 +38,9 @@
|
|||||||
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/auto_dac"
|
android:textSize="22sp"
|
||||||
|
android:textStyle="bold"
|
||||||
|
android:text="@string/calibrate_device"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toBottomOf="parent"
|
app:layout_constraintTop_toBottomOf="parent"
|
||||||
app:layout_constraintTop_toTopOf="parent" />
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
@@ -63,9 +65,10 @@
|
|||||||
android:layout_marginHorizontal="24dp"
|
android:layout_marginHorizontal="24dp"
|
||||||
android:layout_marginTop="16dp"
|
android:layout_marginTop="16dp"
|
||||||
android:gravity="center"
|
android:gravity="center"
|
||||||
|
android:scrollbars="vertical"
|
||||||
android:text="Start"
|
android:text="Start"
|
||||||
android:textColor="@color/black"
|
android:textColor="@color/black"
|
||||||
android:textSize="11sp"
|
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/tv_subtitle3" />
|
app:layout_constraintTop_toBottomOf="@id/tv_subtitle3" />
|
||||||
@@ -79,7 +82,7 @@
|
|||||||
android:layout_marginTop="24dp"
|
android:layout_marginTop="24dp"
|
||||||
android:clickable="false"
|
android:clickable="false"
|
||||||
android:gravity="center"
|
android:gravity="center"
|
||||||
android:text="Start Auto DAC"
|
android:text="@string/calibrate_device"
|
||||||
android:textColor="@color/white"
|
android:textColor="@color/white"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
@@ -93,6 +96,7 @@
|
|||||||
android:layout_marginTop="24dp"
|
android:layout_marginTop="24dp"
|
||||||
android:clickable="false"
|
android:clickable="false"
|
||||||
android:gravity="center"
|
android:gravity="center"
|
||||||
|
android:visibility="gone"
|
||||||
android:text="Read Current DAC Values"
|
android:text="Read Current DAC Values"
|
||||||
android:textColor="@color/white"
|
android:textColor="@color/white"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
|||||||
@@ -38,7 +38,7 @@
|
|||||||
style="@style/title1_1"
|
style="@style/title1_1"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginTop="50dp"
|
android:layout_marginTop="100dp"
|
||||||
android:gravity="center"
|
android:gravity="center"
|
||||||
android:text="Start"
|
android:text="Start"
|
||||||
android:textColor="@color/black"
|
android:textColor="@color/black"
|
||||||
|
|||||||
@@ -81,7 +81,6 @@
|
|||||||
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_subtitle4"/>
|
app:layout_constraintTop_toBottomOf="@id/tv_subtitle4"/>
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
android:id="@+id/btn_submit"
|
android:id="@+id/btn_submit"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
@@ -90,7 +89,7 @@
|
|||||||
android:layout_marginTop="24dp"
|
android:layout_marginTop="24dp"
|
||||||
android:clickable="false"
|
android:clickable="false"
|
||||||
android:gravity="center"
|
android:gravity="center"
|
||||||
android:text="Start"
|
android:text="@string/start"
|
||||||
android:textColor="@color/white"
|
android:textColor="@color/white"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
|||||||
@@ -19,7 +19,7 @@
|
|||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
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"
|
||||||
tools:context="com.example.hpostesting.presentation.hemocube.DigitalCardFragment">
|
tools:context="com.example.hpostesting.presentation.trueheme_test.DigitalCardFragment">
|
||||||
|
|
||||||
<androidx.cardview.widget.CardView
|
<androidx.cardview.widget.CardView
|
||||||
android:id="@+id/userCard"
|
android:id="@+id/userCard"
|
||||||
|
|||||||
@@ -22,7 +22,7 @@
|
|||||||
<androidx.constraintlayout.widget.ConstraintLayout
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
tools:context="com.example.hpostesting.presentation.dashboard.GalleryFragment">
|
tools:context="com.example.hpostesting.presentation.main_base.PanelFragment">
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/tv_subtitle4"
|
android:id="@+id/tv_subtitle4"
|
||||||
@@ -76,7 +76,7 @@
|
|||||||
android:layout_marginHorizontal="16dp"
|
android:layout_marginHorizontal="16dp"
|
||||||
android:layout_marginTop="24dp"
|
android:layout_marginTop="24dp"
|
||||||
android:clickable="false"
|
android:clickable="false"
|
||||||
android:text="@string/auto_dac"
|
android:text="@string/calibrate_device"
|
||||||
android:textColor="@color/white"
|
android:textColor="@color/white"
|
||||||
app:cornerRadius="16dp"
|
app:cornerRadius="16dp"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
@@ -140,6 +140,32 @@
|
|||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toBottomOf="@id/btn_deviceInfo" />
|
app:layout_constraintTop_toBottomOf="@id/btn_deviceInfo" />
|
||||||
|
|
||||||
|
<com.google.android.material.button.MaterialButton
|
||||||
|
android:id="@+id/btn_reset_password"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginHorizontal="16dp"
|
||||||
|
android:layout_marginTop="24dp"
|
||||||
|
android:clickable="false"
|
||||||
|
android:text="@string/reset_password_for_this_device"
|
||||||
|
android:textColor="@color/white"
|
||||||
|
app:cornerRadius="16dp"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toBottomOf="@id/btn_deviceProvision" />
|
||||||
|
<com.google.android.material.button.MaterialButton
|
||||||
|
android:id="@+id/btn_update_values"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginHorizontal="16dp"
|
||||||
|
android:layout_marginTop="24dp"
|
||||||
|
android:clickable="false"
|
||||||
|
android:text="Update values"
|
||||||
|
android:textColor="@color/white"
|
||||||
|
app:cornerRadius="16dp"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toBottomOf="@id/btn_reset_password" />
|
||||||
<com.google.android.material.button.MaterialButton
|
<com.google.android.material.button.MaterialButton
|
||||||
android:id="@+id/btn_firefox"
|
android:id="@+id/btn_firefox"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
@@ -152,7 +178,7 @@
|
|||||||
app:cornerRadius="16dp"
|
app:cornerRadius="16dp"
|
||||||
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_deviceProvision" />
|
app:layout_constraintTop_toBottomOf="@id/btn_reset_password" />
|
||||||
|
|
||||||
<com.google.android.material.button.MaterialButton
|
<com.google.android.material.button.MaterialButton
|
||||||
android:id="@+id/btn_files"
|
android:id="@+id/btn_files"
|
||||||
|
|||||||
158
app/src/main/res/layout/fragment_hb_test.xml
Normal file
158
app/src/main/res/layout/fragment_hb_test.xml
Normal file
@@ -0,0 +1,158 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!--
|
||||||
|
~ // Copyright (c) 2024 ShanMukha Innovations Pvt. Ltd. All rights reserved.
|
||||||
|
~ // Notice: All information contained herein is, and remains
|
||||||
|
~ // the property of ShanMukha Innovations Pvt. Ltd. and its suppliers,
|
||||||
|
~ // if any. The intellectual and technical concepts contained
|
||||||
|
~ // herein are proprietary to ShanMukha Innovations Pvt. Ltd.
|
||||||
|
~ // and its suppliers and may be covered by Indian and Foreign Patents,
|
||||||
|
~ // patents in process, and are protected by trade secret or copyright law.
|
||||||
|
~ // Dissemination of this information or reproduction of this material
|
||||||
|
~ // is strictly forbidden unless prior written permission is obtained
|
||||||
|
~ // from ShanMukha Innovations Pvt. Ltd.
|
||||||
|
-->
|
||||||
|
|
||||||
|
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
tools:context="com.example.hpostesting.presentation.autodac.AutoDacFragment">
|
||||||
|
|
||||||
|
|
||||||
|
<!-- <TextView-->
|
||||||
|
<!-- android:id="@+id/tv_title"-->
|
||||||
|
<!-- style="@style/title1"-->
|
||||||
|
<!-- android:layout_width="wrap_content"-->
|
||||||
|
<!-- android:layout_height="wrap_content"-->
|
||||||
|
<!-- android:layout_marginHorizontal="24dp"-->
|
||||||
|
<!-- android:text="@string/diagnostics"-->
|
||||||
|
<!-- android:layout_marginTop="16dp"-->
|
||||||
|
<!-- app:layout_constraintStart_toStartOf="parent"-->
|
||||||
|
<!-- app:layout_constraintTop_toTopOf="parent" />-->
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/tv_subtitle2"
|
||||||
|
style="@style/title2"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginHorizontal="24dp"
|
||||||
|
android:layout_marginTop="16dp"
|
||||||
|
android:textSize="22sp"
|
||||||
|
android:textStyle="bold"
|
||||||
|
android:text="HB Test"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toBottomOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/tv_subtitle3"
|
||||||
|
style="@style/title2"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginHorizontal="24dp"
|
||||||
|
android:layout_marginTop="16dp"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toBottomOf="@id/tv_subtitle2" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/tv_subtitle4"
|
||||||
|
style="@style/title1_1"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="320dp"
|
||||||
|
android:layout_marginHorizontal="24dp"
|
||||||
|
android:layout_marginTop="16dp"
|
||||||
|
android:gravity="center"
|
||||||
|
android:scrollbars="vertical"
|
||||||
|
android:text="Start"
|
||||||
|
android:textColor="@color/black"
|
||||||
|
android:textSize="14sp"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toBottomOf="@id/tv_subtitle3" />
|
||||||
|
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/btn_buffer"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginHorizontal="16dp"
|
||||||
|
android:layout_marginTop="24dp"
|
||||||
|
android:clickable="false"
|
||||||
|
android:gravity="center"
|
||||||
|
android:text="Buffer Start"
|
||||||
|
android:textColor="@color/white"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toBottomOf="@id/tv_subtitle4" />
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/btn_sample"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginHorizontal="16dp"
|
||||||
|
android:layout_marginTop="15dp"
|
||||||
|
android:clickable="false"
|
||||||
|
android:gravity="center"
|
||||||
|
android:visibility="visible"
|
||||||
|
android:text="Sample Start"
|
||||||
|
android:textColor="@color/white"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toBottomOf="@id/btn_buffer" />
|
||||||
|
<Button
|
||||||
|
android:id="@+id/btn_submit"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginHorizontal="16dp"
|
||||||
|
android:layout_marginTop="24dp"
|
||||||
|
android:clickable="false"
|
||||||
|
android:gravity="center"
|
||||||
|
android:visibility="gone"
|
||||||
|
android:text="Submit"
|
||||||
|
android:textColor="@color/white"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toBottomOf="@id/btn_sample" />
|
||||||
|
|
||||||
|
<!-- <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>-->
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/iv_check"
|
||||||
|
android:visibility="gone"
|
||||||
|
android:layout_width="100dp"
|
||||||
|
android:layout_height="100dp"
|
||||||
|
android:layout_marginTop="40dp"
|
||||||
|
android:importantForAccessibility="no"
|
||||||
|
android:src="@drawable/check"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toBottomOf="@id/btn_submit" />
|
||||||
|
|
||||||
|
<ProgressBar
|
||||||
|
android:id="@+id/progressBar"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_centerInParent="true"
|
||||||
|
android:elevation="12dp"
|
||||||
|
android:indeterminate="true"
|
||||||
|
android:indeterminateDrawable="@drawable/progressbar_drawable"
|
||||||
|
android:visibility="gone"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
|
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
@@ -14,76 +14,80 @@
|
|||||||
<layout xmlns:android="http://schemas.android.com/apk/res/android"
|
<layout 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"
|
||||||
tools:context="com.example.hpostesting.presentation.hemocube.HemoCubeFragment">
|
tools:context="com.example.hpostesting.presentation.trueheme_test.TrueHemeTestFragment">
|
||||||
|
|
||||||
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
|
android:id="@+id/cl_parent"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent">
|
||||||
|
<Button
|
||||||
|
android:id="@+id/btn_placeRefreshbuffer"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:padding="5dp"
|
||||||
|
android:layout_marginTop="3dp"
|
||||||
|
android:layout_marginEnd="3dp"
|
||||||
|
android:textSize="14sp"
|
||||||
|
android:visibility="gone"
|
||||||
|
android:clickable="false"
|
||||||
|
android:text="Refresh \nbuffer"
|
||||||
|
android:textColor="@color/white"
|
||||||
|
android:backgroundTint="@color/brightGreen"
|
||||||
|
app:cornerRadius="16dp"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
|
/>
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/tv_title"
|
||||||
|
style="@style/title1"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginHorizontal="24dp"
|
||||||
|
android:layout_marginTop="16dp"
|
||||||
|
android:text="@string/Instructions"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
<androidx.constraintlayout.widget.ConstraintLayout
|
<TextView
|
||||||
android:id="@+id/cl_parent"
|
android:id="@+id/tv_subtitle2"
|
||||||
android:layout_width="match_parent"
|
style="@style/title2"
|
||||||
android:layout_height="match_parent">
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginHorizontal="24dp"
|
||||||
|
android:layout_marginTop="16dp"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toBottomOf="@id/tv_title" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/tv_title"
|
android:id="@+id/tv_name"
|
||||||
style="@style/title1"
|
style="@style/title2"
|
||||||
android:layout_width="wrap_content"
|
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:gravity="center"
|
||||||
android:text="@string/Instructions"
|
android:padding="12dp"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
android:layout_marginTop="26dp"
|
||||||
app:layout_constraintTop_toTopOf="parent" />
|
android:textSize="14sp"
|
||||||
|
android:textFontWeight="700"
|
||||||
|
android:text="Name: SMI\n ID: 1672282828"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
tools:ignore="MissingConstraints" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/tv_subtitle2"
|
android:id="@+id/tv_subtitle4"
|
||||||
style="@style/title2"
|
style="@style/title1_1"
|
||||||
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="72dp"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
android:gravity="center"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
android:textColor="@color/red"
|
||||||
app:layout_constraintTop_toBottomOf="@id/tv_title" />
|
android:textSize="16sp"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
<!-- <TextView-->
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
<!-- android:id="@+id/tv_subtitle3"-->
|
app:layout_constraintTop_toBottomOf="@id/et_abha_id" />
|
||||||
<!-- style="@style/title2"-->
|
|
||||||
<!-- android:layout_width="0dp"-->
|
|
||||||
<!-- android:layout_height="wrap_content"-->
|
|
||||||
<!-- android:layout_marginHorizontal="24dp"-->
|
|
||||||
<!-- android:layout_marginTop="16dp"-->
|
|
||||||
<!-- android:text="@string/step5"-->
|
|
||||||
<!-- app:layout_constraintEnd_toEndOf="parent"-->
|
|
||||||
<!-- app:layout_constraintStart_toStartOf="parent"-->
|
|
||||||
<!-- app:layout_constraintTop_toBottomOf="@id/tv_subtitle2" />-->
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/tv_name"
|
|
||||||
style="@style/title2"
|
|
||||||
android:layout_width="0dp"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginHorizontal="24dp"
|
|
||||||
android:gravity="center"
|
|
||||||
android:padding="12dp"
|
|
||||||
android:layout_marginTop="26dp"
|
|
||||||
android:textFontWeight="700"
|
|
||||||
android:text="Name: SMI\n ID: 1672282828"
|
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
|
||||||
tools:ignore="MissingConstraints" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/tv_subtitle4"
|
|
||||||
style="@style/title1_1"
|
|
||||||
android:layout_width="0dp"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginHorizontal="24dp"
|
|
||||||
android:layout_marginTop="72dp"
|
|
||||||
android:gravity="center"
|
|
||||||
android:textColor="@color/red"
|
|
||||||
android:textSize="18sp"
|
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
|
||||||
app:layout_constraintTop_toBottomOf="@id/et_abha_id" />
|
|
||||||
|
|
||||||
|
|
||||||
<!-- <Button-->
|
<!-- <Button-->
|
||||||
@@ -246,8 +250,10 @@
|
|||||||
android:gravity="center"
|
android:gravity="center"
|
||||||
android:text="no device message"
|
android:text="no device message"
|
||||||
android:textColor="@color/black"
|
android:textColor="@color/black"
|
||||||
|
android:scrollbars="vertical"
|
||||||
android:textSize="11sp"
|
android:textSize="11sp"
|
||||||
android:visibility="visible"
|
android:visibility="gone"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintTop_toBottomOf="@id/ll_btns" />
|
app:layout_constraintTop_toBottomOf="@id/ll_btns" />
|
||||||
|
|
||||||
@@ -265,14 +271,25 @@
|
|||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toBottomOf="@id/error_message" />
|
app:layout_constraintTop_toBottomOf="@id/error_message" />
|
||||||
|
|
||||||
<ImageView
|
<pl.droidsonroids.gif.GifImageView
|
||||||
|
android:id="@+id/testing"
|
||||||
|
android:visibility="gone"
|
||||||
|
android:layout_width="180dp"
|
||||||
|
android:layout_height="150dp"
|
||||||
|
android:layout_marginTop="10dp"
|
||||||
|
android:importantForAccessibility="no"
|
||||||
|
android:src="@drawable/virtual_lab"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toBottomOf="@id/tv_device_messages" />
|
||||||
|
<pl.droidsonroids.gif.GifImageView
|
||||||
android:id="@+id/iv_check"
|
android:id="@+id/iv_check"
|
||||||
android:visibility="gone"
|
android:visibility="gone"
|
||||||
android:layout_width="100dp"
|
android:layout_width="100dp"
|
||||||
android:layout_height="100dp"
|
android:layout_height="100dp"
|
||||||
android:layout_marginTop="40dp"
|
android:layout_marginTop="40dp"
|
||||||
android:importantForAccessibility="no"
|
android:importantForAccessibility="no"
|
||||||
android:src="@drawable/check"
|
android:src="@drawable/verified"
|
||||||
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_device_messages" />
|
app:layout_constraintTop_toBottomOf="@id/tv_device_messages" />
|
||||||
|
|||||||
@@ -48,16 +48,25 @@
|
|||||||
android:id="@+id/internetNotAvailableCL"
|
android:id="@+id/internetNotAvailableCL"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:visibility="gone"
|
android:visibility="visible"
|
||||||
android:padding="24dp">
|
android:padding="20dp">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/internetIcon"
|
||||||
|
android:layout_width="33dp"
|
||||||
|
android:layout_height="33dp"
|
||||||
|
android:layout_marginEnd="10dp"
|
||||||
|
android:src="@drawable/off"
|
||||||
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
/>
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/btnLogout1"
|
android:id="@+id/btnLogout1"
|
||||||
android:layout_width="30dp"
|
android:layout_width="33dp"
|
||||||
android:layout_height="30dp"
|
android:layout_height="33dp"
|
||||||
android:layout_marginEnd="10dp"
|
android:layout_marginEnd="10dp"
|
||||||
android:src="@drawable/baseline_logout_24"
|
android:src="@drawable/baseline_logout_24"
|
||||||
app:layout_constraintTop_toTopOf="@+id/internetNotAvailableCL"
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
@@ -67,11 +76,11 @@
|
|||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:gravity="center"
|
android:gravity="center"
|
||||||
android:layout_marginTop="24dp"
|
android:layout_marginTop="8dp"
|
||||||
android:text="@string/internet_not_available_please_enter_the_user_id_manually"
|
android:text="@string/internet_not_available_please_enter_the_user_id_manually"
|
||||||
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_toBottomOf="@+id/btnLogout1"/>
|
||||||
|
|
||||||
<com.google.android.material.textfield.TextInputLayout
|
<com.google.android.material.textfield.TextInputLayout
|
||||||
android:id="@+id/til_name"
|
android:id="@+id/til_name"
|
||||||
@@ -90,7 +99,27 @@
|
|||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:maxLength="18"
|
android:maxLength="18"
|
||||||
android:inputType="textCapCharacters"
|
android:inputType="textCapCharacters"
|
||||||
android:hint="@string/user_id" />
|
android:hint="@string/sample_id" />
|
||||||
|
|
||||||
|
</com.google.android.material.textfield.TextInputLayout>
|
||||||
|
<com.google.android.material.textfield.TextInputLayout
|
||||||
|
android:id="@+id/til_age"
|
||||||
|
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="24dp"
|
||||||
|
android:layout_marginHorizontal="24dp"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toBottomOf="@+id/til_name">
|
||||||
|
|
||||||
|
<com.google.android.material.textfield.TextInputEditText
|
||||||
|
android:id="@+id/age"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:maxLength="2"
|
||||||
|
android:inputType="number"
|
||||||
|
android:hint="@string/age" />
|
||||||
|
|
||||||
</com.google.android.material.textfield.TextInputLayout>
|
</com.google.android.material.textfield.TextInputLayout>
|
||||||
|
|
||||||
@@ -103,7 +132,7 @@
|
|||||||
android:layout_marginTop="24dp"
|
android:layout_marginTop="24dp"
|
||||||
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/til_name">
|
app:layout_constraintTop_toBottomOf="@+id/til_age">
|
||||||
|
|
||||||
<AutoCompleteTextView
|
<AutoCompleteTextView
|
||||||
android:id="@+id/et_blood_group"
|
android:id="@+id/et_blood_group"
|
||||||
@@ -119,7 +148,11 @@
|
|||||||
android:id="@+id/btn_submit"
|
android:id="@+id/btn_submit"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_margin="24dp"
|
android:layout_marginStart="54dp"
|
||||||
|
android:layout_marginEnd="54dp"
|
||||||
|
android:layout_marginTop="15dp"
|
||||||
|
android:layout_marginBottom="10dp"
|
||||||
|
android:textColor="@color/white"
|
||||||
android:text="@string/submit"
|
android:text="@string/submit"
|
||||||
app:cornerRadius="100dp"
|
app:cornerRadius="100dp"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
@@ -130,6 +163,7 @@
|
|||||||
android:id="@+id/rv_order_offline"
|
android:id="@+id/rv_order_offline"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="0dp"
|
android:layout_height="0dp"
|
||||||
|
android:visibility="gone"
|
||||||
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
|
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
@@ -147,164 +181,16 @@
|
|||||||
<!-- android:visibility="gone"-->
|
<!-- android:visibility="gone"-->
|
||||||
<!-- app:layout_constraintBottom_toBottomOf="@+id/rv_order_offline"-->
|
<!-- app:layout_constraintBottom_toBottomOf="@+id/rv_order_offline"-->
|
||||||
<!-- app:layout_constraintStart_toStartOf="parent" />-->
|
<!-- app:layout_constraintStart_toStartOf="parent" />-->
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/label1"
|
|
||||||
style="@style/title1_1"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:text="@string/new_kit"
|
|
||||||
app:layout_constraintBottom_toTopOf="@+id/btnNewKitoffline"
|
|
||||||
app:layout_constraintEnd_toEndOf="parent" />
|
|
||||||
|
|
||||||
<com.google.android.material.floatingactionbutton.FloatingActionButton
|
|
||||||
android:id="@+id/btnNewKitoffline"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_margin="8dp"
|
|
||||||
android:backgroundTint="@color/primary"
|
|
||||||
android:contentDescription="@string/new_kit"
|
|
||||||
android:src="@drawable/ic_add"
|
|
||||||
app:elevation="1dp"
|
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
|
||||||
app:layout_constraintEnd_toEndOf="parent" />
|
|
||||||
|
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
|
||||||
|
|
||||||
<androidx.constraintlayout.widget.ConstraintLayout
|
|
||||||
android:id="@+id/internetAvailableCL"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:visibility="visible"
|
|
||||||
android:padding="24dp">
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/tv_title"
|
|
||||||
style="@style/title1"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:text="@string/user_list"
|
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
|
||||||
app:layout_constraintTop_toTopOf="parent" />
|
|
||||||
|
|
||||||
<ImageView
|
|
||||||
android:id="@+id/uploadData"
|
|
||||||
android:layout_width="50dp"
|
|
||||||
android:layout_height="50dp"
|
|
||||||
android:src="@drawable/upload_data"
|
|
||||||
android:visibility="gone"
|
|
||||||
app:layout_constraintBottom_toBottomOf="@+id/tv_title"
|
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
|
||||||
app:layout_constraintTop_toTopOf="@+id/tv_title" />
|
|
||||||
<ImageView
|
|
||||||
android:id="@+id/btnLogout"
|
|
||||||
android:layout_width="30dp"
|
|
||||||
android:layout_height="30dp"
|
|
||||||
android:layout_marginEnd="10dp"
|
|
||||||
android:src="@drawable/baseline_logout_24"
|
|
||||||
app:layout_constraintBottom_toBottomOf="@+id/tv_title"
|
|
||||||
app:layout_constraintEnd_toStartOf="@+id/uploadData"
|
|
||||||
app:layout_constraintTop_toTopOf="@+id/tv_title" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/tv_not_available"
|
|
||||||
style="@style/title1_1"
|
|
||||||
android:layout_width="0dp"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginHorizontal="16dp"
|
|
||||||
android:layout_marginTop="56dp"
|
|
||||||
android:text="@string/no_patient_records_found_to_test_please_add_one_from_below"
|
|
||||||
android:textAlignment="center"
|
|
||||||
android:visibility="gone"
|
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
|
||||||
app:layout_constraintTop_toBottomOf="@id/tv_title" />
|
|
||||||
|
|
||||||
<androidx.cardview.widget.CardView
|
|
||||||
android:id="@+id/cardView4"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
app:cardElevation="0dp"
|
|
||||||
app:layout_constraintTop_toBottomOf="@+id/tv_title"
|
|
||||||
tools:layout_editor_absoluteX="24dp">
|
|
||||||
|
|
||||||
<androidx.constraintlayout.widget.ConstraintLayout
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent">
|
|
||||||
|
|
||||||
<androidx.appcompat.widget.SearchView
|
|
||||||
android:id="@+id/search_product"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_margin="10dp"
|
|
||||||
android:background="@drawable/edit_text_background"
|
|
||||||
android:inputType="text"
|
|
||||||
app:iconifiedByDefault="false"
|
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
|
||||||
app:layout_constraintTop_toTopOf="parent" />
|
|
||||||
|
|
||||||
<requestFocus />
|
|
||||||
|
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
|
||||||
|
|
||||||
</androidx.cardview.widget.CardView>
|
|
||||||
|
|
||||||
<RadioGroup
|
|
||||||
android:id="@+id/radioGroup"
|
|
||||||
android:layout_width="0dp"
|
|
||||||
android:orientation="horizontal"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
|
||||||
app:layout_constraintTop_toBottomOf="@+id/cardView4">
|
|
||||||
|
|
||||||
<RadioButton
|
|
||||||
android:id="@+id/userIdRadioButton"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:checked="true"
|
|
||||||
android:text="@string/user_id" />
|
|
||||||
|
|
||||||
<RadioButton
|
|
||||||
android:id="@+id/abhaIdRadioButton"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:text="@string/abha_id"
|
|
||||||
app:layout_constraintTop_toBottomOf="@id/userIdRadioButton" />
|
|
||||||
|
|
||||||
<RadioButton
|
|
||||||
android:id="@+id/aadharIdRadioButton"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:text="@string/aadhar_id"
|
|
||||||
app:layout_constraintTop_toBottomOf="@id/abhaIdRadioButton" />
|
|
||||||
|
|
||||||
</RadioGroup>
|
|
||||||
|
|
||||||
<androidx.recyclerview.widget.RecyclerView
|
|
||||||
android:id="@+id/rv_order"
|
|
||||||
android:layout_width="0dp"
|
|
||||||
android:layout_height="0dp"
|
|
||||||
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
|
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
|
||||||
app:layout_constraintTop_toBottomOf="@+id/radioGroup"
|
|
||||||
tools:listitem="@layout/user_item_view"/>
|
|
||||||
|
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/labelQuickCapture"
|
android:id="@+id/labelQuickCapture"
|
||||||
style="@style/title1_1"
|
style="@style/title1_1"
|
||||||
android:visibility="gone"
|
android:visibility="gone"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="Quick Capture"
|
android:text="@string/quick_capture"
|
||||||
app:layout_constraintBottom_toTopOf="@+id/btnQuickCapture"
|
app:layout_constraintBottom_toTopOf="@+id/btnNewKitoffline"
|
||||||
app:layout_constraintEnd_toEndOf="parent" />
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
/>
|
||||||
|
|
||||||
<com.google.android.material.floatingactionbutton.FloatingActionButton
|
<com.google.android.material.floatingactionbutton.FloatingActionButton
|
||||||
android:id="@+id/btnQuickCapture"
|
android:id="@+id/btnQuickCapture"
|
||||||
@@ -316,22 +202,21 @@
|
|||||||
android:contentDescription="Capture measurements quickly"
|
android:contentDescription="Capture measurements quickly"
|
||||||
android:src="@drawable/flask"
|
android:src="@drawable/flask"
|
||||||
app:elevation="1dp"
|
app:elevation="1dp"
|
||||||
app:layout_constraintBottom_toTopOf="@+id/label"
|
app:layout_constraintBottom_toTopOf="@+id/labelQuickCapture"
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintEnd_toEndOf="parent" />
|
/>
|
||||||
|
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/label"
|
android:id="@+id/label1"
|
||||||
style="@style/title1_1"
|
style="@style/title1_1"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="@string/new_kit"
|
android:text="@string/new_kit"
|
||||||
app:layout_constraintBottom_toTopOf="@+id/btnNewKit"
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
app:layout_constraintEnd_toEndOf="parent" />
|
app:layout_constraintEnd_toEndOf="parent" />
|
||||||
|
|
||||||
<com.google.android.material.floatingactionbutton.FloatingActionButton
|
<com.google.android.material.floatingactionbutton.FloatingActionButton
|
||||||
android:id="@+id/btnNewKit"
|
android:id="@+id/btnNewKitoffline"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_margin="8dp"
|
android:layout_margin="8dp"
|
||||||
@@ -339,11 +224,158 @@
|
|||||||
android:contentDescription="@string/new_kit"
|
android:contentDescription="@string/new_kit"
|
||||||
android:src="@drawable/ic_add"
|
android:src="@drawable/ic_add"
|
||||||
app:elevation="1dp"
|
app:elevation="1dp"
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
app:layout_constraintBottom_toTopOf="@+id/label1"
|
||||||
app:layout_constraintEnd_toEndOf="parent" />
|
app:layout_constraintEnd_toEndOf="parent" />
|
||||||
|
|
||||||
|
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
|
|
||||||
|
<!-- <androidx.constraintlayout.widget.ConstraintLayout-->
|
||||||
|
<!-- android:id="@+id/internetAvailableCL"-->
|
||||||
|
<!-- android:layout_width="match_parent"-->
|
||||||
|
<!-- android:layout_height="match_parent"-->
|
||||||
|
<!-- android:visibility="gone"-->
|
||||||
|
<!-- android:padding="24dp">-->
|
||||||
|
|
||||||
|
<!-- <TextView-->
|
||||||
|
<!-- android:id="@+id/tv_title"-->
|
||||||
|
<!-- style="@style/title1"-->
|
||||||
|
<!-- android:layout_width="wrap_content"-->
|
||||||
|
<!-- android:layout_height="wrap_content"-->
|
||||||
|
<!-- android:text="@string/user_list"-->
|
||||||
|
<!-- app:layout_constraintEnd_toEndOf="parent"-->
|
||||||
|
<!-- app:layout_constraintStart_toStartOf="parent"-->
|
||||||
|
<!-- app:layout_constraintTop_toTopOf="parent" />-->
|
||||||
|
|
||||||
|
<!-- <ImageView-->
|
||||||
|
<!-- android:id="@+id/uploadData"-->
|
||||||
|
<!-- android:layout_width="50dp"-->
|
||||||
|
<!-- android:layout_height="50dp"-->
|
||||||
|
<!-- android:src="@drawable/upload_data"-->
|
||||||
|
<!-- android:visibility="gone"-->
|
||||||
|
<!-- app:layout_constraintBottom_toBottomOf="@+id/tv_title"-->
|
||||||
|
<!-- app:layout_constraintEnd_toEndOf="parent"-->
|
||||||
|
<!-- app:layout_constraintTop_toTopOf="@+id/tv_title" />-->
|
||||||
|
<!-- <ImageView-->
|
||||||
|
<!-- android:id="@+id/btnLogout"-->
|
||||||
|
<!-- android:layout_width="30dp"-->
|
||||||
|
<!-- android:layout_height="30dp"-->
|
||||||
|
<!-- android:layout_marginEnd="10dp"-->
|
||||||
|
<!-- android:src="@drawable/baseline_logout_24"-->
|
||||||
|
<!-- app:layout_constraintBottom_toBottomOf="@+id/tv_title"-->
|
||||||
|
<!-- app:layout_constraintEnd_toStartOf="@+id/uploadData"-->
|
||||||
|
<!-- app:layout_constraintTop_toTopOf="@+id/tv_title" />-->
|
||||||
|
|
||||||
|
<!-- <TextView-->
|
||||||
|
<!-- android:id="@+id/tv_not_available"-->
|
||||||
|
<!-- style="@style/title1_1"-->
|
||||||
|
<!-- android:layout_width="0dp"-->
|
||||||
|
<!-- android:layout_height="wrap_content"-->
|
||||||
|
<!-- android:layout_marginHorizontal="16dp"-->
|
||||||
|
<!-- android:layout_marginTop="56dp"-->
|
||||||
|
<!-- android:text="@string/no_patient_records_found_to_test_please_add_one_from_below"-->
|
||||||
|
<!-- android:textAlignment="center"-->
|
||||||
|
<!-- android:visibility="gone"-->
|
||||||
|
<!-- app:layout_constraintEnd_toEndOf="parent"-->
|
||||||
|
<!-- app:layout_constraintStart_toStartOf="parent"-->
|
||||||
|
<!-- app:layout_constraintTop_toBottomOf="@id/tv_title" />-->
|
||||||
|
|
||||||
|
<!-- <androidx.cardview.widget.CardView-->
|
||||||
|
<!-- android:id="@+id/cardView4"-->
|
||||||
|
<!-- android:layout_width="match_parent"-->
|
||||||
|
<!-- android:layout_height="wrap_content"-->
|
||||||
|
<!-- app:cardElevation="0dp"-->
|
||||||
|
<!-- app:layout_constraintTop_toBottomOf="@+id/tv_title"-->
|
||||||
|
<!-- tools:layout_editor_absoluteX="24dp">-->
|
||||||
|
|
||||||
|
<!-- <androidx.constraintlayout.widget.ConstraintLayout-->
|
||||||
|
<!-- android:layout_width="match_parent"-->
|
||||||
|
<!-- android:layout_height="match_parent">-->
|
||||||
|
|
||||||
|
<!-- <androidx.appcompat.widget.SearchView-->
|
||||||
|
<!-- android:id="@+id/search_product"-->
|
||||||
|
<!-- android:layout_width="match_parent"-->
|
||||||
|
<!-- android:layout_height="wrap_content"-->
|
||||||
|
<!-- android:layout_margin="10dp"-->
|
||||||
|
<!-- android:background="@drawable/edit_text_background"-->
|
||||||
|
<!-- android:inputType="text"-->
|
||||||
|
<!-- app:iconifiedByDefault="false"-->
|
||||||
|
<!-- app:layout_constraintBottom_toBottomOf="parent"-->
|
||||||
|
<!-- app:layout_constraintEnd_toEndOf="parent"-->
|
||||||
|
<!-- app:layout_constraintStart_toStartOf="parent"-->
|
||||||
|
<!-- app:layout_constraintTop_toTopOf="parent" />-->
|
||||||
|
|
||||||
|
<!-- <requestFocus />-->
|
||||||
|
|
||||||
|
<!-- </androidx.constraintlayout.widget.ConstraintLayout>-->
|
||||||
|
|
||||||
|
<!-- </androidx.cardview.widget.CardView>-->
|
||||||
|
|
||||||
|
<!-- <RadioGroup-->
|
||||||
|
<!-- android:id="@+id/radioGroup"-->
|
||||||
|
<!-- android:layout_width="0dp"-->
|
||||||
|
<!-- android:orientation="horizontal"-->
|
||||||
|
<!-- android:layout_height="wrap_content"-->
|
||||||
|
<!-- app:layout_constraintEnd_toEndOf="parent"-->
|
||||||
|
<!-- app:layout_constraintStart_toStartOf="parent"-->
|
||||||
|
<!-- app:layout_constraintTop_toBottomOf="@+id/cardView4">-->
|
||||||
|
|
||||||
|
<!-- <RadioButton-->
|
||||||
|
<!-- android:id="@+id/userIdRadioButton"-->
|
||||||
|
<!-- android:layout_width="wrap_content"-->
|
||||||
|
<!-- android:layout_height="wrap_content"-->
|
||||||
|
<!-- android:checked="true"-->
|
||||||
|
<!-- android:text="@string/user_id" />-->
|
||||||
|
|
||||||
|
<!-- <RadioButton-->
|
||||||
|
<!-- android:id="@+id/abhaIdRadioButton"-->
|
||||||
|
<!-- android:layout_width="wrap_content"-->
|
||||||
|
<!-- android:layout_height="wrap_content"-->
|
||||||
|
<!-- android:text="@string/abha_id"-->
|
||||||
|
<!-- app:layout_constraintTop_toBottomOf="@id/userIdRadioButton" />-->
|
||||||
|
|
||||||
|
<!-- <RadioButton-->
|
||||||
|
<!-- android:id="@+id/aadharIdRadioButton"-->
|
||||||
|
<!-- android:layout_width="wrap_content"-->
|
||||||
|
<!-- android:layout_height="wrap_content"-->
|
||||||
|
<!-- android:text="@string/aadhar_id"-->
|
||||||
|
<!-- app:layout_constraintTop_toBottomOf="@id/abhaIdRadioButton" />-->
|
||||||
|
|
||||||
|
<!-- </RadioGroup>-->
|
||||||
|
|
||||||
|
<!-- <androidx.recyclerview.widget.RecyclerView-->
|
||||||
|
<!-- android:id="@+id/rv_order"-->
|
||||||
|
<!-- android:layout_width="0dp"-->
|
||||||
|
<!-- android:layout_height="0dp"-->
|
||||||
|
<!-- app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"-->
|
||||||
|
<!-- app:layout_constraintBottom_toBottomOf="parent"-->
|
||||||
|
<!-- app:layout_constraintEnd_toEndOf="parent"-->
|
||||||
|
<!-- app:layout_constraintStart_toStartOf="parent"-->
|
||||||
|
<!-- app:layout_constraintTop_toBottomOf="@+id/radioGroup"-->
|
||||||
|
<!-- tools:listitem="@layout/user_item_view"/>-->
|
||||||
|
|
||||||
|
<!-- <TextView-->
|
||||||
|
<!-- android:id="@+id/label"-->
|
||||||
|
<!-- style="@style/title1_1"-->
|
||||||
|
<!-- android:layout_width="wrap_content"-->
|
||||||
|
<!-- android:layout_height="wrap_content"-->
|
||||||
|
<!-- android:text="@string/new_kit"-->
|
||||||
|
<!-- app:layout_constraintBottom_toTopOf="@+id/btnNewKit"-->
|
||||||
|
<!-- app:layout_constraintEnd_toEndOf="parent" />-->
|
||||||
|
|
||||||
|
<!-- <com.google.android.material.floatingactionbutton.FloatingActionButton-->
|
||||||
|
<!-- android:id="@+id/btnNewKit"-->
|
||||||
|
<!-- android:layout_width="wrap_content"-->
|
||||||
|
<!-- android:layout_height="wrap_content"-->
|
||||||
|
<!-- android:layout_margin="8dp"-->
|
||||||
|
<!-- android:backgroundTint="@color/primary"-->
|
||||||
|
<!-- android:contentDescription="@string/new_kit"-->
|
||||||
|
<!-- android:src="@drawable/ic_add"-->
|
||||||
|
<!-- app:elevation="1dp"-->
|
||||||
|
<!-- app:layout_constraintBottom_toBottomOf="parent"-->
|
||||||
|
<!-- app:layout_constraintEnd_toEndOf="parent" />-->
|
||||||
|
|
||||||
|
|
||||||
|
<!-- </androidx.constraintlayout.widget.ConstraintLayout>-->
|
||||||
|
|
||||||
|
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user