General Category > Discussion - MCU

Opportunities of implementing MQTT and their benefits

<< < (2/2)

BRT Community:
Hello,

This is basic C language. It is called a typecast. More information on this is available online.

Best Regards,
BRT Community

Vladi:
Hello,

yeah I know this but the question is: Why there is a typecast needed?
In arg there are strange numbers.

Why can't I just let the pointer uninitialized like:
 struct sub_info *subInfo;
subInfo->topic = TOPIC_CONTROL;

Is it because in arg is the adress of the pointer on the heap? And pointers need to have an address where they point to?

BRT Community:
Hello,

It is a method used in C to allow the passing of arbitrary data (as void *) to a function. The function can then optionally perform actions to determine how to handle the data. In this case a pointer is made to the data which assumes the data is of a particular structure.

The MQTT client in lwIP has an arbitrary argument which is passed to each callback function. This argument can be used to tell between different contexts (e.g. for different MQTT subscriptions etc). This argument is for the callback to mqtt_subscribe where a mqtt_incoming_publish_cb_t is passed. The argument passed to the callback allows the code to work out what to do with the incoming data.

Best Regards,
BRT Community

Debrasoare:
Thanks I will try this out.
I want to publish the mqtt messages over to the cloud using certificates for authentication. Is there a way for the module to connect to the cloud like aws/google/azure iotdirectly without a broker? How can we attach the CA and private certificates for this?

BRT Community:
Hello,

There are choices to make in mbedlts_config.h for each different platform.
You can set the mbedTLS up for each of them depending on their platform specifications.

There is very limited space for this in flash and in RAM though.

We have another unreleased/beta Application called BRT_AN_051 FT90x AWS IoT Application in which the FT90x publishes the MQTT messages to the AWS cloud and uses certificates for authentication. If you are interested in this, please contact us via email:

https://brtchip.com/contact-us/

Best Regards,
BRT Community

Navigation

[0] Message Index

[*] Previous page

Go to full version