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 @@ -3,7 +3,7 @@
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.shimmerresearch.shimmerserviceexample.PlotFragment"
tools:context="com.shimmerresearch.shimmercapture.PlotFragment"
android:orientation="vertical">


Expand Down
20 changes: 10 additions & 10 deletions ShimmerAndroidInstrumentDriver/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,11 @@ allprojects {
*/
username = project.findProperty("gpr.usr") ?: System.getenv("USERNAME")
password = project.findProperty("gpr.key") ?: System.getenv("TOKEN")
/* should the above not work key in your username and password directly e.g.
username = "username"
password = "password"
/* should the above not work key in your username and password directly e.g.
username = "username"
password = "password"
DO NOT commit your username and password
*/
*/
}
}
maven {
Expand All @@ -59,11 +59,11 @@ allprojects {
*/
username = project.findProperty("gpr.usr") ?: System.getenv("USERNAME")
password = project.findProperty("gpr.key") ?: System.getenv("TOKEN")
/* should the above not work key in your username and password directly e.g.
username = "username"
password = "password"
/* should the above not work key in your username and password directly e.g.
username = "username"
password = "password"
DO NOT commit your username and password
*/
*/
}
}
mavenCentral()
Expand All @@ -78,15 +78,15 @@ allprojects {
implementation 'java3d:vecmath:1.3.1'
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.github.Jasonchenlijian:FastBle:2.4.0'
implementation (group: 'com.shimmerresearch', name: 'shimmerbluetoothmanager', version:'0.11.0_beta'){
implementation (group: 'com.shimmerresearch', name: 'shimmerbluetoothmanager', version:'0.11.1_beta'){

// 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.shimmerresearch', name: 'shimmerdriver', version:'0.11.0_beta'){
implementation (group: 'com.shimmerresearch', name: 'shimmerdriver', version:'0.11.1_beta'){

// excluding org.json which is provided by Android
exclude group: 'io.netty'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
apply plugin: 'com.android.application'

android {
compileSdkVersion 33
compileSdkVersion 34

defaultConfig {
applicationId "com.shimmerresearch.shimmerserviceexample"
applicationId "com.shimmersensing.shimmerconnect"
minSdkVersion 14
targetSdkVersion 33
versionCode 1
versionName "1.0"
targetSdkVersion 34
versionCode 27
versionName "27.0"
multiDexEnabled true

testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.shimmerresearch.shimmerserviceexample;
package com.shimmerresearch.shimmercapture;

import android.content.Context;
import android.support.test.InstrumentationRegistry;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?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="com.shimmerresearch.shimmerserviceexample">
package="com.shimmerresearch.shimmercapture">
<uses-permission android:name="android.permission.BLUETOOTH"
android:maxSdkVersion="30" />
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN"
Expand All @@ -23,7 +23,7 @@
tools:remove="android:appComponentFactory"
tools:targetApi="p">
<service android:name="com.shimmerresearch.android.shimmerService.ShimmerService" />
<activity android:name=".MainActivity"
<activity android:name="com.shimmerresearch.shimmercapture.MainActivity"
android:screenOrientation="portrait"
android:exported="true">
<intent-filter>
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.shimmerresearch.shimmerserviceexample;
package com.shimmerresearch.shimmercapture;

import android.Manifest;

Expand Down Expand Up @@ -90,6 +90,12 @@ public class MainActivity extends AppCompatActivity implements ConnectedShimmers
final static String LOG_TAG = "Shimmer";
final static String SERVICE_TAG = "ShimmerService";
final static int REQUEST_CONNECT_SHIMMER = 2;
public static APP_RELEASE_TYPE appReleaseType = APP_RELEASE_TYPE.PUBLIC;
public enum APP_RELEASE_TYPE{
INTERNAL,
PUBLIC,
TESTING
}

ShimmerDialogConfigurations dialog;
BluetoothAdapter btAdapter;
Expand All @@ -114,6 +120,37 @@ public class MainActivity extends AppCompatActivity implements ConnectedShimmers
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
AlertDialog.Builder alertDialog = new AlertDialog.Builder(this);
//alertDialog.setTitle("Device Info");
alertDialog.setMessage("Shimmer Capture App collect Location data to enable Bluetooth devices scanning on Android versions 11 and lower even when the app is closed or not in use.");
alertDialog.setCancelable(false);
alertDialog.setPositiveButton("OK", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
requestPermissions();
}
});
alertDialog.show();

//Check if Bluetooth is enabled
/*if (!btAdapter.isEnabled()) {
int REQUEST_ENABLE_BT = 1;
Intent enableBtIntent = new Intent(BluetoothAdapter.ACTION_REQUEST_ENABLE);
startActivityForResult(enableBtIntent, REQUEST_ENABLE_BT);
}
else {*/

//}


/*
if(checkSelfPermission(Manifest.permission.WRITE_EXTERNAL_STORAGE )!= PackageManager.PERMISSION_GRANTED) {
requestPermissions(new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE},
PERMISSIONS_REQUEST_WRITE_STORAGE);
}*/
}

public void requestPermissions(){

int permissionCheck = ContextCompat.checkSelfPermission(this, Manifest.permission.BLUETOOTH_CONNECT);
boolean permissionGranted = true;
Expand All @@ -125,6 +162,7 @@ protected void onCreate(Bundle savedInstanceState) {
if (permissionCheck != PackageManager.PERMISSION_GRANTED) {
permissionGranted = false;
}

permissionCheck = ContextCompat.checkSelfPermission(this, Manifest.permission.ACCESS_COARSE_LOCATION);
if (permissionCheck != PackageManager.PERMISSION_GRANTED) {
permissionGranted = false;
Expand Down Expand Up @@ -152,25 +190,7 @@ protected void onCreate(Bundle savedInstanceState) {
mViewPager.setOffscreenPageLimit(5); //Ensure none of the fragments has their view destroyed when off-screen
btAdapter = BluetoothAdapter.getDefaultAdapter();
dialog = new ShimmerDialogConfigurations();

//Check if Bluetooth is enabled
/*if (!btAdapter.isEnabled()) {
int REQUEST_ENABLE_BT = 1;
Intent enableBtIntent = new Intent(BluetoothAdapter.ACTION_REQUEST_ENABLE);
startActivityForResult(enableBtIntent, REQUEST_ENABLE_BT);
}
else {*/

//}


/*
if(checkSelfPermission(Manifest.permission.WRITE_EXTERNAL_STORAGE )!= PackageManager.PERMISSION_GRANTED) {
requestPermissions(new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE},
PERMISSIONS_REQUEST_WRITE_STORAGE);
}*/
}

@Override
public boolean onCreateOptionsMenu(Menu menu) {
MenuInflater inflater = getMenuInflater();
Expand Down Expand Up @@ -201,8 +221,11 @@ protected void startServiceandBTManager(){

@Override
public boolean onPrepareOptionsMenu(Menu menu) {
if(mService != null){
menu.findItem(R.id.connect_device).setEnabled(mService.getListOfConnectedDevices().isEmpty());

if(appReleaseType.equals(APP_RELEASE_TYPE.PUBLIC)){
if(mService != null){
menu.findItem(R.id.connect_device).setEnabled(mService.getListOfConnectedDevices().isEmpty());
}
}
MenuItem item1 = menu.findItem(R.id.data_sync);
MenuItem item2 = menu.findItem(R.id.disable_logging);
Expand All @@ -214,6 +237,7 @@ public boolean onPrepareOptionsMenu(Menu menu) {
MenuItem item8 = menu.findItem(R.id.start_sd_logging);
MenuItem item9 = menu.findItem(R.id.stop_sd_logging);
MenuItem item10 = menu.findItem(R.id.device_info);
MenuItem item11 = menu.findItem(R.id.privacy_policy);
if(selectedDeviceAddress != null){
ShimmerDevice device = mService.getShimmer(selectedDeviceAddress);
if(device instanceof VerisenseDevice) {
Expand All @@ -227,6 +251,7 @@ public boolean onPrepareOptionsMenu(Menu menu) {
item8.setVisible(false);
item9.setVisible(false);
item10.setVisible(false);
item11.setVisible(false);
if (((VerisenseDevice)device).isRecordingEnabled()){
item2.setTitle("Disable Logging");
return true;
Expand All @@ -241,6 +266,7 @@ public boolean onPrepareOptionsMenu(Menu menu) {
item8.setVisible(true);
item9.setVisible(true);
item10.setVisible(true);
item11.setVisible(true);
}
}
item1.setVisible(false);
Expand Down Expand Up @@ -506,6 +532,10 @@ public void onClick(DialogInterface dialog, int id) {
alertDialog.setMessage("Shimmer Version: "+shimmerVersion + "\n\nFirmware Version: "+FWName);
alertDialog.show();

return true;
case R.id.privacy_policy:
startActivity(new Intent(Intent.ACTION_VIEW,Uri.parse("https://www.shimmersensing.com/privacy/")));

return true;
default:
return super.onOptionsItemSelected(item);
Expand All @@ -531,8 +561,9 @@ public void onServiceConnected(ComponentName className, IBinder service) {
Log.d(SERVICE_TAG, "Shimmer Service Bound");

//if there is a device connected display it on the fragment
connectedShimmersListFragment.buildShimmersConnectedListView(mService.getListOfConnectedDevices(), getApplicationContext());

if(connectedShimmersListFragment!=null) {
connectedShimmersListFragment.buildShimmersConnectedListView(mService.getListOfConnectedDevices(), getApplicationContext());
}
}

public void onServiceDisconnected(ComponentName className) {
Expand Down Expand Up @@ -620,8 +651,11 @@ protected void onActivityResult(int requestCode, int resultCode, Intent data) {
if (deviceName.contains(VerisenseDevice.VERISENSE_PREFIX)){

} else {
showBtTypeConnectionOption();

if(appReleaseType.equals(APP_RELEASE_TYPE.PUBLIC)){
preferredBtType = ShimmerBluetoothManagerAndroid.BT_TYPE.BT_CLASSIC;
}else{
showBtTypeConnectionOption();
}
}
mService.connectShimmer(macAdd,deviceName,preferredBtType,this); //Connect to the selected device, and set context to show progress dialog when pairing
//mService.connectShimmer(macAdd,this); //Connect to the selected device, and set context to show progress dialog when pairing
Expand All @@ -640,7 +674,6 @@ public class SectionsPagerAdapter1 extends FragmentStatePagerAdapter {

public SectionsPagerAdapter1(FragmentManager fm) {
super(fm);
dataSyncFragment = DataSyncFragment.newInstance();
connectedShimmersListFragment = ConnectedShimmersListFragment.newInstance();
sensorsEnabledFragment = SensorsEnabledFragment.newInstance(null, null);
deviceConfigFragment = DeviceConfigFragment.newInstance();
Expand All @@ -652,7 +685,10 @@ public SectionsPagerAdapter1(FragmentManager fm) {
add(deviceConfigFragment, "Device Configuration");
add(plotFragment, "Plot");
add(signalsToPlotFragment, "Signals to Plot");
add(dataSyncFragment, "Verisense Sync");
if(!(appReleaseType.equals(APP_RELEASE_TYPE.PUBLIC))){
dataSyncFragment = DataSyncFragment.newInstance();
add(dataSyncFragment, "Verisense Sync");
}
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.shimmerresearch.shimmerserviceexample.MainActivity"
tools:context="com.shimmerresearch.shimmercapture.MainActivity"
android:orientation="vertical"
android:id="@+id/content_frame">

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,6 @@
android:id="@+id/stop_sd_logging"></item>
<item android:title="Device Info"
android:id="@+id/device_info"></item>
<item android:title="Privacy Policy"
android:id="@+id/privacy_policy"></item>
</menu>
Original file line number Diff line number Diff line change
@@ -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="@color/ic_launcher_background"/>
<foreground android:drawable="@mipmap/ic_launcher_foreground"/>
</adaptive-icon>
Original file line number Diff line number Diff line change
@@ -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="@color/ic_launcher_background"/>
<foreground android:drawable="@mipmap/ic_launcher_foreground"/>
</adaptive-icon>
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="ic_launcher_background">#FFFFFF</color>
</resources>
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<resources>
<string name="app_name">Shimmer Service Example</string>
<string name="app_name">Shimmer Capture</string>
<string name="connect">Connect a Shimmer</string>
<string name="disconnect">Disconnect Shimmer</string>
<string name="startstream">Start streaming</string>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.shimmerresearch.shimmerserviceexample;
package com.shimmerresearch.shimmercapture;

import org.junit.Test;

Expand Down