-
-
Notifications
You must be signed in to change notification settings - Fork 118
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
Added mDNS support for AP interface #40
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -32,6 +32,12 @@ | |
#include <lwip/inet_chksum.h> | ||
|
||
#include "WiFi.h" | ||
#include "mdns.h" | ||
|
||
// defines required from mdns service | ||
#define LWIP_MDNS_RESPONDER 1 | ||
#define LWIP_IGM 1 | ||
#define LWIP_IPV4 1 | ||
|
||
WiFiClass::WiFiClass() : | ||
_initialized(false), | ||
|
@@ -697,6 +703,15 @@ void WiFiClass::handleSystemEvent(system_event_t* event) | |
case SYSTEM_EVENT_AP_START: { | ||
struct netif* apNetif; | ||
|
||
mdns_init(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Are you sure this There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As described by the example seems yes, its recommend by the example, i had test adding in the properly interface like how we do in STA but not works i had found an issue on the epressif repo. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As i understand when the AP interface is used we should enable a dns local instance because we don't have a reference DNS Server like the STA (i'm testing it). |
||
|
||
if (strlen(_hostname) == 0) { | ||
uint8_t mac[6]; | ||
esp_wifi_get_mac(ESP_IF_WIFI_AP, mac); | ||
sprintf(_hostname, "arduino-%.2x%.2x", mac[4], mac[5]); | ||
} | ||
tcpip_adapter_set_hostname(TCPIP_ADAPTER_IF_AP, _hostname); | ||
|
||
if (tcpip_adapter_get_netif(TCPIP_ADAPTER_IF_AP, (void**)&apNetif) == ESP_OK) { | ||
if (apNetif->input != WiFiClass::apNetifInputHandler) { | ||
_apNetifInput = apNetif->input; | ||
|
@@ -705,6 +720,8 @@ void WiFiClass::handleSystemEvent(system_event_t* event) | |
} | ||
} | ||
|
||
mdns_hostname_set(_hostname); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What's the difference between There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. mdns_hostname_set set the name on the mdns onject the other goes to set the hostname on the lwip tcpip interface There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. maybe the second is useless while mdns is enabled There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. in STA mode mdns not works |
||
|
||
wifi_config_t config; | ||
|
||
esp_wifi_get_config(ESP_IF_WIFI_AP, &config); | ||
|
@@ -722,7 +739,6 @@ void WiFiClass::handleSystemEvent(system_event_t* event) | |
} else { | ||
tcpip_adapter_get_ip_info(TCPIP_ADAPTER_IF_AP, &_ipInfo); | ||
} | ||
|
||
_status = WL_AP_LISTENING; | ||
xEventGroupSetBits(_eventGroup, BIT1); | ||
break; | ||
|
@@ -733,6 +749,7 @@ void WiFiClass::handleSystemEvent(system_event_t* event) | |
memset(&_apRecord, 0x00, sizeof(_apRecord)); | ||
memset(&_ipInfo, 0x00, sizeof(_ipInfo)); | ||
xEventGroupClearBits(_eventGroup, BIT1); | ||
mdns_free(); | ||
break; | ||
|
||
case SYSTEM_EVENT_AP_STACONNECTED: | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -206,6 +206,12 @@ CONFIG_EFUSE_MAX_BLK_LEN=192 | |
# ESP32-specific | ||
# | ||
CONFIG_IDF_TARGET_ESP32=y | ||
CONFIG_ESP32_REV_MIN_0=y | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Which IDF are you using? If it's an IDF update, it should be an independent commit. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Are these all the default values? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yes is the one we suggest on the install on the read me, maybe i enable unvolontarly i'm work to remove it |
||
CONFIG_ESP32_REV_MIN_1= | ||
CONFIG_ESP32_REV_MIN_2= | ||
CONFIG_ESP32_REV_MIN_3= | ||
CONFIG_ESP32_REV_MIN=0 | ||
CONFIG_ESP32_DPORT_WORKAROUND=y | ||
CONFIG_ESP32_DEFAULT_CPU_FREQ_80=y | ||
CONFIG_ESP32_DEFAULT_CPU_FREQ_160= | ||
CONFIG_ESP32_DEFAULT_CPU_FREQ_240= | ||
|
@@ -339,6 +345,8 @@ CONFIG_ESP_HTTP_CLIENT_ENABLE_HTTPS=y | |
CONFIG_HTTPD_MAX_REQ_HDR_LEN=512 | ||
CONFIG_HTTPD_MAX_URI_LEN=512 | ||
CONFIG_HTTPD_ERR_RESP_NO_DELAY=y | ||
CONFIG_HTTPD_PURGE_BUF_LEN=32 | ||
CONFIG_HTTPD_LOG_PURGE_DATA= | ||
|
||
# | ||
# ESP HTTPS OTA | ||
|
@@ -443,6 +451,8 @@ CONFIG_FREERTOS_USE_TRACE_FACILITY= | |
CONFIG_FREERTOS_GENERATE_RUN_TIME_STATS= | ||
CONFIG_FREERTOS_DEBUG_INTERNALS= | ||
CONFIG_FREERTOS_TASK_FUNCTION_WRAPPER=y | ||
CONFIG_FREERTOS_CHECK_MUTEX_GIVEN_BY_OWNER= | ||
CONFIG_FREERTOS_CHECK_PORT_CRITICAL_COMPLIANCE= | ||
|
||
# | ||
# Heap memory debugging | ||
|
@@ -624,7 +634,7 @@ CONFIG_MBEDTLS_ECP_NIST_OPTIM=y | |
# | ||
# mDNS | ||
# | ||
CONFIG_MDNS_MAX_SERVICES=10 | ||
CONFIG_MDNS_MAX_SERVICES=11 | ||
|
||
# | ||
# ESP-MQTT Configurations | ||
|
@@ -666,6 +676,9 @@ CONFIG_ESP32_PTHREAD_TASK_NAME_DEFAULT="pthread" | |
CONFIG_SPI_FLASH_VERIFY_WRITE= | ||
CONFIG_SPI_FLASH_ENABLE_COUNTERS= | ||
CONFIG_SPI_FLASH_ROM_DRIVER_PATCH=y | ||
CONFIG_SPI_FLASH_WRITING_DANGEROUS_REGIONS_ABORTS=y | ||
CONFIG_SPI_FLASH_WRITING_DANGEROUS_REGIONS_FAILS= | ||
CONFIG_SPI_FLASH_WRITING_DANGEROUS_REGIONS_ALLOWED= | ||
CONFIG_SPI_FLASH_YIELD_DURING_ERASE=y | ||
CONFIG_SPI_FLASH_ERASE_YIELD_DURATION_MS=20 | ||
CONFIG_SPI_FLASH_ERASE_YIELD_TICKS=1 | ||
|
@@ -728,3 +741,8 @@ CONFIG_SUPPORT_TERMIOS=y | |
CONFIG_WL_SECTOR_SIZE_512= | ||
CONFIG_WL_SECTOR_SIZE_4096=y | ||
CONFIG_WL_SECTOR_SIZE=4096 | ||
|
||
# | ||
# Wi-Fi Provisioning Manager | ||
# | ||
CONFIG_WIFI_PROV_SCAN_MAX_ENTRIES=16 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems really strange we need these defines to be manually added ... are you sure we need them?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
removed!! added on the kconfig