Sickle Cell App With Usb Integration

This commit is contained in:
Ramandeep
2022-01-21 20:55:06 +05:30
commit a01211ec88
33 changed files with 1964 additions and 0 deletions

1
app/.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
/build

40
app/build.gradle Normal file
View File

@@ -0,0 +1,40 @@
apply plugin: 'com.android.application'
android {
compileSdkVersion 30
buildToolsVersion "30.0.0"
defaultConfig {
applicationId "shanmukha.in.sickle_cell"
minSdkVersion 16
targetSdkVersion 30
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
dependencies {
implementation fileTree(dir: "libs", include: ["*.jar"])
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'com.google.android.material:material:1.0.0'
implementation 'com.github.felHR85:UsbSerial:6.1.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
}

21
app/proguard-rules.pro vendored Normal file
View File

@@ -0,0 +1,21 @@
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}
# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable
# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile

View File

@@ -0,0 +1,26 @@
package shanmukha.in.sickle_cell;
import android.content.Context;
import androidx.test.platform.app.InstrumentationRegistry;
import androidx.test.ext.junit.runners.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.*;
/**
* Instrumented test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
assertEquals("com.xoco96.serialled", appContext.getPackageName());
}
}

View File

@@ -0,0 +1,30 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="shanmukha.in.sickle_cell">
<uses-feature android:name="android.hardware.usb.host" />
<application
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.SplashScreen" 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.Serial_Com" android:screenOrientation="portrait"> <intent-filter>
<action android:name="android.hardware.usb.action.USB_DEVICE_ATTACHED" />
</intent-filter></activity>
<service
android:name="shanmukha.in.sickle_cell.UsbService"
android:enabled="true">
</service>
</application>
</manifest>

View File

@@ -0,0 +1,572 @@
package shanmukha.in.sickle_cell;
import androidx.appcompat.app.AppCompatActivity;
import android.app.AlertDialog;
import android.app.PendingIntent;
import android.content.DialogInterface;
import android.hardware.usb.UsbDevice;
import android.os.Bundle;
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.os.Handler;
import android.os.IBinder;
import android.os.Message;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
import android.widget.Toast;
import java.lang.ref.WeakReference;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;
import static shanmukha.in.sickle_cell.UsbService.obj;
public class Serial_Com extends AppCompatActivity {
public static flag_pojo fobj = new flag_pojo();
int flag=0;
int dev=0;int bas=0;int ru=0;
/*
* Notifications from UsbService will be received here.
*/
private final BroadcastReceiver mUsbReceiver = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
switch (intent.getAction()) {
case UsbService.ACTION_USB_PERMISSION_GRANTED: // USB PERMISSION GRANTED
flag=0;
Toast.makeText(context, "USB Ready", Toast.LENGTH_SHORT).show();
break;
case UsbService.ACTION_USB_PERMISSION_NOT_GRANTED: // USB PERMISSION NOT GRANTED
Toast.makeText(context, "USB Permission not granted", Toast.LENGTH_SHORT).show();
flag=1;
break;
case UsbService.ACTION_NO_USB: // NO USB CONNECTED
Toast.makeText(context, "No USB connected", Toast.LENGTH_SHORT).show();
flag=1;
break;
case UsbService.ACTION_USB_DISCONNECTED: // USB DISCONNECTED
Toast.makeText(context, "USB disconnected", Toast.LENGTH_SHORT).show();
break;
case UsbService.ACTION_USB_NOT_SUPPORTED: // USB NOT SUPPORTED
Toast.makeText(context, "USB device not supported", Toast.LENGTH_SHORT).show();
break;
}
}
};
private UsbService usbService;
private MyHandler mHandler;
double ratio,ab_427,ab_555;
private static final String ACTION_USB_PERMISSION = "shanmukha.in.sickle_cell.USB_PERMISSION";
private TextView textViewTitle ;
String result;
private final ServiceConnection usbConnection = new ServiceConnection() {
@Override
public void onServiceConnected(ComponentName arg0, IBinder arg1) {
usbService = ((UsbService.UsbBinder) arg1).getService();
usbService.setHandler(mHandler);
}
@Override
public void onServiceDisconnected(ComponentName arg0) {
usbService = null;
}
};
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_serial);
mHandler = new MyHandler(this);
textViewTitle=findViewById(R.id.textViewTitle1);
Button sendButton = (Button) findViewById(R.id.buttonSend);
Button baseli=(Button) findViewById(R.id.baseline_c);
Button runi=(Button) findViewById(R.id.run_c);
Button next=(Button) findViewById(R.id.next_c);
next.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (dev == 1 && bas == 1 && ru == 1) {
if (flag != 1) {
Log.e("x 427 pixel ", obj.getX_427());
Log.e("x 555 pixel ", obj.getX_555());
Log.e("i 427 pixel ", obj.getI_427());
Log.e("i 555 pixel ", obj.getI_555());
Log.e("f 427 pixel ", obj.getF_427());
Log.e("f 555 pixel ", obj.getF_555());
ab_427 = Math.log(Double.parseDouble(obj.getF_427()) / Double.parseDouble(obj.getI_427()));
Log.e("ab 427 ", String.valueOf(ab_427));
ab_555 = Math.log(Double.parseDouble(obj.getF_555()) / Double.parseDouble(obj.getI_555()));
Log.e("ab 555 ", String.valueOf(ab_555));
ratio = ab_555 / ab_427;
Log.e("ratio ", String.valueOf(ratio));
if (ratio < 0.32) {
result = "Healthy";
Log.e("result ", String.valueOf(result));
textViewTitle.setText(result);
} else if (ratio > 0.32 && ratio < 0.475) {
result = "SCT";
Log.e("result ", String.valueOf(result));
textViewTitle.setText(result);
} else if (ratio > 0.475) {
result = "SCD";
textViewTitle.setText(result);
Log.e("result ", String.valueOf(result));
} else {
textViewTitle.setText("No Result Try Again");
}
} else {
Toast.makeText(Serial_Com.this, "USB Not Connect", Toast.LENGTH_SHORT).show();
}
/* Intent intent=new Intent (Serial_Com.this,run23.class);
startActivity(intent);*/
}
dev=0;ru=0;bas=0;
}
});
runi.setOnClickListener(new View.OnClickListener()
{
@Override
public void onClick (View v){
fobj.setRun_flag(1);
ru=1;
if (bas == 1 && dev == 1) {
if (usbService != null) {
try {
int number427 = Integer.valueOf(obj.getX_427());
Thread.sleep(1000);
int number555 = Integer.valueOf(obj.getX_555());
Log.e("Final x value 555", String.valueOf(number555));
Thread.sleep(1000);
String string44 = "print " + number427 + "\r";
usbService.write(string44.getBytes());
Thread.sleep(2000);
String string45 = "print " + number555 + "\r";
usbService.write(string45.getBytes());
Thread.sleep(2000);
} catch (InterruptedException e) {
e.printStackTrace();
}
} else {
Toast.makeText(Serial_Com.this, "USB Not Connect", Toast.LENGTH_SHORT).show();
}
/* try {
Thread.sleep(1000);
int number427=Integer.valueOf(obj.getX_427());
Thread.sleep(1000);
int number555=Integer.valueOf(obj.getX_555());
Log.e("Final x value 555", String.valueOf(number555));
Thread.sleep(1000);
String string44 = "print "+number427+"\r";
usbService.write(string44.getBytes());
Thread.sleep(1000);
String string45 = "print "+number555+"\r";
usbService.write(string45.getBytes());
Thread.sleep(1000);
} catch (InterruptedException e) {
e.printStackTrace();
}
*/
} else {
Toast.makeText(Serial_Com.this, "Set Device and Baseline PAramter before ", Toast.LENGTH_SHORT).show();
}
}
});
baseli.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
fobj.setBaseline_flag(1);
bas=1;
if(dev==1) {
if (flag == 0) {
Log.e("X value 427 usb service", obj.getX_427());
Log.e("X value 555 usb service", obj.getX_555());
String string22 = "led2 50\r";
usbService.write(string22.getBytes());
String string1 = "autoset\r";
usbService.write(string1.getBytes());
try {
Thread.sleep(Long.parseLong("1000"));
String string4 = "run\r";
Thread.sleep(2000);
usbService.write(string4.getBytes());
Thread.sleep(2000);
int number427 = Integer.valueOf(obj.getX_427());
Thread.sleep(1000);
int number555 = Integer.valueOf(obj.getX_555());
Thread.sleep(2000);
String string44 = "print " + number427 + "\r";
usbService.write(string44.getBytes());
Thread.sleep(2000);
String string45 = "print " + number555 + "\r";
usbService.write(string45.getBytes());
Thread.sleep(2000);
} catch (InterruptedException e) {
e.printStackTrace();
}
/* String string22 = "led2 50\r";
usbService.write(string22.getBytes());
String string1 = "autoset\r";
usbService.write(string1.getBytes());
try {
Thread.sleep(Long.parseLong("1000"));
String string4 = "run\r";
Thread.sleep(2000);
usbService.write(string4.getBytes());
Thread.sleep(2000);
int number1=45;
Thread.sleep(2000);
usbService.write(string4.getBytes());
Thread.sleep(2000);
String string44 = "print "+number1+"\r";
usbService.write(string44.getBytes());
Thread.sleep(2000);
String string = data + "\r";
usbService.write(string.getBytes());
} catch (InterruptedException e) {
e.printStackTrace();
}*/
// if UsbService was correctly binded, Send data
} else {
Toast.makeText(Serial_Com.this, "USB Not Connect", Toast.LENGTH_SHORT).show();
}
}
else
{
Toast.makeText(Serial_Com.this, "Get Device Parameters First ", Toast.LENGTH_SHORT).show();
}
}
});
sendButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
fobj.setConnect_flag(1);
dev=1;
textViewTitle.setText("");
if (flag==0) {
try {
String string22 = "read\r";
usbService.write(string22.getBytes());
Thread.sleep(10000);
} catch (InterruptedException e) {
e.printStackTrace();
}
/* String string22 = "led2 50\r";
usbService.write(string22.getBytes());
String string1 = "autoset\r";
usbService.write(string1.getBytes());
try {
Thread.sleep(Long.parseLong("1000"));
String string4 = "run\r";
Thread.sleep(2000);
usbService.write(string4.getBytes());
Thread.sleep(2000);
int number1=45;
Thread.sleep(2000);
usbService.write(string4.getBytes());
Thread.sleep(2000);
String string44 = "print "+number1+"\r";
usbService.write(string44.getBytes());
Thread.sleep(2000);
String string = data + "\r";
usbService.write(string.getBytes());
} catch (InterruptedException e) {
e.printStackTrace();
}*/
// if UsbService was correctly binded, Send data
}
else
{
Toast.makeText(Serial_Com.this, "USB Not Connect", Toast.LENGTH_SHORT).show();
}
}
});
}
@Override
public void onResume() {
super.onResume();
setFilters(); // Start listening notifications from UsbService
startService(UsbService.class, usbConnection, null); // Start UsbService(if it was not started before) and Bind it
}
@Override
public void onPause() {
super.onPause();
unregisterReceiver(mUsbReceiver);
unbindService(usbConnection);
}
private void startService(Class<?> service, ServiceConnection serviceConnection, Bundle extras) {
if (!UsbService.SERVICE_CONNECTED) {
Intent startService = new Intent(this, service);
if (extras != null && !extras.isEmpty()) {
Set<String> keys = extras.keySet();
for (String key : keys) {
String extra = extras.getString(key);
startService.putExtra(key, extra);
}
}
startService(startService);
}
Intent bindingIntent = new Intent(this, service);
bindService(bindingIntent, serviceConnection, Context.BIND_AUTO_CREATE);
}
private void setFilters() {
IntentFilter filter = new IntentFilter();
filter.addAction(UsbService.ACTION_USB_PERMISSION_GRANTED);
filter.addAction(UsbService.ACTION_NO_USB);
filter.addAction(UsbService.ACTION_USB_DISCONNECTED);
filter.addAction(UsbService.ACTION_USB_NOT_SUPPORTED);
filter.addAction(UsbService.ACTION_USB_PERMISSION_NOT_GRANTED);
registerReceiver(mUsbReceiver, filter);
}
/*
* This handler will be passed to UsbService. Data received from serial port is displayed through this handler
*/
private static class MyHandler extends Handler {
private final WeakReference<Serial_Com> mActivity;
public MyHandler(Serial_Com activity) {
mActivity = new WeakReference<>(activity);
}
@Override
public void handleMessage(Message msg) {
switch (msg.what) {
case UsbService.MESSAGE_FROM_SERIAL_PORT:
String data = (String) msg.obj;
break;
case UsbService.SYNC_READ:
String buffer = (String) msg.obj;
break;
}
}
}
public void onClickconectar(View view) {
UsbService sf=new UsbService();
HashMap<String, UsbDevice> usbDevices = sf.usbManager.getDeviceList();
if (!usbDevices.isEmpty()) {
boolean keep = true;
for (Map.Entry<String, UsbDevice> entry : usbDevices.entrySet()) {
flag=0;
sf.device = entry.getValue();
int deviceVID = sf.device.getVendorId();
if (deviceVID == 0x0403 || deviceVID == 0x0403)// Arduino Vendor ID
//if(deviceVID == 0x2341)// Arduino Vendor ID
{
PendingIntent pi = PendingIntent.getBroadcast(this, 0, new Intent(ACTION_USB_PERMISSION), 0);
sf.usbManager.requestPermission(sf.device, pi);
keep = false;
} else {
sf.connection = null;
sf.device = null;
}
if (!keep)
break;
flag=0;
}
}
}
@Override
public void onBackPressed() {
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setCancelable(false);
builder.setMessage("Do you want to Exit ?");
builder.setPositiveButton("Yes", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
finishAffinity();
finish();
}
});
builder.setNegativeButton("No", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
dialog.cancel();
}
});
AlertDialog alert = builder.create();
alert.show();
}
}

