Intial site commit

This commit is contained in:
Nicholas O'Leary 2012-10-26 23:04:27 +01:00
commit c762c1b8ab
9 changed files with 9353 additions and 0 deletions

295
api.html Normal file
View File

@ -0,0 +1,295 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset=UTF-8>
<title>Arduino Client for MQTT</title>
<link rel="stylesheet" href="bootstrap/css/bootstrap.knolleary.css" type="text/css">
<link rel="stylesheet" href="style.css" type="text/css">
<link href='http://fonts.googleapis.com/css?family=Lora:400,400italic' rel='stylesheet' type='text/css'>
<!--[if IE]>
<script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.1/jquery.min.js"></script>
<script src="bootstrap/js/bootstrap.js"></script>
</head>
<body>
<div class="container">
<div class="navbar navbar-fixed-top">
<div class="navbar-inner">
<div class="container">
<a class="brand" href="./index.html">Arduino Client for MQTT</a>
<div class="nav-collapse collapse">
<ul class="nav">
<li class=""><a href="./index.html">Home</a></li>
<li class=""><a href="./tutorial.html">Tutorial</a></li>
<li class="active"><a href="./api.html">API Docs</a></li>
</ul>
</div>
</div>
</div>
</div>
<div class="row">
<div class="span3" id="navcolumn">
<div class="affix">
<h4>API Docs</h4>
<ul class="nav nav-pills nav-stacked">
<li><a href="#PubSubClient">PubSubClient(...)</a></li>
<li><a href="#PubSubClient2">PubSubClient(...)</a></li>
<li><a href="#connect1">boolean connect(...)</a></li>
<li><a href="#connect2">boolean connect(...)</a></li>
<li><a href="#connect3">boolean connect(...)</a></li>
<li><a href="#connect4">boolean connect(...)</a></li>
<li><a href="#disconnect">void disconnect()</a></li>
<li><a href="#publish1">boolean publish(...)</a></li>
<li><a href="#publish2">boolean publish(...)</a></li>
<li><a href="#publish3">boolean publish(...)</a></li>
<li><a href="#publish4">boolean publish_P(...)</a></li>
<li><a href="#subscribe">boolean subscribe(...)</a></li>
<li><a href="#loop">boolean loop()</a></li>
<li><a href="#connected">boolean connected()</a></li>
<li><a href="#configoptions">Configuration Options</a></li>
</ul>
</div>
</div>
<div class="span9" id="content">
<p><i>These docs refer to the latest version of the library on <a href="https://github.com/knolleary/pubsubclient">GitHub</a></i></p>
<section class="method" id="PubSubClient">
<h4><span class="methodname">PubSubClient</span> <span class="methodparams">(server, port, callback, client)</span></h4>
<p>Creates a client instance, with the server specified by IP address.</p>
<h5>Parameters</h5>
<ul>
<li>server : the IP address of the server (array of 4 bytes)</li>
<li>port : the port to connect to (int)</li>
<li>callback : a pointer to a function called when a message arrives for a subscription created by this client. If no callback is required, set this to 0</li>
<li>client : an instance of <code>Client</code>, typically <code>EthernetClient</code>.</li>
</ul>
<p>The callback function has the following signature:</p>
<pre>
void callback(char* topic, byte* payload, unsigned int length)
</pre>
</section>
<section class="method" id="PubSubClient2">
<h4><span class="methodname">PubSubClient</span> <span class="methodparams">(serverDNS, port, callback, client)</span></h4>
<p>Creates a client instance, with the server specified by DNS name.</p>
<h5>Parameters</h5>
<ul>
<li>serverDNS : the DNS name of the server (char*)</li>
<li>port : the port to connect to (int)</li>
<li>callback : a pointer to a function called when a message arrives for a subscription created by this client. If no callback is required, set this to 0</li>
<li>client : an instance of <code>Client</code>, typically <code>EthernetClient</code>.</li>
</ul>
<p>The callback function has the following signature:</p>
<pre>
void callback(char* topic, byte* payload, unsigned int length)
</pre>
</section>
<section class="method" id="connect1">
<h4><span class="methodreturn">boolean</span> <span class="methodname">connect</span> <span class="methodparams">(clientID)</span></h4>
<p>Connects the client.</p>
<h5>Parameters</h5>
<ul>
<li>clientID : the client ID to use when connecting to the server. As per MQTT, this must be between 1 and 23 characters long.</li>
</ul>
<h5>Returns</h5>
<ul>
<li>false &#8211; connection failed.</li>
<li>true &#8211; connection succeeded.</li>
</ul>
</section>
<section class="method" id="connect2">
<h4><span class="methodreturn">boolean</span> <span class="methodname">connect</span> <span class="methodparams">(clientID, willTopic, willQoS, willRetain, willMessage)</span></h4>
<p>Connects the client with a Will message specified.</p>
<h5>Parameters</h5>
<ul>
<li>clientID : the client ID to use when connecting to the server. As per MQTT, this must be between 1 and 23 characters long.</li>
<li>willTopic : the topic to be used by the will message (char*)</li>
<li>willQoS : the quality of service to be used by the will message (int : 0,1 or 2)</li>
<li>willRetain : whether the will should be published with the retain flag (int : 0 or 1)</li>
<li>willMessage : the payload of the will message (char*)</li>
</ul>
<h5>Returns</h5>
<ul>
<li>false &#8211; connection failed.</li>
<li>true &#8211; connection succeeded.</li>
</ul>
</section>
<section class="method" id="connect3">
<h4><span class="methodreturn">boolean</span> <span class="methodname">connect</span> <span class="methodparams">(clientID, username, password)</span></h4>
<p>Connects the client with a username and password specified.</p>
<h5>Parameters</h5>
<ul>
<li>clientID : the client ID to use when connecting to the server. As per MQTT, this must be between 1 and 23 characters long.</li>
<li>username : the username to use. If NULL, no username or password is used (char*)</li>
<li>password : the password to use. If NULL, no password is used (char*)</li>
</ul>
<h5>Returns</h5>
<ul>
<li>false &#8211; connection failed.</li>
<li>true &#8211; connection succeeded.</li>
</ul>
</section>
<section class="method" id="connect4">
<h4><span class="methodreturn">boolean</span> <span class="methodname">connect</span> <span class="methodparams">(clientID, username, password, willTopic, willQoS, willRetain, willMessage)</span></h4>
<p>Connects the client with a Will message, username and password specified.</p>
<h5>Parameters</h5>
<ul>
<li>clientID : the client ID to use when connecting to the server. As per MQTT, this must be between 1 and 23 characters long.</li>
<li>username : the username to use. If NULL, no username or password is used (char*)</li>
<li>password : the password to use. If NULL, no password is used (char*)</li>
<li>willTopic : the topic to be used by the will message (char*)</li>
<li>willQoS : the quality of service to be used by the will message (int : 0,1 or 2)</li>
<li>willRetain : whether the will should be published with the retain flag (int : 0 or 1)</li>
<li>willMessage : the payload of the will message (char*)</li>
</ul>
<h5>Returns</h5>
<ul>
<li>false &#8211; connection failed.</li>
<li>true &#8211; connection succeeded.</li>
</ul>
</section>
<section class="method" id="disconnect">
<h4><span class="methodreturn">void</span> <span class="methodname">disconnect</span> <span class="methodparams">()</span></h4>
<p>Disconnects the client.</p>
</section>
<section class="method" id="publish1">
<h4><span class="methodreturn">int</span> <span class="methodname">publish</span> <span class="methodparams">(topic, payload)</span></h4>
<p>Publishes a string message to the specified topic.</p>
<h5>Parameters</h5>
<ul>
<li>topic &#8211; the topic to publish to (char*)</li>
<li>payload &#8211; the message to publish (char*)</li>
</ul>
<h5>Returns</h5>
<ul>
<li>false &#8211; publish failed.</li>
<li>true &#8211; publish succeeded.</li>
</ul>
</section>
<section class="method" id="publish2">
<h4><span class="methodreturn">int</span> <span class="methodname">publish</span> <span class="methodparams">(topic, payload, length)</span></h4>
<p>Publishes a message to the specified topic.</p>
<h5>Parameters</h5>
<ul>
<li>topic &#8211; the topic to publish to (char*)</li>
<li>payload &#8211; the message to publish (byte array)</li>
<li>length &#8211; the length of the message (byte)</li>
</ul>
<h5>Returns</h5>
<ul>
<li>false &#8211; publish failed.</li>
<li>true &#8211; publish succeeded.</li>
</ul>
</section>
<section class="method" id="publish3">
<h4><span class="methodreturn">int</span> <span class="methodname">publish</span> <span class="methodparams">(topic, payload, length, retained)</span></h4>
<p>Publishes a message to the specified topic, with the retained flag as specified.</p>
<h5>Parameters</h5>
<ul>
<li>topic &#8211; the topic to publish to (char*)</li>
<li>payload &#8211; the message to publish (byte array)</li>
<li>length &#8211; the length of the message (byte)</li>
<li>retained &#8211; whether the message should be retained (byte)
<ul>
<li>0 &#8211; not retained</li>
<li>1 &#8211; retained</li>
</ul>
</li>
</ul>
<h5>Returns</h5>
<ul>
<li>false &#8211; publish failed.</li>
<li>true &#8211; publish succeeded.</li>
</ul>
</section>
<section class="method" id="publish4">
<h4><span class="methodreturn">int</span> <span class="methodname">publish_P</span> <span class="methodparams">(topic, payload, length, retained)</span></h4>
<p>Publishes a message stored in <code>PROGMEN</code> to the specified topic, with the retained flag as specified.</p>
<h5>Parameters</h5>
<ul>
<li>topic &#8211; the topic to publish to (char*)</li>
<li>payload &#8211; the message to publish (PROGMEM byte array)</li>
<li>length &#8211; the length of the message (byte)</li>
<li>retained &#8211; whether the message should be retained (byte)
<ul>
<li>0 &#8211; not retained</li>
<li>1 &#8211; retained</li>
</ul>
</li>
</ul>
<h5>Returns</h5>
<ul>
<li>false &#8211; publish failed.</li>
<li>true &#8211; publish succeeded.</li>
</ul>
</section>
<section class="method" id="subscribe">
<h4><span class="methodreturn">boolean</span> <span class="methodname">subscribe</span> <span class="methodparams">(topic)</span></h4>
<p>Subscribes to messages published to the specified topic.</p>
<h5>Parameters</h5>
<ul>
<li>topic &#8211; the topic to publish to (char*)</li>
</ul>
<h5>Returns</h5>
<ul>
<li>false &#8211; sending the subscribe failed.</li>
<li>true &#8211; sending the subscribe succeeded. The request completes asynchronously.</li>
</ul>
</section>
<section class="method" id="loop">
<h4><span class="methodreturn">boolean</span> <span class="methodname">loop</span> <span class="methodparams">()</span></h4>
<p>This should be called regularly to allow the client to process incoming messages and maintain its connection to the server.</p>
<h5>Returns</h5>
<ul>
<li>false &#8211; the client is no longer connected</li>
<li>true &#8211; the client is still connected</li>
</ul>
</section>
<section class="method" id="connected">
<h4><span class="methodreturn">int</span> <span class="methodname">connected</span> <span class="methodparams">()</span></h4>
<p>Checks whether the client is connected to the server.</p>
<h5>Returns</h5>
<ul>
<li>false &#8211; the client is no longer connected</li>
<li>true &#8211; the client is still connected</li>
</ul>
</section>
<section class="method" id="configoptions">
<h4>Configuration Options</h4>
<p>The following configuration options can be used to configure the library. They are contained in <code>PubSubClient.h</code>.</p>
<dl>
<dt><code>MQTT_MAX_PACKET_SIZE</code></dt>
<dd>Sets the largest packet size, in bytes, the client will handle. Any packet received that exceeds this size will be ignored.</p>
<p>Default: 128 bytes
</dd>
<dt><code>MQTT_KEEPALIVE</code></dt>
<dd>Sets the keepalive interval, in seconds, the client will use. This is used to maintain the connection when no other packets are being<br />
sent or received.</p>
<p>Default: 15 seconds
</dd>
</dl>
</section>
</div>
</div>
</body>
</html>

