I am using samples/net/mqtt for MQTT connection. I have a custom MQTT broker with SSL/TLS encryption which also requires username and password for authentication. I am confused as to where to add this.
I am using actnius icarus ns
sdk 2.3.0
I am using samples/net/mqtt for MQTT connection. I have a custom MQTT broker with SSL/TLS encryption which also requires username and password for authentication. I am confused as to where to add this.
I am using actnius icarus ns
sdk 2.3.0
Hi,
You can set the username in the struct mqtt_helper_conn_params conn_params in connect_work_fn in transport.c.
However, the mqtt_helper library does not support setting a password. So you will have to add that to the mqtt_helper_conn_params struct and client_connect function in the mqtt_helper library.
Best regards,
Didrik
What do you mean by adding password to the mqtt_conn_params struct and client_connect function, where can I locate the mqtt_helper library? could you please elaborate more with an example? I am new to using Nrf9160. Do I need to make changes anywhere else?
P.S: I cannot locate the file mqtt_helper.h anywhere in the sdk or the project
User_PP said:Do I need to make changes anywhere else?
Yes, you will need to add password handling to the mqtt_helper library.
mqtt_helper.h can be found here: nrf\include\net\mqtt_helper.h
mqtt_helper.c can be found here: nrf\subsys\net\lib\mqtt_helper\mqtt_helper.c
The library already handles the username, and both the username and password are handled the same way by the underlying MQTT client library, so you should be able to just copy what the mqtt_helper library does with the username.
User_PP said:Do I need to make changes anywhere else?
Yes, you will need to add password handling to the mqtt_helper library.
mqtt_helper.h can be found here: nrf\include\net\mqtt_helper.h
mqtt_helper.c can be found here: nrf\subsys\net\lib\mqtt_helper\mqtt_helper.c
The library already handles the username, and both the username and password are handled the same way by the underlying MQTT client library, so you should be able to just copy what the mqtt_helper library does with the username.
It worked thank you so much for all the help
Could you also tell me where to access nrf_modem_gnss.c?
The modem library is closed source, so that file is not available.
Okay I understand