View File

@@ -0,0 +1,39 @@
package shanmukha.in.sickle_cell;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.os.Handler;
import androidx.appcompat.app.AppCompatActivity;
public class SplashScreen extends AppCompatActivity {
private static int SPLASH_TIME_OUT=3000;
String number;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_splash_screen);
SharedPreferences preferences6 = getSharedPreferences("PhoneBook_number", MODE_PRIVATE);
number = preferences6.getString("Phone", null);
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
Intent home = new Intent(SplashScreen.this, Serial_Com.class);
startActivity(home);
finish();
}
}, SPLASH_TIME_OUT);
}
}

View File

@@ -0,0 +1,499 @@
package shanmukha.in.sickle_cell;
import android.app.PendingIntent;
import android.app.Service;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.hardware.usb.UsbDevice;
import android.hardware.usb.UsbDeviceConnection;
import android.hardware.usb.UsbManager;
import android.os.Binder;
import android.os.Handler;
import android.os.IBinder;
import android.util.Log;
import com.felhr.usbserial.CDCSerialDevice;
import com.felhr.usbserial.UsbSerialDevice;
import com.felhr.usbserial.UsbSerialInterface;
import java.io.UnsupportedEncodingException;
import java.math.BigDecimal;
import java.util.HashMap;
import java.util.Map;
import static shanmukha.in.sickle_cell.Serial_Com.fobj;
public class UsbService extends Service {
public static final String TAG = "UsbService";
public static final String ACTION_USB_READY = "USB_READY";
public static final String ACTION_USB_ATTACHED = "USB_DEVICE_ATTACHED";
public static final String ACTION_USB_DETACHED = "USB_DEVICE_DETACHED";
public static final String ACTION_USB_NOT_SUPPORTED = "USB_NOT_SUPPORTED";
public static final String ACTION_NO_USB = "NO_USB";
public static final String ACTION_USB_PERMISSION_GRANTED = "USB_PERMISSION_GRANTED";
public static final String ACTION_USB_PERMISSION_NOT_GRANTED = "USB_PERMISSION_NOT_GRANTED";
public static final String ACTION_USB_DISCONNECTED = "USB_DISCONNECTED";
public static final String ACTION_CDC_DRIVER_NOT_WORKING = "ACTION_CDC_DRIVER_NOT_WORKING";
public static final String ACTION_USB_DEVICE_NOT_WORKING = "ACTION_USB_DEVICE_NOT_WORKING";
public static final int MESSAGE_FROM_SERIAL_PORT = 0;
public static final int CTS_CHANGE = 1;
public static final int DSR_CHANGE = 2;
public static final int SYNC_READ = 3;
private static final String ACTION_USB_PERMISSION = "shanmukha.in.sickle_cell.USB_PERMISSION";
public static boolean SERVICE_CONNECTED = false;
private IBinder binder = new UsbBinder();
private Context context;
private Handler mHandler;
public static UsbManager usbManager;
public static UsbDevice device;
public static UsbDeviceConnection connection;
private UsbSerialDevice serialPort;
float a, b, c, d, ddash_427, ddash_555;
int wl_427, wl_555;
String i_427, i_555,f_427,f_555;
public static pojo obj = new pojo();
private boolean serialPortConnected;
/*
* Data received from serial port will be received here. Just populate onReceivedData with your code
* In this particular example. byte stream is converted to String and send to UI thread to
* be treated there.
*/
private UsbSerialInterface.UsbReadCallback mCallback = new UsbSerialInterface.UsbReadCallback() {
@Override
public void onReceivedData(byte[] arg0) {
String data = null;
try {
data = new String(arg0, "UTF-8");
data.concat("/n");
if (data.contains(",")) {
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);
BigDecimal d3 = new BigDecimal(namesList[2]);
BigDecimal d1 = new BigDecimal(namesList[1]);
Double d8 = (Double) (-d3.doubleValue() + Math.sqrt(Math.pow(d3.doubleValue(), 2) - 4 * (d1).doubleValue() * ddash_427));
d8 = d8 / (2 * d1.doubleValue());
BigDecimal d11 = new BigDecimal(d8);
System.out.println(d11.toPlainString());
wl_427 = (int) Math.round(d8);
obj.setX_427(String.valueOf(wl_427));
Log.e("Value x 427 ", String.valueOf(wl_427));
Log.e("Value x 427 obj ", String.valueOf(obj.getX_427()));
Double d9 = (Double) (-d3.doubleValue() + Math.sqrt(Math.pow(d3.doubleValue(), 2) - 4 * (d1).doubleValue() * ddash_555));
d9 = d9 / (2 * d1.doubleValue());
BigDecimal d12 = new BigDecimal(d9);
System.out.println(d12.toPlainString());
wl_555 = (int) Math.round(d9);
Log.e("Value x 555 ", String.valueOf(wl_555));
obj.setX_555(String.valueOf(wl_555));
Log.e("Value x 555 obj ", String.valueOf(obj.getX_555()));
}
} catch (UnsupportedEncodingException e){
e.printStackTrace();
}
try {
String data1 = new String(arg0, "UTF-8");
if (mHandler != null)
mHandler.obtainMessage(MESSAGE_FROM_SERIAL_PORT, data1).sendToTarget();
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
}
};
private UsbSerialInterface.UsbCTSCallback ctsCallback = new UsbSerialInterface.UsbCTSCallback() {
@Override
public void onCTSChanged(boolean state) {
if(mHandler != null)
mHandler.obtainMessage(CTS_CHANGE).sendToTarget();
}
};
/*
* State changes in the DSR line will be received here
*/
private UsbSerialInterface.UsbDSRCallback dsrCallback = new UsbSerialInterface.UsbDSRCallback() {
@Override
public void onDSRChanged(boolean state) {
if(mHandler != null)
mHandler.obtainMessage(DSR_CHANGE).sendToTarget();
}
};
private final BroadcastReceiver usbReceiver = new BroadcastReceiver() {
@Override
public void onReceive(Context arg0, Intent arg1) {
if (arg1.getAction().equals(ACTION_USB_PERMISSION)) {
boolean granted = arg1.getExtras().getBoolean(UsbManager.EXTRA_PERMISSION_GRANTED);
if (granted) // User accepted our USB connection. Try to open the device as a serial port
{
Intent intent = new Intent(ACTION_USB_PERMISSION_GRANTED);
arg0.sendBroadcast(intent);
connection = usbManager.openDevice(device);
new ConnectionThread().start();
} else // User not accepted our USB connection. Send an Intent to the Main Activity
{
Intent intent = new Intent(ACTION_USB_PERMISSION_NOT_GRANTED);
arg0.sendBroadcast(intent);
}
} else if (arg1.getAction().equals(ACTION_USB_ATTACHED)) {
if (!serialPortConnected)
findSerialPortDevice(); // A USB device has been attached. Try to open it as a Serial port
} else if (arg1.getAction().equals(ACTION_USB_DETACHED)) {
// Usb device was disconnected. send an intent to the Main Activity
Intent intent = new Intent(ACTION_USB_DISCONNECTED);
arg0.sendBroadcast(intent);
if (serialPortConnected) {
serialPort.syncClose();
}
serialPortConnected = false;
}
}
};
/*
* onCreate will be executed when service is started. It configures an IntentFilter to listen for
* incoming Intents (USB ATTACHED, USB DETACHED...) and it tries to open a serial port.
*/
@Override
public void onCreate() {
this.context = this;
serialPortConnected = false;
UsbService.SERVICE_CONNECTED = true;
setFilter();
usbManager = (UsbManager) getSystemService(Context.USB_SERVICE);
findSerialPortDevice();
}
/* MUST READ about services
* http://developer.android.com/guide/components/services.html
* http://developer.android.com/guide/components/bound-services.html
*/
@Override
public IBinder onBind(Intent intent) {
return binder;
}
@Override
public int onStartCommand(Intent intent, int flags, int startId) {
return Service.START_NOT_STICKY;
}
@Override
public void onDestroy() {
super.onDestroy();
serialPort.close();
unregisterReceiver(usbReceiver);
UsbService.SERVICE_CONNECTED = false;
}
/*
* This function will be called from MainActivity to write data through Serial Port
*/
public void write(byte[] data) {
if (serialPort != null)
serialPort.syncWrite(data, 0);
}
/*
* This function will be called from MainActivity to change baud rate
*/
public void changeBaudRate(int baudRate){
if(serialPort != null)
serialPort.setBaudRate(baudRate);
}
public void setHandler(Handler mHandler) {
this.mHandler = mHandler;
}
private void findSerialPortDevice() {
// This snippet will try to open the first encountered usb device connected, excluding usb root hubs
HashMap<String, UsbDevice> usbDevices = usbManager.getDeviceList();
if (!usbDevices.isEmpty()) {
// first, dump the map for diagnostic purposes
for (Map.Entry<String, UsbDevice> entry : usbDevices.entrySet()) {
device = entry.getValue();
Log.d(TAG, String.format("USBDevice.HashMap (vid:pid) (%X:%X)-%b class:%X:%X name:%s",
device.getVendorId(), device.getProductId(),
UsbSerialDevice.isSupported(device),
device.getDeviceClass(), device.getDeviceSubclass(),
device.getDeviceName()));
}
for (Map.Entry<String, UsbDevice> entry : usbDevices.entrySet()) {
device = entry.getValue();
int deviceVID = device.getVendorId();
int devicePID = device.getProductId();
// if (deviceVID != 0x1d6b && (devicePID != 0x0001 && devicePID != 0x0002 && devicePID != 0x0003)) {
if (UsbSerialDevice.isSupported(device)) {
// There is a device connected to our Android device. Try to open it as a Serial Port.
requestUserPermission();
break;
} else {
connection = null;
device = null;
}
}
if (device==null) {
// There is no USB devices connected (but usb host were listed). Send an intent to MainActivity.
Intent intent = new Intent(ACTION_NO_USB);
sendBroadcast(intent);
}
} else {
Log.d(TAG, "findSerialPortDevice() usbManager returned empty device list." );
// There is no USB devices connected. Send an intent to MainActivity
Intent intent = new Intent(ACTION_NO_USB);
sendBroadcast(intent);
}
}
private void setFilter() {
IntentFilter filter = new IntentFilter();
filter.addAction(ACTION_USB_PERMISSION);
filter.addAction(ACTION_USB_DETACHED);
filter.addAction(ACTION_USB_ATTACHED);
registerReceiver(usbReceiver, filter);
}
/*
* Request user permission. The response will be received in the BroadcastReceiver
*/
private void requestUserPermission() {
Log.d(TAG, String.format("requestUserPermission(%X:%X)", device.getVendorId(), device.getProductId() ) );
PendingIntent mPendingIntent = PendingIntent.getBroadcast(this, 0, new Intent(ACTION_USB_PERMISSION), 0);
usbManager.requestPermission(device, mPendingIntent);
}
public class UsbBinder extends Binder {
public UsbService getService() {
return UsbService.this;
}
}
/*
* A simple thread to open a serial port.
* Although it should be a fast operation. moving usb operations away from UI thread is a good thing.
*/
private class ConnectionThread extends Thread {
@Override
public void run() {
serialPort = UsbSerialDevice.createUsbSerialDevice(device, connection);
if (serialPort != null) {
if (serialPort.syncOpen()) {
serialPortConnected = true;
serialPort.setBaudRate(115200);
serialPort.setDataBits(UsbSerialInterface.DATA_BITS_8);
serialPort.setStopBits(UsbSerialInterface.STOP_BITS_1);
serialPort.setParity(UsbSerialInterface.PARITY_NONE);
serialPort.setFlowControl(UsbSerialInterface.FLOW_CONTROL_OFF);
serialPort.read(mCallback);
serialPort.getCTS(ctsCallback);
serialPort.getDSR(dsrCallback);
new ReadThread().start();
Intent intent = new Intent(ACTION_USB_READY);
context.sendBroadcast(intent);
} else {
if (serialPort instanceof CDCSerialDevice) {
Intent intent = new Intent(ACTION_CDC_DRIVER_NOT_WORKING);
context.sendBroadcast(intent);
} else {
Intent intent = new Intent(ACTION_USB_DEVICE_NOT_WORKING);
context.sendBroadcast(intent);
}
}
} else {
Intent intent = new Intent(ACTION_USB_NOT_SUPPORTED);
context.sendBroadcast(intent);
}
}
}
private class ReadThread extends Thread {
@Override
public void run() {
while (true) {
byte[] buffer = new byte[100];
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);
data.concat("/n");
if (fobj.getConnect_flag() == 1) {
if (data.contains(",")) {
try {
Thread.sleep(Long.parseLong("4000"));
} catch (InterruptedException e) {
e.printStackTrace();
}
String[] namesList = data.split(",");
try {
Thread.sleep(Long.parseLong("4000"));
} catch (InterruptedException e) {
e.printStackTrace();
}
Double d5 = new Double(namesList[3]);
ddash_427 = (float) (Float.parseFloat(String.valueOf((d5))) - 427.00);
ddash_555 = (float) (Float.parseFloat(String.valueOf((d5))) - 555.00);
BigDecimal d3 = new BigDecimal(namesList[2]);
BigDecimal d1 = new BigDecimal(namesList[1]);
Double d8 = (Double) (-d3.doubleValue() + Math.sqrt(Math.pow(d3.doubleValue(), 2) - 4 * (d1).doubleValue() * ddash_427));
d8 = d8 / (2 * d1.doubleValue());
BigDecimal d11 = new BigDecimal(d8);
wl_427 = (int) Math.round(d8);
obj.setX_427(String.valueOf(wl_427));
Log.e("Value x 427 ", String.valueOf(wl_427));
Log.e("Value x 427 obj ", String.valueOf(obj.getX_427()));
Double d9 = (Double) (-d3.doubleValue() + Math.sqrt(Math.pow(d3.doubleValue(), 2) - 4 * (d1).doubleValue() * ddash_555));
d9 = d9 / (2 * d1.doubleValue());
BigDecimal d12 = new BigDecimal(d9);
wl_555 = (int) Math.round(d9);
Log.e("Value x 555 ", String.valueOf(wl_555));
obj.setX_555(String.valueOf(wl_555));
Log.e("Value x 555 obj ", String.valueOf(obj.getX_555()));
}
}
if (fobj.getRun_flag()==1)
{
fobj.setBaseline_flag(0);
if (data.contains(String.valueOf(obj.getX_427()))) {
Log.e("final 427 value yes", String.valueOf(data));
String ds2 = data.substring(data.lastIndexOf(":") + 1).trim();
f_427 = ds2;
ds2=ds2.replace("OK [0]","");
obj.setF_427(ds2);
Log.e("Value of initial 427", String.valueOf(f_427));
}
if (data.contains(String.valueOf(obj.getX_555()))) {
Log.e("i 555 value yes", String.valueOf(data));
String ds2 = data.substring(data.lastIndexOf(":") + 1).trim();
f_555 = ds2;
ds2=ds2.replace("OK [0]","");
obj.setF_555(ds2);
Log.e("Value of final 555", String.valueOf(f_555));
}
}
if (fobj.getBaseline_flag() == 1) {
fobj.setRun_flag(0);
if (data.contains(String.valueOf(obj.getX_427()))) {
Log.e("i 427 value yes", String.valueOf(data));
String ds1 = data.substring(data.lastIndexOf(":") + 1).trim();
i_427 = ds1;
try {
Thread.sleep(Long.parseLong("1000"));
} catch (InterruptedException e) {
e.printStackTrace();
}
ds1=ds1.replace("OK [0]","");
try {
Thread.sleep(Long.parseLong("1000"));
} catch (InterruptedException e) {
e.printStackTrace();
}
Log.e("this is i value",ds1);
obj.setI_427(ds1);
Log.e("Value of initial 427", String.valueOf(i_427));
}
if (data.contains(String.valueOf(obj.getX_555()))) {
Log.e("i 555 value ", String.valueOf(data));
String ds2 = data.substring(data.lastIndexOf(":") + 1).trim();
i_555 = ds2;
try {
Thread.sleep(Long.parseLong("1000"));
} catch (InterruptedException e) {
e.printStackTrace();
}
ds2=ds2.replace("OK [0]","");
try {
Thread.sleep(Long.parseLong("1000"));
} catch (InterruptedException e) {
e.printStackTrace();
}
obj.setI_555(ds2);
Log.e("Value of initial 555", String.valueOf(i_555));
Log.e("Value of obj in 427", obj.getI_427());
Log.e("Value of obj in 555", obj.getI_555());
}
}
}
}
}
}
}

