Jim Flynn / Mbed OS aws-iot-device-sdk-mbed-c
Embed: (wiki syntax)

« Back to documentation index

subscribe_publish_library_sample.c File Reference

subscribe_publish_library_sample.c File Reference

simple MQTT publish and subscribe on the same topic using the SDK as a library More...

Go to the source code of this file.

Variables

char certDirectory [PATH_MAX+1] = "../../../certs"
 Default cert location.
char HostAddress [HOST_ADDRESS_SIZE] = AWS_IOT_MQTT_HOST
 Default MQTT HOST URL is pulled from the aws_iot_config.h.
uint32_t port = AWS_IOT_MQTT_PORT
 Default MQTT port is pulled from the aws_iot_config.h.
uint32_t publishCount = 0
 This parameter will avoid infinite loop of publish and exit the program after certain number of publishes.

Detailed Description

simple MQTT publish and subscribe on the same topic using the SDK as a library

This example takes the parameters from the aws_iot_config.h file and establishes a connection to the AWS IoT MQTT Platform. It subscribes and publishes to the same topic - "sdkTest/sub"

If all the certs are correct, you should see the messages received by the application in a loop.

The application takes in the certificate path, host name , port and the number of times the publish should happen.

Definition in file subscribe_publish_library_sample.c.


Variable Documentation

char certDirectory[PATH_MAX+1] = "../../../certs"

Default cert location.

Definition at line 45 of file subscribe_publish_library_sample.c.

char HostAddress[HOST_ADDRESS_SIZE] = AWS_IOT_MQTT_HOST

Default MQTT HOST URL is pulled from the aws_iot_config.h.

Definition at line 50 of file subscribe_publish_library_sample.c.

uint32_t port = AWS_IOT_MQTT_PORT

Default MQTT port is pulled from the aws_iot_config.h.

Definition at line 55 of file subscribe_publish_library_sample.c.

uint32_t publishCount = 0

This parameter will avoid infinite loop of publish and exit the program after certain number of publishes.

Definition at line 60 of file subscribe_publish_library_sample.c.