diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..a0288f0 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,19 @@ +language: python +python: + - "2.7" + +cache: + directories: + - "~/.platformio" + +env: + - PLATFORMIO_CI_SRC=examples/FullyFeatured + - CPPLINT=true + +install: + - pip install -U platformio + - pip install cpplint + - platformio lib install 305 # ESPAsyncTCP + +script: + - if [[ "$CPPLINT" ]]; then make cpplint; else platformio ci --lib="." --board=esp01 --board=nodemcuv2; fi diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..608f0c2 --- /dev/null +++ b/Makefile @@ -0,0 +1,3 @@ +cpplint: + cpplint --repository=. --recursive --filter=-whitespace/line_length,-legal/copyright,-runtime/printf,-build/include,-build/namespace ./src +.PHONY: cpplint diff --git a/src/AsyncMqttClient.cpp b/src/AsyncMqttClient.cpp index 3c4a57c..6194d9f 100644 --- a/src/AsyncMqttClient.cpp +++ b/src/AsyncMqttClient.cpp @@ -363,7 +363,7 @@ void AsyncMqttClient::_onMessage(char* topic, char* payload, uint8_t qos, bool d bool notifyPublish = true; if (qos == 2) { - for (AsyncMqttClientInternals::PendingPubRel pendingPubRel :_pendingPubRels) { + for (AsyncMqttClientInternals::PendingPubRel pendingPubRel : _pendingPubRels) { if (pendingPubRel.packetId == packetId) { notifyPublish = false; break; @@ -413,7 +413,7 @@ void AsyncMqttClient::_onPublish(uint16_t packetId, uint8_t qos) { _lastActivity = millis(); bool pubRelAwaiting = false; - for (AsyncMqttClientInternals::PendingPubRel pendingPubRel :_pendingPubRels) { + for (AsyncMqttClientInternals::PendingPubRel pendingPubRel : _pendingPubRels) { if (pendingPubRel.packetId == packetId) { pubRelAwaiting = true; break; @@ -512,7 +512,7 @@ bool AsyncMqttClient::connected() const { } void AsyncMqttClient::connect() { - if(_connected) return; + if (_connected) return; if (_useIp) { _client.connect(_ip, _port); @@ -522,7 +522,7 @@ void AsyncMqttClient::connect() { } void AsyncMqttClient::disconnect() { - if(!_connected) return; + if (!_connected) return; char fixedHeader[2]; fixedHeader[0] = AsyncMqttClientInternals::PacketType.DISCONNECT; @@ -536,7 +536,7 @@ void AsyncMqttClient::disconnect() { } uint16_t AsyncMqttClient::subscribe(const char* topic, uint8_t qos) { - if(!_connected) return 0; + if (!_connected) return 0; char fixedHeader[5]; fixedHeader[0] = AsyncMqttClientInternals::PacketType.SUBSCRIBE; @@ -569,7 +569,7 @@ uint16_t AsyncMqttClient::subscribe(const char* topic, uint8_t qos) { } uint16_t AsyncMqttClient::unsubscribe(const char* topic) { - if(!_connected) return 0; + if (!_connected) return 0; char fixedHeader[5]; fixedHeader[0] = AsyncMqttClientInternals::PacketType.UNSUBSCRIBE; @@ -598,7 +598,7 @@ uint16_t AsyncMqttClient::unsubscribe(const char* topic) { } uint16_t AsyncMqttClient::publish(const char* topic, uint8_t qos, bool retain, const char* payload, size_t length) { - if(!_connected) return 0; + if (!_connected) return 0; char fixedHeader[5]; fixedHeader[0] = AsyncMqttClientInternals::PacketType.PUBLISH; diff --git a/src/AsyncMqttClient.h b/src/AsyncMqttClient.h index d982594..23d3055 100644 --- a/src/AsyncMqttClient.h +++ b/src/AsyncMqttClient.h @@ -1,6 +1,6 @@ -#ifndef ASYNCMQTTCLIENT_SRC_ASYNCMQTTCLIENT_H_ -#define ASYNCMQTTCLIENT_SRC_ASYNCMQTTCLIENT_H_ +#ifndef SRC_ASYNCMQTTCLIENT_H_ +#define SRC_ASYNCMQTTCLIENT_H_ #include "AsyncMqttClient.hpp" -#endif // ASYNCMQTTCLIENT_SRC_ASYNCMQTTCLIENT_H_ +#endif // SRC_ASYNCMQTTCLIENT_H_ diff --git a/src/AsyncMqttClient/Helpers.hpp b/src/AsyncMqttClient/Helpers.hpp index b9bdbb0..7113033 100644 --- a/src/AsyncMqttClient/Helpers.hpp +++ b/src/AsyncMqttClient/Helpers.hpp @@ -1,3 +1,5 @@ +#pragma once + namespace AsyncMqttClientInternals { class Helpers { public: diff --git a/src/AsyncMqttClient/Packets/UnsubAckPacket.cpp b/src/AsyncMqttClient/Packets/UnsubAckPacket.cpp index 1407423..3c0ed74 100644 --- a/src/AsyncMqttClient/Packets/UnsubAckPacket.cpp +++ b/src/AsyncMqttClient/Packets/UnsubAckPacket.cpp @@ -24,7 +24,7 @@ void UnsubAckPacket::parseVariableHeader(char* data, size_t len, size_t* current } } -void UnsubAckPacket::parsePayload(char* data, size_t len, size_t* currentBytePosition) { - (void)data; +void UnsubAckPacket::parsePayload(char* data, size_t len, size_t* currentBytePosition) { + (void)data; (void)currentBytePosition; }