Graph & android fixes
This commit is contained in:
@@ -1,30 +0,0 @@
|
||||
|
||||
|
||||
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
|
||||
});
|
||||
|
||||
// ---------------------
|
||||
|
||||
|
||||
@@ -126,12 +126,18 @@ export const deviceStateReducer = (state = INITIAL_DEVICE_STATE, action) => {
|
||||
case DEVICE_DISCONNECT:
|
||||
return { ...INITIAL_DEVICE_STATE, connState: ConnState.DISCONNECTED };
|
||||
case SESSION_STARTED:
|
||||
console.log("session started");
|
||||
return { ...INITIAL_DEVICE_STATE, connState: ConnState.CONNECTED_RUNNING, sessionId: action.sessionId };
|
||||
case SESSION_STOPPED:
|
||||
console.log("session stopped");
|
||||
return { ...INITIAL_DEVICE_STATE, connState: ConnState.CONNECTED_STOPPED };
|
||||
case START_SESSION:
|
||||
if(state.connState === ConnState.SESSION_STARTED)
|
||||
return state;
|
||||
return { ...INITIAL_DEVICE_STATE, connState: ConnState.CONNECTED_STARTING };
|
||||
case STOP_SESSION:
|
||||
if(state.connState === ConnState.SESSION_STOPPED)
|
||||
return state;
|
||||
return { ...INITIAL_DEVICE_STATE, connState: ConnState.CONNECTED_STOPPING };
|
||||
default:
|
||||
console.log("Unhandled state in deviceStateReducer", action.type);
|
||||
@@ -140,4 +146,4 @@ export const deviceStateReducer = (state = INITIAL_DEVICE_STATE, action) => {
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,7 +1,29 @@
|
||||
import { combineReducers } from 'redux';
|
||||
import { CHANGE_THEME, CHANGE_USER_NAME, NEW_DEVICE_DATA, START_SESSION, STOP_SESSION, RESET_DEVICE_DATA } from './ActionCreators';
|
||||
import { deviceStateReducer } from "./DeviceReduxCoupling";
|
||||
|
||||
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
|
||||
});
|
||||
|
||||
const INITIAL_SETTINGS = {
|
||||
theme: "hot",
|
||||
username: "",
|
||||
@@ -12,6 +34,8 @@ const INITIAL_SETTINGS = {
|
||||
windowSizeInSecs: 5,
|
||||
numMeasurementsPerSec: 10,
|
||||
|
||||
kgFactor: 1.0 / 1100.0,
|
||||
|
||||
peakDetector: 'SIMPLE', // either 'SIMPLE' or 'ZSCORE'
|
||||
peakDetectorSimpleThreshold: 2500,
|
||||
|
||||
|
||||
Reference in New Issue
Block a user