1058
bootstrap/css/bootstrap-responsive.css vendored Normal file

File diff suppressed because it is too large Load Diff

5774
bootstrap/css/bootstrap.knolleary.css vendored Normal file

File diff suppressed because it is too large Load Diff

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

2027
bootstrap/js/bootstrap.js vendored Normal file

File diff suppressed because it is too large Load Diff

134
index.html Normal file
View File

@ -0,0 +1,134 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset=UTF-8>
<title>Arduino Client for MQTT</title>
<link rel="stylesheet" href="bootstrap/css/bootstrap.knolleary.css" type="text/css">
<link rel="stylesheet" href="style.css" type="text/css">
<link href='http://fonts.googleapis.com/css?family=Lora:400,400italic' rel='stylesheet' type='text/css'>
<!--[if IE]>
<script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.1/jquery.min.js"></script>
<script src="bootstrap/js/bootstrap.js"></script>
</head>
<body>
<div class="container">
<div class="navbar navbar-fixed-top">
<div class="navbar-inner">
<div class="container">
<a class="brand" href="./index.html">Arduino Client for MQTT</a>
<div class="nav-collapse collapse">
<ul class="nav">
<li class="active"><a href="./index.html">Home</a></li>
<li class=""><a href="./tutorial.html">Tutorial</a></li>
<li class=""><a href="./api.html">API Docs</a></li>
</ul>
</div>
</div>
</div>
</div>
<div class="row">
<div class="span3" id="navcolumn">
<div class="affix">
<h4>Home</h4>
<ul class="nav nav-pills nav-stacked">
<li><a href="#Download">Download</a></li>
<li><a href="#License">License</a></li>
<li><a href="#ChangeHistory">Change History</a></li>
</ul>
</div>
</div>
<div class="span9" id="content">
<h1>Arduino Client for MQTT</h1>
<p>This library provides a client for doing simple publish/subscribe messaging with a server that supports MQTT v3.</p>
<p>For more information about MQTT, visit <a href="http://mqtt.org">mqtt.org</a>.</p>
<section id="Download">
<h3>Download</h3>
<p>The latest version of the library can be downloaded from <a href="https://github.com/knolleary/pubsubclient/tags">GitHub</a>.</p>
</section>
<section id="License">
<h3>License</h3>
<p>This library is released under the <a href="http://www.opensource.org/licenses/mit-license.php">MIT License</a>.</p>
</section>
<section id="ChangeHistory">
<h3>Change History</h3>
<p>The complete change history is available on <a href="https://github.com/knolleary/pubsubclient/commits/master">GitHub</a>.</p>
<dl>
<dt>1.8</dt>
<dd>
<ul>
<li>KeepAlive interval is configurable in <code>PubSubClient.h</code></li>
<li>Maximum packet size is configurable in <code>PubSubClient.h</code></li>
<li><b><i>API change</i></b>: Return <code>boolean</code> rather than <code>int</code> from various functions</li>
<li><b><i>API change</i></b>: Length parameter in message callback changed from <code>int</code> to <code>unsigned int</code>
<li>Various internal tidy-ups around types</li>
<li>Able to specify server address by DNS name</li>
</ul>
</dd>
<dt>1.7</dt>
<dd>
<ul>
<li>Improved keepalive handling</li>
<li>Updated to the Arduino-1.0 API</li>
</ul>
</dd>
<dt>1.6</dt>
<dd>
<ul>
<li>Added ability to publish retained messages</li>
</ul>
</dd>
<dt>1.5</dt>
<dd>
<ul>
<li>Added default constructor</li>
<li>Fixed compile error when used with arduino-0021 or later</li>
</ul>
</dd>
<dt>1.4</dt>
<dd>
<ul>
<li>Fixed connection lost handling</li>
</ul>
</dd>
<dt>1.3</dt>
<dd>
<ul>
<li>Fixed packet reading bug</li>
</ul>
</dd>
<dt>1.2</dt>
<dd>
<ul>
<li>Fixed compile error when used with arduino-0016 or later</li>
</ul>
</dd>
<dt>1.1</dt>
<dd>
<ul>
<li>Reduced size of library</li>
<li>Added support for Will messages</li?
<li>Clarified licensing &#8211; see LICENSE.txt</li>
</ul>
</dd>
<dt>1.0</dt>
<dd>
<ul>
<li>Only Quality of Service (QOS) 0 messaging is supported</li>
<li>The maximum message size, including header, is 128 bytes</li>
<li>The keepalive interval is set to 30 seconds</li>
<li>No support for Will messages</li>
</ul>
</dd>
</dl>
</section>
</div>
</div>
</body>
</html>

