Skip to content

Commit

Permalink
Bug fixes - device name
Browse files Browse the repository at this point in the history
  • Loading branch information
protocentralashwin committed Oct 28, 2018
1 parent 5583db5 commit 75aad99
Show file tree
Hide file tree
Showing 14 changed files with 198 additions and 111 deletions.
Binary file modified .idea/caches/build_file_checksums.ser
Binary file not shown.
22 changes: 0 additions & 22 deletions .idea/compiler.xml

This file was deleted.

3 changes: 0 additions & 3 deletions .idea/copyright/profiles_settings.xml

This file was deleted.

9 changes: 5 additions & 4 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

126 changes: 76 additions & 50 deletions app/app.iml

Large diffs are not rendered by default.

45 changes: 33 additions & 12 deletions app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,21 +1,26 @@
apply plugin: 'com.android.application'

android {
signingConfigs {
config {
keyAlias 'key0'
keyPassword 'open1234'
storeFile file('/Users/ashwinkwhitchurch/Dropbox/akw-newkey')
storePassword 'open1234'
}
}
compileSdkVersion 27
buildToolsVersion '27.0.3'

buildToolsVersion '28.0.3'
defaultConfig {
applicationId "com.protocentral.heartypatch"
minSdkVersion 19
targetSdkVersion 27
versionCode 8
versionName "2.5"
versionCode 9
versionName "2.6"
}

aaptOptions {
noCompress "zip"
}

buildTypes {
release {
minifyEnabled true
Expand All @@ -27,9 +32,27 @@ android {
repositories {
maven { url "https://repo.eclipse.org/content/repositories/paho-releases/" }
maven { url "https://s3.amazonaws.com/repo.commonsware.com" }
maven {
url 'https://www.jitpack.io'
}
}

dependencies {
<<<<<<< HEAD
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support:appcompat-v7:27.0.1'
implementation 'com.android.support:design:27.0.1'
implementation 'com.google.android.gms:play-services-analytics:11.0.4'
implementation 'com.google.android.gms:play-services-location:11.0.4'
implementation 'com.google.android.gms:play-services-vision:11.0.4'
implementation('org.eclipse.paho:org.eclipse.paho.android.service:1.0.2') {
exclude module: 'support-v4'
}
//compile 'org.eclipse.paho:org.eclipse.paho.client.mqttv3:1.0.2'
//compile 'org.eclipse.paho:org.eclipse.paho.android.service:1.0.2'
implementation('com.commonsware.cwac:provider:0.5.1') {
exclude group: 'com.android.support'
=======
implementation fileTree(dir: 'libs', include: ['*.jar'])

implementation 'com.android.support:appcompat-v7:27.1.1'
Expand All @@ -40,17 +63,15 @@ dependencies {
implementation 'com.google.android.gms:play-services-vision:15.0.2'


implementation(group: 'org.eclipse.paho', name: 'org.eclipse.paho.android.service', version: '1.1.1') {
exclude group: 'com.android.support', module:'support-v4'
compile('org.eclipse.paho:org.eclipse.paho.android.service:1.0.2') {
exclude module: 'support-v4'
}

implementation 'org.eclipse.paho:org.eclipse.paho.client.mqttv3:1.0.2'
implementation 'org.eclipse.paho:org.eclipse.paho.android.service:1.0.2'

implementation ('com.commonsware.cwac:provider:0.5.1') {
exclude group: 'com.android.support'
>>>>>>> c6f593a69dbcdfbc41b44df5194037dea2ec479f
}
implementation ('com.jjoe64:graphview:4.2.1'){
implementation('com.jjoe64:graphview:4.2.1') {
exclude group: 'com.android.support'
}
}
Binary file added app/debug/app-debug.apk
Binary file not shown.
1 change: 1 addition & 0 deletions app/debug/output.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[{"outputType":{"type":"APK"},"apkInfo":{"type":"MAIN","splits":[],"versionCode":8,"versionName":"2.5","enabled":true,"outputFile":"app-debug.apk","fullName":"debug","baseName":"debug"},"path":"app-debug.apk","properties":{}}]
2 changes: 1 addition & 1 deletion app/release/output.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
[{"outputType":{"type":"APK"},"apkInfo":{"type":"MAIN","splits":[],"versionCode":7},"path":"app-release.apk","properties":{"packageId":"com.protocentral.heartypatch","split":"","minSdkVersion":"19"}}]
[{"outputType":{"type":"APK"},"apkInfo":{"type":"MAIN","splits":[],"versionCode":8,"versionName":"2.5","enabled":true,"outputFile":"app-release.apk","fullName":"release","baseName":"release"},"path":"app-release.apk","properties":{}}]
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,9 @@ public class InfoActivity extends AppCompatActivity implements BleManager.BleMan
public final static UUID UUID_CUSTOM_HRV =
UUID.fromString("01bfa86f-970f-8d96-d44d-9023c47faddc");

public final static UUID UUID_CUSTOM_POSITION =
UUID.fromString("000000a2-0000-1000-8000-00805f9b34fb");

// UI
private ExpandableListView mInfoListView;
private ExpandableListAdapter mInfoListAdapter;
Expand All @@ -98,6 +101,7 @@ public class InfoActivity extends AppCompatActivity implements BleManager.BleMan
private int globalStress=0;
private int globalArrDetect=0;
private float globalRMSSD=0;
private int globalPosition=0;

private LineGraphSeries<DataPoint> HRseries;
private int lineplotxcount=0;
Expand Down Expand Up @@ -441,8 +445,8 @@ public void onDataAvailable(BluetoothGattCharacteristic characteristic)
byte[] data = characteristic.getValue();
mValuesMap.put(key, data);

//Log.d("akw", "BT data recv");
//Log.d("akw", characteristic.getUuid().toString());
Log.d("akw", "BT data recv");
Log.d("akw", characteristic.getUuid().toString());

if (UUID_HEART_RATE_MEASUREMENT.equals(characteristic.getUuid()))
{
Expand All @@ -468,15 +472,20 @@ public void onDataAvailable(BluetoothGattCharacteristic characteristic)

Log.d("akw", "RRI present");
}

final int heartRate = characteristic.getIntValue(format, 1);
// final int RRI = characteristic.getIntValue(BluetoothGattCharacteristic.FORMAT_UINT16, 2);
final int RRI = characteristic.getIntValue(BluetoothGattCharacteristic.FORMAT_UINT16, 2);
Log.d(TAG, String.format("Received heart rate: %d", heartRate));
// Log.d(TAG, String.format("Received RRI: %d", RRI));
Log.d(TAG, String.format("Received RRI: %d", RRI));
HRseries.appendData(new DataPoint(lineplotxcount++, heartRate), true, 40);
// HRseries.resetData()

globalHR = heartRate; //valueString;
// globalRR = String.format("%d", RRI); //valueString;
globalRR = RRI; //valueString;
<<<<<<< HEAD

=======
>>>>>>> c6f593a69dbcdfbc41b44df5194037dea2ec479f
if(recordingLog==true)
{
writeLog("", new float[] {globalHR, globalMean,globalSDNN, globalPNN, globalRMSSD});
Expand All @@ -489,6 +498,13 @@ public void onDataAvailable(BluetoothGattCharacteristic characteristic)
globalBattery = BatteryLevel;
}

if (UUID_CUSTOM_POSITION.equals(characteristic.getUuid()))
{
final int Position = characteristic.getIntValue(BluetoothGattCharacteristic.FORMAT_UINT8, 0);
globalPosition = Position;
Log.d("akw", "Position received:"+Position);
}

if (UUID_CUSTOM_HRV.equals(characteristic.getUuid()))
{
globalMean = characteristic.getIntValue(BluetoothGattCharacteristic.FORMAT_UINT32, 0);
Expand All @@ -513,14 +529,32 @@ public void run()
updateUI();

TextView HRTextView = (TextView) findViewById(R.id.HRTextView);
HRTextView.setText( String.format("%d",globalHR));
HRTextView.setText( String.format("%d",globalRR));

TextView ArrTextView = (TextView) findViewById(R.id.txtRhythm);
if(globalArrDetect==0) {
ArrTextView.setText("Normal");
<<<<<<< HEAD
if(globalArrDetect==0xff) {
ArrTextView.setText("Abnormal");
} else
{
ArrTextView.setText("Abnormal");
ArrTextView.setText("Normal");
=======

switch (globalArrDetect)
{
case 0x1f:
ArrTextView.setText(" NORMAL");
ArrTextView.setBackgroundColor(Color.argb(150,4,122,55));
break;
case 0xff:
ArrTextView.setText(" ABNORMAL");
ArrTextView.setBackgroundColor(Color.RED);
break;
default:
ArrTextView.setText(" UNKNOWN");
ArrTextView.setBackgroundColor(Color.YELLOW);

>>>>>>> c6f593a69dbcdfbc41b44df5194037dea2ec479f
}

TextView BatteryTextView = (TextView) findViewById(R.id.BatteryTextView);
Expand All @@ -538,6 +572,9 @@ public void run()
TextView RMSSDTextView = (TextView) findViewById(R.id.RMSSDTextView);
RMSSDTextView.setText( String.format("%.1f",(globalRMSSD/100)));

TextView PositionTextView = (TextView) findViewById(R.id.textPosition);
PositionTextView.setText( String.format("Position: %d",(globalPosition)));

}
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1321,7 +1321,11 @@ private ArrayList<BluetoothDeviceData> calculateFilteredPeripherals()
{

ArrayList<BluetoothDeviceData> peripherals = (ArrayList<BluetoothDeviceData>) mScannedDevices.clone();
mFilterName = "Hp2";
<<<<<<< HEAD
mFilterName = "atch";
=======
mFilterName = "H";
>>>>>>> c6f593a69dbcdfbc41b44df5194037dea2ec479f
// Sort devices alphabetically
Collections.sort(peripherals, new Comparator<BluetoothDeviceData>() {
@Override
Expand Down Expand Up @@ -1637,6 +1641,7 @@ public boolean onTouch(View v, MotionEvent event) {
});
*/


holder.connectButton.setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
Expand All @@ -1649,6 +1654,7 @@ public boolean onTouch(View v, MotionEvent event) {
});



BluetoothDeviceData deviceData = mFilteredPeripherals.get(groupPosition);
holder.nameTextView.setText(deviceData.getNiceName());

Expand Down
28 changes: 22 additions & 6 deletions app/src/main/res/layout/activity_info.xml
Original file line number Diff line number Diff line change
Expand Up @@ -116,27 +116,33 @@
android:layout_height="wrap_content"
android:layout_weight="0.49"
android:text="Rhythm:"
android:textColor="#ffffff"
android:textAlignment="center"
android:textSize="18sp"/>
android:textColor="#ffffff"
android:textSize="24sp" />

<TextView
android:id="@+id/txtRhythm"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0.49"
android:text="Unknown"
android:textAlignment="textEnd"
android:ellipsize="middle"
android:paddingBottom="5dp"
android:paddingTop="5dp"
android:text=" Unknown"
android:textAlignment="center"
android:textColor="#ffffff"
android:textSize="18sp"
android:textSize="24sp"
android:textStyle="bold" />



</LinearLayout>

<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
android:orientation="horizontal"
android:paddingTop="5dp">

<LinearLayout
android:layout_width="match_parent"
Expand Down Expand Up @@ -267,6 +273,16 @@
android:layout_height="wrap_content"
android:layout_weight="1" />

<TextView
android:id="@+id/textPosition"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Position: ---"
android:textAlignment="center"
android:textColor="@android:color/background_light"
android:textSize="24sp" />

<Switch
android:id="@+id/logToggle"
android:layout_width="match_parent"
Expand Down
6 changes: 5 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,11 @@ buildscript {
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.3'
<<<<<<< HEAD
classpath 'com.android.tools.build:gradle:3.2.1'
=======
classpath 'com.android.tools.build:gradle:3.1.4'
>>>>>>> c6f593a69dbcdfbc41b44df5194037dea2ec479f

// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
Expand Down
4 changes: 2 additions & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Tue Aug 14 09:45:21 PDT 2018
#Wed Oct 24 15:28:44 IST 2018
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-all.zip

0 comments on commit 75aad99

Please sign in to comment.