Code: Select all
IP4_ADDR(&info.gw, 192, 168, 1, 1);//ESP acts as router, so gw addr will be its own addrCode: Select all
IP4_ADDR(&info.gw, 192, 168, 1, 1);//ESP acts as router, so gw addr will be its own addrHi WiFive,Set this to 0 otherwise your phone will try to send internet traffic thereCode: Select all
IP4_ADDR(&info.gw, 192, 168, 1, 1);//ESP acts as router, so gw addr will be its own addr
Ok. Understood.No it is like
1) iOS device has cellular internet connection
2) ESP32 Device is working as AP mode
3) iOS Device is trying to connect with ESP32 device and trying to keep internet connection from cellular
Trying either option on ESP IDF 3.3 still results in there being a DNS server on 192.168.4.1, but the gateway on 192.168.4.1 disappears. Android still doesn't use cellular in this case.Interesting about the Garmin device. What device is it? Does it prevent hijacking the internet connection on both iOS and Android?
Here's what I have after struggling with this as well. It seems to work for iOS, but not always working in Android.
this is in main() before initializing WiFi:Hope it helps.Code: Select all
tcpip_adapter_init(); { tcpip_adapter_ip_info_t info = {0}; tcpip_adapter_dns_info_t dns_info = {0}; IP_ADDR4(&dns_info.ip, 0, 0, 0, 0); IP4_ADDR(&info.ip, 192, 168, 4, 1); IP4_ADDR(&info.gw, 0, 0, 0, 0); IP4_ADDR(&info.netmask, 255, 255, 255, 0); ESP_ERROR_CHECK(tcpip_adapter_dhcps_stop(TCPIP_ADAPTER_IF_AP)); ESP_ERROR_CHECK(tcpip_adapter_set_ip_info(TCPIP_ADAPTER_IF_AP, &info)); dhcps_dns_setserver(&(dns_info.ip)); uint8_t opt_val = 0; // don't supply a dns server via dhcps //ESP_ERROR_CHECK(tcpip_adapter_dhcps_option(TCPIP_ADAPTER_OP_SET, TCPIP_ADAPTER_DOMAIN_NAME_SERVER, &opt_val, 1)); // don't supply a dns server via dhcps ESP_ERROR_CHECK(tcpip_adapter_dhcps_option(TCPIP_ADAPTER_OP_SET, TCPIP_ADAPTER_ROUTER_SOLICITATION_ADDRESS, &opt_val, 1)); // don't supply a gateway (router) via dhcps option 3 ESP_ERROR_CHECK(tcpip_adapter_dhcps_start(TCPIP_ADAPTER_IF_AP)); }
Code: Select all
uint8_t opt_val = 0; // don't supply a dns server via dhcps
ESP_ERROR_CHECK(tcpip_adapter_dhcps_option(TCPIP_ADAPTER_OP_SET, TCPIP_ADAPTER_DOMAIN_NAME_SERVER, &opt_val, 1));
Users browsing this forum: Baidu [Spider], Bing [Bot], PerplexityBot, Qwantbot and 7 guests