Skip to content

Allow a minimum of 5 characters (for WEP passwords). #7

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
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
6 changes: 6 additions & 0 deletions esp8266/src/esp_wifi.c
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,13 @@ void wifi_changed_cb(System_Event_t *evt) {
send_ev = true;
break;
case EVENT_SOFTAPMODE_STACONNECTED:
mg_ev = MGOS_NET_EV_AP_CONNECTED;
send_ev = true;
break;
case EVENT_SOFTAPMODE_STADISCONNECTED:
mg_ev = MGOS_NET_EV_AP_DISCONNECTED;
send_ev = true;
break;
case EVENT_SOFTAPMODE_PROBEREQRECVED:
case EVENT_STAMODE_AUTHMODE_CHANGE:
case EVENT_STAMODE_DHCP_TIMEOUT:
Expand Down
2 changes: 2 additions & 0 deletions include/mgos_wifi.h
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,8 @@ enum mgos_wifi_status {
MGOS_WIFI_CONNECTING = 1,
MGOS_WIFI_CONNECTED = 2,
MGOS_WIFI_IP_ACQUIRED = 3,
MGOS_WIFI_AP_DISCONNECTED = 4,
MGOS_WIFI_AP_CONNECTED = 5
};

/*
Expand Down
22 changes: 20 additions & 2 deletions src/mgos_wifi.c
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,17 @@ static void mgos_wifi_on_change_cb(void *arg) {
ws = MGOS_WIFI_IP_ACQUIRED;
break;
}
case MGOS_NET_EV_AP_CONNECTED: {
s_sta_status = MGOS_WIFI_AP_CONNECTED;
ws = MGOS_WIFI_AP_CONNECTED;
break;
}

case MGOS_NET_EV_AP_DISCONNECTED:{
s_sta_status = MGOS_WIFI_AP_DISCONNECTED;
ws = MGOS_WIFI_AP_DISCONNECTED;
break;
}
}

mgos_net_dev_event_cb(MGOS_NET_IF_TYPE_WIFI, MGOS_NET_IF_WIFI_STA, ev);
Expand Down Expand Up @@ -112,10 +123,11 @@ bool mgos_wifi_validate_sta_cfg(const struct mgos_config_wifi_sta *cfg,
}
return false;
}
// Minimum of 5 chars for password (WEP)
if (!mgos_conf_str_empty(cfg->pass) &&
(strlen(cfg->pass) < 8 || strlen(cfg->pass) > 63)) {
(strlen(cfg->pass) < 5 || strlen(cfg->pass) > 63)) {
if (!mg_asprintf(msg, 0, "%s %s must be between %d and %d chars", "STA",
"password", 8, 63)) {
"password", 5, 63)) {
}
return false;
}
Expand Down Expand Up @@ -242,6 +254,12 @@ char *mgos_wifi_get_status_str(void) {
case MGOS_WIFI_CONNECTED:
s = "connected";
break;
case MGOS_WIFI_AP_CONNECTED:
s = "AP connected";
break;
case MGOS_WIFI_AP_DISCONNECTED:
s = "AP disconnected";
break;
case MGOS_WIFI_IP_ACQUIRED:
s = "got ip";
break;
Expand Down