blob: 92a426fc93a605cf36f6bc4347ef6d088ce865ac [file] [log] [blame]
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<title>mqttpp: mqtt/connect_options.h Source File</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<!-- Generated by Doxygen 1.6.1 -->
<div class="navigation" id="top">
<div class="tabs">
<ul>
<li><a href="main.html"><span>Main&nbsp;Page</span></a></li>
<li><a href="annotated.html"><span>Classes</span></a></li>
<li class="current"><a href="files.html"><span>Files</span></a></li>
</ul>
</div>
<div class="tabs">
<ul>
<li><a href="files.html"><span>File&nbsp;List</span></a></li>
</ul>
</div>
<h1>mqtt/connect_options.h</h1><a href="connect__options_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001
<a name="l00002"></a>00002
<a name="l00003"></a>00003
<a name="l00004"></a>00004
<a name="l00005"></a>00005
<a name="l00006"></a>00006
<a name="l00007"></a>00007
<a name="l00008"></a>00008 <span class="comment">/*******************************************************************************</span>
<a name="l00009"></a>00009 <span class="comment"> * Copyright (c) 2013 Frank Pagliughi &lt;fpagliughi@mindspring.com&gt;</span>
<a name="l00010"></a>00010 <span class="comment"> *</span>
<a name="l00011"></a>00011 <span class="comment"> * All rights reserved. This program and the accompanying materials</span>
<a name="l00012"></a>00012 <span class="comment"> * are made available under the terms of the Eclipse Public License v1.0</span>
<a name="l00013"></a>00013 <span class="comment"> * and Eclipse Distribution License v1.0 which accompany this distribution. </span>
<a name="l00014"></a>00014 <span class="comment"> *</span>
<a name="l00015"></a>00015 <span class="comment"> * The Eclipse Public License is available at </span>
<a name="l00016"></a>00016 <span class="comment"> * http://www.eclipse.org/legal/epl-v10.html</span>
<a name="l00017"></a>00017 <span class="comment"> * and the Eclipse Distribution License is available at </span>
<a name="l00018"></a>00018 <span class="comment"> * http://www.eclipse.org/org/documents/edl-v10.php.</span>
<a name="l00019"></a>00019 <span class="comment"> *</span>
<a name="l00020"></a>00020 <span class="comment"> * Contributors:</span>
<a name="l00021"></a>00021 <span class="comment"> * Frank Pagliughi - initial implementation and documentation</span>
<a name="l00022"></a>00022 <span class="comment"> *******************************************************************************/</span>
<a name="l00023"></a>00023
<a name="l00024"></a>00024 <span class="preprocessor">#ifndef __mqtt_connect_options_h</span>
<a name="l00025"></a>00025 <span class="preprocessor"></span><span class="preprocessor">#define __mqtt_connect_options_h</span>
<a name="l00026"></a>00026 <span class="preprocessor"></span>
<a name="l00027"></a>00027 <span class="keyword">extern</span> <span class="stringliteral">&quot;C&quot;</span> {
<a name="l00028"></a>00028 <span class="preprocessor"> #include &quot;MQTTAsync.h&quot;</span>
<a name="l00029"></a>00029 }
<a name="l00030"></a>00030
<a name="l00031"></a>00031 <span class="preprocessor">#include &quot;<a class="code" href="message_8h.html" title="Declaration of MQTT message class.">mqtt/message.h</a>&quot;</span>
<a name="l00032"></a>00032 <span class="preprocessor">#include &quot;<a class="code" href="topic_8h.html" title="Declaration of MQTT topic class.">mqtt/topic.h</a>&quot;</span>
<a name="l00033"></a>00033 <span class="preprocessor">#include &lt;string&gt;</span>
<a name="l00034"></a>00034 <span class="preprocessor">#include &lt;vector&gt;</span>
<a name="l00035"></a>00035 <span class="preprocessor">#include &lt;memory&gt;</span>
<a name="l00036"></a>00036
<a name="l00037"></a>00037 <span class="keyword">namespace </span>mqtt {
<a name="l00038"></a>00038
<a name="l00039"></a>00039 <span class="keyword">class </span>async_client;
<a name="l00040"></a>00040
<a name="l00042"></a>00042
<a name="l00047"></a><a class="code" href="classmqtt_1_1connect__options.html">00047</a> <span class="keyword">class </span><a class="code" href="classmqtt_1_1connect__options.html" title="Holds the set of options that control how the client connects to a server.">connect_options</a>
<a name="l00048"></a>00048 {
<a name="l00050"></a>00050 MQTTAsync_connectOptions opts_;
<a name="l00051"></a>00051
<a name="l00053"></a><a class="code" href="classmqtt_1_1connect__options.html#ac39954340d8b15edaa883af1bcfcf7ae">00053</a> <span class="keyword">friend</span> <span class="keyword">class </span><a class="code" href="classmqtt_1_1async__client.html" title="Lightweight client for talking to an MQTT server using non-blocking methods that...">async_client</a>;
<a name="l00054"></a>00054
<a name="l00055"></a>00055 <span class="keyword">public</span>:
<a name="l00059"></a><a class="code" href="classmqtt_1_1connect__options.html#a7e8d78cc1d555b18e74f5ce2a52d4caa">00059</a> <span class="keyword">typedef</span> std::shared_ptr&lt;connect_options&gt; <a class="code" href="classmqtt_1_1connect__options.html#a7e8d78cc1d555b18e74f5ce2a52d4caa" title="Smart/shared pointer to this class.">ptr_t</a>;
<a name="l00063"></a><a class="code" href="classmqtt_1_1connect__options.html#a5811ad2a2bbbb02b04d79b08530349a3">00063</a> <a class="code" href="classmqtt_1_1connect__options.html#a5811ad2a2bbbb02b04d79b08530349a3" title="Constructs a new MqttConnectOptions object using the default values.">connect_options</a>() : opts_( MQTTAsync_connectOptions_initializer ) {}
<a name="l00068"></a>00068 <span class="keywordtype">int</span> <a class="code" href="classmqtt_1_1connect__options.html#a259f3095aef935973902485c9716fa18" title="Returns the connection timeout value.">get_connection_timeout</a>() <span class="keyword">const</span>;
<a name="l00069"></a>00069
<a name="l00070"></a>00070 <span class="comment">//java.util.Properties getDebug()</span>
<a name="l00071"></a>00071
<a name="l00076"></a><a class="code" href="classmqtt_1_1connect__options.html#a5e774ce28ff7bdcebd0f49b5620596a7">00076</a> <span class="keywordtype">int</span> <a class="code" href="classmqtt_1_1connect__options.html#a5e774ce28ff7bdcebd0f49b5620596a7" title="Returns the &amp;quot;keep alive&amp;quot; interval.">get_keep_alive_interval</a>()<span class="keyword"> const </span>{
<a name="l00077"></a>00077 <span class="keywordflow">return</span> opts_.keepAliveInterval;
<a name="l00078"></a>00078 }
<a name="l00083"></a><a class="code" href="classmqtt_1_1connect__options.html#aa651f99bb39cf32a7bbd4a006747cfa6">00083</a> std::string <a class="code" href="classmqtt_1_1connect__options.html#aa651f99bb39cf32a7bbd4a006747cfa6" title="Returns the password to use for the connection.">get_password</a>()<span class="keyword"> const </span>{
<a name="l00084"></a>00084 <span class="keywordflow">return</span> std::string(opts_.password);
<a name="l00085"></a>00085 }
<a name="l00090"></a>00090 <span class="comment">//javax.net.SocketFactory get_socket_factory();</span>
<a name="l00094"></a>00094 <span class="comment"></span> <span class="comment">//java.util.Properties get_ssl_properties();</span>
<a name="l00099"></a><a class="code" href="classmqtt_1_1connect__options.html#ab1f82172788574ffbba8ea9211261a56">00099</a> <span class="comment"></span> std::string <a class="code" href="classmqtt_1_1connect__options.html#ab1f82172788574ffbba8ea9211261a56" title="Returns the socket factory that will be used when connecting, or null if one has...">get_user_name</a>()<span class="keyword"> const </span>{
<a name="l00100"></a>00100 <span class="keywordflow">return</span> std::string(opts_.username);
<a name="l00101"></a>00101 }
<a name="l00106"></a>00106 std::string <a class="code" href="classmqtt_1_1connect__options.html#a3f0b0c3d2d2cc2719fd7c681c2c13689" title="Returns the topic to be used for last will and testament (LWT).">get_will_destination</a>() <span class="keyword">const</span>;
<a name="l00111"></a>00111 <a class="code" href="classmqtt_1_1message.html" title="An MQTT message holds the application payload and options specifying how the message...">message</a> <a class="code" href="classmqtt_1_1connect__options.html#a087b0be7949039373eb83c885fe41aea" title="Returns the message to be sent as last will and testament (LWT).">get_will_message</a>() <span class="keyword">const</span>;
<a name="l00117"></a><a class="code" href="classmqtt_1_1connect__options.html#a062dd43eb33c096559678777a9a7f2fe">00117</a> <span class="keywordtype">bool</span> <a class="code" href="classmqtt_1_1connect__options.html#a062dd43eb33c096559678777a9a7f2fe" title="Returns whether the server should remember state for the client across reconnects...">is_clean_session</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> opts_.cleansession != 0; }
<a name="l00123"></a><a class="code" href="classmqtt_1_1connect__options.html#a403bdb15d0383f160e590cdb19039c30">00123</a> <span class="keywordtype">void</span> <a class="code" href="classmqtt_1_1connect__options.html#a403bdb15d0383f160e590cdb19039c30" title="Sets whether the server should remember state for the client across reconnects.">set_clean_session</a>(<span class="keywordtype">bool</span> cleanSession) {
<a name="l00124"></a>00124 opts_.cleansession = (cleanSession) ? (!0) : 0;
<a name="l00125"></a>00125 }
<a name="l00130"></a><a class="code" href="classmqtt_1_1connect__options.html#a21d0565ce539b40097bb911c50ecbc60">00130</a> <span class="keywordtype">void</span> <a class="code" href="classmqtt_1_1connect__options.html#a21d0565ce539b40097bb911c50ecbc60" title="Sets the connection timeout value.">set_connection_timeout</a>(<span class="keywordtype">int</span> timeout) {
<a name="l00131"></a>00131 opts_.connectTimeout = timeout;
<a name="l00132"></a>00132 }
<a name="l00137"></a><a class="code" href="classmqtt_1_1connect__options.html#a8f7c99d453da95192b15641a80286441">00137</a> <span class="keywordtype">void</span> <a class="code" href="classmqtt_1_1connect__options.html#a8f7c99d453da95192b15641a80286441" title="Sets the &amp;quot;keep alive&amp;quot; interval.">set_keep_alive_interval</a>(<span class="keywordtype">int</span> keepAliveInterval) {
<a name="l00138"></a>00138 opts_.keepAliveInterval = keepAliveInterval;
<a name="l00139"></a>00139 }
<a name="l00143"></a>00143 <span class="keywordtype">void</span> <a class="code" href="classmqtt_1_1connect__options.html#aca62e4465ce0c18f9442ff160be26a7f" title="Sets the password to use for the connection.">set_password</a>(<span class="keyword">const</span> std::string&amp; password);
<a name="l00147"></a>00147 <span class="comment">//void set_socket_factory(javax.net.SocketFactory socketFactory)</span>
<a name="l00151"></a>00151 <span class="comment"></span> <span class="comment">//void set_ssl_properties(java.util.Properties props);</span>
<a name="l00156"></a>00156 <span class="comment"></span> <span class="keywordtype">void</span> <a class="code" href="classmqtt_1_1connect__options.html#a4ff426fbb1c7d68294da67b9d5e1062f" title="Sets the SocketFactory to use.">set_user_name</a>(<span class="keyword">const</span> std::string&amp; userName);
<a name="l00165"></a><a class="code" href="classmqtt_1_1connect__options.html#a73bfee26dd549531fc7095e2d43496bc">00165</a> <span class="keywordtype">void</span> <a class="code" href="classmqtt_1_1connect__options.html#a73bfee26dd549531fc7095e2d43496bc" title="Sets the &amp;quot;Last Will and Testament&amp;quot; (LWT) for the connection.">set_will</a>(<span class="keyword">const</span> <a class="code" href="classmqtt_1_1topic.html" title="Represents a topic destination, used for publish/subscribe messaging.">topic</a>&amp; top, <span class="keywordtype">void</span>* payload, <span class="keywordtype">size_t</span> n, <span class="keywordtype">int</span> qos, <span class="keywordtype">bool</span> retained) {
<a name="l00166"></a>00166 <a class="code" href="classmqtt_1_1connect__options.html#a73bfee26dd549531fc7095e2d43496bc" title="Sets the &amp;quot;Last Will and Testament&amp;quot; (LWT) for the connection.">set_will</a>(top.<a class="code" href="classmqtt_1_1topic.html#af55ba2eb3d5c795eca0a82e6fc9567be" title="Returns the name of the queue or topic.">get_name</a>(), payload, n, qos, retained);
<a name="l00167"></a>00167 }
<a name="l00176"></a>00176 <span class="keywordtype">void</span> <a class="code" href="classmqtt_1_1connect__options.html#a73bfee26dd549531fc7095e2d43496bc" title="Sets the &amp;quot;Last Will and Testament&amp;quot; (LWT) for the connection.">set_will</a>(<span class="keyword">const</span> std::string&amp; top, <span class="keywordtype">void</span>* payload, <span class="keywordtype">size_t</span> n, <span class="keywordtype">int</span> qos, <span class="keywordtype">bool</span> retained);
<a name="l00184"></a>00184 <span class="comment">/*protected*/</span> <span class="keywordtype">void</span> <a class="code" href="classmqtt_1_1connect__options.html#a73bfee26dd549531fc7095e2d43496bc" title="Sets the &amp;quot;Last Will and Testament&amp;quot; (LWT) for the connection.">set_will</a>(<span class="keyword">const</span> std::string&amp; top, <a class="code" href="classmqtt_1_1message.html" title="An MQTT message holds the application payload and options specifying how the message...">message</a> msg, <span class="keywordtype">int</span> qos, <span class="keywordtype">bool</span> retained);
<a name="l00185"></a>00185
<a name="l00186"></a>00186 std::string to_str() <span class="keyword">const</span>;
<a name="l00187"></a>00187 };
<a name="l00188"></a>00188
<a name="l00192"></a>00192 <span class="keyword">typedef</span> <a class="code" href="classmqtt_1_1connect__options.html#a7e8d78cc1d555b18e74f5ce2a52d4caa" title="Smart/shared pointer to this class.">connect_options::ptr_t</a> connect_options_ptr;
<a name="l00193"></a>00193
<a name="l00195"></a>00195 <span class="comment">// end namespace mqtt</span>
<a name="l00196"></a>00196 }
<a name="l00197"></a>00197
<a name="l00198"></a>00198 <span class="preprocessor">#endif // __mqtt_connect_options_h</span>
<a name="l00199"></a>00199 <span class="preprocessor"></span>
</pre></div></div>
<hr size="1"/><address style="text-align: right;"><small>Generated on 30 Apr 2014 for mqttpp by&nbsp;
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.6.1 </small></address>
</body>
</html>