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 @@ -235,10 +235,7 @@ public void removeSetWaitForDataAll(){
}

mWaitForData = null;
Iterator<WaitForData> entries = mListWaitForData.iterator();
while (entries.hasNext()) {
entries.remove();
}
mListWaitForData.clear();
}

public void setWaitForDataWithSingleInstanceCheck(BasicProcessWithCallBack b){
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,11 @@

import org.apache.commons.lang3.ArrayUtils;

import com.shimmerresearch.driver.Configuration;
import com.shimmerresearch.driver.ObjectCluster;
import com.shimmerresearch.algorithms.AbstractAlgorithm;
import com.shimmerresearch.algorithms.AlgorithmResultObject;
import com.shimmerresearch.algorithms.gyroOnTheFlyCal.GyroOnTheFlyCalLoader;
import com.shimmerresearch.algorithms.AlgorithmDetails;
import com.shimmerresearch.algorithms.AlgorithmDetails.SENSOR_CHECK_METHOD;
import com.shimmerresearch.algorithms.AlgorithmLoaderInterface;
import com.shimmerresearch.algorithms.orientation.OrientationModule6DOFLoader;
import com.shimmerresearch.algorithms.orientation.OrientationModule9DOFLoader;
Expand All @@ -36,7 +35,6 @@
import com.shimmerresearch.comms.serialPortInterface.AbstractSerialPortHal;
import com.shimmerresearch.comms.wiredProtocol.UartComponentPropertyDetails;
import com.shimmerresearch.driver.Configuration.COMMUNICATION_TYPE;
import com.shimmerresearch.driver.Configuration.Shimmer3;
import com.shimmerresearch.driver.calibration.CalibDetails;
import com.shimmerresearch.driver.calibration.CalibDetailsKinematic;
import com.shimmerresearch.driver.calibration.CalibDetails.CALIB_READ_SOURCE;
Expand Down Expand Up @@ -67,7 +65,6 @@
import com.shimmerresearch.sensors.SensorShimmerClock;
import com.shimmerresearch.shimmerConfig.FixedShimmerConfigs;
import com.shimmerresearch.shimmerConfig.FixedShimmerConfigs.FIXED_SHIMMER_CONFIG_MODE;
import com.shimmerresearch.verisense.communication.VerisenseProtocolByteCommunication;
import com.shimmerresearch.verisense.sensors.ISensorConfig;

public abstract class ShimmerDevice extends BasicProcessWithCallBack implements Serializable{
Expand Down Expand Up @@ -142,13 +139,17 @@ public abstract class ShimmerDevice extends BasicProcessWithCallBack implements
private boolean mConfigurationReadSuccess = false;
public boolean mReadDaughterIDSuccess = false;
public boolean writeRealWorldClockFromPcTimeSuccess = false;
public boolean mReadBtVerSuccess = false;
public boolean mReadBtModeSuccess = false;

protected boolean mIsConnected = false;
protected boolean mIsSensing = false;
protected boolean mIsStreaming = false; // This is used to monitor whether the device is in streaming mode
protected boolean mIsInitialised = false;
private boolean mIsDocked = false;
private boolean mIsUsbPluggedIn= false;
private boolean mIsUsbPluggedIn = false;
private boolean mIsDockCommsSuccessful = false;
public boolean mIsUsbDfuMode= false;
protected boolean mHaveAttemptedToReadConfig = false;

//BSL related start
Expand Down Expand Up @@ -754,7 +755,11 @@ public void addCommunicationRoute(COMMUNICATION_TYPE communicationType) {
// Collections.sort(mListOfAvailableCommunicationTypes);

if(communicationType==COMMUNICATION_TYPE.DOCK){
setIsDocked(true);
if(mDockID.contains(DEVICE_TYPE.SHIMMER3R.toString())) {
setIsUsbPluggedIn(true);
}else {
setIsDocked(true);
}
}

//TODO temp here -> check if the best place for it
Expand All @@ -780,7 +785,8 @@ public void removeCommunicationRoute(COMMUNICATION_TYPE communicationType) {
}
// Collections.sort(mListOfAvailableCommunicationTypes);

if(communicationType==COMMUNICATION_TYPE.DOCK){
if(communicationType==COMMUNICATION_TYPE.DOCK){
setIsUsbPluggedIn(false);
setIsDocked(false);
setFirstDockRead();
clearDockInfo(mDockID, mSlotNumber);
Expand Down Expand Up @@ -1102,6 +1108,14 @@ public boolean isDocked() {
public boolean isUsbPluggedIn() {
return mIsUsbPluggedIn;
}

public boolean isUsbDfuMode(){
return mIsUsbDfuMode;
}

public void setUsbDfuMode(boolean state) {
mIsUsbDfuMode = state;
}

public void setIsConnected(boolean state) {
mIsConnected = state;
Expand Down Expand Up @@ -1691,6 +1705,8 @@ public void setFirstDockRead() {
mReadHwFwSuccess = false;
mReadDaughterIDSuccess = false;
writeRealWorldClockFromPcTimeSuccess = false;
mReadBtVerSuccess = false;
mReadBtModeSuccess = false;
}

// ----------------- Overrides from ShimmerDevice end -------------
Expand Down Expand Up @@ -3076,9 +3092,22 @@ public void setIsAlgorithmEnabled(String algorithmName, boolean state){
if(abstractAlgorithm!=null && abstractAlgorithm.mAlgorithmDetails!=null){
if(state){
//switch on the required sensors
//TODO add support for ANY/ALL sensors
for (Integer sensorId:abstractAlgorithm.mAlgorithmDetails.mListOfRequiredSensors) {
setSensorEnabledState(sensorId, true);
if (abstractAlgorithm.mAlgorithmDetails.mSensorCheckMethod==SENSOR_CHECK_METHOD.ANY) {

int tempSensorId = handleSpecCasesBeforeSetSensorState(sensorId,state);
SensorDetails sensorDetails = getSensorDetails(tempSensorId);
if(sensorDetails!=null){
setSensorEnabledState(sensorId, true);
}
}
else if (abstractAlgorithm.mAlgorithmDetails.mSensorCheckMethod==SENSOR_CHECK_METHOD.ALL) {
boolean success = setSensorEnabledState(sensorId, true);
if(!success){
consolePrintErrLn("Failed to enable required sensor ID " + sensorId + " for algorithm:\t" + abstractAlgorithm.getAlgorithmName());
return;
}
}
}
}
abstractAlgorithm.setIsEnabled(state);
Expand Down Expand Up @@ -4768,4 +4797,12 @@ public String getRadioModel() {
return "";
}

public boolean isDockCommsSuccessful() {
return mIsDockCommsSuccessful;
}

public void setDockCommsSuccessful(boolean isDockCommsSuccessful) {
mIsDockCommsSuccessful = isDockCommsSuccessful;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ public class ShimmerShell extends ShimmerDevice {
/** * */
private static final long serialVersionUID = 3505947289367382624L;

public String macIDParsed = "";

public ShimmerShell() {
setFirstDockRead();
}
Expand Down Expand Up @@ -147,5 +149,23 @@ protected void dataHandler(ObjectCluster ojc) {
// TODO Auto-generated method stub

}

@Override
public String getMacIdFromUartParsed() {
if(!macIDParsed.isEmpty()) {
return macIDParsed;
} else {
return super.getMacIdFromUartParsed();
}
}

@Override
public String getMacIdParsed() {
if(!macIDParsed.isEmpty()) {
return macIDParsed;
} else {
return super.getMacIdParsed();
}
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ public static void generateMultipleShimmerConfig(List<ShimmerDevice> listOfShimm
for(ShimmerDevice shimmerDevice:listOfShimmersToConfigureClone) {
// Configure for docks.
if(commType==COMMUNICATION_TYPE.DOCK
&& shimmerDevice.isDocked()
&& (shimmerDevice.isDocked() || shimmerDevice.isUsbPluggedIn())
&& !shimmerDevice.isStreaming()){
listForConfiguringDocked.add(shimmerDevice.deepClone());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,17 +99,16 @@ public enum DOCK_JOB_TYPE {
aMap.put(getJobErrorCode(DOCK_JOB_TYPE.SET_INDICATOR_LEDS_STATE), "INDICATOR_LEDS_SET");
aMap.put(getJobErrorCode(DOCK_JOB_TYPE.GET_INDICATOR_LEDS_STATE), "INDICATOR_LEDS_GET");
aMap.put(getJobErrorCode(DOCK_JOB_TYPE.ACCESS_SD_CARD), "ACCESS_SD_CARD");

aMap.put(getJobErrorCode(DOCK_JOB_TYPE.FW_DOCK), "FW_DOCK");


aMap.put(getJobErrorCode(DOCK_JOB_TYPE.SHIMMER_WRITE_EXP_BRD_MEMORY), "SHIMMER_WRITE_EXP");


aMap.put(getJobErrorCode(DOCK_JOB_TYPE.DOCK_BOOT), "Fail to detect bootup");
aMap.put(getJobErrorCode(DOCK_JOB_TYPE.DOCK_RESET_VIA_FW), "Failed to reset Base");
aMap.put(getJobErrorCode(DOCK_JOB_TYPE.DOCK_RESET_VIA_BSL), "Failed to reset Base");

aMap.put(getJobErrorCode(DOCK_JOB_TYPE.FW_DOCK), "FW_DOCK");

aMap.put(getJobErrorCode(DOCK_JOB_TYPE.SHIMMER_WRITE_EXP_BRD_MEMORY), "SHIMMER_WRITE_EXP");
aMap.put(getJobErrorCode(DOCK_JOB_TYPE.SHIMMER_WRITE_DAUGHTER_CARD_ID), "SHIMMER_WRITE_DAUGHTER_CARD_ID");

//Experimental
aMap.put(getJobErrorCode(DOCK_JOB_TYPE.DOCK_MANAGER_RELOAD), "DOCK_MANAGER_RELOAD");
aMap.put(getJobErrorCode(DOCK_JOB_TYPE.DOCK_MANAGER_LOAD), "DOCK_MANAGER_LOAD");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,5 +40,6 @@ public class HwDriverDeviceDetails {
public String deviceDriverVersion = "";

public String devInterfaceGuid = "";


public String deviceInstanceId = "";
}
Original file line number Diff line number Diff line change
Expand Up @@ -145,15 +145,10 @@ public static final class MASS_STORAGE_DEVICE {
"VID_0424&PID_2640",
};

public static final String[] SHIMMER_3R = new String[] {
"VID_0483&PID_52A4",
};

public static final String[] SHIMMER_3R_USB_DFU = new String[] {
"VID_0483&PID_DF11",
};


public static final String[] SHIMMER = new String[] {
"shimmer",
};
Expand All @@ -170,6 +165,8 @@ public static final class MASS_STORAGE_DEVICE {

public static final String[] SHIMMER3R_MSC_DEVICE = new String[] { "SHIMMER MSC","STM32 MSC DEVICE" };

public static final String[] SHIMMER3R_DFU_DEVICE_BUS_DESCRITION = new String[] { "DFU in HS Mode" };

public static final class SERVICE_DESCRIPTION {
public static final String[] COMPOSITE_DEVICE = new String[]{"USB Composite Device"};

Expand Down Expand Up @@ -203,6 +200,10 @@ public static final class SERIAL_PORT {
public static final String FTDI_FT4232H_PROD_ID = "6011";

public static final String VIRTUAL_PORT = "COM0COM";

public static final String[] SHIMMER_3R = new String[] {
"VID_0483&PID_52A4"
};
}

public static final class BT {
Expand Down Expand Up @@ -272,6 +273,8 @@ public static final class BASE_HARDWARE_IDS{
public HwDriverDeviceDetails portableDevice = null;
public HwDriverDeviceDetails storageVolume = null;

public HwDriverDeviceDetails dfuDevice = null;

public String mDockID= "";
public String mSmartDockFwComPort= "";
public String mSmartDockUartComPort= "";
Expand All @@ -282,8 +285,8 @@ public static final class BASE_HARDWARE_IDS{

public HIDDeviceInfo mHidDeviceInfo = null;

/** Normally used to store the FTDI serial ID. */
public String mFtdiSerialID = "";
/** Unique HW ID (e.g., FTDI serial ID or location path). */
public String mUniqueHwID = "";
public SPAN_VERSION mSpanVersion = SPAN_VERSION.UNKNOWN;

public HwDriverShimmerDeviceDetails() {
Expand Down
Loading