Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [paho-dev] example code - mqtt on cc3200

Danny,

Are you looking to use the client layer generically, ie on linux? If so Ian accepted the changeset I put in that includes a simple example that will subscribe to a topic on a server and print incoming messages to stdout.

If you're looking to use it specifically on a CC3200; I'm presuming here that you're using TI's CCS development environment with the CC3200 SDK installed and working.

The easiest thing to do is extend one of the SDK samples, for example tcp_socket. The main.c in this is mostly involved with setting up the board and only a small section with the actual network activity. In main() after the board is finished configuring and connecting to the wifi network (network settings are #defines starting at line 100) you can pretty much copy and paste lines 212 - 249 from the stdoutsub.c sample along with the messageArrived function. You'll want to remove the signal() lines and where I have printf() replace with UART_PRINT(). Make sure the source files for the client (both the MQTTClient-C and MQTTPacket sources) are accessible in your project, edit MQTTClient.h to #include MQTTCC3200.h and #include MQTTClient.h in your application.

This should give you a working example that will allow you to connect to an mqtt server, subscribe to a topic and print out messages to the serial port.

Al

On 23/09/14 22:31, Daniel Kern wrote:
Hi,

I imported the newest code and it compiles fine- link below
http://git.eclipse.org/c/paho/org.eclipse.paho.mqtt.embedded-c.git/commit/?id=8e6d4a43276f02a056865415ccad76f425f9f936

I'm unsure how to use the client module. What would the simplest example
look like - subscribing to message published from iot.eclipse.org
<http://iot.eclipse.org/>?

Best,

Danny


_______________________________________________
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



Back to the top