Skip to content

Commit

Permalink
Revert "Added support of CleanSession flag during connect"
Browse files Browse the repository at this point in the history
  • Loading branch information
knolleary authored Nov 1, 2018
1 parent b1bdbb7 commit 3637cbe
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 10 deletions.
15 changes: 6 additions & 9 deletions src/PubSubClient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -102,18 +102,18 @@ PubSubClient::PubSubClient(const char* domain, uint16_t port, MQTT_CALLBACK_SIGN
}

boolean PubSubClient::connect(const char *id) {
return connect(id,NULL,NULL,0,0,0,0,1);
return connect(id,NULL,NULL,0,0,0,0);
}

boolean PubSubClient::connect(const char *id, const char *user, const char *pass) {
return connect(id,user,pass,0,0,0,0,1);
return connect(id,user,pass,0,0,0,0);
}

boolean PubSubClient::connect(const char *id, const char* willTopic, uint8_t willQos, boolean willRetain, const char* willMessage) {
return connect(id,NULL,NULL,willTopic,willQos,willRetain,willMessage,1);
return connect(id,NULL,NULL,willTopic,willQos,willRetain,willMessage);
}

boolean PubSubClient::connect(const char *id, const char *user, const char *pass, const char* willTopic, uint8_t willQos, boolean willRetain, const char* willMessage, boolean cleanSession) {
boolean PubSubClient::connect(const char *id, const char *user, const char *pass, const char* willTopic, uint8_t willQos, boolean willRetain, const char* willMessage) {
if (!connected()) {
int result = 0;

Expand Down Expand Up @@ -141,14 +141,11 @@ boolean PubSubClient::connect(const char *id, const char *user, const char *pass

uint8_t v;
if (willTopic) {
v = 0x04|(willQos<<3)|(willRetain<<5);
v = 0x06|(willQos<<3)|(willRetain<<5);
} else {
v = 0;
v = 0x02;
}

if (cleanSession)
v = v|0x02;

if(user != NULL) {
v = v|0x80;

Expand Down
2 changes: 1 addition & 1 deletion src/PubSubClient.h
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ class PubSubClient : public Print {
boolean connect(const char* id);
boolean connect(const char* id, const char* user, const char* pass);
boolean connect(const char* id, const char* willTopic, uint8_t willQos, boolean willRetain, const char* willMessage);
boolean connect(const char* id, const char* user, const char* pass, const char* willTopic, uint8_t willQos, boolean willRetain, const char* willMessage, boolean cleanSession);
boolean connect(const char* id, const char* user, const char* pass, const char* willTopic, uint8_t willQos, boolean willRetain, const char* willMessage);
void disconnect();
boolean publish(const char* topic, const char* payload);
boolean publish(const char* topic, const char* payload, boolean retained);
Expand Down

0 comments on commit 3637cbe

Please sign in to comment.