View File

@@ -0,0 +1,31 @@
package shanmukha.in.sickle_cell;
public class flag_pojo {
private int connect_flag;
private int baseline_flag;
private int run_flag;
public int getConnect_flag() {
return connect_flag;
}
public void setConnect_flag(int connect_flag) {
this.connect_flag = connect_flag;
}
public int getBaseline_flag() {
return baseline_flag;
}
public void setBaseline_flag(int baseline_flag) {
this.baseline_flag = baseline_flag;
}
public int getRun_flag() {
return run_flag;
}
public void setRun_flag(int run_flag) {
this.run_flag = run_flag;
}
}

View File

@@ -0,0 +1,94 @@
package shanmukha.in.sickle_cell;
public class pojo {
private String x_427;
private String x_555;
private String i_427;
private String i_555;
private String f_427;
private String f_555;
private String a_555;
private String a_427;
private String ratio;
private String result;
public String getA_555() {
return a_555;
}
public void setA_555(String a_555) {
this.a_555 = a_555;
}
public String getA_427() {
return a_427;
}
public void setA_427(String a_427) {
this.a_427 = a_427;
}
public String getRatio() {
return ratio;
}
public void setRatio(String ratio) {
this.ratio = ratio;
}
public String getResult() {
return result;
}
public void setResult(String result) {
this.result = result;
}
public String getX_427() {
return x_427;
}
public void setX_427(String x_427) {
this.x_427 = x_427;
}
public String getX_555() {
return x_555;
}
public void setX_555(String x_555) {
this.x_555 = x_555;
}
public String getI_427() {
return i_427;
}
public void setI_427(String i_427) {
this.i_427 = i_427;
}
public String getI_555() {
return i_555;
}
public void setI_555(String i_555) {
this.i_555 = i_555;
}
public String getF_427() {
return f_427;
}
public void setF_427(String f_427) {
this.f_427 = f_427;
}
public String getF_555() {
return f_555;
}
public void setF_555(String f_555) {
this.f_555 = f_555;
}
}

