Skip to content
Closed
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 @@ -902,6 +902,7 @@ public class GuiLabelConfig{
public static final String ENABLE_ERROR_LEDS_RTC = "RTC Error LEDs";
public static final String ENABLE_ERROR_LEDS_SD = "SD Error LEDs";
public static final String LOW_POWER_AUTOSTOP = "Low-power Autostop";
public static final String RAW_AUDIO = "Store Raw Audio";

public static final String KINEMATIC_LPM = "Kinematic Sensors Low-Power Mode";//XXX-RS-LSM-SensorClass? What about HighResolutionMode?!
public static final String CALIBRATION_ALL = AbstractSensor.GuiLabelConfigCommon.CALIBRATION_ALL;
Expand Down Expand Up @@ -2002,6 +2003,13 @@ public static class CompatibilityInfoForMaps{
ConfigOptionDetailsSensor.GUI_COMPONENT_TYPE.CHECKBOX,
Arrays.asList(new ShimmerVerObject(FW_ID.LOGANDSTREAM, 0, 9, 6),
new ShimmerVerObject(FW_ID.SDLOG, 0, 17, 3)));

/** Bench audio recorder (audiorec9): also store the microphone WAV beside the fingerprint. */
public static final ConfigOptionDetailsSensor configOptionRawAudio = new ConfigOptionDetailsSensor(
Configuration.Shimmer3.GuiLabelConfig.RAW_AUDIO,
ShimmerDevice.DatabaseConfigHandle.RAW_AUDIO,
ConfigOptionDetailsSensor.GUI_COMPONENT_TYPE.CHECKBOX,
Arrays.asList(new ShimmerVerObject(HW_ID.SHIMMER_3R, FW_ID.LOGANDSTREAM, 1, 1, 21)));

public static final Map<String, ConfigOptionDetailsSensor> mConfigOptionsMapRef;
static {
Expand Down Expand Up @@ -2275,6 +2283,7 @@ public static class CompatibilityInfoForMaps{
CompatibilityInfoForMaps.listOfCompatibleVersionInfoAnyExpBoardAndFw));

aMap.put(Configuration.Shimmer3.GuiLabelConfig.LOW_POWER_AUTOSTOP, configOptionLowPowerAutoStop);
aMap.put(Configuration.Shimmer3.GuiLabelConfig.RAW_AUDIO, configOptionRawAudio);

mConfigOptionsMapRef3r = Collections.unmodifiableMap(aMap);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,7 @@ public static final class DatabaseConfigHandle{
public static final String TRIAL_ID = "Trial_Id";
public static final String N_SHIMMER = "NShimmer";
public static final String LOW_POWER_AUTOSTOP = "Low_Power_Autostop";
public static final String RAW_AUDIO = "Raw_Audio";

public static final String SHIMMER_VERSION = "Shimmer_Version";
public static final String FW_VERSION = "FW_ID";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -574,6 +574,9 @@ public String toString() {
private boolean isOverrideShowErrorLedsSd = false;
private int mShowErrorLedsSd = 0;
private boolean mLowBattAutoStop = false;
private boolean mRawAudio = false;
/** Only internal apps may switch raw audio on; any other app writes it off. */
private static boolean sIsRawAudioAllowed = false;

protected int mTrialId = 0;
protected int mTrialNumberOfShimmers = 0;
Expand Down Expand Up @@ -4989,6 +4992,7 @@ public void setDefaultShimmerConfiguration() {
setSingleTouch(false);
setTCXO(false);
setLowBattAutoStop(false);
setRawAudio(false);

setPacketSize(0);
mConfigByte0=0;
Expand Down Expand Up @@ -5160,6 +5164,10 @@ public void configBytesParse(byte[] configBytes, COMMUNICATION_TYPE commType) {
if(isVerCompatibleWithAnyOf(Configuration.Shimmer3.configOptionLowPowerAutoStop.mListOfCompatibleVersionInfo)) {
setLowBattAutoStop((configBytes[configByteLayoutCast.idxSDExperimentConfig1] >> configByteLayoutCast.bitShiftLowBattStop) & configByteLayoutCast.maskLowBattStop);
}

if(isVerCompatibleWithAnyOf(Configuration.Shimmer3.configOptionRawAudio.mListOfCompatibleVersionInfo)) {
setRawAudio(((configBytes[configByteLayoutCast.idxSDExperimentConfig1] >> configByteLayoutCast.bitShiftRawAudio) & configByteLayoutCast.maskRawAudio) > 0);
}

byte[] macIdBytes = new byte[configByteLayoutCast.lengthMacIdBytes];
System.arraycopy(configBytes, configByteLayoutCast.idxMacAddress, macIdBytes, 0 , configByteLayoutCast.lengthMacIdBytes);
Expand Down Expand Up @@ -5419,6 +5427,10 @@ public byte[] configBytesGenerate(boolean generateForWritingToShimmer, COMMUNICA
mConfigBytes[configByteLayoutCast.idxSDExperimentConfig1] |= (byte) ((isLowBattAutoStop()?1:0 & configByteLayoutCast.maskLowBattStop) << configByteLayoutCast.bitShiftLowBattStop);
}

if(isVerCompatibleWithAnyOf(Configuration.Shimmer3.configOptionRawAudio.mListOfCompatibleVersionInfo)) {
mConfigBytes[configByteLayoutCast.idxSDExperimentConfig1] |= (byte) ((((sIsRawAudioAllowed && isRawAudio())?1:0) & configByteLayoutCast.maskRawAudio) << configByteLayoutCast.bitShiftRawAudio);
}

if(getFirmwareIdentifier()==FW_ID.LOGANDSTREAM || getFirmwareIdentifier()==FW_ID.SDLOG || getFirmwareIdentifier()==FW_ID.STROKARE) {
if(generateForWritingToShimmer) {
// MAC address - set to all 0xFF (i.e. invalid MAC) so that Firmware will know to check for MAC from Bluetooth transceiver
Expand Down Expand Up @@ -6207,6 +6219,18 @@ private boolean isLowBattAutoStop() {
return mLowBattAutoStop;
}

public void setRawAudio(boolean state) {
mRawAudio = state;
}

public boolean isRawAudio() {
return mRawAudio;
}

public static void setRawAudioAllowed(boolean isAllowed) {
sIsRawAudioAllowed = isAllowed;
}

/**
* @return the mTrialNumberOfShimmers
*/
Expand Down Expand Up @@ -9735,6 +9759,9 @@ public Object getConfigValueUsingConfigLabel(String identifier, String configLab
case(Configuration.Shimmer3.GuiLabelConfig.LOW_POWER_AUTOSTOP):
returnValue = isLowBattAutoStop();
break;
case(Configuration.Shimmer3.GuiLabelConfig.RAW_AUDIO):
returnValue = isRawAudio();
break;

case(Configuration.Shimmer3.GuiLabelConfig.BLUETOOTH_BAUD_RATE):
returnValue = getBluetoothBaudRate();
Expand Down Expand Up @@ -9903,6 +9930,9 @@ public Object setConfigValueUsingConfigLabel(String identifier, String configLab
case(Configuration.Shimmer3.GuiLabelConfig.LOW_POWER_AUTOSTOP):
setLowBattAutoStop((boolean)valueToSet);
break;
case(Configuration.Shimmer3.GuiLabelConfig.RAW_AUDIO):
setRawAudio((boolean)valueToSet && isVerCompatibleWithAnyOf(Configuration.Shimmer3.configOptionRawAudio.mListOfCompatibleVersionInfo));
break;

case(Configuration.Shimmer3.GuiLabelConfig.BLUETOOTH_BAUD_RATE):
setBluetoothBaudRate((int)valueToSet);
Expand Down Expand Up @@ -10151,6 +10181,7 @@ public LinkedHashMap<String, Object> generateConfigMap(COMMUNICATION_TYPE commTy
configMapForDb.put(DatabaseConfigHandleShimmerObject.TRIAL_DURATION_MAXIMUM, (double) getTrialDurationMaximumInSecs());

configMapForDb.put(ShimmerDevice.DatabaseConfigHandle.LOW_POWER_AUTOSTOP, (double) (isLowBattAutoStop()? 1:0));
configMapForDb.put(ShimmerDevice.DatabaseConfigHandle.RAW_AUDIO, (double) (isRawAudio()? 1:0));

//Now handled in the algorithm class in super
/**
Expand Down Expand Up @@ -10200,6 +10231,9 @@ public void parseConfigMap(ShimmerVerObject svo, LinkedHashMap<String, Object> m
if(mapOfConfigPerShimmer.containsKey(DatabaseConfigHandle.LOW_POWER_AUTOSTOP)){
setLowBattAutoStop(((Double) mapOfConfigPerShimmer.get(DatabaseConfigHandle.LOW_POWER_AUTOSTOP))>0? true:false);
}
if(mapOfConfigPerShimmer.containsKey(DatabaseConfigHandle.RAW_AUDIO)){
setRawAudio(((Double) mapOfConfigPerShimmer.get(DatabaseConfigHandle.RAW_AUDIO))>0);
}

//EXG Configuration
byte[] exg1Bytes = SensorEXG.parseExgConfigFromDb(mapOfConfigPerShimmer, EXG_CHIP_INDEX.CHIP1,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,9 @@ public class ConfigByteLayoutShimmer3 extends ConfigByteLayout implements Serial
public int bitShiftLowBattStop = 0;
public int maskLowBattStop = 0x01;

public int bitShiftRawAudio = 1;
public int maskRawAudio = 0x01;

public int bitShiftTCX0 = 4;
public int maskTimeTCX0 = 0x01;

Expand Down
Loading