Skip to content
This repository has been archived by the owner on Nov 29, 2023. It is now read-only.

Commit

Permalink
added QoS option
Browse files Browse the repository at this point in the history
  • Loading branch information
nscooling committed Feb 18, 2013
1 parent 463832f commit 5a6ee36
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 3 deletions.
Binary file removed .DS_Store
Binary file not shown.
Binary file removed build/.DS_Store
Binary file not shown.
2 changes: 1 addition & 1 deletion src/mqtt.c
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ mqtt_broker_handle_t * mqtt_connect(const char* client, const char * server_ip,



int mqtt_subscribe(mqtt_broker_handle_t *broker, const char *topic)
int mqtt_subscribe(mqtt_broker_handle_t *broker, const char *topic, QoS qos)
{
if (!broker->connected) {
return -1;
Expand Down
4 changes: 3 additions & 1 deletion src/mqtt.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,14 @@ POSSIBILITY OF SUCH DAMAGE.

typedef struct mqtt_broker_handle mqtt_broker_handle_t;

typedef enum {QoS0, QoS1, QoS2} QoS;

mqtt_broker_handle_t * mqtt_connect(const char* client, const char * server_ip, uint32_t port);
void mqtt_disconnect(mqtt_broker_handle_t *broker);

int mqtt_publish(mqtt_broker_handle_t *broker, const char *topic, const char *msg);

int mqtt_subscribe(mqtt_broker_handle_t *broker, const char *topic);
int mqtt_subscribe(mqtt_broker_handle_t *broker, const char *topic, QoS qos);
void mqtt_display_message(mqtt_broker_handle_t *broker, int (*print)(int));


Expand Down
2 changes: 1 addition & 1 deletion submain/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ int main (int argc, char** argv)
exit(1);
}

int result = mqtt_subscribe(broker, topic);
int result = mqtt_subscribe(broker, topic, QoS0);

if(result != 1) {
puts("failed to Subscribe");
Expand Down

0 comments on commit 5a6ee36

Please sign in to comment.