NETXDUO
Nx_MQTT_Client application description :
This application provides an example of Azure RTOS NetX/NetXDuo stack usage. It shows how to exchange data between client and server using MQTT protocol in an encrypted mode supporting TLS v1.2 .
The main entry function tx_application_define() is called by ThreadX during kernel start, at this stage, all NetX resources are created.
- A NX_PACKET_POOLis allocated
- A NX_IP instance using that pool is initialized
- The ARP, ICMP, UDP and TCP protocols are enabled for the NX_IP instance
- A DHCP client is created.
** The AppMainThread starts and perform the following actions:
- creates a dns_client with USER_DNS_ADDRESS (default value defined IP_ADDRESS(1, 1, 1, 1) on app_netxduo.h.
- starts the DHCP client
- waits for the IP address resolution
- resumes the AppSNTPThread
** The AppSNTPThread, once started:
- it connects to an SNTP server to get the current time.
- resumes the AppMQTTClientThread
** The AppMQTTClientThread, once started:
- creates an mqtt_client
connects mqtt_client to the online MQTT broker; connection with server will be secure and a tls_setup_callback will set TLS parametres. By default MQTT_PORT for encrypted mode is 8883
- mqtt_client subscribes on a predefined topic TOPIC_NAME “Temperature” with a Quality Of Service QOS0
- depending on the number of message “NB_MESSAGE” defined by user, mqtt_client will publish a random number generated by RNG. If NB_MESSAGE = 0, it means that number of messages is infinitely.
- mqtt_client will get messages from the MQTT broker and print them.
link 2: https://github.com/STMicroelectronics/x-cube-azrtos-f4/tree/main/Projects/STM32F429ZI-Nucleo/Applications/NetXDuo/Nx_MQTT_Client
Commentaires
Enregistrer un commentaire