View File

@@ -0,0 +1,30 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:aapt="http://schemas.android.com/aapt"
android:width="108dp"
android:height="108dp"
android:viewportWidth="108"
android:viewportHeight="108">
<path android:pathData="M31,63.928c0,0 6.4,-11 12.1,-13.1c7.2,-2.6 26,-1.4 26,-1.4l38.1,38.1L107,108.928l-32,-1L31,63.928z">
<aapt:attr name="android:fillColor">
<gradient
android:endX="85.84757"
android:endY="92.4963"
android:startX="42.9492"
android:startY="49.59793"
android:type="linear">
<item
android:color="#44000000"
android:offset="0.0" />
<item
android:color="#00000000"
android:offset="1.0" />
</gradient>
</aapt:attr>
</path>
<path
android:fillColor="#FFFFFF"
android:fillType="nonZero"
android:pathData="M65.3,45.828l3.8,-6.6c0.2,-0.4 0.1,-0.9 -0.3,-1.1c-0.4,-0.2 -0.9,-0.1 -1.1,0.3l-3.9,6.7c-6.3,-2.8 -13.4,-2.8 -19.7,0l-3.9,-6.7c-0.2,-0.4 -0.7,-0.5 -1.1,-0.3C38.8,38.328 38.7,38.828 38.9,39.228l3.8,6.6C36.2,49.428 31.7,56.028 31,63.928h46C76.3,56.028 71.8,49.428 65.3,45.828zM43.4,57.328c-0.8,0 -1.5,-0.5 -1.8,-1.2c-0.3,-0.7 -0.1,-1.5 0.4,-2.1c0.5,-0.5 1.4,-0.7 2.1,-0.4c0.7,0.3 1.2,1 1.2,1.8C45.3,56.528 44.5,57.328 43.4,57.328L43.4,57.328zM64.6,57.328c-0.8,0 -1.5,-0.5 -1.8,-1.2s-0.1,-1.5 0.4,-2.1c0.5,-0.5 1.4,-0.7 2.1,-0.4c0.7,0.3 1.2,1 1.2,1.8C66.5,56.528 65.6,57.328 64.6,57.328L64.6,57.328z"
android:strokeWidth="1"
android:strokeColor="#00000000" />
</vector>

