Use bool instead of boolean in drivers (#888)
In the Arduino IDE, boolean is an alias for bool. The Arduino IDE might deprecate boolean in the future. See https://github.com/arduino/Arduino/issues/4673 for details. Command: find drivers -type f | xargs sed -i 's/boolean/bool/g'
This commit is contained in:
committed by
Patrick Fallberg
parent
4ea0c88ac8
commit
a941827157
@@ -119,24 +119,24 @@ PubSubClient::PubSubClient(const char* domain, uint16_t port, MQTT_CALLBACK_SIGN
|
||||
setStream(stream);
|
||||
}
|
||||
|
||||
boolean PubSubClient::connect(const char *id)
|
||||
bool PubSubClient::connect(const char *id)
|
||||
{
|
||||
return connect(id,NULL,NULL,0,0,0,0);
|
||||
}
|
||||
|
||||
boolean PubSubClient::connect(const char *id, const char *user, const char *pass)
|
||||
bool PubSubClient::connect(const char *id, const char *user, const char *pass)
|
||||
{
|
||||
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)
|
||||
bool PubSubClient::connect(const char *id, const char* willTopic, uint8_t willQos,
|
||||
bool willRetain, const char* willMessage)
|
||||
{
|
||||
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)
|
||||
bool PubSubClient::connect(const char *id, const char *user, const char *pass,
|
||||
const char* willTopic, uint8_t willQos, bool willRetain, const char* willMessage)
|
||||
{
|
||||
if (!connected()) {
|
||||
int result = 0;
|
||||
@@ -230,7 +230,7 @@ boolean PubSubClient::connect(const char *id, const char *user, const char *pass
|
||||
}
|
||||
|
||||
// reads a byte into result
|
||||
boolean PubSubClient::readByte(uint8_t * result)
|
||||
bool PubSubClient::readByte(uint8_t * result)
|
||||
{
|
||||
uint32_t previousMillis = millis();
|
||||
while(!_client->available()) {
|
||||
@@ -244,7 +244,7 @@ boolean PubSubClient::readByte(uint8_t * result)
|
||||
}
|
||||
|
||||
// reads a byte into result[*index] and increments index
|
||||
boolean PubSubClient::readByte(uint8_t * result, uint16_t * index)
|
||||
bool PubSubClient::readByte(uint8_t * result, uint16_t * index)
|
||||
{
|
||||
uint16_t current_index = *index;
|
||||
uint8_t * write_address = &(result[current_index]);
|
||||
@@ -316,7 +316,7 @@ uint16_t PubSubClient::readPacket(uint8_t* lengthLength)
|
||||
return len;
|
||||
}
|
||||
|
||||
boolean PubSubClient::loop()
|
||||
bool PubSubClient::loop()
|
||||
{
|
||||
if (connected()) {
|
||||
unsigned long t = millis();
|
||||
@@ -382,23 +382,23 @@ boolean PubSubClient::loop()
|
||||
return false;
|
||||
}
|
||||
|
||||
boolean PubSubClient::publish(const char* topic, const char* payload)
|
||||
bool PubSubClient::publish(const char* topic, const char* payload)
|
||||
{
|
||||
return publish(topic,(const uint8_t*)payload,strlen(payload),false);
|
||||
}
|
||||
|
||||
boolean PubSubClient::publish(const char* topic, const char* payload, boolean retained)
|
||||
bool PubSubClient::publish(const char* topic, const char* payload, bool retained)
|
||||
{
|
||||
return publish(topic,(const uint8_t*)payload,strlen(payload),retained);
|
||||
}
|
||||
|
||||
boolean PubSubClient::publish(const char* topic, const uint8_t* payload, unsigned int plength)
|
||||
bool PubSubClient::publish(const char* topic, const uint8_t* payload, unsigned int plength)
|
||||
{
|
||||
return publish(topic, payload, plength, false);
|
||||
}
|
||||
|
||||
boolean PubSubClient::publish(const char* topic, const uint8_t* payload, unsigned int plength,
|
||||
boolean retained)
|
||||
bool PubSubClient::publish(const char* topic, const uint8_t* payload, unsigned int plength,
|
||||
bool retained)
|
||||
{
|
||||
if (connected()) {
|
||||
if (MQTT_MAX_PACKET_SIZE < 5 + 2+strlen(topic) + plength) {
|
||||
@@ -421,8 +421,8 @@ boolean PubSubClient::publish(const char* topic, const uint8_t* payload, unsigne
|
||||
return false;
|
||||
}
|
||||
|
||||
boolean PubSubClient::publish_P(const char* topic, const uint8_t* payload, unsigned int plength,
|
||||
boolean retained)
|
||||
bool PubSubClient::publish_P(const char* topic, const uint8_t* payload, unsigned int plength,
|
||||
bool retained)
|
||||
{
|
||||
uint8_t llen = 0;
|
||||
uint8_t digit;
|
||||
@@ -468,7 +468,7 @@ boolean PubSubClient::publish_P(const char* topic, const uint8_t* payload, unsig
|
||||
return rc == tlen + 4 + plength;
|
||||
}
|
||||
|
||||
boolean PubSubClient::write(uint8_t header, uint8_t* buf, uint16_t length)
|
||||
bool PubSubClient::write(uint8_t header, uint8_t* buf, uint16_t length)
|
||||
{
|
||||
uint8_t lenBuf[4];
|
||||
uint8_t llen = 0;
|
||||
@@ -495,7 +495,7 @@ boolean PubSubClient::write(uint8_t header, uint8_t* buf, uint16_t length)
|
||||
uint8_t* writeBuf = buf+(4-llen);
|
||||
uint16_t bytesRemaining = length+1+llen; //Match the length type
|
||||
uint8_t bytesToWrite;
|
||||
boolean result = true;
|
||||
bool result = true;
|
||||
while((bytesRemaining > 0) && result) {
|
||||
bytesToWrite = (bytesRemaining > MQTT_MAX_TRANSFER_SIZE)?MQTT_MAX_TRANSFER_SIZE:bytesRemaining;
|
||||
rc = _client->write(writeBuf,bytesToWrite);
|
||||
@@ -511,12 +511,12 @@ boolean PubSubClient::write(uint8_t header, uint8_t* buf, uint16_t length)
|
||||
#endif
|
||||
}
|
||||
|
||||
boolean PubSubClient::subscribe(const char* topic)
|
||||
bool PubSubClient::subscribe(const char* topic)
|
||||
{
|
||||
return subscribe(topic, 0);
|
||||
}
|
||||
|
||||
boolean PubSubClient::subscribe(const char* topic, uint8_t qos)
|
||||
bool PubSubClient::subscribe(const char* topic, uint8_t qos)
|
||||
{
|
||||
// original: if (qos < 0 || qos > 1) { (qos is uint8_t, hence qos < 0 impossible, tekka)
|
||||
if (qos > 1) {
|
||||
@@ -542,7 +542,7 @@ boolean PubSubClient::subscribe(const char* topic, uint8_t qos)
|
||||
return false;
|
||||
}
|
||||
|
||||
boolean PubSubClient::unsubscribe(const char* topic)
|
||||
bool PubSubClient::unsubscribe(const char* topic)
|
||||
{
|
||||
if (MQTT_MAX_PACKET_SIZE < 9 + strlen(topic)) {
|
||||
// Too long
|
||||
@@ -587,9 +587,9 @@ uint16_t PubSubClient::writeString(const char* string, uint8_t* buf, uint16_t po
|
||||
}
|
||||
|
||||
|
||||
boolean PubSubClient::connected()
|
||||
bool PubSubClient::connected()
|
||||
{
|
||||
boolean rc;
|
||||
bool rc;
|
||||
if (_client == NULL ) {
|
||||
rc = false;
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user