Skip to content

Commit 46e82af

Browse files
authored
Merge pull request #99 from Rotzbua/fix_bool
change boolean to bool
2 parents 6f14db6 + 0280ca2 commit 46e82af

File tree

4 files changed

+47
-47
lines changed

4 files changed

+47
-47
lines changed

README.md

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -149,56 +149,56 @@ void setOptions(int keepAlive, bool cleanSession, int timeout);
149149
Connect to broker using the supplied client id and an optional username and password:
150150

151151
```c++
152-
boolean connect(const char clientId[]);
153-
boolean connect(const char clientId[], const char username[]);
154-
boolean connect(const char clientId[], const char username[], const char password[]);
152+
bool connect(const char clientId[]);
153+
bool connect(const char clientId[], const char username[]);
154+
bool connect(const char clientId[], const char username[], const char password[]);
155155
```
156156
157157
- This functions returns a boolean that indicates if the connection has been established successfully.
158158
159159
Publishes a message to the broker with an optional payload:
160160
161161
```c++
162-
boolean publish(const String &topic);
163-
boolean publish(const char topic[]);
164-
boolean publish(const String &topic, const String &payload);
165-
boolean publish(const String &topic, const String &payload, bool retained, int qos);
166-
boolean publish(const char topic[], const String &payload);
167-
boolean publish(const char topic[], const String &payload, bool retained, int qos);
168-
boolean publish(const char topic[], const char payload[]);
169-
boolean publish(const char topic[], const char payload[], bool retained, int qos);
170-
boolean publish(const char topic[], const char payload[], int length);
171-
boolean publish(const char topic[], const char payload[], int length, bool retained, int qos);
162+
bool publish(const String &topic);
163+
bool publish(const char topic[]);
164+
bool publish(const String &topic, const String &payload);
165+
bool publish(const String &topic, const String &payload, bool retained, int qos);
166+
bool publish(const char topic[], const String &payload);
167+
bool publish(const char topic[], const String &payload, bool retained, int qos);
168+
bool publish(const char topic[], const char payload[]);
169+
bool publish(const char topic[], const char payload[], bool retained, int qos);
170+
bool publish(const char topic[], const char payload[], int length);
171+
bool publish(const char topic[], const char payload[], int length, bool retained, int qos);
172172
```
173173

174174
Subscribe to a topic:
175175

176176
```c++
177-
boolean subscribe(const String &topic);
178-
boolean subscribe(const String &topic, int qos);
179-
boolean subscribe(const char topic[]);
180-
boolean subscribe(const char topic[], int qos);
177+
bool subscribe(const String &topic);
178+
bool subscribe(const String &topic, int qos);
179+
bool subscribe(const char topic[]);
180+
bool subscribe(const char topic[], int qos);
181181
```
182182
183183
Unsubscribe from a topic:
184184
185185
```c++
186-
boolean unsubscribe(const String &topic);
187-
boolean unsubscribe(const char topic[]);
186+
bool unsubscribe(const String &topic);
187+
bool unsubscribe(const char topic[]);
188188
```
189189

190190
Sends and receives packets:
191191

192192
```c++
193-
boolean loop();
193+
bool loop();
194194
```
195195

196196
- This function should be called in every `loop`.
197197

198198
Check if the client is currently connected:
199199

200200
```c++
201-
boolean connected();
201+
bool connected();
202202
```
203203

204204
Access low-level information for debugging:
@@ -211,5 +211,5 @@ lwmqtt_return_code_t returnCode();
211211
Disconnect from the broker:
212212

213213
```c++
214-
boolean disconnect();
214+
bool disconnect();
215215
```

