Added Text files for baseline and run
This commit is contained in:
@@ -10,6 +10,7 @@ android {
|
||||
targetSdkVersion 30
|
||||
versionCode 1
|
||||
versionName "1.0"
|
||||
multiDexEnabled true
|
||||
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
}
|
||||
@@ -24,6 +25,9 @@ android {
|
||||
sourceCompatibility JavaVersion.VERSION_1_8
|
||||
targetCompatibility JavaVersion.VERSION_1_8
|
||||
}
|
||||
configurations.all {
|
||||
resolutionStrategy.force 'com.google.android.gms:play-services-base:17.1.0'
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
@@ -33,9 +37,13 @@ dependencies {
|
||||
implementation 'com.google.android.material:material:1.0.0'
|
||||
implementation 'com.github.felHR85:UsbSerial:6.1.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'
|
||||
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
|
||||
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"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
package="shanmukha.in.sickle_cell">
|
||||
|
||||
<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
|
||||
android:requestLegacyExternalStorage="true"
|
||||
android:preserveLegacyExternalStorage="true"
|
||||
|
||||
android:allowBackup="true"
|
||||
android:icon="@drawable/shanmukha_logo_small"
|
||||
android:label="@string/app_name"
|
||||
android:roundIcon="@drawable/shanmukha_logo_small"
|
||||
android:supportsRtl="true"
|
||||
android:theme="@style/AppTheme">
|
||||
<activity android:name="shanmukha.in.sickle_cell.UI.SplashScreen" android:screenOrientation="portrait"><intent-filter>
|
||||
<activity
|
||||
android:name=".UI.SplashScreen"
|
||||
android:screenOrientation="portrait">
|
||||
|
||||
</activity>
|
||||
<activity
|
||||
android:name=".UI.SerialData"
|
||||
android:screenOrientation="portrait">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
<activity android:name="shanmukha.in.sickle_cell.UI.SerialData" android:screenOrientation="portrait"> <intent-filter>
|
||||
<intent-filter>
|
||||
<action android:name="android.hardware.usb.action.USB_DEVICE_ATTACHED" />
|
||||
</intent-filter></activity>
|
||||
|
||||
</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
|
||||
android:name="shanmukha.in.sickle_cell.Service.UsbService"
|
||||
android:enabled="true">
|
||||
</service>
|
||||
android:name=".Service.UsbService"
|
||||
android:enabled="true"></service>
|
||||
</application>
|
||||
|
||||
</manifest>
|
||||
@@ -1,28 +1,53 @@
|
||||
package shanmukha.in.sickle_cell.Service;
|
||||
|
||||
import android.Manifest;
|
||||
import android.app.PendingIntent;
|
||||
import android.app.ProgressDialog;
|
||||
import android.app.Service;
|
||||
import android.content.BroadcastReceiver;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.IntentFilter;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.hardware.usb.UsbDevice;
|
||||
import android.hardware.usb.UsbDeviceConnection;
|
||||
import android.hardware.usb.UsbManager;
|
||||
import android.os.Binder;
|
||||
import android.os.Environment;
|
||||
import android.os.Handler;
|
||||
import android.os.IBinder;
|
||||
import android.os.Looper;
|
||||
import android.util.Log;
|
||||
import android.widget.Toast;
|
||||
|
||||
import androidx.core.content.ContextCompat;
|
||||
|
||||
import com.felhr.usbserial.CDCSerialDevice;
|
||||
import com.felhr.usbserial.UsbSerialDevice;
|
||||
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.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
|
||||
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 {
|
||||
private Context appContext;
|
||||
|
||||
File filePath1 = null;
|
||||
File filePath = null;
|
||||
String directory_path;
|
||||
private ProgressDialog loadingBar;
|
||||
|
||||
public static final String TAG = "UsbService";
|
||||
public static int tr = 0;
|
||||
@@ -76,19 +104,21 @@ public class UsbService extends Service {
|
||||
|
||||
try {
|
||||
data = new String(arg0, "UTF-8");
|
||||
Log.e("data received",data);
|
||||
|
||||
data.concat("/n");
|
||||
|
||||
|
||||
if (data.contains(",")) {
|
||||
|
||||
appendLog("Hi");
|
||||
|
||||
String[] namesList = data.split(",");
|
||||
|
||||
BigDecimal d5 = new BigDecimal(namesList[3]);
|
||||
|
||||
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]);
|
||||
@@ -351,16 +381,16 @@ public class UsbService extends Service {
|
||||
@Override
|
||||
public void run() {
|
||||
while (true) {
|
||||
byte[] buffer = new byte[100];
|
||||
byte[] buffer = new byte[81024];
|
||||
int n = serialPort.syncRead(buffer, 0);
|
||||
if (n > 0) {
|
||||
byte[] received = new byte[n];
|
||||
System.arraycopy(buffer, 0, received, 0, n);
|
||||
String receivedStr = new String(received);
|
||||
// Log.e("Recived Data", receivedStr);
|
||||
String data = null;
|
||||
|
||||
data = new String(received);
|
||||
Log.e("Recived Data",data);
|
||||
|
||||
|
||||
data.concat("/n");
|
||||
if (fobj.getConnect_flag() == 1) {
|
||||
@@ -442,6 +472,8 @@ public class UsbService extends Service {
|
||||
}
|
||||
|
||||
if (fobj.getRun_flag() == 1) {
|
||||
|
||||
|
||||
if (data.contains(String.valueOf(obj.getX_427()))) {
|
||||
String ds2 = data.substring(data.lastIndexOf(":") + 1).trim();
|
||||
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;
|
||||
|
||||
import android.Manifest;
|
||||
import android.app.AlertDialog;
|
||||
import android.app.PendingIntent;
|
||||
import android.content.BroadcastReceiver;
|
||||
@@ -10,20 +11,36 @@ import android.content.Intent;
|
||||
import android.content.IntentFilter;
|
||||
import android.content.ServiceConnection;
|
||||
import android.hardware.usb.UsbDevice;
|
||||
import android.net.Uri;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.os.Environment;
|
||||
import android.os.Handler;
|
||||
import android.os.IBinder;
|
||||
import android.os.Message;
|
||||
import android.provider.Settings;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.widget.Button;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import androidx.annotation.RequiresApi;
|
||||
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.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
@@ -96,6 +113,7 @@ public class SerialData extends AppCompatActivity {
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
@@ -104,6 +122,71 @@ public class SerialData extends AppCompatActivity {
|
||||
mHandler = new MyHandler(this);
|
||||
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 baseli = (Button) findViewById(R.id.baseline_c);
|
||||
Button runi = (Button) findViewById(R.id.run_c);
|
||||
@@ -139,22 +222,43 @@ public class SerialData extends AppCompatActivity {
|
||||
|
||||
|
||||
try {
|
||||
String string22 = "led2 50\r";
|
||||
|
||||
usbService.write(string22.getBytes());
|
||||
String string23 = "led1 50\r";
|
||||
usbService.write(string23.getBytes());
|
||||
Thread.sleep(2000);
|
||||
|
||||
String string1 = "autoset\r";
|
||||
usbService.write(string1.getBytes());
|
||||
Thread.sleep(2000);
|
||||
|
||||
Thread.sleep(Long.parseLong("1000"));
|
||||
String string4 = "run\r";
|
||||
Thread.sleep(2000);
|
||||
|
||||
usbService.write(string4.getBytes());
|
||||
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);
|
||||
|
||||
int number427 = Integer.valueOf(obj.getX_427());
|
||||
@@ -322,15 +426,19 @@ public class SerialData extends AppCompatActivity {
|
||||
|
||||
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("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())));
|
||||
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));
|
||||
|
||||
ratio = ab_555 / ab_427;
|
||||
@@ -418,6 +526,14 @@ public class SerialData extends AppCompatActivity {
|
||||
usbService.write(string45.getBytes());
|
||||
Thread.sleep(4000);
|
||||
|
||||
String string23 = "print 1 3694\r";
|
||||
Thread.sleep(3000);
|
||||
|
||||
usbService.write(string23.getBytes());
|
||||
Thread.sleep(5000);
|
||||
|
||||
|
||||
|
||||
|
||||
} catch (Exception e) {
|
||||
Toast.makeText(SerialData.this, "Perform Run Step Again ", Toast.LENGTH_SHORT).show();
|
||||
@@ -476,21 +592,32 @@ public class SerialData extends AppCompatActivity {
|
||||
if (flag == 0) {
|
||||
|
||||
|
||||
String string22 = "led2 50\r";
|
||||
|
||||
usbService.write(string22.getBytes());
|
||||
String string1 = "autoset\r";
|
||||
usbService.write(string1.getBytes());
|
||||
|
||||
|
||||
try {
|
||||
String string22 = "led2 25\r";
|
||||
|
||||
usbService.write(string22.getBytes());
|
||||
|
||||
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);
|
||||
|
||||
usbService.write(string4.getBytes());
|
||||
usbService.write(string8.getBytes());
|
||||
Thread.sleep(2000);
|
||||
|
||||
int number427 = Integer.valueOf(obj.getX_427());
|
||||
@@ -512,6 +639,21 @@ public class SerialData extends AppCompatActivity {
|
||||
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())) {
|
||||
Toast.makeText(SerialData.this, "Perform Baseline Step Again ", Toast.LENGTH_SHORT).show();
|
||||
|
||||
@@ -552,6 +694,7 @@ public class SerialData extends AppCompatActivity {
|
||||
alert.show();
|
||||
|
||||
|
||||
|
||||
} else {
|
||||
fobj.setBaseline_flag(1);
|
||||
fobj.setRun_flag(0);
|
||||
@@ -597,6 +740,13 @@ public class SerialData extends AppCompatActivity {
|
||||
|
||||
|
||||
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())) {
|
||||
@@ -626,6 +776,7 @@ public class SerialData extends AppCompatActivity {
|
||||
|
||||
sta.setBase_para_flag(1);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -665,9 +816,12 @@ public class SerialData extends AppCompatActivity {
|
||||
new Handler().postDelayed(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
String string22 = "read\r";
|
||||
|
||||
/* String string22 = "read\r";
|
||||
usbService.write(string22.getBytes());
|
||||
*/
|
||||
String string22 = "read\r";
|
||||
usbService.write(string22.getBytes());
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -713,6 +867,7 @@ public class SerialData extends AppCompatActivity {
|
||||
if (flag == 0) {
|
||||
|
||||
|
||||
|
||||
new Handler().postDelayed(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
@@ -721,6 +876,7 @@ public class SerialData extends AppCompatActivity {
|
||||
usbService.write(string22.getBytes());
|
||||
|
||||
|
||||
|
||||
}
|
||||
}, 5000);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user