From f6521a2ed069452d7897af6bcee753ff3cc07b9a Mon Sep 17 00:00:00 2001 From: Nick O'Leary Date: Fri, 28 Aug 2015 13:44:56 +0100 Subject: [PATCH] Readme update --- PubSubClient/LICENSE.txt | 2 +- PubSubClient/library.properties | 2 +- PubSubClient/src/PubSubClient.h | 31 ++++++++++++----------- README | 4 --- README.md | 45 +++++++++++++++++++++++++++++++++ 5 files changed, 63 insertions(+), 21 deletions(-) delete mode 100644 README create mode 100644 README.md diff --git a/PubSubClient/LICENSE.txt b/PubSubClient/LICENSE.txt index f512cba2..217df35c 100755 --- a/PubSubClient/LICENSE.txt +++ b/PubSubClient/LICENSE.txt @@ -1,4 +1,4 @@ -Copyright (c) 2008-2012 Nicholas O'Leary +Copyright (c) 2008-2015 Nicholas O'Leary Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the diff --git a/PubSubClient/library.properties b/PubSubClient/library.properties index c4e031a9..2cbe034c 100644 --- a/PubSubClient/library.properties +++ b/PubSubClient/library.properties @@ -5,5 +5,5 @@ maintainer=Nick O'Leary sentence=A client library for MQTT messaging. paragraph=MQTT is a lightweight messaging protocol ideal for small devices. This library allows you to send and receive MQTT messages from a remote server. It supports the latest MQTT 3.1.1 protocol and can be configured to use the older MQTT 3.1 if needed. It supports all Arduino Ethernet Client compatible hardware, including the Intel Galileo/Edison and ESP8266. category=Communication -url=http://knolleary.net/arduino-client-for-mqtt/ +url=http://knolleary.github.io/pubsubclient/ architectures=* diff --git a/PubSubClient/src/PubSubClient.h b/PubSubClient/src/PubSubClient.h index 7b044621..5c2e5b61 100755 --- a/PubSubClient/src/PubSubClient.h +++ b/PubSubClient/src/PubSubClient.h @@ -1,6 +1,6 @@ /* PubSubClient.h - A simple client for MQTT. - Nicholas O'Leary + Nick O'Leary http://knolleary.net */ @@ -15,15 +15,29 @@ #define MQTT_VERSION_3_1 3 #define MQTT_VERSION_3_1_1 4 -// MQTT_VERSION +// MQTT_VERSION : Pick the version +//#define MQTT_VERSION MQTT_VERSION_3_1 #define MQTT_VERSION MQTT_VERSION_3_1_1 + // MQTT_MAX_PACKET_SIZE : Maximum packet size #define MQTT_MAX_PACKET_SIZE 128 // MQTT_KEEPALIVE : keepAlive interval in Seconds #define MQTT_KEEPALIVE 15 +// Possible values for client.state() +#define MQTT_CONNECTION_TIMEOUT -4 +#define MQTT_CONNECTION_LOST -3 +#define MQTT_CONNECT_FAILED -2 +#define MQTT_DISCONNECTED -1 +#define MQTT_CONNECTED 0 +#define MQTT_CONNECT_BAD_PROTOCOL 1 +#define MQTT_CONNECT_BAD_CLIENT_ID 2 +#define MQTT_CONNECT_UNAVAILABLE 3 +#define MQTT_CONNECT_BAD_CREDENTIALS 4 +#define MQTT_CONNECT_UNAUTHORIZED 5 + #define MQTTCONNECT 1 << 4 // Client request to connect to Server #define MQTTCONNACK 2 << 4 // Connect Acknowledgment #define MQTTPUBLISH 3 << 4 // Publish message @@ -44,19 +58,6 @@ #define MQTTQOS1 (1 << 1) #define MQTTQOS2 (2 << 1) -#define MQTT_CONNECTION_TIMEOUT -4 -#define MQTT_CONNECTION_LOST -3 -#define MQTT_CONNECT_FAILED -2 -#define MQTT_DISCONNECTED -1 -#define MQTT_CONNECTED 0 -#define MQTT_CONNECT_BAD_PROTOCOL 1 -#define MQTT_CONNECT_BAD_CLIENT_ID 2 -#define MQTT_CONNECT_UNAVAILABLE 3 -#define MQTT_CONNECT_BAD_CREDENTIALS 4 -#define MQTT_CONNECT_UNAUTHORIZED 5 - - - #define MQTT_CALLBACK_SIGNATURE void (*callback)(char*,uint8_t*,unsigned int) class PubSubClient { diff --git a/README b/README deleted file mode 100644 index 332b6858..00000000 --- a/README +++ /dev/null @@ -1,4 +0,0 @@ -A client library for the Arduino Ethernet Shield that provides support for MQTT. -Nicholas O'Leary -http://knolleary.net/arduino-client-for-mqtt/ - diff --git a/README.md b/README.md new file mode 100644 index 00000000..acc19560 --- /dev/null +++ b/README.md @@ -0,0 +1,45 @@ +# Arduino Client for MQTT + +This library provides a client for doing simple publish/subscribe messaging with +a server that supports MQTT. + +## Examples + +The library comes with a number of example sketches. See File > Examples > PubSubClient +within the Arduino application. + +Full API documentation is available here: http://knolleary.github.io/pubsubclient/ + +## Limitations + + - It can only publish QoS 0 messages. It can subscribe at QoS 0 or QoS 1. + - The maximum message size, including header, is **128 bytes** by default. This + is configurable via `MQTT_MAX_PACKET_SIZE` in `PubSubClient.h`. + - The keepalive interval is set to 15 seconds by default. This is configurable + via `MQTT_KEEPALIVE` in `PubSubClient.h`. + - The client uses MQTT 3.1.1 by default. It can be changed to use MQTT 3.1 by + changing value of `MQTT_VERSION` in `PubSubClient.h`. + + +## Compatible Hardware + +The library uses the Arduino Ethernet Client api for interacting with the +underlying network hardware. This means it Just Works with a growing number of +boards and shields, including: + + - Arduino Ethernet + - Arduino Ethernet Shield + - Arduino YUN – use the included `YunClient` in place of `EthernetClient`, and + be sure to do a `Bridge.begin()` first + - Arduino WiFi Shield + - Sparkfun WiFly Shield – when used with [this library](https://github.com/dpslwk/WiFly) + - Intel Galileo/Edison + - ESP8266 + +The library cannot currently be used with hardware based on the ENC28J60 chip – +such as the Nanode or the Nuelectronics Ethernet Shield. For those, there is an +[alternative library](https://github.com/njh/NanodeMQTT) available. + +## License + +This code is released under the MIT License.