Run-Time Configuration

µC/MQTT-client requires a run-time configuration that must be passed during the initialization. MQTT run-time configuration are provided in several examples (see Directories and Files).

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 - MQTTc Run-time Configuration Structure
const  MQTTc_CFG  AppMQTTc_Cfg = {
    APP_MQTTc_MSG_QTY,                                          /* Max nbr of messages used at any given time.          */
    APP_MQTTc_INACTIVITY_TIMEOUT_s,                             /* Inactivity timeout, in seconds.                      */
    APP_MQTTc_INTERNAL_TASK_DLY                                 /* Delay, in milliseconds, of internal MQTTc task.      */
};
Structure FieldTypeDescriptionPossible Values
MaxMsgNbrCPU_INT16U

µC/MQTT-client maximum number of messages.

This field is the maximum number of message (for every connection) that will be processed concurrently.

That is, if a maximum of 3 messages can be "queued" within the MQTTc stack at any given time, this field should be set to 3.

No default value.

MUST be >= 1.

InactivityTimeout_sCPU_INT16U

Inactivity timeout for every TCP connection opened by µC/MQTT-client.

No default value.

MUST be >= 1.

TaskDly
CPU_INT32U

µC/MQTT-client Task delay in milliseconds.

Default value: 1ms.

MUST be >= 1

Task Configuration Structure

A task configuration must be passed to the function MQTTc_Init. The µC/MQTT-client Task configuration structure uses the NET_TASK_CFG type. The details of this configuration for the MQTT-client stack are presented below. You may refer to the Tasks Configuration page from the TCP-IP stack documentation for more details on the NET_TASK_CFG type.

Listing - MQTTc Task Configuration
const  NET_TASK_CFG  AMQTTc_TaskCfg = {
    8u,                                                         /* MQTTc internal task prio.                            */
    2048,                                                       /* MQTTc internal task stack size.                      */
    DEF_NULL,                                                   /* Ptr to start of MQTTc internal stack.                */
};


MQTTc Task Configuration Fields

Structure FieldTypeDescriptionPossible Values
PrioCPU_INT32U

Priority of the µC/MQTT-client Task.

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.

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 data table where the stack's task will be allocated is located.

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