I'm currently working on the MQTT Paho demo but I have no clue as to where the void appInitSystem(xTimerHandle xTimer) goes to?

Also, at which point do I state the cliendID and where can I get the clientID from?

Thanks!

0 (0 Votes)
RE: Where do I add void appInitSystem(xTimerHandle xTimer) ?
Answer
5/11/17 4:37 PM as a reply to Jaden Edwin Chua.

Hello Jaden,

the appInitSystem is the entry point for your program. You can put it in any file you want, but it is generally preferable to put it in a source file, where the initialization of resources is handled.
In any case, it has to be at the very bottom of the source file.

If you are working on the MQTT Paho demo, which you can find here, there will already be an appInitSystem function implemented. To be exact, it is implemented in your project in /source/mqttInit.c.

The Client ID is set in /source/mqttConfig.h, on line 50. A client ID is generally not needed for an MQTT client, since communication is done anonymously by using topics, to which you can publish or subscribe. In the case of the MQTT Paho Demo for the XDK, the client ID later determines how the topics, to which your XDK publishes, are named. You can find the structure of the topic in /source/mqttPahoClient.h on line 40. The %s in the string will be later substitued by the client ID.

To be sure, I recommend reading the MQTT Paho Getting Started Guide, which is provided in the zip file with the MQTT Paho Demo (it will not be imported into the project, you have to open the zip-file manually).

Please tell me if this is helpful and do not hesitate to ask if you have further questions.

Kind regards,
Franjo

0 (0 Votes)
RE: Where do I add void appInitSystem(xTimerHandle xTimer) ?
Answer
5/11/17 9:24 AM as a reply to Franjo Stjepandic.

Do I have to create a mqttInit header file?

In the MQTT paho demo guide, code 2 & 3, do i have to include the includes and defines above the appinitsystem()? In code 2,  the words in blue "SSID" "PW" is where I enter the details, or do I have to declare this somewhere else? 

For code 6 and 8, it's at mqttPahoClient.h, but a few sentences are missing. Do I have to fill in those missing lines of codes?

For code 4, data.clientID.cstring = "xdk123"; Do I have enter the clientID i recieved from the hive broker websocket?

My system header files are facing issues, #include <stdio.h> , it's unresolved tried cleaning and rebuilding it but to no avail.... uint32_t types are facing issues too, any tips?

Thank you so much! Really new to this... >_>

 

-edit-

"Also flashing selected project aborted due to compilation problem" Tried building but errors are popping up everywhere. T.T

 

0 (0 Votes)
RE: Where do I add void appInitSystem(xTimerHandle xTimer) ?
Answer
5/11/17 4:48 PM as a reply to Jaden Edwin Chua.

Hello Jaden,

I assume we need to clarify some things first.
As I mentioned last time, there is the MQTT paho Demo provided in the community that demonstrates a complete MQTT project implementation.

I assume you are going through the MQTT Guide of the Learning section that shows how to implement MQTT on the XDK on your own. This guides is based on an empty application (XdkApplicationTemplate of the workbench welcome screen) to keep it modular for any use case.

I would recommend to go exactly through the complete guide, to get a basic understanding how it is implemented.
This should solve most of your issues with the code snippets.

Although the issue about unsolvable variables is caused by the linker of the XDK Workbench. This results because the linker is unable to resolve the variables correctly with the defined ones in the interfaces stdio.h and stdin.h. The issue can be solved by right clicking the project, browsing down to index and by clicking rebuild.

Please tell me if this is helpful and do not hesitate to ask if you have further questions.

Kind regards,
Franjo

0 (0 Votes)