MQTT
Answer
2/7/18 9:53 AM

Hello,

I'm working on a project, where I want to publish sensor data through the enterprise network to the MQTT broker.

I started to work with the enterprise Wifi demo and started to add the MQTT part.

I added the include Serval_Mqtt.h, but when I add the static variable from type MqttSession_T for the session variables, it fails ("Type 'MqttSession_T' could not be resolved").

Do I forgot to include something?

Best Regards
François Boissinot

0 (0 Votes)
RE: MQTT
Answer
2/7/18 1:45 PM as a reply to Francois Boissinot.
Hello Francois,

first of all, I would like to welcome you to the XDK community.

Regarding your issue, there is a macro in Serval_Defines.h to enable the MQTT header-file. This file is located in the SDK at SDK > xdk110 > Libraries > ServalStack > 3rd-party > ServalStack > api.

The macro in question is on line 84. Set this macro to 1, as follows:
#define SERVAL_ENABLE_MQTT   1
This should enable the header-file. And just to make sure, add (or adapt) the line SERVAL_ENABLE_MQTT=1 in SDK > common > make_defines.txt .

I think the issue is simply that the header-file is enabled (it is guarded by #if SERVAL_ENABLE_MQTT ). But if this does not work even after making these changes, could you please tell me which Workbench version you are using?

The source code is definitely enabled with 3.2.0, but with lower versions, there might be an issue where there is no compiled code that corresponds to the header-file.

Please tell me if this was helpful, and do not hesitate to ask further questions.

Kind regards,
Alex
+1 (1 Vote)
RE: MQTT
Answer
2/7/18 3:03 PM as a reply to Alexander Sawtschuk.

Hello,

Thanks for your quick response.

I work with the 3.2.0 version.

Somehow it still doesn't work.

The steps I did:

- Download the EnterpriseWifi (http://appropos.de/downloads/xdk/Enterprise-WiFi-3.0.zip)

- Adapt the WLAN parameters

- Change the Serval_Defines.h and add in the header file the following

#define SERVAL_ENABLE_MQTT   1
#define MQTT_BROKER_HOST "*****.com"
#define MQTT_BROKER_PORT 1883
static MqttSession_T session;
static MqttSession_T *session_ptr = &session;

And ... I still keep the error: "unknown type name 'MqttSession_T'."

Regards
François

Update: after moving the session variables from the header file to the .c file, the error disappeared.

0 (0 Votes)
RE: MQTT
Answer
2/7/18 3:51 PM as a reply to Francois Boissinot.

After inserting the whole code (https://developer.appropos.de/xdk/protocols/mqtt/), the build was error free. I flashed the program to the XDK, but it doesn't work :(

The XDK is connecting to the network, discovering the IP of the MQTT broker, and after I became the following message

"INFO | XDK DEVICE 1:  asserted at Filename 3rd-party/FreeRTOS/Source/queue.c , line no  1372
 INFO | XDK DEVICE 1: asserted at Filename 3rd-party/FreeRTOS/Source/queue.c , line no  616 "

How should I handle it? (Search what is wrong)

Thanks in advance

François

0 (0 Votes)
RE: MQTT
Answer
6/5/18 11:58 AM as a reply to Francois Boissinot.
Hello Francois,

I took a look at the respective lines in the implementation file queue.c . Both errors are pointing to the call of configASSERT( pxQueue ) , which is responsible for raising the assert.

This basically means, that there is some uninitialized queue that your application attempts to access.

Are you implementing additional functionality that is utilizing a queue?

If this is not the case, I can only assume that this is related to the CmdProcessor , which is calling appInitSystem or a module that uses a queue internally, that is not initialized properly.

For further analysis, I would ask you to push your code in a Github repository, so that I am able to inspect it directly.

If this is no suitable option for you, then I would ask you to post your email address in here, so that we can exchange the code via email.

Please let me know if that was helpful and feel free to ask if you have further questions.

Kind regards,
Alex
0 (0 Votes)