Skip to content

Commit 563dd5b

Browse files
authored
Merge pull request #237 from ShimmerEngineering/DEV-405
DEV-405
2 parents d56942c + 645bd83 commit 563dd5b

9 files changed

Lines changed: 38 additions & 10 deletions

File tree

ShimmerDriver/src/main/java/com/shimmerresearch/bluetooth/ShimmerBluetooth.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -505,6 +505,7 @@ public int getNumCrcBytes() {
505505

506506
public static final int MSG_IDENTIFIER_VERISENSE_ERASE_DATA_COMPLETED = 14;
507507
public static final int MSG_IDENTIFIER_VERISENSE_WRITE_OPCONFIG_COMPLETED = 15;
508+
public static final int MSG_IDENTIFIER_SYNC_COMPLETED = 16;
508509

509510
// private boolean mVerboseMode = true;
510511
// private String mParentClassName = "ShimmerPC";

ShimmerDriver/src/main/java/com/shimmerresearch/comms/radioProtocol/RadioListener.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ public interface RadioListener {
2626
public void isNowStreamingCallback();
2727
public void hasStopStreamingCallback();
2828
public void isNowStreamLoggedDataCallback();
29-
public void hasStopStreamLoggedDataCallback();
29+
public void hasStopStreamLoggedDataCallback(String binPath);
3030
public void initialiseStreamingCallback();
3131

3232
// public void eventSyncStates(boolean isDocked, boolean isInitialised, boolean isSdLogging, boolean isSensing, boolean isStreaming, boolean haveAttemptedToRead);

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,11 @@ public void newSyncPayloadReceived(int payloadIndex, boolean crcError, double tr
107107
mShimmerDevice.sendCallBackMsg(ShimmerBluetooth.MSG_IDENTIFIER_SYNC_PROGRESS, callBackObject);
108108
}
109109

110+
public void readLoggedDataCompleted(String binFilePath) {
111+
CallbackObject callBackObject = new CallbackObject(getMacId(), getComPort(), new SyncProgressDetails(binFilePath));
112+
mShimmerDevice.sendCallBackMsg(ShimmerBluetooth.MSG_IDENTIFIER_SYNC_COMPLETED, callBackObject);
113+
}
114+
110115
public void eraseDataCompleted() {
111116
CallbackObject callBackObject = new CallbackObject(getMacId(), getComPort(), true);
112117
mShimmerDevice.sendCallBackMsg(ShimmerBluetooth.MSG_IDENTIFIER_VERISENSE_ERASE_DATA_COMPLETED, callBackObject);

ShimmerDriver/src/main/java/com/shimmerresearch/driver/shimmer4sdk/Shimmer4sdk.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -693,7 +693,7 @@ public void isNowStreamLoggedDataCallback() {
693693
}
694694

695695
@Override
696-
public void hasStopStreamLoggedDataCallback() {
696+
public void hasStopStreamLoggedDataCallback(String binPath) {
697697
// TODO Auto-generated method stub
698698

699699
}

ShimmerDriver/src/main/java/com/shimmerresearch/verisense/VerisenseDevice.java

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1686,7 +1686,8 @@ public void isNowStreamLoggedDataCallback() {
16861686
}
16871687

16881688
@Override
1689-
public void hasStopStreamLoggedDataCallback() {
1689+
public void hasStopStreamLoggedDataCallback(String binFilePath) {
1690+
mDeviceCallbackAdapter.readLoggedDataCompleted(binFilePath);
16901691
// TODO Auto-generated method stub
16911692
setBluetoothRadioState(BT_STATE.CONNECTED);
16921693
}
@@ -1940,6 +1941,16 @@ public void readLoggedData() throws ShimmerException {
19401941
mapOfVerisenseProtocolByteCommunication.get(currentStreamingCommsRoute).readLoggedData();
19411942
}
19421943

1944+
public void setRootPathForBinFile(String path) {
1945+
mapOfVerisenseProtocolByteCommunication.get(currentStreamingCommsRoute).setRootPathForBinFile(path);
1946+
}
1947+
1948+
public void deleteData() throws Exception {
1949+
1950+
mapOfVerisenseProtocolByteCommunication.get(currentStreamingCommsRoute).eraseDataTask().waitForCompletion();
1951+
1952+
}
1953+
19431954
/**
19441955
* @return Null if sensor not supported by current hardware
19451956
* @see SensorLIS2DW12
@@ -2187,15 +2198,15 @@ public void setPendingEventScheduleRwcSync(PendingEventSchedule pendingEventSche
21872198
}
21882199

21892200
/**
2190-
* The number of minute’s interval the ASM sensor will wait after a failed connection attempt before turning on the scheduler again
2201+
* The number of minutes interval the ASM sensor will wait after a failed connection attempt before turning on the scheduler again
21912202
* @return interval in minutes, if this value is set to either 0 or 65535 then the adaptive scheduler will never be turned on.
21922203
*/
21932204
public int getAdaptiveSchedulerInterval() {
21942205
return adaptiveSchedulerInterval;
21952206
}
21962207

21972208
/**
2198-
* The number of minute’s interval the ASM sensor will wait after a failed connection attempt before turning on the scheduler again
2209+
* The number of minutes interval the ASM sensor will wait after a failed connection attempt before turning on the scheduler again
21992210
* @param adaptiveSchedulerInterval interval in minutes, if this value is set to either 0 or 65535 then the adaptive scheduler will never be turned on.
22002211
*/
22012212
public void setAdaptiveSchedulerInterval(int adaptiveSchedulerInterval) {

ShimmerDriver/src/main/java/com/shimmerresearch/verisense/communication/SyncProgressDetails.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,7 @@ public SyncProgressDetails(int payloadIndex, boolean crcError, double transferRa
1212
mTransferRateBytes = transferRateBytes;
1313
mBinFilePath = binFilePath;
1414
}
15+
public SyncProgressDetails(String binFilePath) {
16+
mBinFilePath = binFilePath;
17+
}
1518
}

ShimmerDriver/src/main/java/com/shimmerresearch/verisense/communication/VerisenseProtocolByteCommunication.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ void handleResponse(VerisenseMessage verisenseMessage) {
195195
resetFileNameOnStreamingLoggedDataFinish();
196196
stateChange(VerisenseProtocolState.Connected);
197197
for (RadioListener rl : mRadioListenerList) {
198-
rl.hasStopStreamLoggedDataCallback();
198+
rl.hasStopStreamLoggedDataCallback(getDataFilePath());
199199
}
200200
}
201201

ShimmerDriverPC/src/main/java/com/shimmerresearch/driver/ble/BleRadioByteCommunication.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ public void connect() throws ShimmerException{
188188
WriteDataToProcess("Connect");
189189
mTaskConnect = new TaskCompletionSource<>();
190190
try {
191-
boolean result = mTaskConnect.getTask().waitForCompletion(2, TimeUnit.SECONDS);
191+
boolean result = mTaskConnect.getTask().waitForCompletion(6, TimeUnit.SECONDS);
192192
if (result) {
193193

194194
} else {

ShimmerDriverPC/src/main/java/com/shimmerresearch/tools/bluetooth/BasicShimmerBluetoothManagerPc.java

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,19 +39,27 @@ public class BasicShimmerBluetoothManagerPc extends ShimmerBluetoothManager {
3939
List<String> shimmer3BleMacIdList = new ArrayList<String>();
4040
List<VerisenseDevice> verisenseDeviceList = new ArrayList<VerisenseDevice>();
4141
List<ShimmerGRPC> shimmer3BleDeviceList = new ArrayList<ShimmerGRPC>();
42-
private boolean mInternalUse = true;
4342
public static int mGRPCPort;
4443

4544
public BasicShimmerBluetoothManagerPc() {
4645
startGrpc();
4746
}
4847

49-
public BasicShimmerBluetoothManagerPc(boolean isInternalUse) {
50-
if(isInternalUse) {
48+
public BasicShimmerBluetoothManagerPc(boolean enableGRPC) {
49+
if(enableGRPC) {
5150
startGrpc();
5251
}
5352
}
5453

54+
protected void startGrpc(String path) {
55+
try {
56+
GrpcBLERadioByteTools grpcTool = new GrpcBLERadioByteTools("ShimmerBLEGrpc.exe",path);
57+
mGRPCPort = grpcTool.startServer();
58+
} catch(Exception e) {
59+
e.printStackTrace();
60+
}
61+
}
62+
5563
private void startGrpc() {
5664
try {
5765
GrpcBLERadioByteTools grpcTool = new GrpcBLERadioByteTools();

0 commit comments

Comments
 (0)