- This example show how to initialize µC/DHCPcHTTP-server:
- Initialize uC/HTTPs HTTP-server module objects.
- Initialize a web server's instance
- Start the web server's instance.
- This example assumes the presence of µC/TCP-IP and and µC/FS. It is assume also that all prerequisite modules have been initialized before starting to initialize µC/HTTPs HTTP-server and any web server instance.
...
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
#include <Server/Source/http-s.h>
#include <FS/uC-FS-V4/net_fs_v4.h> /* See Note #4. */
CPU_BOOLEAN AppHTTPsInit (void)
{
HTTPs_INSTANCE *p_https_instance;
HTTPs_ERR http_err;
/* Prerequisites modules must be initialized prior calling any of the following functions. See Note #1. */
/* Make sure File System (such as uC/FS) is initialized before starting the instance. See Note #2. */
/* Make sure Files that must serve by the web server is loaded in the file system. See Note #2. */
/* -------------- INITALIZE HTTPS MODULE -------------- */
HTTPs_Init(DEF_NULL, &http_err); /* See Note #3. */
if (http_err != HTTPs_ERR_NONE) {
return (DEF_FAIL);
}
/* ---------- INITALIZE WEB SERVER INSTANCE ----------- */
p_https_instance = HTTPs_InstanceInit(&HTTPs_CfgInstance, /* Instance configuration. See Note #4a. */
&HTTPs_TaskCfgInstance, /* Task Instance configuration. See Note #4b. */
&http_err);
if (http_err != HTTPs_ERR_NONE) {
return (DEF_FAIL);
}
/* ------------ START WEB SERVER INSTANCE ------------- */
HTTPs_InstanceStart(p_https_instance, /* Instance handle. See Note #5. */
&http_err);
if (http_err != HTTPs_ERR_NONE) {
return (DEF_FAIL);
}
return (DEF_OK);
} |
Panel | ||
---|---|---|
| ||
|
...
|
...
|
...
|
...
|
...
|
...
'$uC-TCPIP/FS/<fs>/net_<fs>.h'
NetFS_API_FS_V4
The static file system API is located under uC/HTTPs File system folder;
...
|
...
...