Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
nexboot
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
esp
nexboot
Commits
857abc55
Commit
857abc55
authored
May 17, 2018
by
Franco (nextime) Lanza
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Starting to add httpd server
parent
9f31120e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
1 deletion
+25
-1
esp32-http-server
components/esp32-http-server
+1
-1
nexboot.c
main/nexboot.c
+24
-0
No files found.
esp32-http-server
@
202ecff2
Subproject commit
baf849bf66e6dc56b9eb92c7a0b28d6a7bf6e3bb
Subproject commit
202ecff281b8cafa95f52a61c2a6cb245a04dd30
main/nexboot.c
View file @
857abc55
...
...
@@ -11,6 +11,8 @@
#include "lwip/err.h"
#include "lwip/sys.h"
#include "https_server.h"
/* You can set Wifi configuration via
'make menuconfig'.
...
...
@@ -32,6 +34,23 @@ const int WIFI_CONNECTED_BIT = BIT0;
static
const
char
*
TAG
=
"Nexboot"
;
http_server_t
server
;
esp_err_t
httpd_start
(
void
)
{
ESP_LOGI
(
TAG
,
"Starting HTTPD..."
);
#if HTTPS_SERVER
http_server_options_t
http_options
=
HTTPS_SERVER_OPTIONS_DEFAULT
();
#else
http_server_options_t
http_options
=
HTTP_SERVER_OPTIONS_DEFAULT
();
#endif
esp_err_t
res
;
ESP_ERROR_CHECK
(
res
=
http_server_start
(
&
http_options
,
&
server
)
);
ESP_LOGI
(
TAG
,
"HTTPD Started"
);
return
res
;
}
static
esp_err_t
event_handler
(
void
*
ctx
,
system_event_t
*
event
)
{
switch
(
event
->
event_id
)
{
...
...
@@ -42,6 +61,7 @@ static esp_err_t event_handler(void *ctx, system_event_t *event)
ESP_LOGI
(
TAG
,
"got ip:%s"
,
ip4addr_ntoa
(
&
event
->
event_info
.
got_ip
.
ip_info
.
ip
));
xEventGroupSetBits
(
wifi_event_group
,
WIFI_CONNECTED_BIT
);
ESP_ERROR_CHECK
(
httpd_start
());
break
;
case
SYSTEM_EVENT_AP_STACONNECTED
:
ESP_LOGI
(
TAG
,
"station:"
MACSTR
" join, AID=%d"
,
...
...
@@ -54,6 +74,9 @@ static esp_err_t event_handler(void *ctx, system_event_t *event)
event
->
event_info
.
sta_disconnected
.
aid
);
break
;
case
SYSTEM_EVENT_STA_DISCONNECTED
:
ESP_LOGI
(
TAG
,
"Stopping HTTPD"
);
ESP_ERROR_CHECK
(
http_server_stop
(
server
));
ESP_LOGI
(
TAG
,
"HTTPD Stopped"
);
esp_wifi_connect
();
xEventGroupClearBits
(
wifi_event_group
,
WIFI_CONNECTED_BIT
);
break
;
...
...
@@ -92,6 +115,7 @@ void wifi_init_softap()
ESP_LOGI
(
TAG
,
"wifi_init_softap finished.SSID:%s password:%s"
,
ESP_WIFI_SSID
,
ESP_WIFI_PASS
);
ESP_ERROR_CHECK
(
httpd_start
());
}
#else // if ESP_WIFI_MODE_AP
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment