blinkenstrip

Documentation: http://frombelow.net/projects/blinkenstrip/
Clone: git clone https://git.frombelow.net/blinkenstrip.git
Log | Files | Refs | README | LICENSE

webserver.h (1687B)


      1 /*
      2   Copyright © 2021 Gerd Beuster <gerd@frombelow.net>
      3 
      4   Licensed under the Apache License, Version 2.0 (the "License");
      5   you may not use this file except in compliance with the License.
      6   You may obtain a copy of the License at
      7 
      8       http://www.apache.org/licenses/LICENSE-2.0
      9 
     10   Unless required by applicable law or agreed to in writing, software
     11   distributed under the License is distributed on an "AS IS" BASIS,
     12   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     13   See the License for the specific language governing permissions and
     14   limitations under the License.
     15 */
     16 #ifndef WEBSERVER_H
     17 #define WEBSERVER_H
     18 
     19 #include "esp_event.h"
     20 #include "lwip/api.h"
     21 
     22 // Data structure for HTML request handlers
     23 typedef struct {
     24   void (*handler)(struct netconn *conn, char *base_url_begin,
     25                   char *base_url_end, char *parameters);
     26   const char *url;
     27 } page_handler_t;
     28 
     29 // The actual HTML request handlers are application
     30 // specific. Therefore the are defined externally.
     31 extern const page_handler_t page_handlers[];
     32 extern const uint8_t number_of_page_handlers;
     33 
     34 // Functions to get web server running.
     35 void initialise_wifi(uint8_t wifi_ap, char *wifi_essid, char *wifi_password);
     36 void http_server(void *pvParameters);
     37 
     38 /* Functions for parsing HTTP requests */
     39 bool url_key_value(char *begin, const char *key,
     40                    char **value_begin, char **value_end);
     41 void base_url(char *url_with_parameters, 
     42               char **base_url_begin, char **base_url_end,
     43               char **parameters_start);
     44 
     45 
     46 // Updating LEDs is extrem time sensitive.
     47 // We have to suspend the http server during updates.
     48 TaskHandle_t http_server_task;
     49 
     50 #endif