...
- This example show how to initialize µC/HTTP-server:
- Initialize uC/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 µC/FS. It is assume also that all prerequisite modules have been initialized before starting to initialize µC/HTTP-server and any web server instance.
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
#include <Source<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 -------------- */ http_err = 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_0, /* Instance configuration. See Note #4a. */ &NetFS_API_FS_V4HTTPs_TaskCfgInstance, /* FileTask systemInstance configuration. API.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 | |
---|---|
|
...
| |
|
...
|
...
|
...
|
...
|
...
|
...
- The uC/TCP-IP Network file system abstraction layer folder for traditional file system;
'$uC-TCPIP/FS/<fs>/net_<fs>.h'
NetFS_API_FS_V4
The static file system API is located under uC/HTTPs File system folder;
'$uc-HTTPs/FS/Static/http-s_fs_static.h'
HTTPs_FS_API_Static
|
...
...