View File

@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>
<shape
xmlns:android="http://schemas.android.com/apk/res/android">
<stroke
android:width="1dp"
android:color="@android:color/holo_blue_light"/>
<corners
android:radius="16dp" />
<padding
android:left="1dp"
android:right="1dp"
android:top="1dp"
android:bottom="1dp"/>
<solid android:color="@android:color/holo_blue_dark"/>
</shape>

View File

@@ -0,0 +1,170 @@
<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="108dp"
android:height="108dp"
android:viewportWidth="108"
android:viewportHeight="108">
<path
android:fillColor="#3DDC84"
android:pathData="M0,0h108v108h-108z" />
<path
android:fillColor="#00000000"
android:pathData="M9,0L9,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,0L19,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M29,0L29,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M39,0L39,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M49,0L49,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M59,0L59,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M69,0L69,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M79,0L79,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M89,0L89,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M99,0L99,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,9L108,9"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,19L108,19"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,29L108,29"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,39L108,39"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,49L108,49"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,59L108,59"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,69L108,69"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,79L108,79"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,89L108,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,99L108,99"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,29L89,29"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,39L89,39"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,49L89,49"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,59L89,59"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,69L89,69"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,79L89,79"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M29,19L29,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M39,19L39,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M49,19L49,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M59,19L59,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M69,19L69,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M79,19L79,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
</vector>

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

