OmEspHelpers
Public Member Functions | List of all members
OmWebServer Class Reference

Manages wifi connection, and forwarding http requests to a handler, typically OmWebPages. More...

#include <OmWebServer.h>

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)
 
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 ()
 
unsigned int getIp ()
 
int getClientPort ()
 
unsigned int getClientIp ()
 
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)
 
- Public Member Functions inherited from OmIByteStream
virtual bool putS (const char *s)
 convenience routine, same as put byte-by-byte.
 

Additional Inherited Members

- Public Attributes inherited from OmIByteStream
bool isDone = false
 

Detailed Description

Manages wifi connection, and forwarding http requests to a handler, typically OmWebPages.

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 
)

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. :(

◆ 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: