I have just downloaded the MQTT 'C' client. Somewhere in the documentation, I read that this client can
run in single thread also, and the behaviour of publish and subscribe will be synchronous in nature.
When I quickly peeked into the source code, there is no way by which we can run in Bare metal board(non OS based).
Please let me know if it is there and I missed it. I am planning to use very time processor to develop the mqtt client.
And having OS on this would be a costly affair.
here is reply from Andy Piper sent via Paho mailing list
What kind of board are you using, exactly?
There's a small MQTT client for the Arduino, another for Netduino, and one for mbed. None of these are currently part of Paho, and all of them have limitations around e.g. not supporting QoS levels greater than 0 (often due to the storage and local persistence limitations)
You mention running on bare-metal without an OS. The clients we currently have in the Paho project do expect at least a small OS (although that could be an embedded Linux or Java-type of thing as a minimum).
Actually, we are using 8051 based processor with UART to send/receive message over TCP using GPRS module. So we don't need to have OS to have TCP stack. Secondly I believe multi-threading in the current implementation of Paho client is for subscription(though I need to reconfirm).
We are developing a GPRS based telematic solution, which is mostly into publishing only. Our data size is 4*4 Bytes, so for persistent data we can use the connected 1MB EEPROM. Which will be more than sufficient.
Andy Piper Messages: 15 Registered: November 2011 Location: Kingston upon Thames, UK
(you will find that Ian Craggs the C client author may respond more quickly on the mailing list... we are working on how to integrate communications though!)
OK, so MQTT as implemented by Paho does depend on a TCP stack, and an OS. There is a variant called MQTT-s (MQTT for sensors) which does not need TCP, but Paho doesn't implement that. You could also look at the Arduino MQTT client which is independent of Paho for some ideas that may help.
One technique that is sometimes used in the lightweight model that you are describing is to have a local "concentrator" node running e.g. embedded Linux which can understand your networking protocol (UART, serial, zigbee or other mesh networks are examples) and then aggregate the data packets from sensors. This would then send MQTT messages upstream to a broker and other applications.
We are having GPRS enabled sensors, which are capable of transmit/receive data over TCP. With these sensors, we need to connect a small micro(8051), which will have MQTT implementation and in turn command sensor to send the desired packet over TCP.
MQTT-s wont be suitable for our application as we want the sensor should talk to the serve(broker) directly. In short, we need to have MQTT client.
Have you found any suitable client for your needs?
I´ve also found it hard to get a bare-metal compatible client or even a freeRTOS compatible client.
However I´ve found, and will soon start testing, this client: git://github.com/m2mIO/client-libraries.git