GithubHelp home page GithubHelp logo

Comments (6)

alanswx avatar alanswx commented on July 17, 2024 1

Looks useful. Let me add it.

from espasyncwifimanager.

kiralikbeyin avatar kiralikbeyin commented on July 17, 2024
class AsyncWiFiManager
{
  public:
    AsyncWiFiManager(AsyncWebServer * server, DNSServer *dns);

    void          scan();
    String        scanme();
    String        handleInfome();
/** Handle the info ME page */
String AsyncWiFiManager::handleInfome() {
  DEBUG_WM(F("Info"));
  String pager;
  String page ;
  page += F("<dt>Chip ID</dt><dd>");
  page += ESP.getChipId();
  page += F("</dd>");
  page += F("<dt>Flash Chip ID</dt><dd>");
  page += ESP.getFlashChipId();
  page += F("</dd>");
  page += F("<dt>IDE Flash Size</dt><dd>");
  page += ESP.getFlashChipSize();
  page += F(" bytes</dd>");
  page += F("<dt>Real Flash Size</dt><dd>");
  page += ESP.getFlashChipRealSize();
  page += F(" bytes</dd>");
  page += F("<dt>Soft AP IP</dt><dd>");
  page += WiFi.softAPIP().toString();
  page += F("</dd>");
  page += F("<dt>Soft AP MAC</dt><dd>");
  page += WiFi.softAPmacAddress();
  page += F("</dd>");
  page += F("<dt>Station SSID</dt><dd>");
  page += WiFi.SSID();
  page += F("</dd>");
  page += F("<dt>Station IP</dt><dd>");
  page += WiFi.localIP().toString();
  page += F("</dd>");
  page += F("<dt>Station MAC</dt><dd>");
  page += WiFi.macAddress();
  page += F("</dd>");
  page += F("</dl>");
 pager = page;
return pager;

  DEBUG_WM(F("Sent info page"));
}

Usage;

String handleInfome = wifiManager.handleInfome();
    ws.textAll(handleInfome);

Please can you add this also?
@alanswx Thanks a lot!

from espasyncwifimanager.

kiralikbeyin avatar kiralikbeyin commented on July 17, 2024

Html part for wifiManager.scanme();

  <script>
        function c(l) {
            document.getElementById('ssid').value = l.innerText || l.textContent;
            document.getElementById('passwordnet').focus();
        }
        </script>

from espasyncwifimanager.

alanswx avatar alanswx commented on July 17, 2024

I am not sure about the interrupt - but the scan should be separate from printing out the results of the scan. We have to scan in the background because the async web server can't pause during a request. Therefore, I try to have the last scan cached. I think you want two calls - one to scan, and one to return the results in a string.

I am not sure where your HTML goes.. If you want to submit a sample with a websocket example that would be great.

from espasyncwifimanager.

alanswx avatar alanswx commented on July 17, 2024

I pushed some changes. Here are the relevant calls:

String scanModal();
String infoAsString()

Does this work for you? Thanks!!

from espasyncwifimanager.

kiralikbeyin avatar kiralikbeyin commented on July 17, 2024

Hi Thanks for update! It works clearly!

You can get this interrupt like this;

html-js

  websocket.onopen = function(evt) {
                                             console.log("CONNECTED");
                                             websocket.send("sendMebaby");
}

trigger ws message in ws events...

 String infoAsString = wifiManager.infoAsString();
    ws.textAll(infoAsString);
// directly append returning string to a div element in html.

I saw resets so i put a bool in the loop which works stabile


 if (searchWifi) {
    String ok = wifiManager.scanModal();
// directly append returning string to a div element in html.
    ws.textAll(ok);
    searchWifi = false;
  }

in html js-jquey needed ;


websocket.onmessage = function(evt) {

if (evt.data.indexOf("<div><a href=") > -1) {
                                        //    console.log(evt.data);
                                        $("#temp").remove();
                                        $('#network').append("<div id='temp'></div>");
                                        $('#temp').append(evt.data);
                                    }

if (evt.data.indexOf("Chip ID") > -1) {
                                        //  console.log(evt.data);
                                        $("#tempinfos").remove();
                                        $('#infos').append("<div id='tempinfos'></div>");
                                        $('#tempinfos').append(evt.data);
                                    }                                    
}

from espasyncwifimanager.

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.