Compare commits
5 Commits
developerr
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
36eeb017a6 | ||
|
|
c7298ea125 | ||
|
|
b1d9bcd7fc | ||
|
|
39cd4f8401 | ||
|
|
0da7b600a7 |
@@ -1,42 +1,71 @@
|
|||||||
before_script:
|
# 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
|
||||||
- export ANDROID_HOME="$HOME/Library/Android/sdk"
|
# If you are interested in using Android with FastLane for publishing take a look at the Android-Fastlane template.
|
||||||
- bundle install
|
|
||||||
|
|
||||||
|
image: openjdk:8-jdk
|
||||||
|
|
||||||
|
variables:
|
||||||
|
|
||||||
|
# ANDROID_COMPILE_SDK is the version of Android you're compiling with.
|
||||||
|
# It should match compileSdkVersion.
|
||||||
|
ANDROID_COMPILE_SDK: "29"
|
||||||
|
|
||||||
|
# ANDROID_BUILD_TOOLS is the version of the Android build tools you are using.
|
||||||
|
# It should match buildToolsVersion.
|
||||||
|
ANDROID_BUILD_TOOLS: "29.0.3"
|
||||||
|
|
||||||
|
# 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: "6514223"
|
||||||
|
|
||||||
|
# Packages installation before running script
|
||||||
stages:
|
stages:
|
||||||
- build
|
- build
|
||||||
- test
|
|
||||||
- quality_assurance
|
# Packages installation before running script
|
||||||
|
before_script:
|
||||||
|
- apt-get --quiet update --yes
|
||||||
|
- apt-get --quiet install --yes wget tar unzip lib32stdc++6 lib32z1
|
||||||
|
|
||||||
build_job:
|
# Setup path as android_home for moving/exporting the downloaded sdk into it
|
||||||
|
- export ANDROID_HOME="${PWD}/android-home"
|
||||||
|
# Create a new directory at specified location
|
||||||
|
- 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 --output-document=$ANDROID_HOME/cmdline-tools.zip https://dl.google.com/android/repository/commandlinetools-linux-${ANDROID_SDK_TOOLS}_latest.zip
|
||||||
|
# move to the archive at ANDROID_HOME
|
||||||
|
- pushd $ANDROID_HOME
|
||||||
|
- unzip -d cmdline-tools cmdline-tools.zip
|
||||||
|
- popd
|
||||||
|
- export PATH=$PATH:${ANDROID_HOME}/cmdline-tools/tools/bin/
|
||||||
|
|
||||||
|
# Nothing fancy here, just checking sdkManager version
|
||||||
|
- sdkmanager --version
|
||||||
|
|
||||||
|
# use yes to accept all licenses
|
||||||
|
- yes | sdkmanager --sdk_root=${ANDROID_HOME} --licenses || true
|
||||||
|
- sdkmanager --sdk_root=${ANDROID_HOME} "platforms;android-${ANDROID_COMPILE_SDK}"
|
||||||
|
- sdkmanager --sdk_root=${ANDROID_HOME} "platform-tools"
|
||||||
|
- sdkmanager --sdk_root=${ANDROID_HOME} "build-tools;${ANDROID_BUILD_TOOLS}"
|
||||||
|
|
||||||
|
# Not necessary, but just for surity
|
||||||
|
- chmod +x ./gradlew
|
||||||
|
|
||||||
|
# Basic android and gradle stuff
|
||||||
|
# Check linting
|
||||||
|
build_debug:
|
||||||
stage: build
|
stage: build
|
||||||
script:
|
script:
|
||||||
- ./gradlew clean assembleRelease
|
- ./gradlew assembleDebug
|
||||||
|
- ./gradlew assembleDebugAndroidTest
|
||||||
|
|
||||||
artifacts:
|
artifacts:
|
||||||
paths:
|
paths:
|
||||||
- app/build/outputs/
|
- app/build/outputs/
|
||||||
|
|
||||||
unit_tests:
|
|
||||||
stage: test
|
|
||||||
script:
|
|
||||||
- ./gradlew test
|
|
||||||
artifacts:
|
|
||||||
name: "reports_${CI_PROJECT_NAME}_${CI_BUILD_REF_NAME}"
|
|
||||||
when: on_failure
|
|
||||||
expire_in: 4 days
|
|
||||||
paths:
|
|
||||||
- app/build/reports/tests/
|
|
||||||
|
|
||||||
static_analysis:
|
|
||||||
stage: quality_assurance
|
|
||||||
script:
|
|
||||||
- ./gradlew lint
|
|
||||||
- ./gradlew checkstyle
|
|
||||||
- ./gradlew pmd
|
|
||||||
- ./gradlew findbugs
|
|
||||||
artifacts:
|
|
||||||
name: "reports_${CI_PROJECT_NAME}_${CI_BUILD_REF_NAME}"
|
|
||||||
when: on_failure
|
|
||||||
expire_in: 4 days
|
|
||||||
paths:
|
|
||||||
- app/build/reports/
|
|
||||||
|
|
||||||
|
|||||||
2
.idea/compiler.xml
generated
2
.idea/compiler.xml
generated
@@ -1,6 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<project version="4">
|
<project version="4">
|
||||||
<component name="CompilerConfiguration">
|
<component name="CompilerConfiguration">
|
||||||
<bytecodeTargetLevel target="11" />
|
<bytecodeTargetLevel target="1.8" />
|
||||||
</component>
|
</component>
|
||||||
</project>
|
</project>
|
||||||
2
.idea/gradle.xml
generated
2
.idea/gradle.xml
generated
@@ -4,7 +4,7 @@
|
|||||||
<component name="GradleSettings">
|
<component name="GradleSettings">
|
||||||
<option name="linkedExternalProjectsSettings">
|
<option name="linkedExternalProjectsSettings">
|
||||||
<GradleProjectSettings>
|
<GradleProjectSettings>
|
||||||
<option name="testRunner" value="PLATFORM" />
|
<option name="testRunner" value="GRADLE" />
|
||||||
<option name="distributionType" value="DEFAULT_WRAPPED" />
|
<option name="distributionType" value="DEFAULT_WRAPPED" />
|
||||||
<option name="externalProjectPath" value="$PROJECT_DIR$" />
|
<option name="externalProjectPath" value="$PROJECT_DIR$" />
|
||||||
<option name="gradleJvm" value="1.8" />
|
<option name="gradleJvm" value="1.8" />
|
||||||
|
|||||||
2
.idea/misc.xml
generated
2
.idea/misc.xml
generated
@@ -1,6 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<project version="4">
|
<project version="4">
|
||||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_11" default="false" project-jdk-name="1.8" project-jdk-type="JavaSDK">
|
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
|
||||||
<output url="file://$PROJECT_DIR$/build/classes" />
|
<output url="file://$PROJECT_DIR$/build/classes" />
|
||||||
</component>
|
</component>
|
||||||
<component name="ProjectType">
|
<component name="ProjectType">
|
||||||
|
|||||||
13
.idea/runConfigurations.xml
generated
13
.idea/runConfigurations.xml
generated
@@ -1,13 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project version="4">
|
|
||||||
<component name="RunConfigurationProducerService">
|
|
||||||
<option name="ignoredProducers">
|
|
||||||
<set>
|
|
||||||
<option value="com.android.tools.idea.compose.preview.runconfiguration.ComposePreviewRunConfigurationProducer" />
|
|
||||||
<option value="org.jetbrains.plugins.gradle.execution.test.runner.AllInPackageGradleConfigurationProducer" />
|
|
||||||
<option value="org.jetbrains.plugins.gradle.execution.test.runner.TestClassGradleConfigurationProducer" />
|
|
||||||
<option value="org.jetbrains.plugins.gradle.execution.test.runner.TestMethodGradleConfigurationProducer" />
|
|
||||||
</set>
|
|
||||||
</option>
|
|
||||||
</component>
|
|
||||||
</project>
|
|
||||||
@@ -10,6 +10,7 @@ android {
|
|||||||
targetSdkVersion 30
|
targetSdkVersion 30
|
||||||
versionCode 1
|
versionCode 1
|
||||||
versionName "1.0"
|
versionName "1.0"
|
||||||
|
multiDexEnabled true
|
||||||
|
|
||||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||||
}
|
}
|
||||||
@@ -24,6 +25,9 @@ android {
|
|||||||
sourceCompatibility JavaVersion.VERSION_1_8
|
sourceCompatibility JavaVersion.VERSION_1_8
|
||||||
targetCompatibility JavaVersion.VERSION_1_8
|
targetCompatibility JavaVersion.VERSION_1_8
|
||||||
}
|
}
|
||||||
|
configurations.all {
|
||||||
|
resolutionStrategy.force 'com.google.android.gms:play-services-base:17.1.0'
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
@@ -33,9 +37,13 @@ dependencies {
|
|||||||
implementation 'com.google.android.material:material:1.0.0'
|
implementation 'com.google.android.material:material:1.0.0'
|
||||||
implementation 'com.github.felHR85:UsbSerial:6.1.0'
|
implementation 'com.github.felHR85:UsbSerial:6.1.0'
|
||||||
implementation 'com.github.ybq:Android-SpinKit:1.4.0'
|
implementation 'com.github.ybq:Android-SpinKit:1.4.0'
|
||||||
|
implementation 'com.google.android.gms:play-services-base:17.1.0'
|
||||||
|
|
||||||
|
implementation 'org.apache.poi:poi:4.0.0'
|
||||||
|
implementation 'org.apache.poi:poi-ooxml:4.0.0'
|
||||||
testImplementation 'junit:junit:4.12'
|
testImplementation 'junit:junit:4.12'
|
||||||
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
|
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
|
||||||
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
|
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
|
||||||
|
implementation 'com.karumi:dexter:6.2.2'
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -1,30 +1,78 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<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"
|
||||||
package="shanmukha.in.sickle_cell">
|
package="shanmukha.in.sickle_cell">
|
||||||
|
|
||||||
<uses-feature android:name="android.hardware.usb.host" />
|
<uses-feature android:name="android.hardware.usb.host" />
|
||||||
|
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
|
||||||
|
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
|
||||||
|
<uses-permission android:name="android.permission.CAMERA" />
|
||||||
|
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
|
||||||
|
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
|
||||||
|
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
|
||||||
|
<uses-permission android:name="android.permission.INTERNET" />
|
||||||
|
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
|
||||||
|
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
|
||||||
|
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
|
||||||
|
<uses-permission android:name="android.permission.QUERY_ALL_PACKAGES" tools:ignore="QueryAllPackagesPermission" />
|
||||||
|
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
|
||||||
|
<uses-permission android:name="android.permission.QUERY_ALL_PACKAGES" tools:ignore="QueryAllPackagesPermission" />
|
||||||
|
<uses-permission android:name="android.permission.MANAGE_EXTERNAL_STORAGE" />
|
||||||
|
<uses-permission android:name="android.permission.MANAGE_EXTERNAL_STORAGE"
|
||||||
|
tools:ignore="ScopedStorage" />
|
||||||
|
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
|
||||||
|
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
|
||||||
|
<uses-permission android:name="android.permission.INTERNET" />
|
||||||
|
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
|
||||||
|
<uses-permission android:name="android.permission.READ_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.ACCESS_MEDIA_LOCATION"/>
|
||||||
|
<uses-permission
|
||||||
|
android:name="android.permission.MANAGE_EXTERNAL_STORAGE"
|
||||||
|
tools:ignore="ScopedStorage" />
|
||||||
|
|
||||||
<application
|
<application
|
||||||
android:allowBackup="true"
|
android:requestLegacyExternalStorage="true"
|
||||||
|
android:preserveLegacyExternalStorage="true"
|
||||||
|
|
||||||
|
android:allowBackup="true"
|
||||||
android:icon="@drawable/shanmukha_logo_small"
|
android:icon="@drawable/shanmukha_logo_small"
|
||||||
android:label="@string/app_name"
|
android:label="@string/app_name"
|
||||||
android:roundIcon="@drawable/shanmukha_logo_small"
|
android:roundIcon="@drawable/shanmukha_logo_small"
|
||||||
android:supportsRtl="true"
|
android:supportsRtl="true"
|
||||||
android:theme="@style/AppTheme">
|
android:theme="@style/AppTheme">
|
||||||
<activity android:name="shanmukha.in.sickle_cell.UI.SplashScreen" android:screenOrientation="portrait"><intent-filter>
|
<activity
|
||||||
<action android:name="android.intent.action.MAIN" />
|
android:name=".UI.SplashScreen"
|
||||||
|
android:screenOrientation="portrait">
|
||||||
|
|
||||||
<category android:name="android.intent.category.LAUNCHER" />
|
|
||||||
</intent-filter>
|
|
||||||
</activity>
|
</activity>
|
||||||
<activity android:name="shanmukha.in.sickle_cell.UI.SerialData" android:screenOrientation="portrait"> <intent-filter>
|
<activity
|
||||||
<action android:name="android.hardware.usb.action.USB_DEVICE_ATTACHED" />
|
android:name=".UI.SerialData"
|
||||||
</intent-filter></activity>
|
android:screenOrientation="portrait">
|
||||||
|
<intent-filter>
|
||||||
|
<action android:name="android.intent.action.MAIN" />
|
||||||
|
|
||||||
|
<category android:name="android.intent.category.LAUNCHER" />
|
||||||
|
</intent-filter>
|
||||||
|
<intent-filter>
|
||||||
|
<action android:name="android.hardware.usb.action.USB_DEVICE_ATTACHED" />
|
||||||
|
</intent-filter>
|
||||||
|
</activity>
|
||||||
|
<provider
|
||||||
|
android:name="androidx.core.content.FileProvider"
|
||||||
|
android:authorities="${applicationId}.fileprovider"
|
||||||
|
android:exported="false"
|
||||||
|
android:grantUriPermissions="true">
|
||||||
|
<meta-data
|
||||||
|
android:name="android.support.FILE_PROVIDER_PATHS"
|
||||||
|
android:resource="@xml/file_path" />
|
||||||
|
</provider>
|
||||||
<service
|
<service
|
||||||
android:name="shanmukha.in.sickle_cell.Service.UsbService"
|
android:name=".Service.UsbService"
|
||||||
android:enabled="true">
|
android:enabled="true"></service>
|
||||||
</service>
|
|
||||||
</application>
|
</application>
|
||||||
|
|
||||||
</manifest>
|
</manifest>
|
||||||
@@ -1,28 +1,53 @@
|
|||||||
package shanmukha.in.sickle_cell.Service;
|
package shanmukha.in.sickle_cell.Service;
|
||||||
|
|
||||||
|
import android.Manifest;
|
||||||
import android.app.PendingIntent;
|
import android.app.PendingIntent;
|
||||||
|
import android.app.ProgressDialog;
|
||||||
import android.app.Service;
|
import android.app.Service;
|
||||||
import android.content.BroadcastReceiver;
|
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.pm.PackageManager;
|
||||||
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;
|
||||||
import android.os.Binder;
|
import android.os.Binder;
|
||||||
|
import android.os.Environment;
|
||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
import android.os.IBinder;
|
import android.os.IBinder;
|
||||||
import android.os.Looper;
|
import android.os.Looper;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
|
import androidx.core.content.ContextCompat;
|
||||||
|
|
||||||
import com.felhr.usbserial.CDCSerialDevice;
|
import com.felhr.usbserial.CDCSerialDevice;
|
||||||
import com.felhr.usbserial.UsbSerialDevice;
|
import com.felhr.usbserial.UsbSerialDevice;
|
||||||
import com.felhr.usbserial.UsbSerialInterface;
|
import com.felhr.usbserial.UsbSerialInterface;
|
||||||
|
|
||||||
|
import org.apache.poi.hssf.usermodel.HSSFCell;
|
||||||
|
import org.apache.poi.hssf.usermodel.HSSFRow;
|
||||||
|
import org.apache.poi.hssf.usermodel.HSSFSheet;
|
||||||
|
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
|
||||||
|
import org.apache.poi.poifs.filesystem.POIFSFileSystem;
|
||||||
|
import org.apache.poi.ss.usermodel.Cell;
|
||||||
|
import org.apache.poi.ss.usermodel.Row;
|
||||||
|
|
||||||
|
import java.io.BufferedReader;
|
||||||
|
import java.io.BufferedWriter;
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.FileInputStream;
|
||||||
|
import java.io.FileReader;
|
||||||
|
import java.io.FileWriter;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.InputStream;
|
||||||
|
import java.io.PrintWriter;
|
||||||
import java.io.UnsupportedEncodingException;
|
import java.io.UnsupportedEncodingException;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
import java.util.Iterator;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import shanmukha.in.sickle_cell.Model.PojoParameters;
|
import shanmukha.in.sickle_cell.Model.PojoParameters;
|
||||||
@@ -32,7 +57,10 @@ import static shanmukha.in.sickle_cell.UI.SerialData.fobj;
|
|||||||
|
|
||||||
public class UsbService extends Service {
|
public class UsbService extends Service {
|
||||||
private Context appContext;
|
private Context appContext;
|
||||||
|
File filePath1 = null;
|
||||||
|
File filePath = null;
|
||||||
|
String directory_path;
|
||||||
|
private ProgressDialog loadingBar;
|
||||||
|
|
||||||
public static final String TAG = "UsbService";
|
public static final String TAG = "UsbService";
|
||||||
public static int tr = 0;
|
public static int tr = 0;
|
||||||
@@ -76,19 +104,21 @@ public class UsbService extends Service {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
data = new String(arg0, "UTF-8");
|
data = new String(arg0, "UTF-8");
|
||||||
|
Log.e("data received",data);
|
||||||
|
|
||||||
data.concat("/n");
|
data.concat("/n");
|
||||||
|
|
||||||
|
|
||||||
if (data.contains(",")) {
|
if (data.contains(",")) {
|
||||||
|
appendLog("Hi");
|
||||||
|
|
||||||
String[] namesList = data.split(",");
|
String[] namesList = data.split(",");
|
||||||
|
|
||||||
BigDecimal d5 = new BigDecimal(namesList[3]);
|
BigDecimal d5 = new BigDecimal(namesList[3]);
|
||||||
|
|
||||||
ddash_427 = (float) (Float.parseFloat(String.valueOf((d5))) - 427.00);
|
ddash_427 = (float) (Float.parseFloat(String.valueOf((d5))) - 427.00);
|
||||||
ddash_555 = (float) (Float.parseFloat(String.valueOf((d5))) - 555.00);
|
ddash_555 = (float) (Float.parseFloat(String.valueOf((d5))) - 539.00);
|
||||||
|
// ddash_539 = (float) (Float.parseFloat(String.valueOf((d5))) - 539.00);
|
||||||
|
|
||||||
|
|
||||||
BigDecimal d3 = new BigDecimal(namesList[2]);
|
BigDecimal d3 = new BigDecimal(namesList[2]);
|
||||||
@@ -351,16 +381,16 @@ public class UsbService extends Service {
|
|||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
while (true) {
|
while (true) {
|
||||||
byte[] buffer = new byte[100];
|
byte[] buffer = new byte[81024];
|
||||||
int n = serialPort.syncRead(buffer, 0);
|
int n = serialPort.syncRead(buffer, 0);
|
||||||
if (n > 0) {
|
if (n > 0) {
|
||||||
byte[] received = new byte[n];
|
byte[] received = new byte[n];
|
||||||
System.arraycopy(buffer, 0, received, 0, n);
|
System.arraycopy(buffer, 0, received, 0, n);
|
||||||
String receivedStr = new String(received);
|
String receivedStr = new String(received);
|
||||||
// Log.e("Recived Data", receivedStr);
|
|
||||||
String data = null;
|
String data = null;
|
||||||
|
|
||||||
data = new String(received);
|
data = new String(received);
|
||||||
|
Log.e("Recived Data",data);
|
||||||
|
|
||||||
|
|
||||||
data.concat("/n");
|
data.concat("/n");
|
||||||
if (fobj.getConnect_flag() == 1) {
|
if (fobj.getConnect_flag() == 1) {
|
||||||
@@ -442,6 +472,8 @@ public class UsbService extends Service {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (fobj.getRun_flag() == 1) {
|
if (fobj.getRun_flag() == 1) {
|
||||||
|
|
||||||
|
|
||||||
if (data.contains(String.valueOf(obj.getX_427()))) {
|
if (data.contains(String.valueOf(obj.getX_427()))) {
|
||||||
String ds2 = data.substring(data.lastIndexOf(":") + 1).trim();
|
String ds2 = data.substring(data.lastIndexOf(":") + 1).trim();
|
||||||
f_427 = ds2;
|
f_427 = ds2;
|
||||||
@@ -463,6 +495,12 @@ public class UsbService extends Service {
|
|||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
try {
|
||||||
|
buttonCreateFile1(data);
|
||||||
|
readfile1();
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -493,7 +531,14 @@ public class UsbService extends Service {
|
|||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
try {
|
||||||
|
buttonCreateFile(data);
|
||||||
|
|
||||||
|
readfile();
|
||||||
|
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -535,5 +580,161 @@ public class UsbService extends Service {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
public void appendLog(String text)
|
||||||
|
{
|
||||||
|
File logFile = new File("sdcard/log.file");
|
||||||
|
if (!logFile.exists())
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
logFile.createNewFile();
|
||||||
|
}
|
||||||
|
catch (IOException e)
|
||||||
|
{
|
||||||
|
// TODO Auto-generated catch block
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
try
|
||||||
|
{
|
||||||
|
//BufferedWriter for performance, true to set append to file flag
|
||||||
|
BufferedWriter buf = new BufferedWriter(new FileWriter(logFile, true));
|
||||||
|
buf.append(text);
|
||||||
|
buf.newLine();
|
||||||
|
buf.close();
|
||||||
|
}
|
||||||
|
catch (IOException e)
|
||||||
|
{
|
||||||
|
// TODO Auto-generated catch block
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public void buttonCreateFile1(String data) throws IOException {
|
||||||
|
String directory_path = Environment.getExternalStorageDirectory().getPath() + "/Test Report/";
|
||||||
|
File file = new File(directory_path);
|
||||||
|
if (!file.exists()) {
|
||||||
|
file.mkdirs();
|
||||||
|
}
|
||||||
|
File file1 = new File(directory_path, "Data_Run" +".txt");
|
||||||
|
if (!file1.exists()) {
|
||||||
|
|
||||||
|
file1.createNewFile();
|
||||||
|
|
||||||
|
}
|
||||||
|
PrintWriter writer = new PrintWriter(file1);
|
||||||
|
writer.print("");
|
||||||
|
// other operations
|
||||||
|
writer.close();
|
||||||
|
FileWriter writer1 = new FileWriter(file1, true);
|
||||||
|
writer1.append(data);
|
||||||
|
writer1.flush();
|
||||||
|
writer1.close();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
public void buttonCreateFile(String data) throws IOException {
|
||||||
|
String directory_path = Environment.getExternalStorageDirectory().getPath() + "/Test Report/";
|
||||||
|
File file = new File(directory_path);
|
||||||
|
if (!file.exists()) {
|
||||||
|
|
||||||
|
file.mkdirs();
|
||||||
|
}
|
||||||
|
File file1 = new File(directory_path, "Data_Baseline" +".txt");
|
||||||
|
if (!file1.exists()) {
|
||||||
|
|
||||||
|
file1.createNewFile();
|
||||||
|
|
||||||
|
}
|
||||||
|
PrintWriter writer = new PrintWriter(file1);
|
||||||
|
writer.print("");
|
||||||
|
// other operations
|
||||||
|
writer.close();
|
||||||
|
FileWriter writer1 = new FileWriter(file1, true);
|
||||||
|
writer1.append(data);
|
||||||
|
writer1.flush();
|
||||||
|
writer1.close();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void readfile()
|
||||||
|
{
|
||||||
|
String directory_path = Environment.getExternalStorageDirectory().getPath() + "/Test Report/";
|
||||||
|
File file = new File(directory_path, "Data_Baseline" +".txt");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//Get the text file
|
||||||
|
|
||||||
|
//Read text from file
|
||||||
|
StringBuilder text = new StringBuilder();
|
||||||
|
|
||||||
|
try {
|
||||||
|
BufferedReader br = new BufferedReader(new FileReader(file));
|
||||||
|
String line;
|
||||||
|
|
||||||
|
while ((line = br.readLine()) != null) {
|
||||||
|
Thread.sleep(3);
|
||||||
|
// Log.e("text", line);
|
||||||
|
/* text.append(line);
|
||||||
|
text.append('\n');*/
|
||||||
|
}
|
||||||
|
br.close();
|
||||||
|
}
|
||||||
|
catch (IOException | InterruptedException e) {
|
||||||
|
//You'll need to add proper error 1handling here
|
||||||
|
}
|
||||||
|
|
||||||
|
//Find the view by its id
|
||||||
|
|
||||||
|
}
|
||||||
|
public void readfile1()
|
||||||
|
{
|
||||||
|
String directory_path = Environment.getExternalStorageDirectory().getPath() + "/Test Report/";
|
||||||
|
File file = new File(directory_path, "Data_Run" +".txt");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//Get the text file
|
||||||
|
|
||||||
|
//Read text from file
|
||||||
|
StringBuilder text = new StringBuilder();
|
||||||
|
|
||||||
|
try {
|
||||||
|
BufferedReader br = new BufferedReader(new FileReader(file));
|
||||||
|
String line;
|
||||||
|
|
||||||
|
while ((line = br.readLine()) != null) {
|
||||||
|
Thread.sleep(1);
|
||||||
|
// Log.e("text", line);
|
||||||
|
/* text.append(line);
|
||||||
|
text.append('\n');*/
|
||||||
|
}
|
||||||
|
br.close();
|
||||||
|
}
|
||||||
|
catch (IOException | InterruptedException e) {
|
||||||
|
//You'll need to add proper error 1handling here
|
||||||
|
}
|
||||||
|
|
||||||
|
//Find the view by its id
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
package shanmukha.in.sickle_cell.UI;
|
package shanmukha.in.sickle_cell.UI;
|
||||||
|
|
||||||
|
import android.Manifest;
|
||||||
import android.app.AlertDialog;
|
import android.app.AlertDialog;
|
||||||
import android.app.PendingIntent;
|
import android.app.PendingIntent;
|
||||||
import android.content.BroadcastReceiver;
|
import android.content.BroadcastReceiver;
|
||||||
@@ -10,20 +11,36 @@ import android.content.Intent;
|
|||||||
import android.content.IntentFilter;
|
import android.content.IntentFilter;
|
||||||
import android.content.ServiceConnection;
|
import android.content.ServiceConnection;
|
||||||
import android.hardware.usb.UsbDevice;
|
import android.hardware.usb.UsbDevice;
|
||||||
|
import android.net.Uri;
|
||||||
|
import android.os.Build;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
import android.os.Environment;
|
||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
import android.os.IBinder;
|
import android.os.IBinder;
|
||||||
import android.os.Message;
|
import android.os.Message;
|
||||||
|
import android.provider.Settings;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.widget.Button;
|
import android.widget.Button;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
|
import androidx.annotation.RequiresApi;
|
||||||
import androidx.appcompat.app.AppCompatActivity;
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
|
import androidx.core.app.ActivityCompat;
|
||||||
|
|
||||||
|
import com.karumi.dexter.Dexter;
|
||||||
|
import com.karumi.dexter.MultiplePermissionsReport;
|
||||||
|
import com.karumi.dexter.PermissionToken;
|
||||||
|
import com.karumi.dexter.listener.PermissionDeniedResponse;
|
||||||
|
import com.karumi.dexter.listener.PermissionGrantedResponse;
|
||||||
|
import com.karumi.dexter.listener.PermissionRequest;
|
||||||
|
import com.karumi.dexter.listener.multi.MultiplePermissionsListener;
|
||||||
|
import com.karumi.dexter.listener.single.PermissionListener;
|
||||||
|
|
||||||
import java.lang.ref.WeakReference;
|
import java.lang.ref.WeakReference;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
@@ -96,6 +113,7 @@ public class SerialData extends AppCompatActivity {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
@@ -104,6 +122,71 @@ public class SerialData extends AppCompatActivity {
|
|||||||
mHandler = new MyHandler(this);
|
mHandler = new MyHandler(this);
|
||||||
textViewTitle = findViewById(R.id.textViewTitle1);
|
textViewTitle = findViewById(R.id.textViewTitle1);
|
||||||
|
|
||||||
|
|
||||||
|
Dexter.withContext(this)
|
||||||
|
.withPermissions(
|
||||||
|
Manifest.permission.MANAGE_EXTERNAL_STORAGE,
|
||||||
|
Manifest.permission.READ_EXTERNAL_STORAGE
|
||||||
|
).withListener(new MultiplePermissionsListener() {
|
||||||
|
@RequiresApi(api = Build.VERSION_CODES.R)
|
||||||
|
@Override public void onPermissionsChecked(MultiplePermissionsReport report) {
|
||||||
|
|
||||||
|
|
||||||
|
if (Build.VERSION.SDK_INT == Build.VERSION_CODES.Q) {
|
||||||
|
Dexter.withContext(getApplicationContext())
|
||||||
|
.withPermission(Manifest.permission.READ_EXTERNAL_STORAGE)
|
||||||
|
.withListener(new PermissionListener() {
|
||||||
|
@Override
|
||||||
|
public void onPermissionGranted(PermissionGrantedResponse permissionGrantedResponse) {
|
||||||
|
Toast.makeText(SerialData.this, "allowed", Toast.LENGTH_SHORT).show();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onPermissionDenied(PermissionDeniedResponse permissionDeniedResponse) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onPermissionRationaleShouldBeShown(PermissionRequest permissionRequest, PermissionToken permissionToken) {
|
||||||
|
permissionToken.continuePermissionRequest();
|
||||||
|
}
|
||||||
|
}).check();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
ActivityCompat.requestPermissions(SerialData.this,
|
||||||
|
new String[]{Manifest.permission.READ_EXTERNAL_STORAGE}, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
else if (!Environment.isExternalStorageManager()) {
|
||||||
|
Intent intent = new Intent();
|
||||||
|
intent.setAction(Settings.ACTION_MANAGE_APP_ALL_FILES_ACCESS_PERMISSION);
|
||||||
|
Uri uri = Uri.fromParts("package", "shanmukha.in.sickle_cell", null);
|
||||||
|
intent.setData(uri);
|
||||||
|
startActivity(intent);
|
||||||
|
Toast.makeText(SerialData.this, "allowed", Toast.LENGTH_SHORT).show();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@Override public void onPermissionRationaleShouldBeShown(List<PermissionRequest> permissions, PermissionToken token) { token.continuePermissionRequest();
|
||||||
|
}
|
||||||
|
}).check();
|
||||||
|
|
||||||
|
ActivityCompat.requestPermissions(this,
|
||||||
|
new String[]{
|
||||||
|
Manifest.permission.MANAGE_EXTERNAL_STORAGE}, 1);
|
||||||
|
|
||||||
|
ActivityCompat.requestPermissions(this,
|
||||||
|
new String[]{Manifest.permission.READ_EXTERNAL_STORAGE}, 0);
|
||||||
Button sendButton = (Button) findViewById(R.id.buttonSend);
|
Button sendButton = (Button) findViewById(R.id.buttonSend);
|
||||||
Button baseli = (Button) findViewById(R.id.baseline_c);
|
Button baseli = (Button) findViewById(R.id.baseline_c);
|
||||||
Button runi = (Button) findViewById(R.id.run_c);
|
Button runi = (Button) findViewById(R.id.run_c);
|
||||||
@@ -139,22 +222,43 @@ public class SerialData extends AppCompatActivity {
|
|||||||
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
String string22 = "led2 50\r";
|
String string23 = "led1 50\r";
|
||||||
|
usbService.write(string23.getBytes());
|
||||||
usbService.write(string22.getBytes());
|
|
||||||
Thread.sleep(2000);
|
Thread.sleep(2000);
|
||||||
|
|
||||||
String string1 = "autoset\r";
|
String string1 = "autoset\r";
|
||||||
usbService.write(string1.getBytes());
|
usbService.write(string1.getBytes());
|
||||||
Thread.sleep(2000);
|
Thread.sleep(2000);
|
||||||
|
|
||||||
Thread.sleep(Long.parseLong("1000"));
|
Thread.sleep(Long.parseLong("1000"));
|
||||||
String string4 = "run\r";
|
String string4 = "run\r";
|
||||||
|
Thread.sleep(2000);
|
||||||
|
|
||||||
|
usbService.write(string4.getBytes());
|
||||||
|
Thread.sleep(2000);
|
||||||
|
|
||||||
|
|
||||||
Thread.sleep(2000);
|
Thread.sleep(2000);
|
||||||
|
|
||||||
usbService.write(string4.getBytes());
|
|
||||||
|
|
||||||
|
String string22 = "led2 0\r";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
usbService.write(string22.getBytes());
|
||||||
|
Thread.sleep(2000);
|
||||||
|
|
||||||
|
String string2 = "autoset\r";
|
||||||
|
usbService.write(string2.getBytes());
|
||||||
|
Thread.sleep(2000);
|
||||||
|
|
||||||
|
Thread.sleep(Long.parseLong("1000"));
|
||||||
|
String string6 = "run\r";
|
||||||
|
|
||||||
|
|
||||||
|
Thread.sleep(2000);
|
||||||
|
|
||||||
|
usbService.write(string6.getBytes());
|
||||||
Thread.sleep(2000);
|
Thread.sleep(2000);
|
||||||
|
|
||||||
int number427 = Integer.valueOf(obj.getX_427());
|
int number427 = Integer.valueOf(obj.getX_427());
|
||||||
@@ -322,15 +426,19 @@ public class SerialData extends AppCompatActivity {
|
|||||||
|
|
||||||
Log.e("O 427 pixel ", obj.getO_427());
|
Log.e("O 427 pixel ", obj.getO_427());
|
||||||
|
|
||||||
|
ab_427 = Math.log10(Double.parseDouble(obj.getI_427())/Double.parseDouble(obj.getF_427()));
|
||||||
|
ab_555= Math.log10(Double.parseDouble(obj.getI_555())/Double.parseDouble(obj.getF_555()));
|
||||||
|
|
||||||
ab_427 = Math.log10(Double.parseDouble(obj.getO_427()) / (Double.parseDouble(obj.getI_427()) - Double.parseDouble(obj.getF_427())));
|
Log.e("ab 427", String.valueOf(ab_427));
|
||||||
|
|
||||||
|
/* ab_427 = Math.log10(Double.parseDouble(obj.getO_427()) / (Double.parseDouble(obj.getI_427()) - Double.parseDouble(obj.getF_427())));
|
||||||
Log.e("without log value 427", String.valueOf(Double.parseDouble(obj.getO_427()) / (Double.parseDouble(obj.getI_427()) - Double.parseDouble(obj.getF_427()))));
|
Log.e("without log value 427", String.valueOf(Double.parseDouble(obj.getO_427()) / (Double.parseDouble(obj.getI_427()) - Double.parseDouble(obj.getF_427()))));
|
||||||
Log.e("ab 427", String.valueOf(ab_427));
|
Log.e("ab 427", String.valueOf(ab_427));
|
||||||
|
|
||||||
|
|
||||||
ab_555 = Math.log10(Double.parseDouble(obj.getO_555()) / (Double.parseDouble(obj.getI_555()) - Double.parseDouble(obj.getF_555())));
|
ab_555 = Math.log10(Double.parseDouble(obj.getO_555()) / (Double.parseDouble(obj.getI_555()) - Double.parseDouble(obj.getF_555())));
|
||||||
Log.e("without log value 555", String.valueOf(Double.parseDouble(obj.getO_555()) / (Double.parseDouble(obj.getI_555()) - Double.parseDouble(obj.getF_555()))));
|
Log.e("without log value 555", String.valueOf(Double.parseDouble(obj.getO_555()) / (Double.parseDouble(obj.getI_555()) - Double.parseDouble(obj.getF_555()))));
|
||||||
|
*/
|
||||||
Log.e("ab 555 ", String.valueOf(ab_555));
|
Log.e("ab 555 ", String.valueOf(ab_555));
|
||||||
|
|
||||||
ratio = ab_555 / ab_427;
|
ratio = ab_555 / ab_427;
|
||||||
@@ -418,6 +526,14 @@ public class SerialData extends AppCompatActivity {
|
|||||||
usbService.write(string45.getBytes());
|
usbService.write(string45.getBytes());
|
||||||
Thread.sleep(4000);
|
Thread.sleep(4000);
|
||||||
|
|
||||||
|
String string23 = "print 1 3694\r";
|
||||||
|
Thread.sleep(3000);
|
||||||
|
|
||||||
|
usbService.write(string23.getBytes());
|
||||||
|
Thread.sleep(5000);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Toast.makeText(SerialData.this, "Perform Run Step Again ", Toast.LENGTH_SHORT).show();
|
Toast.makeText(SerialData.this, "Perform Run Step Again ", Toast.LENGTH_SHORT).show();
|
||||||
@@ -476,21 +592,32 @@ public class SerialData extends AppCompatActivity {
|
|||||||
if (flag == 0) {
|
if (flag == 0) {
|
||||||
|
|
||||||
|
|
||||||
String string22 = "led2 50\r";
|
|
||||||
|
|
||||||
usbService.write(string22.getBytes());
|
|
||||||
String string1 = "autoset\r";
|
|
||||||
usbService.write(string1.getBytes());
|
|
||||||
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
String string22 = "led2 25\r";
|
||||||
|
|
||||||
|
usbService.write(string22.getBytes());
|
||||||
|
|
||||||
Thread.sleep(Long.parseLong("1000"));
|
Thread.sleep(Long.parseLong("1000"));
|
||||||
String string4 = "run\r";
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
String string7 = "autoset\r";
|
||||||
|
usbService.write(string7.getBytes());
|
||||||
|
Thread.sleep(Long.parseLong("1000"));
|
||||||
|
String string8 = "run\r";
|
||||||
|
|
||||||
|
|
||||||
Thread.sleep(2000);
|
Thread.sleep(2000);
|
||||||
|
|
||||||
usbService.write(string4.getBytes());
|
usbService.write(string8.getBytes());
|
||||||
Thread.sleep(2000);
|
Thread.sleep(2000);
|
||||||
|
|
||||||
int number427 = Integer.valueOf(obj.getX_427());
|
int number427 = Integer.valueOf(obj.getX_427());
|
||||||
@@ -512,6 +639,21 @@ public class SerialData extends AppCompatActivity {
|
|||||||
Thread.sleep(4000);
|
Thread.sleep(4000);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
String string23 = "print 1 3694\r";
|
||||||
|
Thread.sleep(3000);
|
||||||
|
|
||||||
|
usbService.write(string23.getBytes());
|
||||||
|
Thread.sleep(5000);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (obj.getI_427() == null && "".equals(obj.getI_427())) {
|
if (obj.getI_427() == null && "".equals(obj.getI_427())) {
|
||||||
Toast.makeText(SerialData.this, "Perform Baseline Step Again ", Toast.LENGTH_SHORT).show();
|
Toast.makeText(SerialData.this, "Perform Baseline Step Again ", Toast.LENGTH_SHORT).show();
|
||||||
|
|
||||||
@@ -552,6 +694,7 @@ public class SerialData extends AppCompatActivity {
|
|||||||
alert.show();
|
alert.show();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
fobj.setBaseline_flag(1);
|
fobj.setBaseline_flag(1);
|
||||||
fobj.setRun_flag(0);
|
fobj.setRun_flag(0);
|
||||||
@@ -597,6 +740,13 @@ public class SerialData extends AppCompatActivity {
|
|||||||
|
|
||||||
|
|
||||||
Thread.sleep(4000);
|
Thread.sleep(4000);
|
||||||
|
String string23 = "print 1 3694\r";
|
||||||
|
Thread.sleep(3000);
|
||||||
|
|
||||||
|
usbService.write(string23.getBytes());
|
||||||
|
Thread.sleep(5000);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (obj.getI_427() == null && "".equals(obj.getI_427())) {
|
if (obj.getI_427() == null && "".equals(obj.getI_427())) {
|
||||||
@@ -626,6 +776,7 @@ public class SerialData extends AppCompatActivity {
|
|||||||
|
|
||||||
sta.setBase_para_flag(1);
|
sta.setBase_para_flag(1);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -665,9 +816,12 @@ public class SerialData extends AppCompatActivity {
|
|||||||
new Handler().postDelayed(new Runnable() {
|
new Handler().postDelayed(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
String string22 = "read\r";
|
/* String string22 = "read\r";
|
||||||
|
|
||||||
usbService.write(string22.getBytes());
|
usbService.write(string22.getBytes());
|
||||||
|
*/
|
||||||
|
String string22 = "read\r";
|
||||||
|
usbService.write(string22.getBytes());
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -713,7 +867,8 @@ public class SerialData extends AppCompatActivity {
|
|||||||
if (flag == 0) {
|
if (flag == 0) {
|
||||||
|
|
||||||
|
|
||||||
new Handler().postDelayed(new Runnable() {
|
|
||||||
|
new Handler().postDelayed(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
String string22 = "read\r";
|
String string22 = "read\r";
|
||||||
@@ -721,6 +876,7 @@ public class SerialData extends AppCompatActivity {
|
|||||||
usbService.write(string22.getBytes());
|
usbService.write(string22.getBytes());
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}, 5000);
|
}, 5000);
|
||||||
|
|
||||||
|
|||||||
3
app/src/main/res/xml/file_path.xml
Normal file
3
app/src/main/res/xml/file_path.xml
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
<paths xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<external-path name="external_files" path="."/>
|
||||||
|
</paths>
|
||||||
Reference in New Issue
Block a user