Skip to content

Commit

Permalink
MQTT examples fix
Browse files Browse the repository at this point in the history
Signed-off-by: Mustafa Ozcelikors <[email protected]>
  • Loading branch information
mozcelikors committed Jan 23, 2018
1 parent f918651 commit e590195
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
8 changes: 5 additions & 3 deletions src/examples/mqtt_publisher.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,12 @@
//Your MQTT Broker credentials and info
#define MQTT_BROKER "127.0.0.1"
#define MQTT_BROKER_PORT 1883 //default:1883
#define ROVER_MQTT_QOS 1 //Quality of service
#define ROVER_MQTT_QOS 0 //Quality of service
#define PUBLISH_TOPIC1 "rover/1/RoverDriving/control"
#define PUBLISH_TOPIC2 "rover/2/RoverDriving/control"
#define PUBLISH_PAYLOAD "Hello from rover!"
#define MQTT_USERNAME "sensor1@DEFAULT_TENANT"
#define MQTT_PASSWORD "hono-secret"

//Using rover namespace from Rover API
using namespace rover;
Expand All @@ -47,8 +49,8 @@ int main()
rover_mqtt_conf.qos = ROVER_MQTT_QOS; // Quality of Service
rover_mqtt_conf.timeout = 10000L; // Polling timeout, 10000L is fine
rover_mqtt_conf.topic = PUBLISH_TOPIC1; // Topic name to publish to or subscribe from
rover_mqtt_conf.username = "sensor1@DEFAULT_TENANT"; // Username - Leave empty for no user and password
rover_mqtt_conf.password = "hono-secret"; // Password - Leave empty for no user and password
rover_mqtt_conf.username = MQTT_USERNAME; // Username - Leave empty for no user and password
rover_mqtt_conf.password = MQTT_PASSWORD; // Password - Leave empty for no user and password
RoverPahoMQTT rover_mqtt = RoverPahoMQTT ( MQTT_BROKER, // MQTT-Broker host
MQTT_BROKER_PORT, // MQTT-Broker port
rover_mqtt_conf);
Expand Down
8 changes: 5 additions & 3 deletions src/examples/mqtt_subscriber.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,12 @@
//Your MQTT Broker credentials and info
#define MQTT_BROKER "127.0.0.1"
#define MQTT_BROKER_PORT 1883 // default:1883
#define ROVER_MQTT_QOS 1 //Quality of service
#define ROVER_MQTT_QOS 0 //Quality of service
#define SUBSCRIBE_TOPIC "rover/1/RoverDriving/control"
#define RECEIVE_PAYLOAD_BUFSIZE 50 // <-- Here we want to receive up to 50 characters of data
// This should be modified in case you want to receive more!
#define MQTT_USERNAME "sensor1@DEFAULT_TENANT"
#define MQTT_PASSWORD "hono-secret"

//Using rover namespace from Rover API
using namespace rover;
Expand All @@ -51,8 +53,8 @@ int main()
rover_mqtt_conf.qos = ROVER_MQTT_QOS; // Quality of Service
rover_mqtt_conf.timeout = 10000L; // Polling timeout, 10000L is fine
rover_mqtt_conf.topic = SUBSCRIBE_TOPIC; // Topic name to subscribe to
rover_mqtt_conf.username = "sensor1@DEFAULT_TENANT"; // Username - Leave empty for no user and password
rover_mqtt_conf.password = "hono-secret"; // Password - Leave empty for no user and password
rover_mqtt_conf.username = MQTT_USERNAME; // Username - Leave empty for no user and password
rover_mqtt_conf.password = MQTT_PASSWORD; // Password - Leave empty for no user and password

RoverPahoMQTT rover_mqtt = RoverPahoMQTT ( MQTT_BROKER, // MQTT-Broker host
MQTT_BROKER_PORT, // MQTT-Broker port
Expand Down

0 comments on commit e590195

Please sign in to comment.