examples/ArduinoMKRGSM1400/ArduinoMKRGSM1400.ino

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ void setup() {
3737

3838
void connect() {
3939
// connection state
40-
boolean connected = false;
40+
bool connected = false;
4141

4242
Serial.print("connecting to cellular network ...");
4343

examples/ArduinoMKRGSM1400_SSL/ArduinoMKRGSM1400_SSL.ino

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ void setup() {
3939

4040
void connect() {
4141
// connection state
42-
boolean connected = false;
42+
bool connected = false;
4343

4444
Serial.print("connecting to cellular network ...");
4545

src/MQTTClient.h

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -158,11 +158,11 @@ class MQTTClient {
158158
this->timeout = (uint32_t)timeout;
159159
}
160160

161-
boolean connect(const char clientId[]) { return this->connect(clientId, nullptr, nullptr); }
161+
bool connect(const char clientId[]) { return this->connect(clientId, nullptr, nullptr); }
162162

163-
boolean connect(const char clientId[], const char username[]) { return this->connect(clientId, username, nullptr); }
163+
bool connect(const char clientId[], const char username[]) { return this->connect(clientId, username, nullptr); }
164164

165-
boolean connect(const char clientId[], const char username[], const char password[]) {
165+
bool connect(const char clientId[], const char username[], const char password[]) {
166166
// close left open connection if still connected
167167
if (this->connected()) {
168168
this->close();
@@ -209,35 +209,35 @@ class MQTTClient {
209209
return true;
210210
}
211211

212-
boolean publish(const String &topic) { return this->publish(topic.c_str(), ""); }
212+
bool publish(const String &topic) { return this->publish(topic.c_str(), ""); }
213213

214-
boolean publish(const char topic[]) { return this->publish(topic, ""); }
214+
bool publish(const char topic[]) { return this->publish(topic, ""); }
215215

216-
boolean publish(const String &topic, const String &payload) { return this->publish(topic.c_str(), payload.c_str()); }
216+
bool publish(const String &topic, const String &payload) { return this->publish(topic.c_str(), payload.c_str()); }
217217

218-
boolean publish(const String &topic, const String &payload, bool retained, int qos) {
218+
bool publish(const String &topic, const String &payload, bool retained, int qos) {
219219
return this->publish(topic.c_str(), payload.c_str(), retained, qos);
220220
}
221221

222-
boolean publish(const char topic[], const String &payload) { return this->publish(topic, payload.c_str()); }
222+
bool publish(const char topic[], const String &payload) { return this->publish(topic, payload.c_str()); }
223223

224-
boolean publish(const char topic[], const String &payload, bool retained, int qos) {
224+
bool publish(const char topic[], const String &payload, bool retained, int qos) {
225225
return this->publish(topic, payload.c_str(), retained, qos);
226226
}
227227

228-
boolean publish(const char topic[], const char payload[]) {
228+
bool publish(const char topic[], const char payload[]) {
229229
return this->publish(topic, (char *)payload, (int)strlen(payload));
230230
}
231231

232-
boolean publish(const char topic[], const char payload[], bool retained, int qos) {
232+
bool publish(const char topic[], const char payload[], bool retained, int qos) {
233233
return this->publish(topic, (char *)payload, (int)strlen(payload), retained, qos);
234234
}
235235

236-
boolean publish(const char topic[], const char payload[], int length) {
236+
bool publish(const char topic[], const char payload[], int length) {
237237
return this->publish(topic, payload, length, false, 0);
238238
}
239239

240-
boolean publish(const char topic[], const char payload[], int length, bool retained, int qos) {
240+
bool publish(const char topic[], const char payload[], int length, bool retained, int qos) {
241241
// return immediately if not connected
242242
if (!this->connected()) {
243243
return false;
@@ -259,13 +259,13 @@ class MQTTClient {
259259
return true;
260260
}
261261

262-
boolean subscribe(const String &topic) { return this->subscribe(topic.c_str()); }
262+
bool subscribe(const String &topic) { return this->subscribe(topic.c_str()); }
263263

264-
boolean subscribe(const String &topic, int qos) { return this->subscribe(topic.c_str(), qos); }
264+
bool subscribe(const String &topic, int qos) { return this->subscribe(topic.c_str(), qos); }
265265

266-
boolean subscribe(const char topic[]) { return this->subscribe(topic, 0); }
266+
bool subscribe(const char topic[]) { return this->subscribe(topic, 0); }
267267

268-
boolean subscribe(const char topic[], int qos) {
268+
bool subscribe(const char topic[], int qos) {
269269
// return immediately if not connected
270270
if (!this->connected()) {
271271
return false;
@@ -280,9 +280,9 @@ class MQTTClient {
280280
return true;
281281
}
282282

283-
boolean unsubscribe(const String &topic) { return this->unsubscribe(topic.c_str()); }
283+
bool unsubscribe(const String &topic) { return this->unsubscribe(topic.c_str()); }
284284

285-
boolean unsubscribe(const char topic[]) {
285+
bool unsubscribe(const char topic[]) {
286286
// return immediately if not connected
287287
if (!this->connected()) {
288288
return false;
@@ -297,7 +297,7 @@ class MQTTClient {
297297
return true;
298298
}
299299

300-
boolean loop() {
300+
bool loop() {
301301
// return immediately if not connected
302302
if (!this->connected()) {
303303
return false;
@@ -323,7 +323,7 @@ class MQTTClient {
323323
return true;
324324
}
325325

326-
boolean connected() {
326+
bool connected() {
327327
// a client is connected if the network is connected, a client is available and
328328
// the connection has been properly initiated
329329
return this->netClient != nullptr && this->netClient->connected() == 1 && this->_connected;
@@ -333,7 +333,7 @@ class MQTTClient {
333333

334334
lwmqtt_return_code_t returnCode() { return this->_returnCode; }
335335

336-
boolean disconnect() {
336+
bool disconnect() {
337337
// return immediately if not connected anymore
338338
if (!this->connected()) {
339339
return false;
@@ -349,7 +349,7 @@ class MQTTClient {
349349
}
350350

351351
private:
352-
boolean close() {
352+
bool close() {
353353
// set flag
354354
this->_connected = false;
355355

0 commit comments

Comments
 (0)