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 @@ -275,6 +275,7 @@ public String toString() {
protected boolean mEnablePCTimeStamps = true;
protected BT_CRC_MODE mBtCommsCrcModeCurrent = BT_CRC_MODE.OFF;
protected static BT_CRC_MODE DEFAULT_BT_CRC_MODE_IF_SUPPORTED = BT_CRC_MODE.ONE_BYTE_CRC;
public static boolean RN4678_ERROR_DETECTION_ENABLED = false;

public enum BT_CRC_MODE {
OFF(0),
Expand All @@ -292,6 +293,11 @@ public int getNumCrcBytes() {
}
}

public enum SHIMMER_FEATURE {
NONE,
RN4678_ERROR_DETECTION,
}

public static final Map<Byte, BtCommandDetails> mBtCommandMapOther;
static {
Map<Byte, BtCommandDetails> aMap = new LinkedHashMap<Byte, BtCommandDetails>();
Expand Down Expand Up @@ -420,7 +426,8 @@ public int getNumCrcBytes() {
aMap.put(UPD_SDLOG_CFG_COMMAND, new BtCommandDetails(UPD_SDLOG_CFG_COMMAND, "UPD_SDLOG_CFG_COMMAND"));
aMap.put(SET_CRC_COMMAND, new BtCommandDetails(SET_CRC_COMMAND, "SET_CRC_COMMAND"));
aMap.put(SET_RWC_COMMAND, new BtCommandDetails(SET_RWC_COMMAND, "SET_RWC_COMMAND"));
aMap.put(SET_TEST, new BtCommandDetails(SET_TEST, "SET_TEST_COMMAND"));
aMap.put(SET_TEST, new BtCommandDetails(SET_TEST, "SET_TEST_COMMAND"));
aMap.put(SET_FEATURE, new BtCommandDetails(SET_FEATURE, "SET_FEATURE_COMMAND"));
mBtSetCommandMap = Collections.unmodifiableMap(aMap);
}

Expand Down Expand Up @@ -2302,6 +2309,9 @@ else if(currentCommand==SET_CRC_COMMAND){
else if(currentCommand==SET_TEST){
InShimmerTest = true;
}
else if (currentCommand == SET_FEATURE) {
// TODO: do something?
}
else {
//unhandled set command
printLogDataForDebugging("Unhandled set command: " + btCommandToString(currentCommand));
Expand Down Expand Up @@ -2637,6 +2647,10 @@ private void initializeShimmer3or3R(int hardwareVersion){
writeBtCommsCrcMode(DEFAULT_BT_CRC_MODE_IF_SUPPORTED);
}

if (RN4678_ERROR_DETECTION_ENABLED && isSupportedRn4678ErrorDetection()) {
writeSetFeatureCommand(SHIMMER_FEATURE.RN4678_ERROR_DETECTION.ordinal(), 1);
}

if (isSetupDeviceWhileConnecting()){
if(mFixedShimmerConfigMode!=null && mFixedShimmerConfigMode!=FIXED_SHIMMER_CONFIG_MODE.NONE){
boolean triggerConfig = setFixedConfigWhenConnecting();
Expand Down Expand Up @@ -4631,6 +4645,15 @@ public void writeMemCommand(int command, int address, byte[] infoMemBytes) {
writeInstruction(instructionBuffer);
}
}

/**
* writeSetFeatureCommand(feature, setting) sets a particular feature on the Shimmer device to the desired setting.
* @param feature is a numeric value defining the feature to be set.
* @param setting is a numeric value defining the desired setting for the feature. Example valid settings values are 0 (Disable feature) and 1 (Enable feature)
*/
public void writeSetFeatureCommand(int feature, int setting){
writeInstruction(new byte[]{SET_FEATURE, (byte)feature, (byte)setting});
}

//endregion --------- READ/WRITE FUNCTIONS ---------

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2166,6 +2166,15 @@ public static boolean isSupportedNoImuSensors(ShimmerVerObject svo, ExpansionBoa
}
}

public boolean isSupportedRn4678ErrorDetection() {
if((isShimmerGen3() && getFirmwareIdentifier()==ShimmerVerDetails.FW_ID.LOGANDSTREAM
&& mShimmerVerObject.compareVersions(HW_ID.SHIMMER_3, FW_ID.LOGANDSTREAM, 1, 0, 17))){
return true;
}
return false;
}


/**
* Check each entry in the passed in list to see if the current Shimmer
* version information in this instance of ShimmerDevice is compatible with
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -476,10 +476,6 @@ public class BTStream {
public static final byte PRESSURE_OVERSAMPLING_RATIO_RESPONSE = (byte) 0x53;
public static final byte GET_PRESSURE_OVERSAMPLING_RATIO_COMMAND = (byte) 0x54;

public static final byte SET_PRESSURE_SAMPLING_RATE_COMMAND = (byte) 0xB5;
public static final byte PRESSURE_SAMPLING_RATE_RESPONSE = (byte) 0xB6;
public static final byte GET_PRESSURE_SAMPLING_RATE_COMMAND = (byte) 0xB7;

//new BT + SD command to set/rsp/get/update_dump_file all calibration parameters using the new byte array structure
public static final byte SET_CALIB_DUMP_COMMAND = (byte) 0x98;
public static final byte RSP_CALIB_DUMP_COMMAND = (byte) 0x99;
Expand All @@ -490,7 +486,10 @@ public class BTStream {

public static final byte GET_BT_FW_VERSION_STR_COMMAND = (byte) 0xA1;
public static final byte BT_FW_VERSION_STR_RESPONSE = (byte) 0xA2;
public static final byte SET_TEST = (byte) 0xA8;
public static final byte SET_TEST = (byte) 0xA8;

public static final byte SET_FEATURE = (byte) 0xB7;

public static final int MAX_NUMBER_OF_SIGNALS = 77;//50; //used to be 11 but now 13 because of the SR30 + 8 for 3d orientation
public static final int MAX_INQUIRY_PACKET_SIZE = 47;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,24 +104,18 @@ public static final class ObjectClusterSensorName{
public static final byte PRESSURE_CALIBRATION_COEFFICIENTS_RESPONSE = (byte) 0xA6;
public static final byte GET_PRESSURE_CALIBRATION_COEFFICIENTS_COMMAND = (byte) 0xA7;

public static final byte SET_PRESSURE_SAMPLING_RATE_COMMAND = (byte) 0xB5;
public static final byte PRESSURE_SAMPLING_RATE_RESPONSE = (byte) 0xB6;
public static final byte GET_PRESSURE_SAMPLING_RATE_COMMAND = (byte) 0xB7;

public static final Map<Byte, BtCommandDetails> mBtGetCommandMap;
static {
Map<Byte, BtCommandDetails> aMap = new LinkedHashMap<Byte, BtCommandDetails>();
aMap.put(GET_PRESSURE_OVERSAMPLING_RATIO_COMMAND, new BtCommandDetails(GET_PRESSURE_OVERSAMPLING_RATIO_COMMAND, "GET_PRESSURE_OVERSAMPLING_RATIO_COMMAND", PRESSURE_OVERSAMPLING_RATIO_RESPONSE));
aMap.put(GET_PRESSURE_CALIBRATION_COEFFICIENTS_COMMAND, new BtCommandDetails(GET_PRESSURE_CALIBRATION_COEFFICIENTS_COMMAND, "GET_PRESSURE_CALIBRATION_COEFFICIENTS_COMMAND", PRESSURE_CALIBRATION_COEFFICIENTS_RESPONSE));
aMap.put(GET_PRESSURE_SAMPLING_RATE_COMMAND, new BtCommandDetails(GET_PRESSURE_SAMPLING_RATE_COMMAND, "GET_PRESSURE_SAMPLING_RATE_COMMAND", PRESSURE_SAMPLING_RATE_RESPONSE));
mBtGetCommandMap = Collections.unmodifiableMap(aMap);
}

public static final Map<Byte, BtCommandDetails> mBtSetCommandMap;
static {
Map<Byte, BtCommandDetails> aMap = new LinkedHashMap<Byte, BtCommandDetails>();
aMap.put(SET_PRESSURE_OVERSAMPLING_RATIO_COMMAND, new BtCommandDetails(SET_PRESSURE_OVERSAMPLING_RATIO_COMMAND, "SET_PRESSURE_OVERSAMPLING_RATIO_COMMAND"));
aMap.put(SET_PRESSURE_SAMPLING_RATE_COMMAND, new BtCommandDetails(SET_PRESSURE_SAMPLING_RATE_COMMAND, "SET_PRESSURE_SAMPLING_RATE_COMMAND"));
mBtSetCommandMap = Collections.unmodifiableMap(aMap);
}
//--------- Bluetooth commands end --------------
Expand Down
Loading