Giter Site home page Giter Site logo

Example for Mobile App about autoconnect HOT 9 CLOSED

hieromon avatar hieromon commented on August 18, 2024
Example for Mobile App

from autoconnect.

Comments (9)

Hieromon avatar Hieromon commented on August 18, 2024

You want may be this:
https://hieromon.github.io/AutoConnect/advancedusage/index.html#disable-the-captive-portal

from autoconnect.

cruizg avatar cruizg commented on August 18, 2024

Hi, When i use :
acConfig.autoRise = false;
i look Net Wifi("esp32", in my case)
but when i use:
acConfig.autoRise = false;
i dont look Net Wifi("esp32", in my case)

and dont connect manually (cellphone) becasuse dont exist wifi. i use this code:

AutoConnectConfig Config("esp32", "passpass");

Config.apip = IPAddress(192,168,10,101); // Sets SoftAP IP address
Config.gateway = IPAddress(192,168,10,1); // Sets WLAN router IP address
Config.netmask = IPAddress(255,255,255,0); // Sets WLAN scope
Config.autoReconnect = true; // Enable auto-reconnect
Config.autoSave = AC_SAVECREDENTIAL_NEVER; // No save credential
Config.staip = IPAddress(192,168,10,10); // Sets static IP
Config.staGateway = IPAddress(192,168,10,1); // Sets WiFi router address
Config.staNetmask = IPAddress(255,255,255,0); // Sets WLAN scope
Config.dns1 = IPAddress(192,168,10,1); // Sets primary DNS address
portal.config(Config);
Config.autoRise = false;
portal.begin();

can you help me?

from autoconnect.

Hieromon avatar Hieromon commented on August 18, 2024

Config.autoRise = false; must be placed before portal.config(Config);. Otherwise, the AutoConnect::autoRise value becomes undefined, and the SoftAP startup will be unstable.

Still the same problems you have?
Is it that esp32 has occurred as an access point even though acConfig.autoRise is false?
If so, Please set the debug level of the ESP32 core to Debug with tool menu on Arduino-IDE and enable the #define AC_DEBUG macro in AutoConnect.h and try again.
You will see the messages in the serial monitor for execution traces. If AutoConnectConfig::autoRise is false, you can collect logs like the following sequence (In the case of DHCP) :

[D][WiFiGeneric.cpp:345] _eventCallback(): Event: 0 - WIFI_READY
[D][WiFiGeneric.cpp:345] _eventCallback(): Event: 14 - AP_STOP
[D][WiFiGeneric.cpp:345] _eventCallback(): Event: 2 - STA_START
[AC] WiFi.config(IP=0.0.0.0, Gateway=0.0.0.0, Subnetmask=0.0.0.0, DNS1=0.0.0.0, DNS2=0.0.0.0)
[E][WiFiSTA.cpp:211] begin(): connect failed!
[AC] WiFi.begin()
[AC] Connecting...........................................................time out IP:0.0.0.0
[D][WiFiGeneric.cpp:345] _eventCallback(): Event: 1 - SCAN_DONE
[AC] 8 network(s) found
[AC] Past SSID:******** loaded
[AC] WiFi.begin(********,********)
[AC] Connecting.........[D][WiFiGeneric.cpp:345] _eventCallback(): Event: 5 - STA_DISCONNECTED
[W][WiFiGeneric.cpp:360] _eventCallback(): Reason: 201 - NO_AP_FOUND
[D][WiFiGeneric.cpp:345] _eventCallback(): Event: 0 - WIFI_READY
[D][WiFiGeneric.cpp:345] _eventCallback(): Event: 2 - STA_START
[D][WiFiGeneric.cpp:345] _eventCallback(): Event: 2 - STA_START
....[D][WiFiGeneric.cpp:345] _eventCallback(): Event: 4 - STA_CONNECTED
[D][WiFiGeneric.cpp:345] _eventCallback(): Event: 7 - STA_GOT_IP
[D][WiFiGeneric.cpp:389] _eventCallback(): STA IP: xxx.xxxx.xxx.xxx, MASK: xxx.xxxx.xxx.xxx, GW: xxx.xxxx.xxx.xxx
established IP:xxx.xxxx.xxx.xxx
[AC] WebServer allocated
[AC] http server started

