OmEspHelpers
Public Member Functions | Static Public Member Functions | Static Public Attributes | List of all members
OmWebServer Class Reference
Inheritance diagram for OmWebServer:
OmIByteStream

Public Member Functions

 OmWebServer (int port=80)
 
void setVerbose (int verbose)
 OmWebServer by default prints much status to serial; set to 0 to cut that out.
 
void setAccessPoint (String ssid, String password, int secondsUntilReboot=0)
 
bool isAccessPoint ()
 return true if we're currently in access point mode
 
void addWifi (String ssid, String password)
 add to the list of known networks to try.
 
void clearWifis ()
 reset the list of known networks to try, to empty again. More...
 
void setBonjourName (String bonjourName)
 advertises on local network as bonjourName.local
 
String getBonjourName ()
 get the current bonjour name
 
void setHandler (OmRequestHandler requestHandler)
 
void setHandler (OmWebPages &requestHandler)
 Introduce an OmWebPages to the server, done and done!
 
void setStatusCallback (OmConnectionStatus statusCallback)
 receive notifications of changes to wifi status
 
void setNtp (OmNtp *ntp)
 Introduce an NTP object to the server.
 
void setPort (int port)
 defaults to 80
 
void setStatusLedPin (int statusLedPin)
 changes or disables the blinking status LED. Use -1 to disable.
 
void end ()
 
void glitch (int k)
 simulate a network trouble. 1==disconnect the wifi
 
int tick ()
 You must call this in loop() to give time to run. This allows networks to be joined and rejoined, and is when requests are served. Call it often! return the number of requests handled, if any. More...
 
const char * getSsid ()
 
int getPort ()
 
uint32_t getIp ()
 
int getClientPort ()
 
unsigned int getTicks ()
 
bool isWifiConnected ()
 is it?
 
long long uptimeMillis ()
 arduino's millis() will overflow after 50 days. Not this baby.
 
bool put (uint8_t) override
 emit a single byte, overridden by any implementation
 
bool done () override
 
bool put (const char *s)
 
bool put (uint8_t *d, int size)
 
void rebootIn (int millis)
 
- Public Member Functions inherited from OmIByteStream
virtual bool putS (const char *s)
 convenience routine, same as put byte-by-byte.
 

Static Public Member Functions

static const char * statusString (int wifiStatus)
 

Static Public Attributes

static OmWebServers = NULL
 

Additional Inherited Members

- Public Attributes inherited from OmIByteStream
bool isDone = false
 

Member Function Documentation

◆ clearWifis()

void OmWebServer::clearWifis ( )

reset the list of known networks to try, to empty again.

empty the wifis list.

◆ setAccessPoint()

void OmWebServer::setAccessPoint ( String  ssid,
String  password,
int  secondsUntilReboot = 0 
)

must be set before begin(), and cannot be revoked. Creates a wifi network access point with the name shown. You'll have to communicate the IP address to the user by your own means, on screen display or something. set "" for no access point. NOTE: 2019-12-14 works sometimes. I dont highly recommend. :( NOTE:2021-06-12 works pretty well now... if you provide a secondsUntilReboot, it will only stay in AP mode that long before rebooting and going through your startup perhaps with other SSIDs again. This, so after a power failure and reboot, if you only use AP for config, it can find its way home. Eventually. NOTE:2021-07-11 if you pass in setAccessPoint("", "", 0) it will clear the secondsUntilReboot and stay in AP mode indefinitely. So you could add a control to disable the timeout in a remote-use setting.

◆ tick()

int OmWebServer::tick ( )

You must call this in loop() to give time to run. This allows networks to be joined and rejoined, and is when requests are served. Call it often! return the number of requests handled, if any.

call this in loop to give time to run.


The documentation for this class was generated from the following files: