2020-06-02 17:19:09 +02:00
|
|
|
import { combineReducers } from 'redux';
|
2020-06-28 18:55:58 +02:00
|
|
|
import { deviceStateReducer } from "./DeviceReduxCoupling";
|
2020-06-02 17:19:09 +02:00
|
|
|
|
2020-06-28 22:10:54 +02:00
|
|
|
export const CHANGE_USER_NAME = "SET_USERNAME";
|
|
|
|
export const CHANGE_THEME = "CHANGE_THEME";
|
|
|
|
export const RESET_DEVICE_DATA = "RESET_DEVICE_DATA";
|
|
|
|
|
|
|
|
|
|
|
|
export const changeUsername = newUsername => ({
|
|
|
|
type: CHANGE_USER_NAME,
|
|
|
|
newUserName: newUsername,
|
|
|
|
});
|
|
|
|
|
|
|
|
export const changeTheme = newThemeName => ({
|
|
|
|
type: CHANGE_THEME,
|
|
|
|
newThemeName: newThemeName
|
|
|
|
});
|
|
|
|
|
|
|
|
export const startSession = () => ({
|
|
|
|
type: START_SESSION
|
|
|
|
});
|
|
|
|
|
|
|
|
export const stopSession = () => ({
|
|
|
|
type: STOP_SESSION
|
|
|
|
});
|
|
|
|
|
2020-06-02 17:19:09 +02:00
|
|
|
const INITIAL_SETTINGS = {
|
|
|
|
theme: "hot",
|
|
|
|
username: "",
|
2020-07-26 14:58:22 +02:00
|
|
|
//swimTrackerHost: "192.168.178.107", // am pool
|
|
|
|
swimTrackerHost: "192.168.178.110", // testgeraet
|
2020-06-02 17:19:09 +02:00
|
|
|
|
2020-06-28 18:55:58 +02:00
|
|
|
analysis: {
|
2020-07-15 15:53:16 +02:00
|
|
|
peaksPerLap: 30,
|
2020-06-28 18:55:58 +02:00
|
|
|
windowSizeInSecs: 5,
|
|
|
|
numMeasurementsPerSec: 10,
|
2020-06-02 17:19:09 +02:00
|
|
|
|
2020-07-15 15:53:16 +02:00
|
|
|
kgFactor: 1.0 / 701.0,
|
2020-06-28 22:10:54 +02:00
|
|
|
|
2020-06-28 18:55:58 +02:00
|
|
|
peakDetector: 'SIMPLE', // either 'SIMPLE' or 'ZSCORE'
|
2020-06-30 18:06:37 +02:00
|
|
|
peakDetectorSimpleThreshold: 2000,
|
2020-06-02 17:19:09 +02:00
|
|
|
|
2020-06-28 18:55:58 +02:00
|
|
|
peakDetectorZScoreLag: 8, // peak detector z-score values
|
|
|
|
peakDetectorZScoreThreshold: 2,
|
|
|
|
peakDetectorZScoreInfluence: 0.1,
|
2020-07-15 15:53:16 +02:00
|
|
|
|
2020-07-15 18:17:12 +02:00
|
|
|
activeTimeThreshold: 700,
|
|
|
|
movingAverageWindowSize: 10*3,
|
2020-06-02 17:19:09 +02:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2020-06-28 18:55:58 +02:00
|
|
|
|
2020-06-02 17:19:09 +02:00
|
|
|
const settingsReducer = (state = INITIAL_SETTINGS, action) => {
|
|
|
|
switch (action.type) {
|
|
|
|
case CHANGE_THEME:
|
|
|
|
return { ...state, theme: action.newThemeName };
|
|
|
|
case CHANGE_USER_NAME:
|
|
|
|
return { ...state, username: action.newUsername };
|
|
|
|
default:
|
|
|
|
return state
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
export default combineReducers({
|
|
|
|
settings: settingsReducer,
|
2020-06-28 18:55:58 +02:00
|
|
|
deviceState: deviceStateReducer,
|
2020-06-02 17:19:09 +02:00
|
|
|
});
|