View File

@@ -0,0 +1,7 @@
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle" >
<solid android:color="#ffffff" />
<stroke android:width="1dp" android:color="@android:color/darker_gray"/>
<corners
android:radius="5dp" />
</shape>

View File

@@ -0,0 +1,104 @@
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="16dp"
android:paddingLeft="16dp"
android:paddingRight="16dp"
android:paddingTop="16dp"
>
<TextView
android:id="@+id/textViewTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:text="serial_port"
android:visibility="gone"
android:textAppearance="?android:attr/textAppearanceLarge"/>
<Button
android:id="@+id/buttonSend"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="42dp"
android:layout_margin="15dp"
android:text="Get Device Parameters"/>
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Set Baseline"
android:id="@+id/baseline_c"
android:layout_below="@id/buttonSend"
android:layout_alignParentLeft="true"
android:layout_margin="15dp"
android:layout_alignParentStart="true"/>
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Run"
android:id="@+id/run_c"
android:layout_below="@id/baseline_c"
android:layout_margin="15dp"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"/>
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Show Result"
android:id="@+id/next_c"
android:layout_below="@id/run_c"
android:layout_alignParentLeft="true"
android:layout_margin="15dp"
android:layout_alignParentStart="true"/>
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Connect"
android:id="@+id/con"
android:onClick="onClickconectar"
android:layout_below="@id/next_c"
android:layout_alignParentLeft="true"
android:layout_margin="15dp"
android:layout_alignParentStart="true"/>
<TextView
android:textSize="30dp"
android:text="Result"
android:gravity="center"
android:id="@+id/textViewTitle1"
android:layout_centerHorizontal="true"
android:layout_marginTop="30dp"
android:layout_width="match_parent"
android:layout_height="34dp"
android:layout_below="@id/con"
/>
</RelativeLayout>

