WIP More Wifi setup

This commit is contained in:
Martin Bauer
2021-06-13 12:43:50 +02:00
parent a6db96ef29
commit 0bb0e2f121
8 changed files with 263 additions and 126 deletions

View File

@@ -87,6 +87,7 @@ export class DeviceReduxCoupling {
this._onNewData,
(sessionId) => this.reduxStore.dispatch(reportSessionStarted(sessionId)),
() => this.reduxStore.dispatch(reportSessionStopped()),
(response) => this.reduxStore.dispatch(reportNewWifiState(response["state"])),
() => this.reduxStore.dispatch(reportDeviceConnect()),
() => this.reduxStore.dispatch(reportDeviceDisconnect())
);
@@ -152,15 +153,14 @@ export const deviceStateReducer = (state = INITIAL_DEVICE_STATE, action) => {
return state;
return { ...INITIAL_DEVICE_STATE, connState: ConnState.CONNECTED_STOPPING };
case WIFI_SET_STATE:
console.log("here");
let wifState = WifiState.UNKNOWN;
if (action.data === "STATION_MODE") { wifState = WifiState.STA; }
else if (action.data === "AP_PROVISIONING") { wifState = WifiState.AP_PROVISIONING; }
else if (action.data === "AP_SECURE") { wifState = WifiState.AP_SECURE; }
if (action.newStateStr === "STATION_MODE") { wifState = WifiState.STA; }
else if (action.newStateStr === "AP_PROVISIONING") { wifState = WifiState.AP_PROVISIONING; }
else if (action.newStateStr === "AP_SECURE") { wifState = WifiState.AP_SECURE; }
return { ...state, wifiState: wifState };
default:
console.log("Unhandled state in deviceStateReducer", action, action.type);
return state
//console.log("Unhandled state in deviceStateReducer", action, action.type, "state", state);
return state;
}
};