Correct way to integrate MQTT wifi sample into an existing project?

Hi,

SDK: nRF Connect v2.7.0.

Hardware: nrf5340 + nrf7002 module (WT02C40C) on a custom board.

IDE: Visual Studio Code 1.95.3 (obviously with the nRF Connect extension).

I have an existing project based on the ble peripheral_uart sample, which is roughly doing what it's supposed to.

I now want to add MQTT-over-wifi functionality to this project. I have previously built and run the MQTT sample on this custom board. But I'm not sure how to go about adding the MQTT configuration to the existing configuration.

My first attempt was to take the contents of the prj.conf from the MQTT sample and paste it into the prj.conf in my target project, and also to copy the nrf7002dk_nrf5340_cpuapp_ns.conf file to the boards directory of my target project and point the build configuration at that file (in addition to the prj.conf).

But it looks like many symbols beginning with CONFIG_MQTT_SAMPLE are either undefined or undeclared, and many build errors occur.

So the question is, what is a good way to merge (using the term loosely) the MQTT sample into my existing ble_peripheral_uart-based project? I know that's a bit of a vague question, but any help would be appreciated and I'm happy to provide more information.

Thanks,

Richard.

Related