Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [paho-dev] Embedded MQTT C Client

To be clear, there are a number of options for embedded clients now.

1) use the lowest-level MQTTPacket library, which is used by Benjamin in his tutorial videos. Thanks Benjamin!

2) use the higher level C++ embedded MQTTClient library. This was written first of all for mbed, where C++, rather than C, is the defacto programming language. This is C++ without STL (char* not String) and still without dynamic memory allocation.

This is also working for the Arduino, and is an API that looks fairly Arduino-like. I've created an Arduino library out of this code.

3) Use the C version of 2), in the MQTTClient-C directory. This was written by Al as a C "copy" of the C++ library, for those environments which struggle with C++ or for which C is the preferred language.

Options 2) and 3) are more helpful than 1), but use more resources.

The CC3200 environment is not conducive to C++ development, from Al's experience, so 1) or 3) are the options to consider.

Ian


On 09/22/2014 05:05 PM, Al Stockdill-Mander wrote:
The CC3200 code relies on the SimpleLink libraries provided by TI. I'm not familiar with the Spark Core but it looks like it's designed to be similar to the arduino in terms of IDE and libraries. It will almost certainly be easier to port the arduino embedded C++ library. If you look in the repo at the moment under arduino there is EthernetStack.h and WifiIPStack.h, these provide the implementation specifics for the Ethernet or WifiShield on an arduino. Looking at the Spark site there seem to be most of the equivalent functions (.connect() .available() .write()) under TCPClient, although it doesn't seem to have a readBytes() so you'd have to use a loop to read() a byte at a time into the buffer. The current Countdown.h in the arduino directory should work as is as it only uses millis() which also seems to be on the spark core.

Al

On 22/09/14 16:44, Guy Dillen wrote:
Hi Al,

Thanks.
Besides the TI CC3200 I also would like porting/using the library with my Spark Core's (www.spark.io) based on that are based on the ARM cortex M3 microprocessor. I suppose, since I'm no expert C developer, can I use the same source code as for the CC3200? Any help/suggestions welcome.

Thanks.
Guy

Sent from my iPad

On 22 Sep 2014, at 17:13, Al Stockdill-Mander <asm@xxxxxxxx> wrote:

Guy,

Copy the MQTTClient.c/h and MQTTCC3200.c/h files to wherever is suitable for the app you're working on. You only need to import the MQTTClient.h, but you have to edit MQTTClient.h to #include the platform specific implementation it is to use. Currently there is only the CC3200 code, so add a #import "MQTTCC3200.h" to the end of the #includes in MQTTClient.h I realise that there is a distinct lack of documentation/samples for the C specific embedded client, I'll try and get something up asap. In the mean time please ask any other questions here and I'll do what I can to help.

Al

On 22/09/14 14:56, Guy Dillen wrote:
Hi,

I mentioned the embedded C implementation has a specific C (and even
more specific) CC3200 implementation.
I’m confused as what sources to use; in the example form Benjamin Cabé
all source code under MQTTPacket was imported in the CC3200
microcontroller project. Should I still import these sources or only the
sources under
org.eclipse.paho.mqtt.embedded-c-master -> MQTTClient-C -> cc3200 ->
MQTTCC3200.c and MQTTCC3200.h?

Thanks.
Guy



_______________________________________________
paho-dev mailing list
paho-dev@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/paho-dev
_______________________________________________
paho-dev mailing list
paho-dev@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/paho-dev
_______________________________________________
paho-dev mailing list
paho-dev@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/paho-dev

_______________________________________________
paho-dev mailing list
paho-dev@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/paho-dev

--
Ian Craggs
icraggs@xxxxxxxxxx                 IBM United Kingdom
Committer on Paho, Mosquitto



Back to the top