If the AP_STOP is being executed but the SSID of esp32 is found in your cell phone, erase the flash of the esp32 with esptool once.

from autoconnect.

cruizg avatar cruizg commented on August 18, 2024

Hi,
this is my configuration:
AutoConnectConfig Config("esp32", "passpass");
Config.apip = IPAddress(192,168,10,101); // Sets SoftAP IP address
Config.gateway = IPAddress(192,168,10,1); // Sets WLAN router IP address
Config.netmask = IPAddress(255,255,255,0); // Sets WLAN scope
Config.autoReconnect = true; // Enable auto-reconnect
Config.autoSave = AC_SAVECREDENTIAL_NEVER; // No save credential
Config.staip = IPAddress(192,168,10,10); // Sets static IP
Config.staGateway = IPAddress(192,168,10,1); // Sets WiFi router address
Config.staNetmask = IPAddress(255,255,255,0); // Sets WLAN scope
Config.dns1 = IPAddress(192,168,10,1); // Sets primary DNS address
Config.autoRise = false;
portal.config(Config);
portal.begin();
Serial.println("Web server started:"+WiFi.localIP().toString());

and my log file:

11:07:09.356 -> [AC] WiFi.config(IP=192.168.10.10, Gateway=192.168.10.1, Subnetmask=255.255.255.0, DNS1=192.168.10.1, DNS2=0.0.0.0) [AC] WiFi.begin()
11:07:09.356 -> [AC] Connecting.....................................................................................................[AC] time out IP:192.168.10.10
11:07:42.843 -> [AC] 13 network(s) found
11:07:42.843 -> [AC] http server started
11:07:42.843 -> Web server started:192.168.10.10

in my celphone dont look network "esp32"

from autoconnect.

cruizg avatar cruizg commented on August 18, 2024

i'm working with v0.9.5 in arduino managenment library

from autoconnect.

Hieromon avatar Hieromon commented on August 18, 2024

how i can disable open browser automatily? because i will open browen in my internal mobile app.

If you do not want to use the captive portal automatically, you have to access the root of the AutoConnect menu manually. But it means ESP32 starting with STA mode only, AutoConnect does not support the SoftAP working without the captive portal.
In the first place, which you want to run ESP32WebServer instance with SotAP or STA?

from autoconnect.

cruizg avatar cruizg commented on August 18, 2024

According to your experience I would like you to recommend me, I'll explain my specific case:
1.- First of all I have a mobile APP that wants to configure the ESP32 Wifi using autoconnect.
2. I connect the ESP32 via USB to the Arduino and start Autoconnect with the configuration described above.
3. from the mobile APP I want to open the Wifi place the SSID and password (esp32ap, passpass). Everything in the background.
4. The ESP32 must be connected to the NETWORK which works well but the problem here is that Autoconnect automatically opens the portal to configure the NETWORK which you already do in step 3.
in conclusion my mobile APP connects and configures the ESP32 but the captive portal remains open, that's why I asked if there was a way to not start the captive portal automatically when you connect to esp32ap.

from autoconnect.

Hieromon avatar Hieromon commented on August 18, 2024

If you want to see the SSID of AutoConnect running ESP32 in your cell phone, it is a captive portal.

AutoConnect does not support the SoftAP working without the captive portal.

There is a possibility that you can implement it if you fork AutoConnect and modify the library. If you can try it, comment out the following code in AutoConnect.cpp. That will stop the captive portal.

_dnsServer->start(AUTOCONNECT_DNSPORT, "*", WiFi.softAPIP());

But your requirement seems that it needs connectivity features like as AutoConnect in both SoftAP and STA. Also, it needs to incorporate two instances, or routing inside ESP32, I think.

from autoconnect.

Hieromon avatar Hieromon commented on August 18, 2024

Closing due to lack of response

from autoconnect.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.