17
style.css Normal file
View File

@ -0,0 +1,17 @@
section {
padding-top: 50px;
margin-top: -50px;
}
body {
padding-top: 60px;
}
.method {
border-bottom: 3px solid #eee;
margin-bottom: 20px;
padding-bottom: 5px;
}
.methodname {}
.methodreturn { font-weight: normal; color: #888;}
.methodparams { font-weight: normal; color: #888;}

48
tutorial.html Normal file
View File

@ -0,0 +1,48 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset=UTF-8>
<title>Arduino Client for MQTT</title>
<link rel="stylesheet" href="bootstrap/css/bootstrap.knolleary.css" type="text/css">
<link rel="stylesheet" href="style.css" type="text/css">
<link href='http://fonts.googleapis.com/css?family=Lora:400,400italic' rel='stylesheet' type='text/css'>
<!--[if IE]>
<script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.1/jquery.min.js"></script>
<script src="bootstrap/js/bootstrap.js"></script>
</head>
<body>
<div class="container">
<div class="navbar navbar-fixed-top">
<div class="navbar-inner">
<div class="container">
<a class="brand" href="./index.html">Arduino Client for MQTT</a>
<div class="nav-collapse collapse">
<ul class="nav">
<li class=""><a href="./index.html">Home</a></li>
<li class="active"><a href="./tutorial.html">Tutorial</a></li>
<li class=""><a href="./api.html">API Docs</a></li>
</ul>
</div>
</div>
</div>
</div>
<div class="row">
<div class="span3" id="navcolumn">
<div class="affix">
<h4>Tutorial</h4>
<ul class="nav nav-pills nav-stacked">
</ul>
</div>
</div>
<div class="span9" id="content">
<h1>The little book of MQTT on Arduino</h1>
<p>More to come...</p>
</div>
</div>
</body>
</html>