New website branch

previous was doomed, that is why I made a new brench that was updated with the main.
This commit is contained in:
TeunBugwood
2023-12-11 13:20:19 +01:00
parent c4b21ee3b3
commit ec09cb9625
23 changed files with 252532 additions and 42896 deletions

View File

@@ -0,0 +1,89 @@
/**
* @file website_backend.h
* @brief Backend for the website to operate
* @author Toon B.
*/
#ifndef INC_WEBSITE_BACKEND_
#define INC_WEBSITE_BACKEND_
/* Include headers C lib */
#include <string.h>
#include <stdint.h>
/* Defines */
#define LOGGER_LEVEL_ALL
#define STR_MAX 200
#define CLR_MAX 11
#define IMG_X 250
#define IMG_Y 50
#define SD_IMG "st.bmp"
/* Include headers */
#include "log.h"
#include "lwip.h"
#include "httpd.h"
#include "lwip/apps/fs.h"
#include "llfs.h"
#include "lcd_api.h"
/**
* @fn void wbe_init(void)
* @brief Initialise the http server. It also sets the beginning screen
* of the display.
*/
void wbe_init(void);
/**
* @fn int fs_open_custom(struct fs_file*, const char*)
* @brief Function is called when the frontend wants to reach/open a file
* or endpoint on the backend.
*
* @param[in] file, the file pointer of the file that the frontend wants
* @param[in] name, the name of the file or endpoint that the frontend asks for
* @return[out] returns 0 if file or endpoint was not found, 1 if it was found
*/
int fs_open_custom(struct fs_file* file, const char* name);
/**
* @fn void fs_close_custom(struct fs_file*)
* @brief Called when closing files and endpoints
*
* @param[in] file, the file pointer of the file that the frontend wants
*/
void fs_close_custom(struct fs_file* file);
/**
* @fn void httpd_cgi_handler(struct fs_file*, const char*, int, char**, char**)
* @brief When data is send from the frontend to the backend with the CGI
* tag and parameters, this function is called. With this comes parameters that
* we want to read for further use.
*
* @param[in] file, the file pointer of the file that the frontend wants
* @param[in] uri, the URI that is given to the backend from the frontend (here cgi)
* @param[in] num_parm, the number of parameters that is given with the URI
* @param[in] pc_param, contains the name of each parameter
* @param[in] pc_value, is the value of each parameter
*/
void httpd_cgi_handler(struct fs_file* file, const char* uri, int num_parm, char** pc_param, char** pc_value );
/**
* @fn void wbe_display(const char*, const uint32_t, const uint32_t, const char*)
* @brief Function displays the sentence, its color, the background and the given
* image on the LCD screen.
*
* @param[in] txt, is the text string that needs to be displayed
* @param[in] txt_color, the color of the wanted string
* @param[in] background_color, color of the background of the screen
* @param[in] image, name of the wanted image to be displayed
*/
void wbe_display(const char* txt, const uint32_t txt_color, const uint32_t background_color, const char* image);
#endif /* INC_WEBSITE_BACKEND_ */