Run-Time Configuration

µC/HTTP-client requires a run-time configuration that must be passed during the initialization. HTTP run-time configuration template files are provided (see Directories and Files). The run-time configuration template file  (http-c_cfg.c ) should be copied into the application folder and modified as per individual project requirements.

Micriµm provides sample configuration code free of charge; however, most sample code will likely require modifications depending on specific feature requirements and memory limitation.

Configuration Structure

Listing - HTTPc Run-time Configuration Structure
const  HTTPc_CFG  HTTPc_Cfg = {
/*
*--------------------------------------------------------------------------------------------------------
*                                       TASK CONFIGURATION
*--------------------------------------------------------------------------------------------------------
*/
         HTTPc_DFLT_TASK_DLY_MS,                                /* .TaskDly_ms (HTTPc Task delay in milliseconds)       */
         HTTPc_DFLT_MSG_Q_SIZE,                                 /* .MsqQ_Size  (Message Task Queue size)                */
/*
*--------------------------------------------------------------------------------------------------------
*                                    CONNECTION CONFIGURATION
*--------------------------------------------------------------------------------------------------------
*/

         HTTPc_DFLT_CONN_CONNECT_TIMEOUT_MS,                    /* .ConnConnectTimeout_ms   (Connect timeout in ms)     */
         HTTPc_DFLT_CONN_INACTIVITY_TIMEOUT_S,                  /* .ConnInactivityTimeout_s (Inactivity timeout in s)   */

};


Task Configuration Fields

Structure FieldTypeDescriptionPossible Values

TaskDly_ms

CPU_INT08U

µC/HTTP-client Task delay in milliseconds.

When the asynchronous task is enabled, the task can be periodically delayed to allow other lower priority tasks to run.

Default value: [HTTPc_DFLT_TASK_DLY_MS] = 10ms

MUST be >= 0

MsgQ_SizeCPU_INT08U

Size of the µC/HTTP-client Task Msg Queue.

This configuration represent the number of request to task that can be sent simultaneously. In other words, it defines the number of time you can call either a HTTPc_ConnOpen(), HTTPc_ReqSend(), HTTPc_ConnClose() and HTTP_WebSockSend() simultaneously. Note that this apply mostly when those request are done with the non-blocking option.

Default value: [HTTPc_DFLT_CONN_Q_SIZE] = 5

MUST be >= 1

Connection Configuration Fields

Structure FieldTypeDescriptionPossible Values
ConnConnectTimeout_msCPU_INT16U

Connection Connect Timeout value in milliseconds.

Time allocated to perform a connection with the HTTP server.

Default value: [HTTPc_DFLT_CONN_CONNECT_TIMEOUT_MS] = 2000ms

MUST be >= 1000; <= 10000

ConnInactivityTimeout_sCPU_INT16U

Connection Inactivity Timeout value in seconds.

The inactivity timeout is set up to close the connection after a period of inactivity. 

Default value: [HTTPc_DFLT_CONN_INACTIVITY_TIMEOUT_S] = 30s

MUST be >= 1; <= 255


Task Configuration Structure

When the µC/HTTP-client task is enabled (see HTTPc_CFG_MODE_ASYNC_TASK_EN) a task configuration must be passed to the function HTTPc_Init. The µC/HTTP-client Task configuration structure is presented below.

Listing - HTTPc Task Configuration
const  HTTPc_TASK_CFG  HTTPc_TaskCfg = {
        15u,                                                    /* .Prio         (HTTPc task priority)                  */
        2048,                                                   /* .StkSizeBytes (HTTPc task stack size in bytes)       */
        DEF_NULL,                                               /* .StkPtr       (HTTPc task stack pointer)             */
};


HTTPc Task Configuration Fields

Structure FieldTypeDescriptionPossible Values
PrioCPU_INT32U

Priority of the µC/HTTP-client Task.

We recommend configuring the Network Protocol Stack task priorities & HTTP Client  task priority as follows:

  • NET_OS_CFG_IF_TX_DEALLOC_TASK_PRIO (Highest)
  • HTTPc_OS_CFG_TASK_PRIO             (  ...  )
  • NET_OS_CFG_TMR_TASK_PRIO           (  ...  ) 
  • NET_OS_CFG_IF_RX_TASK_PRIO         (Lowest )

We recommend that the uC/TCP-IP Timer task and network interface Receive task be lower priorities than almost all other application tasks; but we recommend that the network interface Transmit De-allocation task be higher priority then all application tasks that use uC/TCP-IP network services.

However better performance can be observed when the µC/HTTP-client task is set with the lowest priority. So some experimentation could be required to identify the better task priority configuration.

MUST be >= 1
StkSizeBytesCPU_INT32USize of the stack's task.MUST be >= 512
StkPtrvoid*

Memory location where to allocate the stack's task.

Pointer to memory segment where the stack's task will be located.

DEF_NULL, to allocate the stack's task on the heap memory µC-LIB.