User Manual
AdafruitHTTPServer
AdafruitHTTPServer makes it easy to run an HTTP server on the WICED feather in either SoftAP or normal operating
mode, allowing you to implement custom admin consoles, rich data visualisations, or to publish 'always available'
documention for your project right on the board itself.
The helper class allows you to serve static content stored in flash memory (compiled as part of the Arduino sketch
itself), link to files on the 16MBit SPI flash on the WICED Feather (if enabled via the optional solder jumper on the
bottom of the board), or to dynamically generate page content on to go.
AdafruitHTTPServer API
The AdafruitHTTPServer class has the following public functions:
Dynamic page content can be generated with the following callback handler signature, changing the function name to
something appropriate:
Constructor
When declaring a new instance of the AdafruitHTTPServer class you must declare the maximum number of pages that
the server will host (based on available memory since each page record will require a chunk of SRAM to be allocated),
and whether the server in running in normal (non access point) mode, or in AP mode.
You indicate the operating mode via the ' interface ' field, which has one of the following values:
WIFI_INTERFACE_STATION : Default value, meaning this should run in normal non AP mode
WIFI_INTERFACE_AP : Indicates that the HTTP server should run on the AP (Access Point) interface
For example, to use the default (non AP) interface for the HTTP server you might use the following constructor
declaration:
The AdafruitHTTPServer class requires WICED Feather Lib 0.6.0 or higher to run.
AdafruitHTTPServer(uint8_t max_pages, uint8_t interface = WIFI_INTERFACE_STATION);
uint8_t interface ( void );
void addPages(HTTPPage const* http_pages, uint8_t count = 1);
bool begin(uint16_t port,
uint8_t max_clients,
uint32_t stacksize = HTTPSERVER_STACKSIZE_DEFAULT);
void stop(void);
bool started(void);
void dynamic_page_generator (const char* url,
const char* query,
httppage_request_t* http_request);
© Adafruit Industries https://learn.adafruit.com/introducing-the-adafruit-wiced-feather-wifi Page 100 of 202










