Skip to content

Commit a6c754e

Browse files
committed
Merge branch 'master' into CON_v2_1
2 parents 6777c07 + 56dffae commit a6c754e

8 files changed

Lines changed: 320 additions & 8 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()

ShimmerDriver/src/main/java/com/shimmerresearch/driver/Configuration.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -677,7 +677,7 @@ public class SensorBitmap{
677677
* data packets. The firmware also uses the IMU IDs as Sensor IDs in the
678678
* IMU/BMP calibration bytes.
679679
*/
680-
public class SENSOR_ID{
680+
public static class SENSOR_ID{
681681
public static final int RESERVED_ANY_SENSOR = -1;
682682

683683
public static final int HOST_SHIMMER_STREAMING_PROPERTIES = -100;

ShimmerDriver/src/main/java/com/shimmerresearch/driver/ObjectCluster.java

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ final public class ObjectCluster implements Cloneable,Serializable{
8888

8989
private String mMyName;
9090
private String mBluetoothAddress;
91+
private String mComPort;
9192

9293
// ------- Old Array approach - Start -----------
9394
public byte[] mRawData;
@@ -220,6 +221,13 @@ public void setMacAddress(String macAddress){
220221
mBluetoothAddress = macAddress;
221222
}
222223

224+
public void setComPort(String comport) {
225+
mComPort = comport;
226+
}
227+
228+
public String getComPort() {
229+
return mComPort;
230+
}
223231
/**
224232
* Takes in a collection of Format Clusters and returns the Format Cluster specified by the string format
225233
* @param collectionFormatCluster
@@ -247,6 +255,15 @@ public double getFormatClusterValue(ChannelDetails channelDetails, CHANNEL_TYPE
247255
return getFormatClusterValue(channelDetails.mObjectClusterName, channelType.toString());
248256
}
249257

258+
public FormatCluster getFormatCluster(String channelName, String format)
259+
{
260+
FormatCluster formatCluster = getLastFormatCluster(channelName, format);
261+
if(formatCluster!=null){
262+
return formatCluster;
263+
}
264+
return null;
265+
}
266+
250267
// public double getFormatClusterValue(ChannelDetails channelDetails, String format){
251268
// return getFormatClusterValue(channelDetails.mObjectClusterName, format);
252269
// }

ShimmerDriver/src/main/java/com/shimmerresearch/driver/ShimmerDevice.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4502,6 +4502,13 @@ public String getComPort() {
45024502
return mComPort;
45034503
}
45044504

4505+
/**This method will only return the comport name
4506+
* @return
4507+
*/
4508+
public String getComPortName() {
4509+
return mComPort;
4510+
}
4511+
45054512
public boolean isReadyToConnect() {
45064513
if (mCommsProtocolRadio==null
45074514
||mCommsProtocolRadio.mRadioHal==null

ShimmerDriver/src/main/java/com/shimmerresearch/driver/ShimmerObject.java

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -812,6 +812,7 @@ public ObjectCluster buildMsg(byte[] newPacket, COMMUNICATION_TYPE fwType, boole
812812

813813
objectCluster.setShimmerName(mShimmerUserAssignedName);
814814
objectCluster.setMacAddress(mMyBluetoothAddress);
815+
objectCluster.setComPort(getComPortName());
815816
objectCluster.mRawData = newPacket;
816817

817818
if(fwType!=COMMUNICATION_TYPE.BLUETOOTH && fwType!=COMMUNICATION_TYPE.SD){
@@ -4845,7 +4846,8 @@ public void setDefaultShimmerConfiguration() {
48454846
clearExgConfig(); // this currently must be called before sensorAndConfigMapsCreate() as it controls ExG booleans which affect EnabledSensors
48464847
sensorAndConfigMapsCreate();
48474848

4848-
if (getHardwareVersion() == HW_ID.SHIMMER_3){
4849+
int hwVersion = getHardwareVersion();
4850+
if (hwVersion == HW_ID.SHIMMER_3){
48494851
if(getExpansionBoardId()==HW_ID_SR_CODES.SHIMMER_ECG_MD){
48504852
setSensorEnabledState(Configuration.Shimmer3.SENSOR_ID.HOST_ECG, true);
48514853
} else {
@@ -4856,6 +4858,13 @@ public void setDefaultShimmerConfiguration() {
48564858

48574859
setIsAlgorithmEnabled(GyroOnTheFlyCalModule.GENERAL_ALGORITHM_NAME, true);
48584860
}
4861+
} else if (hwVersion == HW_ID.SHIMMER_3R) {
4862+
setSensorEnabledState(Configuration.Shimmer3.SENSOR_ID.SHIMMER_LSM6DSV_ACCEL_LN, true);
4863+
setSensorEnabledState(Configuration.Shimmer3.SENSOR_ID.SHIMMER_LSM6DSV_GYRO, true);
4864+
setSensorEnabledState(Configuration.Shimmer3.SENSOR_ID.SHIMMER_LIS2MDL_MAG, true);
4865+
setSensorEnabledState(Configuration.Shimmer3.SENSOR_ID.SHIMMER_VBATT, true);
4866+
4867+
setIsAlgorithmEnabled(GyroOnTheFlyCalModule.GENERAL_ALGORITHM_NAME, true);
48594868
}
48604869

48614870
mTrialName = DEFAULT_EXPERIMENT_NAME;

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
@@ -102,3 +106,20 @@ dependencies {
102106
// https://mvnrepository.com/artifact/org.bouncycastle/bcprov-jdk15on
103107
implementation("org.bouncycastle:bcprov-jdk15on:1.61")
104108
}
109+
110+
// Shadow JAR task to create a runnable JAR with dependencies
111+
/*
112+
Change to using the following below for ShimmerDriverPC/ShimmerDriver/ShimmerBluetoothManager
113+
sourceCompatibility = '1.8' // Ensure code is compiled with Java 8
114+
targetCompatibility = '1.8' // Ensure bytecode is compatible with Java 8
115+
*/
116+
shadowJar {
117+
archiveBaseName.set('ShimmerJavaClass') // Use archiveBaseName instead of baseName
118+
archiveClassifier.set('') // Remove classifier so it’s named shimmerjavaclass.jar
119+
120+
manifest {
121+
attributes 'Main-Class': 'com.shimmerresearch.tools.matlab.ShimmerJavaClass' // Specify the main class
122+
}
123+
124+
mergeServiceFiles() // Merges service files (if any)
125+
}

0 commit comments

Comments
 (0)