Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

 

 

Code Block
themeConfluence
languagecpp
titleExample code
linenumberstrue
#include  <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();                                    /* 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_V4,     /* File system  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);
}

...