Skip to content

Commit bbbd078

Browse files
committed
minor updates
1 parent 73c2393 commit bbbd078

4 files changed

Lines changed: 47 additions & 12 deletions

File tree

ShimmerBluetoothManager/build.gradle

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ Rev0.2
1212

1313
sourceCompatibility = 1.11
1414
targetCompatibility = 1.11
15+
//sourceCompatibility = '1.8' // Ensure code is compiled with Java 8 when compiling ShimmerJavaClass for Matlab see ShimmerDriverPC (build.gradle)
16+
//targetCompatibility = '1.8' // Ensure bytecode is compatible with Java 8 when compiling ShimmerJavaClass for Matlab see ShimmerDriverPC (build.gradle)
1517

1618
repositories {
1719
mavenCentral()

ShimmerDriver/build.gradle

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ Rev0.2
1515
apply plugin: 'java-library'
1616
sourceCompatibility = 1.11
1717
targetCompatibility = 1.11
18+
//sourceCompatibility = '1.8' // Ensure code is compiled with Java 8 when compiling ShimmerJavaClass for Matlab see ShimmerDriverPC (build.gradle)
19+
//targetCompatibility = '1.8' // Ensure bytecode is compatible with Java 8 when compiling ShimmerJavaClass for Matlab see ShimmerDriverPC (build.gradle)
1820

1921
repositories {
2022
mavenCentral()

ShimmerDriverPC/build.gradle

Lines changed: 27 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,17 @@
88
*/
99

1010
// Apply the java plugin to add support for Java
11-
apply plugin: 'java'
12-
apply plugin: 'java-library'
13-
apply plugin: 'eclipse'
14-
apply plugin: 'maven-publish'
15-
11+
plugins {
12+
id 'java'
13+
id 'java-library'
14+
id 'eclipse'
15+
id 'maven-publish'
16+
id 'com.github.johnrengelman.shadow' version '7.0.0' // Apply the Shadow plugin
17+
}
1618
sourceCompatibility = 1.11
17-
19+
targetCompatibility = 1.11
20+
//sourceCompatibility = '1.8' // Ensure code is compiled with Java 8 when compiling ShimmerJavaClass for Matlab see ShimmerDriverPC (build.gradle)
21+
//targetCompatibility = '1.8' // Ensure bytecode is compatible with Java 8 when compiling ShimmerJavaClass for Matlab see ShimmerDriverPC (build.gradle)
1822
/*
1923
Rev0.2
2024
- switch to using jfrog
@@ -96,3 +100,20 @@ dependencies {
96100
testImplementation 'junit:junit:4.12'
97101
implementation 'com.parse.bolts:bolts-tasks:1.4.0'
98102
}
103+
104+
// Shadow JAR task to create a runnable JAR with dependencies
105+
/*
106+
Change to using the following below for ShimmerDriverPC/ShimmerDriver/ShimmerBluetoothManager
107+
sourceCompatibility = '1.8' // Ensure code is compiled with Java 8
108+
targetCompatibility = '1.8' // Ensure bytecode is compatible with Java 8
109+
*/
110+
shadowJar {
111+
archiveBaseName.set('ShimmerJavaClass') // Use archiveBaseName instead of baseName
112+
archiveClassifier.set('') // Remove classifier so it’s named shimmerjavaclass.jar
113+
114+
manifest {
115+
attributes 'Main-Class': 'com.shimmerresearch.tools.matlab.ShimmerJavaClass' // Specify the main class
116+
}
117+
118+
mergeServiceFiles() // Merges service files (if any)
119+
}

ShimmerDriverPC/src/main/java/com/shimmerresearch/tools/matlab/ShimmerJavaClass.java

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
import com.shimmerresearch.exceptions.ShimmerException;
2626
import com.shimmerresearch.pcDriver.ShimmerPC;
2727
import com.shimmerresearch.tools.bluetooth.BasicShimmerBluetoothManagerPc;
28+
import com.shimmerresearch.algorithms.*;
2829

2930
public class ShimmerJavaClass {
3031
private String comPort;
@@ -35,15 +36,20 @@ public class ShimmerJavaClass {
3536
private String[] signalNameArray;
3637
private String[] signalFormatArray;
3738
private String[] signalUnitArray;
39+
40+
private boolean mDebug = false;
41+
3842
// private int rowIndex = 0;
3943
Object[] currentData = null;
40-
public static BasicShimmerBluetoothManagerPc mBluetoothManager = new BasicShimmerBluetoothManagerPc();
44+
public static BasicShimmerBluetoothManagerPc mBluetoothManager = new BasicShimmerBluetoothManagerPc(false);
4145

4246
public ShimmerJavaClass() {
4347
sdr.setWaitForData(mBluetoothManager.callBackObject);
4448
mBluetoothManager.addCallBack(sdr);
45-
System.out.println("Callback Registered");
46-
System.out.flush();
49+
if (mDebug) {
50+
System.out.println("Callback Registered");
51+
System.out.flush();
52+
}
4753
}
4854

4955
public static void main(String[] args) {
@@ -155,8 +161,10 @@ private void sendData(Object[] data) {
155161

156162
public void readData() { //Test receive data for all Object Cluster
157163
Object[] data = receiveData();
158-
System.out.println("New Data : " + data[0] + "\tChannel Name : " + data[1]
164+
if (mDebug) {
165+
System.out.println("New Data : " + data[0] + "\tChannel Name : " + data[1]
159166
+ "\tFormat : " + data[2] + "\tUnit : " + data[3]);
167+
}
160168
}
161169

162170
public class SensorDataReceived extends BasicProcessWithCallBack {
@@ -180,8 +188,10 @@ protected void processMsgFromCallback(ShimmerMsg shimmerMSG) {
180188
comPort = callbackObject.mComPort;
181189
}
182190
channelNames = retrieveSensorChannels();
183-
for(String channel : channelNames) {
184-
System.out.println(channel);
191+
if (mDebug) {
192+
for(String channel : channelNames) {
193+
System.out.println(channel);
194+
}
185195
}
186196
} else if (callbackObject.mState == BT_STATE.DISCONNECTED || callbackObject.mState == BT_STATE.CONNECTION_LOST) {
187197
System.out.println("Device State Change: " + callbackObject.mState);

0 commit comments

Comments
 (0)