Skip to content

Commit c2a8d51

Browse files
committed
DEV-651 #time 10m Implemented new BT command for factory use
1 parent b7cab13 commit c2a8d51

3 files changed

Lines changed: 29 additions & 6 deletions

File tree

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

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -275,6 +275,7 @@ public String toString() {
275275
protected boolean mEnablePCTimeStamps = true;
276276
protected BT_CRC_MODE mBtCommsCrcModeCurrent = BT_CRC_MODE.OFF;
277277
protected static BT_CRC_MODE DEFAULT_BT_CRC_MODE_IF_SUPPORTED = BT_CRC_MODE.ONE_BYTE_CRC;
278+
public static boolean RN4678_ERROR_DETECTION_ENABLED = false;
278279

279280
public enum BT_CRC_MODE {
280281
OFF(0),
@@ -292,6 +293,11 @@ public int getNumCrcBytes() {
292293
}
293294
}
294295

296+
public enum SHIMMER_FEATURE {
297+
NONE,
298+
RN4678_ERROR_DETECTION,
299+
}
300+
295301
public static final Map<Byte, BtCommandDetails> mBtCommandMapOther;
296302
static {
297303
Map<Byte, BtCommandDetails> aMap = new LinkedHashMap<Byte, BtCommandDetails>();
@@ -420,7 +426,8 @@ public int getNumCrcBytes() {
420426
aMap.put(UPD_SDLOG_CFG_COMMAND, new BtCommandDetails(UPD_SDLOG_CFG_COMMAND, "UPD_SDLOG_CFG_COMMAND"));
421427
aMap.put(SET_CRC_COMMAND, new BtCommandDetails(SET_CRC_COMMAND, "SET_CRC_COMMAND"));
422428
aMap.put(SET_RWC_COMMAND, new BtCommandDetails(SET_RWC_COMMAND, "SET_RWC_COMMAND"));
423-
aMap.put(SET_TEST, new BtCommandDetails(SET_TEST, "SET_TEST_COMMAND"));
429+
aMap.put(SET_TEST, new BtCommandDetails(SET_TEST, "SET_TEST_COMMAND"));
430+
aMap.put(SET_FEATURE, new BtCommandDetails(SET_FEATURE, "SET_FEATURE_COMMAND"));
424431
mBtSetCommandMap = Collections.unmodifiableMap(aMap);
425432
}
426433

@@ -2637,6 +2644,10 @@ private void initializeShimmer3or3R(int hardwareVersion){
26372644
writeBtCommsCrcMode(DEFAULT_BT_CRC_MODE_IF_SUPPORTED);
26382645
}
26392646

2647+
if (RN4678_ERROR_DETECTION_ENABLED && isSupportedRn4678ErrorTest()) {
2648+
wristSetFeatureCommand(SHIMMER_FEATURE.RN4678_ERROR_DETECTION.ordinal(), 1);
2649+
}
2650+
26402651
if (isSetupDeviceWhileConnecting()){
26412652
if(mFixedShimmerConfigMode!=null && mFixedShimmerConfigMode!=FIXED_SHIMMER_CONFIG_MODE.NONE){
26422653
boolean triggerConfig = setFixedConfigWhenConnecting();
@@ -4631,6 +4642,10 @@ public void writeMemCommand(int command, int address, byte[] infoMemBytes) {
46314642
writeInstruction(instructionBuffer);
46324643
}
46334644
}
4645+
4646+
public void wristSetFeatureCommand(int feature, int setting){
4647+
writeInstruction(new byte[]{SET_FEATURE, (byte)feature, (byte)setting});
4648+
}
46344649

46354650
//endregion --------- READ/WRITE FUNCTIONS ---------
46364651

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

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2166,6 +2166,15 @@ public static boolean isSupportedNoImuSensors(ShimmerVerObject svo, ExpansionBoa
21662166
}
21672167
}
21682168

2169+
public boolean isSupportedRn4678ErrorTest() {
2170+
if((isShimmerGen3() && getFirmwareIdentifier()==ShimmerVerDetails.FW_ID.LOGANDSTREAM
2171+
&& mShimmerVerObject.compareVersions(HW_ID.SHIMMER_3, FW_ID.LOGANDSTREAM, 1, 0, 17))){
2172+
return true;
2173+
}
2174+
return false;
2175+
}
2176+
2177+
21692178
/**
21702179
* Check each entry in the passed in list to see if the current Shimmer
21712180
* version information in this instance of ShimmerDevice is compatible with

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

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -476,10 +476,6 @@ public class BTStream {
476476
public static final byte PRESSURE_OVERSAMPLING_RATIO_RESPONSE = (byte) 0x53;
477477
public static final byte GET_PRESSURE_OVERSAMPLING_RATIO_COMMAND = (byte) 0x54;
478478

479-
public static final byte SET_PRESSURE_SAMPLING_RATE_COMMAND = (byte) 0xB5;
480-
public static final byte PRESSURE_SAMPLING_RATE_RESPONSE = (byte) 0xB6;
481-
public static final byte GET_PRESSURE_SAMPLING_RATE_COMMAND = (byte) 0xB7;
482-
483479
//new BT + SD command to set/rsp/get/update_dump_file all calibration parameters using the new byte array structure
484480
public static final byte SET_CALIB_DUMP_COMMAND = (byte) 0x98;
485481
public static final byte RSP_CALIB_DUMP_COMMAND = (byte) 0x99;
@@ -490,7 +486,10 @@ public class BTStream {
490486

491487
public static final byte GET_BT_FW_VERSION_STR_COMMAND = (byte) 0xA1;
492488
public static final byte BT_FW_VERSION_STR_RESPONSE = (byte) 0xA2;
493-
public static final byte SET_TEST = (byte) 0xA8;
489+
public static final byte SET_TEST = (byte) 0xA8;
490+
491+
public static final byte SET_FEATURE = (byte) 0xB7;
492+
494493
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
495494
public static final int MAX_INQUIRY_PACKET_SIZE = 47;
496495

0 commit comments

Comments
 (0)