Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -74,13 +74,13 @@ dependencies {
compile files('libs/ShimmerBiophysicalProcessingLibrary_Rev_0_11.jar')
compile files('libs/AndroidBluetoothLibrary.jar')
compile files('libs/androidplot-core-0.5.0-release.jar')
implementation (group: 'com.shimmersensing', name: 'ShimmerBluetoothManagerDev', version:'JA-56 v0.4'){
implementation (group: 'com.shimmersensing', name: 'ShimmerBluetoothManagerDev', version:'JA-56 v0.7'){
// excluding org.json which is provided by Android
exclude group: 'io.netty'
exclude group: 'com.google.protobuf'
exclude group: 'org.apache.commons.math'
}
implementation (group: 'com.shimmersensing', name: 'ShimmerDriverDev', version:'JA-56 v0.4'){
implementation (group: 'com.shimmersensing', name: 'ShimmerDriverDev', version:'JA-56 v0.7'){
// excluding org.json which is provided by Android
exclude group: 'io.netty'
exclude group: 'com.google.protobuf'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,11 @@
import android.os.Handler;

import com.shimmerresearch.bluetooth.ShimmerBluetooth;
import com.shimmerresearch.driver.CallbackObject;
import com.shimmerresearch.driver.ObjectCluster;
import com.shimmerresearch.driver.ShimmerMsg;
import com.shimmerresearch.verisense.VerisenseDevice;
import com.shimmerresearch.verisense.communication.SyncProgressDetails;

import java.util.ArrayList;
import java.util.List;
Expand Down Expand Up @@ -47,4 +50,13 @@ private void sendMsgToHandlerListTarget(int what, Object object) {
}
}
}

@Override
public void sendCallBackMsg(int i, Object ojc){
super.sendCallBackMsg(i, ojc);

if(((CallbackObject)ojc).mMyObject instanceof SyncProgressDetails){
sendMsgToHandlerListTarget(ShimmerBluetooth.MSG_IDENTIFIER_SYNC_PROGRESS, -1, -1, ojc);
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
package com.shimmerresearch.android.guiUtilities.supportfragments;

import android.content.Context;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import android.widget.EditText;
import com.shimmerresearch.androidinstrumentdriver.R;


public class DataSyncFragment extends Fragment {

static Context context;
public static EditText editTextParticipantName;
public static EditText editTextTrialName;
public static TextView TextViewPayloadIndex;
public static TextView TextViewSpeed;

public DataSyncFragment() {
// Required empty public constructor
}

public static DataSyncFragment newInstance() {
DataSyncFragment fragment = new DataSyncFragment();
Bundle args = new Bundle();
fragment.setArguments(args);
return fragment;
}

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
context = getActivity();
// Inflate the layout for this fragment
return inflater.inflate(R.layout.data_sync, container, false);
}

@Override
public void onActivityCreated(@Nullable Bundle savedInstanceState) {

editTextParticipantName = (EditText) getView().findViewById(R.id.participantName);
editTextTrialName = (EditText) getView().findViewById(R.id.trialName);
TextViewPayloadIndex = (TextView) getView().findViewById(R.id.payloadIndex);
TextViewSpeed = (TextView) getView().findViewById(R.id.speed);

super.onActivityCreated(savedInstanceState);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ public class PlotFragment extends Fragment {
static String deviceState = "";
static TextView textViewDeviceName;
static TextView textViewDeviceState;
static String selectedDeviceAddress;

private static String LOG_TAG = "PlotFragment";
Button signalsToPlotButton;
Expand Down Expand Up @@ -201,8 +202,11 @@ public void handleMessage(Message msg) {
Log.d(LOG_TAG,"Message Fully Initialized Received from Shimmer driver");
shimmerService.enableGraphingHandler(true);
deviceState = "Connected";
textViewDeviceName.setText(mBluetoothAddress);
textViewDeviceState.setText(deviceState);
if(selectedDeviceAddress.equals(mBluetoothAddress)){
textViewDeviceName.setText(mBluetoothAddress);
textViewDeviceState.setText(deviceState);
}

break;
case SDLOGGING:
Log.d(LOG_TAG,"Message Fully Initialized Received from Shimmer driver");
Expand All @@ -214,8 +218,10 @@ public void handleMessage(Message msg) {
case CONNECTING:
Log.d(LOG_TAG,"Driver is attempting to establish connection with Shimmer device");
deviceState = "Connecting";
textViewDeviceName.setText(mBluetoothAddress);
textViewDeviceState.setText(deviceState);
if(selectedDeviceAddress.equals(mBluetoothAddress)){
textViewDeviceName.setText(mBluetoothAddress);
textViewDeviceState.setText(deviceState);
}
break;
case STREAMING:
deviceState="Streaming";
Expand Down Expand Up @@ -279,6 +285,11 @@ else if(shimmerService.isEXGUsingTestSignal16Configuration(mBluetoothAddress))
textViewDeviceState.setText(deviceState);
//TODO: set the enable logging regarding the user selection
break;
case STREAMING_LOGGED_DATA:
deviceState="Data Sync";
textViewDeviceName.setText(mBluetoothAddress);
textViewDeviceState.setText(deviceState);
break;
case DISCONNECTED:
Log.d(LOG_TAG,"Shimmer No State");
mBluetoothAddress=null;
Expand Down Expand Up @@ -324,4 +335,11 @@ public void clearPlot() {
mPlotDataMap.clear();
dynamicPlot.clear();
}

public void setSelectedDeviceAddress(String address){
selectedDeviceAddress = address;
textViewDeviceName.setText(address);
textViewDeviceState.setText("Connected");
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import android.support.v4.app.Fragment;
import android.support.v4.app.ListFragment;
import android.util.Log;
import android.util.SparseBooleanArray;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
Expand Down Expand Up @@ -141,6 +142,23 @@ public void buildSignalsToPlotList(Context context, final ShimmerService service
listView.setChoiceMode(ListView.CHOICE_MODE_MULTIPLE);
updateCheckboxes();

shimmerService.mPlotManager.removeAllSignals();

SparseBooleanArray pos = listView.getCheckedItemPositions();
for (int i = 0; i < listView.getCount(); i++) {
if (pos.get(i)) {
try {
if(dynamicPlot == null) {
Log.e(LOG_TAG, "dynamicPlot is null!");
}
shimmerService.mPlotManager.addSignal(mList.get(i), dynamicPlot);
} catch (Exception e) {
Log.e(LOG_TAG, "Error! Could not add signal: " + e);
e.printStackTrace();
}
}
}

listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ public class AndroidBleRadioByteCommunication extends AbstractByteCommunication
UUID txid = UUID.fromString(TxID);
UUID rxid = UUID.fromString(RxID);
String mMac;
String uuid;

//"DA:A6:19:F0:4A:D7"
//"E7:45:2C:6D:6F:14"
Expand Down Expand Up @@ -192,4 +193,13 @@ public void onWriteFailure(BleException exception) {
public void stop() {

}
public String convertMacIDtoUUID(String MacID) {
String uuid = "00000000-0000-0000-0000-";
return uuid + MacID.replace(":", "");
}

public String getUuid() {
//"00000000-0000-0000-0000-E7EC37A0D234"
return convertMacIDtoUUID(this.mMac);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="16dp"
android:orientation="horizontal">
<TextView
android:id="@+id/participantNameLabel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Participant Name:"
android:textStyle="bold"
/>
<EditText
android:id="@+id/participantName"
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:textSize="14dp"
android:inputType="text"/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="16dp"
android:orientation="horizontal">
<TextView
android:id="@+id/trialNameLabel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Trial Name:"
android:paddingRight="42dp"
android:textSize="14dp"
android:textStyle="bold"
/>
<EditText
android:id="@+id/trialName"
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:textSize="14dp"
android:inputType="text"/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="16dp"
android:gravity="center"
android:orientation="horizontal">
<TextView
android:id="@+id/payloadIndex"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=" "
android:textStyle="bold"
/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="16dp"
android:gravity="center"
android:orientation="horizontal">
<TextView
android:id="@+id/speed"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=" "
android:textStyle="bold"
/>
</LinearLayout>
</LinearLayout>
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,13 @@ android {

dependencies {
compile project(':ShimmerAndroidInstrumentDriver')
implementation (group: 'com.shimmersensing', name: 'ShimmerBluetoothManagerDev', version:'JA-56 v0.4'){
implementation (group: 'com.shimmersensing', name: 'ShimmerBluetoothManagerDev', version:'JA-56 v0.7'){
// excluding org.json which is provided by Android
exclude group: 'io.netty'
exclude group: 'com.google.protobuf'
exclude group: 'org.apache.commons.math'
}
implementation (group: 'com.shimmersensing', name: 'ShimmerDriverDev', version:'JA-56 v0.4'){
implementation (group: 'com.shimmersensing', name: 'ShimmerDriverDev', version:'JA-56 v0.7'){
// excluding org.json which is provided by Android
exclude group: 'io.netty'
exclude group: 'com.google.protobuf'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.shimmerresearch.shimmerserviceexample">

<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<application android:allowBackup="true" android:icon="@mipmap/ic_launcher"
android:label="@string/app_name" android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true" android:theme="@style/AppTheme"
Expand Down
Loading