Skip to content

Commit

Permalink
Add possibility to save WiFi credentials
Browse files Browse the repository at this point in the history
We still don't use these credentials anywhere.
  • Loading branch information
havardAasen committed Jun 21, 2024
1 parent 1b2f3a0 commit d2202eb
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 1 deletion.
14 changes: 14 additions & 0 deletions src/BPLSettings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,20 @@ void BPLSettings::postFormat(){
}


void BPLSettings::setWiFiConfiguration(const char* ssid, const char* password)
{
if(ssid)
strcpy(_data.wifiConfiguration.ssid, ssid);
else
_data.wifiConfiguration.ssid[0]='\0';

if(password)
strcpy(_data.wifiConfiguration.pass, password);
else
_data.wifiConfiguration.pass[0]='\0';
}


void BPLSettings::load()
{
DBG_PRINTF("syscfg:%d, timeinfo:%d, gdc:%d, \
Expand Down
12 changes: 11 additions & 1 deletion src/BPLSettings.h
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,12 @@ typedef struct _PressureMonitorSettings{
}PressureMonitorSettings;
#endif

struct WiFiConfiguration{
char ssid[33];
char pass[33];
char _padding[30];
};

//####################################################
// whole structure
struct Settings{
Expand All @@ -238,6 +244,7 @@ struct Settings{
RemoteLoggingInformation remoteLogginInfo; // 636: 444
AutoCapSettings autoCapSettings; // 1080: 12
ParasiteTempControlSettings parasiteTempControlSettings; //1092: 20
WiFiConfiguration wifiConfiguration;

#if SupportPressureTransducer
PressureMonitorSettings pressureMonitorSettings; // 16
Expand Down Expand Up @@ -287,7 +294,10 @@ class BPLSettings

void preFormat();
void postFormat();


WiFiConfiguration *getWifiConfiguration(){ return &_data.wifiConfiguration; }
void setWiFiConfiguration(const char* ssid, const char* pass);

#if SupportPressureTransducer
//pressure monitor
PressureMonitorSettings *pressureMonitorSettings(){return &_data.pressureMonitorSettings;}
Expand Down

0 comments on commit d2202eb

Please sign in to comment.