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 @@ -832,7 +832,11 @@ else if(deviceTypeDetected==DEVICE_TYPE.ARDUINO){
if (shimmerDevice!=null && !(shimmerDevice instanceof ShimmerShell)){
printMessage("Connecting to " + shimmerDevice.getClass().getSimpleName() + " with connection handle = " + (connectThroughComPort? comPort:bluetoothAddress));
if(connectThroughComPort){
connectExistingShimmer(shimmerDevice, comPort, bluetoothAddress);
if (!comPort.contains(COMPORT_PREFIX)) {
connectShimmer3BleGrpc(bluetoothDetails);
}else {
connectExistingShimmer(shimmerDevice, comPort, bluetoothAddress);
}
}
else{
connectExistingShimmer(shimmerDevice, bluetoothAddress);
Expand Down Expand Up @@ -982,6 +986,10 @@ protected void connectVerisenseDevice(BluetoothDeviceDetails bdd) {

}

protected void connectShimmer3BleGrpc(BluetoothDeviceDetails bdd) {

}

protected void connectNoninOnyxII(String comPort, String bluetoothAddress) throws ShimmerException {
NoninOnyxIIDevice noninDevice = new NoninOnyxIIDevice(comPort, bluetoothAddress);
connectThirdPartyDevice(noninDevice, comPort, bluetoothAddress);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@ public String getGuiName() {

public void checkDeviceType() {
if(!mShimmerMacId.equals(UtilShimmer.MAC_ADDRESS_ZEROS)){
if(mFriendlyName.contains(HwDriverShimmerDeviceDetails.SH_SEARCH.BT.SHIMMER3)){
if(mFriendlyName.contains(HwDriverShimmerDeviceDetails.SH_SEARCH.BT.SHIMMER3)
|| mFriendlyName.contains(HwDriverShimmerDeviceDetails.SH_SEARCH.BT.SHIMMER3_RN4678_BLE)){
mDeviceTypeDetected = DEVICE_TYPE.SHIMMER3;
}
else if(mFriendlyName.contains(HwDriverShimmerDeviceDetails.DEVICE_TYPE.SHIMMER3_OUTPUT.getLabel())){
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,8 @@ public static final class TOSHIBA_DRIVER {
}

public static final String SHIMMER3 = "Shimmer3";
public static final String SHIMMER3_RN4678_BLE = "S3BLE";
public static final String SHIMMER3_CYW20820_BLE_SUFFIX = "-BLE";
public static final String SHIMMER_ECG_MD = "ShimmerECGmd";
public static final String SHIMMER4 = "Shimmer4";
public static final String RN42 = "RN42";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,9 @@

public class ShimmerGRPC extends ShimmerBluetooth implements Serializable{
String mMacAddress;
ShimmerBLEByteServerGrpc.ShimmerBLEByteServerBlockingStub blockingStub;
ManagedChannel channel;
ThreadSafeByteFifoBuffer mBuffer;
transient ShimmerBLEByteServerGrpc.ShimmerBLEByteServerBlockingStub blockingStub;
transient ManagedChannel channel;
transient ThreadSafeByteFifoBuffer mBuffer;
String mServerHost = "localhost";
int mServerPort = 50052;
protected transient ShimmerDeviceCallbackAdapter mDeviceCallbackAdapter = new ShimmerDeviceCallbackAdapter(this);
Expand Down Expand Up @@ -463,7 +463,7 @@ public ShimmerDevice deepClone() {

ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
ObjectInputStream ois = new ObjectInputStream(bais);
return (ShimmerPC) ois.readObject();
return (ShimmerDevice) ois.readObject();
} catch (IOException e) {
e.printStackTrace();
return null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import com.shimmerresearch.grpc.GrpcBLERadioByteCommunication;
import com.shimmerresearch.grpc.GrpcBLERadioByteTools;
import com.shimmerresearch.managers.bluetoothManager.ShimmerBluetoothManager;
import com.shimmerresearch.pcDriver.ShimmerGRPC;
import com.shimmerresearch.pcDriver.ShimmerPC;
import com.shimmerresearch.pcSerialPort.SerialPortCommJssc;
import com.shimmerresearch.verisense.VerisenseDevice;
Expand All @@ -34,8 +35,10 @@
public class BasicShimmerBluetoothManagerPc extends ShimmerBluetoothManager {

String mPathToVeriBLEApp = "bleconsoleapp\\BLEConsoleApp1.exe";
List<String> macIdList = new ArrayList<String>();
List<String> verisenseMacIdList = new ArrayList<String>();
List<String> shimmer3BleMacIdList = new ArrayList<String>();
List<VerisenseDevice> verisenseDeviceList = new ArrayList<VerisenseDevice>();
List<ShimmerGRPC> shimmer3BleDeviceList = new ArrayList<ShimmerGRPC>();
public static int mGRPCPort;
public BasicShimmerBluetoothManagerPc() {
GrpcBLERadioByteTools grpcTool = new GrpcBLERadioByteTools();
Expand Down Expand Up @@ -146,7 +149,7 @@ protected Shimmer4sdk createNewShimmer4(ShimmerRadioInitializer radioInitializer
protected void connectVerisenseDevice(BluetoothDeviceDetails bdd) {
VerisenseDevice verisenseDevice;

if(!macIdList.contains(bdd.mShimmerMacId)) {
if(!verisenseMacIdList.contains(bdd.mShimmerMacId)) {
//BleRadioByteCommunication radio1 = new BleRadioByteCommunication(bdd, "bleconsoleapp\\BLEConsoleApp1.exe");

GrpcBLERadioByteCommunication radio1 = new GrpcBLERadioByteCommunication(bdd,"localhost",mGRPCPort);
Expand All @@ -158,10 +161,10 @@ protected void connectVerisenseDevice(BluetoothDeviceDetails bdd) {
initializeNewShimmerCommon(verisenseDevice);

verisenseDeviceList.add(verisenseDevice);
macIdList.add(bdd.mShimmerMacId);
verisenseMacIdList.add(bdd.mShimmerMacId);
}
else {
verisenseDevice = verisenseDeviceList.get(macIdList.indexOf(bdd.mShimmerMacId));
verisenseDevice = verisenseDeviceList.get(verisenseMacIdList.indexOf(bdd.mShimmerMacId));
}

try {
Expand All @@ -174,6 +177,33 @@ protected void connectVerisenseDevice(BluetoothDeviceDetails bdd) {
}
}

@Override
protected void connectShimmer3BleGrpc(BluetoothDeviceDetails bdd) {
ShimmerGRPC shimmer;

if(!shimmer3BleMacIdList.contains(bdd.mShimmerMacId)) {

shimmer = new ShimmerGRPC(bdd.mShimmerMacId.replace(":", ""),"localhost",mGRPCPort);
shimmer.setShimmerUserAssignedName(bdd.mFriendlyName);
shimmer.setMacIdFromUart(bdd.mShimmerMacId);
initializeNewShimmerCommon(shimmer);

shimmer3BleDeviceList.add(shimmer);
shimmer3BleMacIdList.add(bdd.mShimmerMacId);
}
else {
shimmer = shimmer3BleDeviceList.get(shimmer3BleMacIdList.indexOf(bdd.mShimmerMacId));
}

try {
if(shimmer.getBluetoothRadioState() == BT_STATE.CONNECTED || shimmer.getBluetoothRadioState() == BT_STATE.STREAMING || shimmer.getBluetoothRadioState() == BT_STATE.STREAMING_LOGGED_DATA) {
throw new ShimmerException("Device is already connected");
}
shimmer.connect("","");
} catch (ShimmerException e) {
e.printStackTrace();
}
}
@Override
public void connectShimmerThroughCommPort(String comPort){
directConnectUnknownShimmer=true;
Expand Down