View File

@@ -0,0 +1,230 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout 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="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<RelativeLayout
android:id="@+id/wvHelp1"
android:layout_width="match_parent"
android:orientation="vertical"
android:layout_height="match_parent"
>
<ImageView
android:id="@+id/image1"
android:layout_centerInParent="true"
android:layout_width="match_parent"
android:layout_height="100dp"
android:src="@drawable/shanmukha_logo_small"
></ImageView>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/sicklecell"
android:textSize="20dp"
android:layout_centerHorizontal="true"
android:layout_below="@id/image1"
android:text="Sickle Cell App"/>
</RelativeLayout>
</LinearLayout>
<!--
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout 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="fill_parent"
android:layout_height="fill_parent"
android:background="@drawable/finalback"
android:orientation="vertical" >
<RelativeLayout
android:id="@+id/wvHelp1"
android:layout_width="match_parent"
android:orientation="vertical"
android:layout_height="0dp"
android:layout_weight="0.1" >
<ImageView
android:layout_marginTop="10dp"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="center"
android:src="@drawable/logo"
></ImageView>
</RelativeLayout>
<RelativeLayout
android:id="@+id/wvHelp3"
android:layout_width="match_parent"
android:orientation="vertical"
android:layout_height="0dp"
android:layout_weight="0.2" >
<TextView
android:id="@+id/yourscore4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:fontFamily="serif-monospace"
android:layout_alignParentTop="true"
android:layout_marginTop="5dp"
android:textAlignment="center"
android:textColor="@color/colorAccent"
android:text="FARMER AND AGRI STARTUP SUPPLY LINKAGE APPLICATION "
android:textSize="22sp"
/>
</RelativeLayout>
<RelativeLayout
android:id="@+id/wvHelp"
android:layout_width="match_parent"
android:orientation="vertical"
android:layout_height="0dp"
android:layout_weight="0.3" >
<TextView
android:id="@+id/yourscoreg"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:padding="20sp"
android:textColor="#FF9933"
android:textAlignment="center"
android:fontFamily="serif-monospace"
android:layout_centerInParent="true"
android:textStyle="bold"
android:layout_alignParentTop="true"
android:layout_marginTop="5dp"
android:text="CONNECTING KITCHEN TO FARM PRODUCE "
android:textSize="20sp"
/>
</RelativeLayout>
<RelativeLayout
android:id="@+id/wvHelpj"
android:layout_width="match_parent"
android:orientation="vertical"
android:layout_height="0dp"
android:layout_weight="0.5" >
</RelativeLayout>
</LinearLayout>-->

View File

@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@drawable/ic_launcher_background" />
<foreground android:drawable="@drawable/ic_launcher_foreground" />
</adaptive-icon>

View File

@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@drawable/ic_launcher_background" />
<foreground android:drawable="@drawable/ic_launcher_foreground" />
</adaptive-icon>

View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="colorPrimary">@android:color/holo_blue_light</color>
<color name="colorPrimaryDark">@android:color/holo_blue_light</color>
<color name="colorAccent">@android:color/holo_blue_light</color>
</resources>

View File

@@ -0,0 +1,7 @@
<resources>
<string name="app_name">Sickle Cell </string>
<string name="txvw">USB Status</string>
<string name="btnon">Connect</string>
<string name="btnoff">Disconnect</string>
<string name="sw">Fetch Data</string>
</resources>

View File

@@ -0,0 +1,10 @@
<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
</style>
</resources>

View File

@@ -0,0 +1,17 @@
package shanmukha.in.sickle_cell;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* Example local unit test, which will execute on the development machine (host).
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() {
assertEquals(4, 2 + 2);
}
}