FreeRTOS-Kernel/FreeRTOS-Plus/Demo/coreMQTT_Windows_Simulator
Soren Ptak 3a2f6646f0
Use CI-CD-Github-Actions for spelling and formatting, add in the bot formatting action, update the CI-CD workflow files. Fix incorrect spelling and formatting on files. (#1083)
* Use new version of CI-CD Actions,  checkout@v3 instead of checkout@v2 on all jobs
* Use cSpell spell check, and use ubuntu-20.04 for formatting check
* Add in bot formatting action
* Update freertos_demo.yml and freertos_plus_demo.yml files to increase github log readability
* Add in a Qemu demo onto the workflows.
2023-09-06 12:35:37 -07:00
..
Common Use CI-CD-Github-Actions for spelling and formatting, add in the bot formatting action, update the CI-CD workflow files. Fix incorrect spelling and formatting on files. (#1083) 2023-09-06 12:35:37 -07:00
MQTT_Basic_TLS Use CI-CD-Github-Actions for spelling and formatting, add in the bot formatting action, update the CI-CD workflow files. Fix incorrect spelling and formatting on files. (#1083) 2023-09-06 12:35:37 -07:00
MQTT_Keep_Alive Use CI-CD-Github-Actions for spelling and formatting, add in the bot formatting action, update the CI-CD workflow files. Fix incorrect spelling and formatting on files. (#1083) 2023-09-06 12:35:37 -07:00
MQTT_Multitask Use CI-CD-Github-Actions for spelling and formatting, add in the bot formatting action, update the CI-CD workflow files. Fix incorrect spelling and formatting on files. (#1083) 2023-09-06 12:35:37 -07:00
MQTT_Mutual_Auth Use CI-CD-Github-Actions for spelling and formatting, add in the bot formatting action, update the CI-CD workflow files. Fix incorrect spelling and formatting on files. (#1083) 2023-09-06 12:35:37 -07:00
MQTT_Mutual_Auth_wolfSSL Use CI-CD-Github-Actions for spelling and formatting, add in the bot formatting action, update the CI-CD workflow files. Fix incorrect spelling and formatting on files. (#1083) 2023-09-06 12:35:37 -07:00
MQTT_Plain_Text Use CI-CD-Github-Actions for spelling and formatting, add in the bot formatting action, update the CI-CD workflow files. Fix incorrect spelling and formatting on files. (#1083) 2023-09-06 12:35:37 -07:00
MQTT_Serializer Use CI-CD-Github-Actions for spelling and formatting, add in the bot formatting action, update the CI-CD workflow files. Fix incorrect spelling and formatting on files. (#1083) 2023-09-06 12:35:37 -07:00
readme.txt Update MQTT demo timeout and record length (#1030) 2023-07-18 12:48:12 +05:30
readme_also_coreMQTT_multithreading_agent.url Add links to the MQTT agent in the non-agent mqtt demos (#470) 2020-12-11 21:12:44 -08:00
readme_coreMQTT.url Update urls in code to those on the server (#396) 2020-11-10 10:53:14 -08:00

The subdirectories of this directory contain multiple examples that demonstrate
coreMQTT using in both single and multi-threaded scenarios, as well as with
both plain text and authenticated and encrypted network interfaces.

The multi threaded example creates an MQTT agent (or daemon task).  It is thread
safe because only the agent task is allowed to access the coreMQTT API - hence
the API is only accessed from one FreeRTOS task.  Other tasks and interrupts
needing to interact with the MQTT agent do so through a thread safe queue.
We are generalising this technique for future coreMQTT releases, which will have
a re-usable agent component.

! Plain text examples are for ease of evaluation only - product devices should
! always use authenticated and encrypted communication.  Never send private or
! sensitive data on an unencrypted connection.


In MQTT demos, for each iteration we send 3 QoS2 MQTT Publish messages and receive
3 QoS2 MQTT Publish messages because we are subscribed to the same topics we
publish on. Each QoS2 MQTT publish message results in total 4 MQTT packets
being exchanged between the device and the broker. For example, the following
MQTT packets are exchanged between the device and the broker when the device
sends a QoS2 MQTT Publish message:

   Device                   Broker
      |                         |
      |      Publish QoS2       |
      +------------------------>|
      |        PUBREC           |
      |<------------------------+
      |        PUBREL           |
      +------------------------>|
      |       PUBCOMP           |
      |<------------------------+
      |                         |

The coreMQTT library keeps track of the in-flight publish messages (i.e. the
publish messages for which the above 4 packets sequence is not complete) in 2
application supplied arrays - pOutgoingPublishRecords and pIncomingPublishRecords
in this demo. We need to set the value of mqttexamplePROCESS_LOOP_TIMEOUT_MS to
ensure that we can keep up with the incoming MQTT packets. We did some experiments
to find the optimal value of mqttexamplePROCESS_LOOP_TIMEOUT_MS. The following
table lists the results of our experiments:

 +------------------------------------+-------------+----------------------------------------------------+
  | mqttexamplePROCESS_LOOP_TIMEOUT_MS | Iteration # | No. of pending messages in pOutgoingPublishRecords |
  +------------------------------------+-------------+----------------------------------------------------+
  |               500                  | 0           | 0                                                  |
  +                                    +-------------+----------------------------------------------------+
  |                                    | 1           | 3                                                  |
  +                                    +-------------+----------------------------------------------------+
  |                                    | 2           | 3                                                  |
  +                                    +-------------+----------------------------------------------------+
  |                                    | 3           | 6                                                  |
  +                                    +-------------+----------------------------------------------------+
  |                                    | 4           | 9                                                  |
  +------------------------------------+-------------+----------------------------------------------------+
  |              1000                  | 0           | 0                                                  |
  +                                    +-------------+----------------------------------------------------+
  |                                    | 1           | 1                                                  |
  +                                    +-------------+----------------------------------------------------+
  |                                    | 2           | 3                                                  |
  +                                    +-------------+----------------------------------------------------+
  |                                    | 3           | 4                                                  |
  +                                    +-------------+----------------------------------------------------+
  |                                    | 4           | 6                                                  |
  +                                    +-------------+----------------------------------------------------+
  |                                    | 5           | 7                                                  |
  +                                    +-------------+----------------------------------------------------+
  |                                    | 6           | 7                                                  |
  +------------------------------------+-------------+----------------------------------------------------+
  |              1500                  | 0           | 0                                                  |
  +                                    +-------------+----------------------------------------------------+
  |                                    | 1           | 0                                                  |
  +                                    +-------------+----------------------------------------------------+
  |                                    | 2           | 1                                                  |
  +                                    +-------------+----------------------------------------------------+
  |                                    | 3           | 2                                                  |
  +                                    +-------------+----------------------------------------------------+
  |                                    | 4           | 3                                                  |
  +                                    +-------------+----------------------------------------------------+
  |                                    | 5           | 3                                                  |
  +                                    +-------------+----------------------------------------------------+
  |                                    | 6           | 0                                                  |
  +------------------------------------+-------------+----------------------------------------------------+
  |              2000                  | 0           | 0                                                  |
  +                                    +-------------+----------------------------------------------------+
  |                                    | 1           | 0                                                  |
  +                                    +-------------+----------------------------------------------------+
  |                                    | 2           | 0                                                  |
  +                                    +-------------+----------------------------------------------------+
  |                                    | 3           | 0                                                  |
  +                                    +-------------+----------------------------------------------------+
  |                                    | 4           | 0                                                  |
  +                                    +-------------+----------------------------------------------------+
  |                                    | 5           | 0                                                  |
  +                                    +-------------+----------------------------------------------------+
  |                                    | 6           | 0                                                  |
  +------------------------------------+-------------+----------------------------------------------------+

As clear from the above table, with the value of mqttexamplePROCESS_LOOP_TIMEOUT_MS
set to 2000, we are able to keep up with the incoming MQTT packets every iteration.
mqttexamplePROCESS_LOOP_TIMEOUT_MS can be updated according to the requirements.