You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
AutoConnect/docs/api/index.html

1586 lines
59 KiB

7 years ago
<!DOCTYPE html>
<html lang="en" class="no-js">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1">
<meta http-equiv="x-ua-compatible" content="ie=edge">
6 years ago
<meta name="description" content="ESP8266/ESP32 WLAN configuration at run time with web interface">
7 years ago
<link rel="canonical" href="https://Hieromon.github.io/AutoConnect/api/index.html">
<meta name="author" content="Hieromon Ikasamo">
<meta name="lang:clipboard.copy" content="Copy to clipboard">
<meta name="lang:clipboard.copied" content="Copied to clipboard">
<meta name="lang:search.language" content="en">
<meta name="lang:search.pipeline.stopwords" content="True">
<meta name="lang:search.pipeline.trimmer" content="True">
<meta name="lang:search.result.none" content="No matching documents">
<meta name="lang:search.result.one" content="1 matching document">
<meta name="lang:search.result.other" content="# matching documents">
<meta name="lang:search.tokenizer" content="[\s\-]+">
<link rel="shortcut icon" href="../assets/images/favicon.png">
<meta name="generator" content="mkdocs-0.17.3, mkdocs-material-2.7.0">
6 years ago
<title>Library APIs - AutoConnect for ESP8266/ESP32</title>
7 years ago
<link rel="stylesheet" href="../assets/stylesheets/application.78aab2dc.css">
<link rel="stylesheet" href="../assets/stylesheets/application-palette.6079476c.css">
<script src="../assets/javascripts/modernizr.1aa3b519.js"></script>
<link href="https://fonts.gstatic.com" rel="preconnect" crossorigin>
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:300,400,400i,700|Roboto+Mono">
<style>body,input{font-family:"Roboto","Helvetica Neue",Helvetica,Arial,sans-serif}code,kbd,pre{font-family:"Roboto Mono","Courier New",Courier,monospace}</style>
<link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons">
<link rel="stylesheet" href="../css/paragraph.css">
</head>
<body dir="ltr" data-md-color-primary="indigo" data-md-color-accent="indigo">
<svg class="md-svg">
<defs>
<svg xmlns="http://www.w3.org/2000/svg" width="416" height="448"
viewBox="0 0 416 448" id="github">
<path fill="currentColor" d="M160 304q0 10-3.125 20.5t-10.75 19-18.125
8.5-18.125-8.5-10.75-19-3.125-20.5 3.125-20.5 10.75-19 18.125-8.5
18.125 8.5 10.75 19 3.125 20.5zM320 304q0 10-3.125 20.5t-10.75
19-18.125 8.5-18.125-8.5-10.75-19-3.125-20.5 3.125-20.5 10.75-19
18.125-8.5 18.125 8.5 10.75 19 3.125 20.5zM360
304q0-30-17.25-51t-46.75-21q-10.25 0-48.75 5.25-17.75 2.75-39.25
2.75t-39.25-2.75q-38-5.25-48.75-5.25-29.5 0-46.75 21t-17.25 51q0 22 8
38.375t20.25 25.75 30.5 15 35 7.375 37.25 1.75h42q20.5 0
37.25-1.75t35-7.375 30.5-15 20.25-25.75 8-38.375zM416 260q0 51.75-15.25
82.75-9.5 19.25-26.375 33.25t-35.25 21.5-42.5 11.875-42.875 5.5-41.75
1.125q-19.5 0-35.5-0.75t-36.875-3.125-38.125-7.5-34.25-12.875-30.25-20.25-21.5-28.75q-15.5-30.75-15.5-82.75
0-59.25 34-99-6.75-20.5-6.75-42.5 0-29 12.75-54.5 27 0 47.5 9.875t47.25
30.875q36.75-8.75 77.25-8.75 37 0 70 8 26.25-20.5
46.75-30.25t47.25-9.75q12.75 25.5 12.75 54.5 0 21.75-6.75 42 34 40 34
99.5z" />
</svg>
</defs>
</svg>
<input class="md-toggle" data-md-toggle="drawer" type="checkbox" id="drawer">
<input class="md-toggle" data-md-toggle="search" type="checkbox" id="search">
<label class="md-overlay" data-md-component="overlay" for="drawer"></label>
<a href="#include-headers" tabindex="1" class="md-skip">
Skip to content
</a>
<header class="md-header" data-md-component="header">
<nav class="md-header-nav md-grid">
<div class="md-flex">
<div class="md-flex__cell md-flex__cell--shrink">
6 years ago
<a href="https://Hieromon.github.io/AutoConnect/" title="AutoConnect for ESP8266/ESP32" class="md-header-nav__button md-logo">
7 years ago
<img src="../images/arduino-logo.svg" width="24" height="24">
</a>
</div>
<div class="md-flex__cell md-flex__cell--shrink">
<label class="md-icon md-icon--menu md-header-nav__button" for="drawer"></label>
</div>
<div class="md-flex__cell md-flex__cell--stretch">
<div class="md-flex__ellipsis md-header-nav__title" data-md-component="title">
<span class="md-header-nav__topic">
6 years ago
AutoConnect for ESP8266/ESP32
7 years ago
</span>
<span class="md-header-nav__topic">
Library APIs
</span>
</div>
</div>
<div class="md-flex__cell md-flex__cell--shrink">
<label class="md-icon md-icon--search md-header-nav__button" for="search"></label>
<div class="md-search" data-md-component="search" role="dialog">
<label class="md-search__overlay" for="search"></label>
<div class="md-search__inner" role="search">
<form class="md-search__form" name="search">
<input type="text" class="md-search__input" name="query" placeholder="Search" autocapitalize="off" autocorrect="off" autocomplete="off" spellcheck="false" data-md-component="query" data-md-state="active">
<label class="md-icon md-search__icon" for="search"></label>
<button type="reset" class="md-icon md-search__icon" data-md-component="reset" tabindex="-1">
&#xE5CD;
</button>
</form>
<div class="md-search__output">
<div class="md-search__scrollwrap" data-md-scrollfix>
<div class="md-search-result" data-md-component="result">
<div class="md-search-result__meta">
Type to start searching
</div>
<ol class="md-search-result__list"></ol>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="md-flex__cell md-flex__cell--shrink">
<div class="md-header-nav__source">
<a href="https://github.com/Hieromon/AutoConnect" title="Go to repository" class="md-source" data-md-source="github">
<div class="md-source__icon">
<svg viewBox="0 0 24 24" width="24" height="24">
<use xlink:href="#github" width="24" height="24"></use>
</svg>
</div>
<div class="md-source__repository">
Hieromon/AutoConnect
</div>
</a>
</div>
</div>
</div>
</nav>
</header>
<div class="md-container">
<nav class="md-tabs" data-md-component="tabs">
<div class="md-tabs__inner md-grid">
<ul class="md-tabs__list">
<li class="md-tabs__item">
<a href="../index.html" title="Overview" class="md-tabs__link md-tabs__link--active">
Overview
</a>
</li>
7 years ago
7 years ago
</ul>
</div>
</nav>
<main class="md-main">
<div class="md-main__inner md-grid" data-md-component="container">
<div class="md-sidebar md-sidebar--primary" data-md-component="navigation">
<div class="md-sidebar__scrollwrap">
<div class="md-sidebar__inner">
<nav class="md-nav md-nav--primary" data-md-level="0">
<label class="md-nav__title md-nav__title--site" for="drawer">
<span class="md-nav__button md-logo">
<img src="../images/arduino-logo.svg" width="48" height="48">
</span>
6 years ago
AutoConnect for ESP8266/ESP32
7 years ago
</label>
<div class="md-nav__source">
<a href="https://github.com/Hieromon/AutoConnect" title="Go to repository" class="md-source" data-md-source="github">
<div class="md-source__icon">
<svg viewBox="0 0 24 24" width="24" height="24">
<use xlink:href="#github" width="24" height="24"></use>
</svg>
</div>
<div class="md-source__repository">
Hieromon/AutoConnect
</div>
</a>
</div>
<ul class="md-nav__list" data-md-scrollfix>
<li class="md-nav__item">
<a href="../index.html" title="Overview" class="md-nav__link">
Overview
</a>
</li>
<li class="md-nav__item">
<a href="../gettingstarted/index.html" title="Getting started" class="md-nav__link">
Getting started
</a>
</li>
<li class="md-nav__item">
<a href="../menu/index.html" title="AutoConnect menu" class="md-nav__link">
AutoConnect menu
</a>
</li>
<li class="md-nav__item">
<a href="../basicusage/index.html" title="Basic usage" class="md-nav__link">
Basic usage
7 years ago
</a>
</li>
<li class="md-nav__item">
<a href="../advancedusage/index.html" title="Advanced usage" class="md-nav__link">
Advanced usage
</a>
</li>
7 years ago
<li class="md-nav__item md-nav__item--active">
<input class="md-toggle md-nav__toggle" data-md-toggle="toc" type="checkbox" id="toc">
<label class="md-nav__link md-nav__link--active" for="toc">
Library APIs
</label>
<a href="index.html" title="Library APIs" class="md-nav__link md-nav__link--active">
Library APIs
</a>
<nav class="md-nav md-nav--secondary">
<label class="md-nav__title" for="toc">Table of contents</label>
<ul class="md-nav__list" data-md-scrollfix>
<li class="md-nav__item">
<a href="#include-headers" title="Include headers" class="md-nav__link">
Include headers
</a>
<nav class="md-nav">
<ul class="md-nav__list">
<li class="md-nav__item">
<a href="#autoconnecth" title=" AutoConnect.h" class="md-nav__link">
AutoConnect.h
</a>
<nav class="md-nav">
<ul class="md-nav__list">
<li class="md-nav__item">
6 years ago
<a href="#defined-macros" title="Defined macros" class="md-nav__link">
Defined macros
7 years ago
</a>
</li>
</ul>
</nav>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item">
<a href="#autoconnect-api" title="AutoConnect API" class="md-nav__link">
AutoConnect API
</a>
<nav class="md-nav">
<ul class="md-nav__list">
<li class="md-nav__item">
<a href="#constructors" title=" Constructors" class="md-nav__link">
Constructors
</a>
<nav class="md-nav">
<ul class="md-nav__list">
<li class="md-nav__item">
<a href="#autoconnect" title="AutoConnect" class="md-nav__link">
AutoConnect
</a>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item">
<a href="#public-member-functions" title=" Public member functions" class="md-nav__link">
Public member functions
</a>
<nav class="md-nav">
<ul class="md-nav__list">
<li class="md-nav__item">
<a href="#begin" title="begin" class="md-nav__link">
begin
</a>
</li>
<li class="md-nav__item">
<a href="#config" title="config" class="md-nav__link">
config
</a>
</li>
<li class="md-nav__item">
<a href="#end" title="end" class="md-nav__link">
end
</a>
</li>
<li class="md-nav__item">
<a href="#handleclient" title="handleClient" class="md-nav__link">
handleClient
</a>
</li>
<li class="md-nav__item">
<a href="#handlerequest" title="handleRequest" class="md-nav__link">
handleRequest
</a>
</li>
<li class="md-nav__item">
<a href="#home" title="home" class="md-nav__link">
home
</a>
</li>
<li class="md-nav__item">
<a href="#host" title="host" class="md-nav__link">
host
</a>
</li>
<li class="md-nav__item">
<a href="#ondetect" title="onDetect" class="md-nav__link">
onDetect
</a>
</li>
<li class="md-nav__item">
<a href="#onnotfound" title="onNotFound" class="md-nav__link">
onNotFound
</a>
</li>
</ul>
</nav>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item">
<a href="#autoconnectconfig-api" title="AutoConnectConfig API" class="md-nav__link">
AutoConnectConfig API
</a>
<nav class="md-nav">
<ul class="md-nav__list">
<li class="md-nav__item">
<a href="#constructor" title=" Constructor" class="md-nav__link">
Constructor
</a>
<nav class="md-nav">
<ul class="md-nav__list">
<li class="md-nav__item">
<a href="#autoconnectconfig" title="AutoConnectConfig" class="md-nav__link">
AutoConnectConfig
</a>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item">
<a href="#public-member-variables" title=" Public member variables" class="md-nav__link">
Public member variables
</a>
<nav class="md-nav">
<ul class="md-nav__list">
<li class="md-nav__item">
<a href="#apid" title="apid" class="md-nav__link">
apid
</a>
</li>
<li class="md-nav__item">
<a href="#apip" title="apip" class="md-nav__link">
apip
</a>
</li>
<li class="md-nav__item">
<a href="#autoreconnect" title="autoReconnect" class="md-nav__link">
autoReconnect
</a>
7 years ago
</li>
<li class="md-nav__item">
<a href="#autoreset" title="autoReset" class="md-nav__link">
autoReset
</a>
</li>
<li class="md-nav__item">
<a href="#autorise" title="autoRise" class="md-nav__link">
autoRise
</a>
7 years ago
</li>
<li class="md-nav__item">
<a href="#autosave" title="autoSave" class="md-nav__link">
autoSave
</a>
</li>
<li class="md-nav__item">
<a href="#boundaryoffset" title="boundaryOffset" class="md-nav__link">
boundaryOffset
</a>
7 years ago
</li>
<li class="md-nav__item">
<a href="#channel" title="channel" class="md-nav__link">
channel
</a>
</li>
<li class="md-nav__item">
<a href="#dns1" title="dns1" class="md-nav__link">
dns1
</a>
</li>
<li class="md-nav__item">
<a href="#dns2" title="dns2" class="md-nav__link">
dns2
</a>
7 years ago
</li>
<li class="md-nav__item">
<a href="#gateway" title="gateway" class="md-nav__link">
gateway
</a>
</li>
<li class="md-nav__item">
<a href="#hidden" title="hidden" class="md-nav__link">
hidden
</a>
</li>
<li class="md-nav__item">
<a href="#homeuri" title="homeUri" class="md-nav__link">
homeUri
</a>
</li>
<li class="md-nav__item">
<a href="#netmask" title="netmask" class="md-nav__link">
netmask
</a>
</li>
<li class="md-nav__item">
<a href="#psk" title="psk" class="md-nav__link">
psk
</a>
</li>
<li class="md-nav__item">
<a href="#staip" title="staip" class="md-nav__link">
staip
</a>
</li>
<li class="md-nav__item">
<a href="#stagateway" title="staGateway" class="md-nav__link">
staGateway
</a>
</li>
<li class="md-nav__item">
<a href="#stanetmask" title="staNetmask" class="md-nav__link">
staNetmask
</a>
7 years ago
</li>
</ul>
</nav>
</li>
<li class="md-nav__item">
<a href="#autoconnectconfig-example" title=" AutoConnectConfig example" class="md-nav__link">
AutoConnectConfig example
</a>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item">
<a href="#something-extra" title=" Something extra" class="md-nav__link">
Something extra
</a>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item">
<a href="../examples/index.html" title="Examples" class="md-nav__link">
Examples
</a>
</li>
<li class="md-nav__item">
<a href="../faq/index.html" title="FAQ" class="md-nav__link">
FAQ
</a>
</li>
<li class="md-nav__item">
<a href="../changelog/index.html" title="Change log" class="md-nav__link">
Change log
</a>
</li>
7 years ago
<li class="md-nav__item">
<a href="../license/index.html" title="License" class="md-nav__link">
License
</a>
</li>
</ul>
</nav>
</div>
</div>
</div>
<div class="md-sidebar md-sidebar--secondary" data-md-component="toc">
<div class="md-sidebar__scrollwrap">
<div class="md-sidebar__inner">
<nav class="md-nav md-nav--secondary">
<label class="md-nav__title" for="toc">Table of contents</label>
<ul class="md-nav__list" data-md-scrollfix>
<li class="md-nav__item">
<a href="#include-headers" title="Include headers" class="md-nav__link">
Include headers
</a>
<nav class="md-nav">
<ul class="md-nav__list">
<li class="md-nav__item">
<a href="#autoconnecth" title=" AutoConnect.h" class="md-nav__link">
AutoConnect.h
</a>
<nav class="md-nav">
<ul class="md-nav__list">
<li class="md-nav__item">
6 years ago
<a href="#defined-macros" title="Defined macros" class="md-nav__link">
Defined macros
7 years ago
</a>
</li>
</ul>
</nav>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item">
<a href="#autoconnect-api" title="AutoConnect API" class="md-nav__link">
AutoConnect API
</a>
<nav class="md-nav">
<ul class="md-nav__list">
<li class="md-nav__item">
<a href="#constructors" title=" Constructors" class="md-nav__link">
Constructors
</a>
<nav class="md-nav">
<ul class="md-nav__list">
<li class="md-nav__item">
<a href="#autoconnect" title="AutoConnect" class="md-nav__link">
AutoConnect
</a>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item">
<a href="#public-member-functions" title=" Public member functions" class="md-nav__link">
Public member functions
</a>
<nav class="md-nav">
<ul class="md-nav__list">
<li class="md-nav__item">
<a href="#begin" title="begin" class="md-nav__link">
begin
</a>
</li>
<li class="md-nav__item">
<a href="#config" title="config" class="md-nav__link">
config
</a>
</li>
<li class="md-nav__item">
<a href="#end" title="end" class="md-nav__link">
end
</a>
</li>
<li class="md-nav__item">
<a href="#handleclient" title="handleClient" class="md-nav__link">
handleClient
</a>
</li>
<li class="md-nav__item">
<a href="#handlerequest" title="handleRequest" class="md-nav__link">
handleRequest
</a>
</li>
<li class="md-nav__item">
<a href="#home" title="home" class="md-nav__link">
home
</a>
</li>
<li class="md-nav__item">
<a href="#host" title="host" class="md-nav__link">
host
</a>
</li>
<li class="md-nav__item">
<a href="#ondetect" title="onDetect" class="md-nav__link">
onDetect
</a>
</li>
<li class="md-nav__item">
<a href="#onnotfound" title="onNotFound" class="md-nav__link">
onNotFound
</a>
</li>
</ul>
</nav>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item">
<a href="#autoconnectconfig-api" title="AutoConnectConfig API" class="md-nav__link">
AutoConnectConfig API
</a>
<nav class="md-nav">
<ul class="md-nav__list">
<li class="md-nav__item">
<a href="#constructor" title=" Constructor" class="md-nav__link">
Constructor
</a>
<nav class="md-nav">
<ul class="md-nav__list">
<li class="md-nav__item">
<a href="#autoconnectconfig" title="AutoConnectConfig" class="md-nav__link">
AutoConnectConfig
</a>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item">
<a href="#public-member-variables" title=" Public member variables" class="md-nav__link">
Public member variables
</a>
<nav class="md-nav">
<ul class="md-nav__list">
<li class="md-nav__item">
<a href="#apid" title="apid" class="md-nav__link">
apid
</a>
</li>
<li class="md-nav__item">
<a href="#apip" title="apip" class="md-nav__link">
apip
</a>
</li>
<li class="md-nav__item">
<a href="#autoreconnect" title="autoReconnect" class="md-nav__link">
autoReconnect
</a>
7 years ago
</li>
<li class="md-nav__item">
<a href="#autoreset" title="autoReset" class="md-nav__link">
autoReset
</a>
</li>
<li class="md-nav__item">
<a href="#autorise" title="autoRise" class="md-nav__link">
autoRise
</a>
7 years ago
</li>
<li class="md-nav__item">
<a href="#autosave" title="autoSave" class="md-nav__link">
autoSave
</a>
</li>
<li class="md-nav__item">
<a href="#boundaryoffset" title="boundaryOffset" class="md-nav__link">
boundaryOffset
</a>
7 years ago
</li>
<li class="md-nav__item">
<a href="#channel" title="channel" class="md-nav__link">
channel
</a>
</li>
<li class="md-nav__item">
<a href="#dns1" title="dns1" class="md-nav__link">
dns1
</a>
</li>
<li class="md-nav__item">
<a href="#dns2" title="dns2" class="md-nav__link">
dns2
</a>
7 years ago
</li>
<li class="md-nav__item">
<a href="#gateway" title="gateway" class="md-nav__link">
gateway
</a>
</li>
<li class="md-nav__item">
<a href="#hidden" title="hidden" class="md-nav__link">
hidden
</a>
</li>
<li class="md-nav__item">
<a href="#homeuri" title="homeUri" class="md-nav__link">
homeUri
</a>
</li>
<li class="md-nav__item">
<a href="#netmask" title="netmask" class="md-nav__link">
netmask
</a>
</li>
<li class="md-nav__item">
<a href="#psk" title="psk" class="md-nav__link">
psk
</a>
</li>
<li class="md-nav__item">
<a href="#staip" title="staip" class="md-nav__link">
staip
</a>
</li>
<li class="md-nav__item">
<a href="#stagateway" title="staGateway" class="md-nav__link">
staGateway
</a>
</li>
<li class="md-nav__item">
<a href="#stanetmask" title="staNetmask" class="md-nav__link">
staNetmask
</a>
7 years ago
</li>
</ul>
</nav>
</li>
<li class="md-nav__item">
<a href="#autoconnectconfig-example" title=" AutoConnectConfig example" class="md-nav__link">
AutoConnectConfig example
</a>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item">
<a href="#something-extra" title=" Something extra" class="md-nav__link">
Something extra
</a>
</li>
</ul>
</nav>
</div>
</div>
</div>
<div class="md-content">
<article class="md-content__inner md-typeset">
<h1>Library APIs</h1>
<h2 id="include-headers">Include headers<a class="headerlink" href="#include-headers" title="Permanent link">&para;</a></h2>
<h3 id="autoconnecth"><i class="fa fa-code"></i> AutoConnect.h<a class="headerlink" href="#autoconnecth" title="Permanent link">&para;</a></h3>
<div class="codehilite"><pre><span></span><span class="cp">#include</span> <span class="cpf">&lt;AutoConnect.h&gt;</span><span class="cp"></span>
</pre></div>
6 years ago
<h4 id="defined-macros">Defined macros<a class="headerlink" href="#defined-macros" title="Permanent link">&para;</a></h4>
7 years ago
<div class="codehilite"><pre><span></span><span class="cp">#define AC_DEBUG </span><span class="c1">// Monitor message output activation</span>
<span class="cp">#define AC_DEBUG_PORT Serial </span><span class="c1">// Default message output device</span>
<span class="cp">#define AUTOCONNECT_AP_IP 0x01F4A8C0 </span><span class="c1">// Default SoftAP IP</span>
<span class="cp">#define AUTOCONNECT_AP_GW 0x01F4A8C0 </span><span class="c1">// Default SoftAP Gateway IP</span>
<span class="cp">#define AUTOCONNECT_AP_NM 0x00FFFFFF </span><span class="c1">// Default subnet mask</span>
<span class="cp">#define AUTOCONNECT_DNSPORT 53 </span><span class="c1">// Default DNS port at captive portal</span>
<span class="cp">#define AUTOCONNECT_HTTPPORT 80 </span><span class="c1">// Default HTTP</span>
7 years ago
<span class="cp">#define AUTOCONNECT_MENU_TITLE &quot;AutoConnect&quot; </span><span class="c1">// Default AutoConnect menu title</span>
<span class="cp">#define AUTOCONNECT_STARTUPTIME 10 </span><span class="c1">// Default waiting time[s] for after reset</span>
7 years ago
<span class="cp">#define AUTOCONNECT_URI &quot;/_ac&quot; </span><span class="c1">// Default AutoConnect root path</span>
<span class="cp">#define AUTOCONNECT_TIMEOUT 30000 </span><span class="c1">// Default connection timeout[ms]</span>
7 years ago
</pre></div>
<h2 id="autoconnect-api">AutoConnect API<a class="headerlink" href="#autoconnect-api" title="Permanent link">&para;</a></h2>
<h3 id="constructors"><i class="fa fa-code"></i> Constructors<a class="headerlink" href="#constructors" title="Permanent link">&para;</a></h3>
<h4 id="autoconnect">AutoConnect<a class="headerlink" href="#autoconnect" title="Permanent link">&para;</a></h4>
<div class="codehilite"><pre><span></span><span class="n">AutoConnect</span><span class="p">()</span>
</pre></div>
<p><a id="withparameter"></a></p>
6 years ago
<p>AutoConnect default constructor. This entry internally allocates the ESP8266WebServer for ESP8266 or WebServer for ESP32 and is activated internally.</p>
<ul>
<li>For ESP8266</li>
</ul>
7 years ago
<div class="codehilite"><pre><span></span><span class="n">AutoConnect</span><span class="p">(</span><span class="n">ESP8266WebServer</span><span class="o">&amp;</span> <span class="n">webServer</span><span class="p">)</span>
</pre></div>
6 years ago
<ul>
<li>For ESP32</li>
</ul>
<div class="codehilite"><pre><span></span><span class="n">AutoConnect</span><span class="p">(</span><span class="n">WebServer</span><span class="o">&amp;</span> <span class="n">webServer</span><span class="p">)</span>
</pre></div>
<p>Run the AutoConnect site using the externally ensured ESP8266WebServer for ESP8266 or WebServer for ESP32.</p>
<p>The <a href="index.html#handleclient"><strong>handleClient</strong></a> function of AutoConnect can include the response of the URI handler added by the user using the "<em>on</em>" function of ESP8266WebServer/WebServer. If ESP8266WebServer/WebServer is assigned internally by AutoConnect, the sketch can obtain that reference with the <a href="../api.me#host"><strong>host</strong></a> function.
7 years ago
<dl class="apidl">
<dt><strong>Parameters</strong></dt>
6 years ago
<dd><span class="apidef">webServer</span>A reference of ESP8266WebServer or WebServer instance.</dd>
7 years ago
</dl></p>
<h3 id="public-member-functions"><i class="fa fa-code"></i> Public member functions<a class="headerlink" href="#public-member-functions" title="Permanent link">&para;</a></h3>
<h4 id="begin">begin<a class="headerlink" href="#begin" title="Permanent link">&para;</a></h4>
<p><div class="codehilite"><pre><span></span><span class="kt">bool</span> <span class="n">begin</span><span class="p">()</span>
</pre></div>
<div class="codehilite"><pre><span></span><span class="kt">bool</span> <span class="n">begin</span><span class="p">(</span><span class="k">const</span> <span class="kt">char</span><span class="o">*</span> <span class="n">ssid</span><span class="p">,</span> <span class="k">const</span> <span class="kt">char</span><span class="o">*</span> <span class="n">passphraase</span><span class="p">)</span>
</pre></div>
6 years ago
<div class="codehilite"><pre><span></span><span class="kt">bool</span> <span class="n">begin</span><span class="p">(</span><span class="k">const</span> <span class="kt">char</span><span class="o">*</span> <span class="n">ssid</span><span class="p">,</span> <span class="k">const</span> <span class="kt">char</span><span class="o">*</span> <span class="n">passphraase</span><span class="p">,</span> <span class="kt">unsigned</span> <span class="kt">long</span> <span class="n">timeout</span><span class="p">)</span>
7 years ago
</pre></div></p>
<p>Starts establishing the WiFi connection.<br />
6 years ago
AutoConnect first invokes <em>WiFi.begin</em>. If the case of SSID and Password missing, its <em>WiFi.begin</em> has no SSID and Password. The WiFi mode at this time is WIFI_STA. Then ESP8266WebServer/WebServer will be started immediately after the first <em>WiFi.begin</em> regardless of the result.</p>
<p>The captive portal will not be started if the connection has been established with first <em>WiFi.begin</em>. If the connection cannot establish, switch to WIFI_AP_STA mode and activate SoftAP. Then DNS server starts.
7 years ago
<dl class="apidl">
<dt><strong>Parameters</strong></dt>
<dd><span class="apidef">ssid</span>SSID to be connected.</dd>
<dd><span class="apidef">passphrase</span>Password for connection.</dd>
<dd><span class="apidef">timeout</span>A time out value in milliseconds for waiting connection.</dd>
<dt><strong>Return value</strong></dt>
<dd><span class="apidef">true</span>Connection established, AutoConnect service started with WIFI_STA mode.</dd>
<dd><span class="apidef">false</span>Could not connected, Captive portal started with WIFI_AP_STA mode.</dd>
</dl></p>
<h4 id="config">config<a class="headerlink" href="#config" title="Permanent link">&para;</a></h4>
<p><div class="codehilite"><pre><span></span><span class="kt">bool</span> <span class="n">config</span><span class="p">(</span><span class="n">AutoConnectConfig</span><span class="o">&amp;</span> <span class="n">config</span><span class="p">)</span>
</pre></div>
<div class="codehilite"><pre><span></span><span class="kt">bool</span> <span class="n">config</span><span class="p">(</span><span class="k">const</span> <span class="kt">char</span><span class="o">*</span> <span class="n">ap</span><span class="p">,</span> <span class="k">const</span> <span class="kt">char</span><span class="o">*</span> <span class="n">password</span> <span class="o">=</span> <span class="k">nullptr</span><span class="p">)</span>
</pre></div></p>
<p>Set SoftAP's WiFi configuration and static IP configuration.
7 years ago
<dl class="apidl">
<dt><strong>Parameters</strong></dt>
<dd><span class="apidef">config</span>Reference to <a href="index.html#autoconnectconfig"><strong>AutoConnectConfig</strong></a> containing SoftAP's parameters and static IP parameters.</dd>
6 years ago
<dd><span class="apidef">ap</span>SSID for SoftAP. The default value is <strong>esp8266ap</strong> for ESP8266, <strong>esp32ap</strong> for ESP32.</dd>
7 years ago
<dd><span class="apidef">password</span>Password for SodtAP. The default value is <strong>12345678</strong>.</dd>
<dt><strong>Return value</strong></dt>
<dd><span class="apidef">true</span>Successfully configured.</dd>
<dd><span class="apidef">false</span>Configuration parameter is invalid, some values out of range.</dd>
</dl></p>
<h4 id="end">end<a class="headerlink" href="#end" title="Permanent link">&para;</a></h4>
<div class="codehilite"><pre><span></span><span class="kt">void</span> <span class="n">end</span><span class="p">()</span>
</pre></div>
6 years ago
<p>Stops AutoConnect captive portal service. Release ESP8266WebServer/WebServer and DNSServer. </p>
7 years ago
<div class="admonition warning">
<p class="admonition-title">Attention to end</p>
6 years ago
<p>The end function releases the instance of ESP8266WebServer/WebServer and DNSServer. It can not process them after the end function.</p>
7 years ago
</div>
<h4 id="handleclient">handleClient<a class="headerlink" href="#handleclient" title="Permanent link">&para;</a></h4>
<div class="codehilite"><pre><span></span><span class="kt">void</span> <span class="n">handleClient</span><span class="p">()</span>
</pre></div>
6 years ago
<p>Process the AutoConnect menu interface. The handleClient() function of the ESP8266WebServer/WebServer hosted by AutoConnect is also called from within AutoConnect and client requests contained in the user sketch handler are also handled.</p>
7 years ago
<h4 id="handlerequest">handleRequest<a class="headerlink" href="#handlerequest" title="Permanent link">&para;</a></h4>
<div class="codehilite"><pre><span></span><span class="kt">void</span> <span class="n">handleRequest</span><span class="p">()</span>
</pre></div>
<p>Handling for the AutoConnect menu request.</p>
<div class="admonition warning">
<p class="admonition-title">About used in combination with handleClient</p>
6 years ago
<p>The handleRequest function is not supposed to use with AutoConnect::handleClient. It should be used with ESP8266WebServer::handleClient or WebServer::handleClient.</p>
7 years ago
</div>
<h4 id="home">home<a class="headerlink" href="#home" title="Permanent link">&para;</a></h4>
<div class="codehilite"><pre><span></span><span class="kt">void</span> <span class="n">home</span><span class="p">(</span><span class="n">String</span> <span class="n">uri</span><span class="p">)</span>
</pre></div>
<p>Put a user site's home URI. The URI specified by home is linked from "HOME" in the AutoConnect menu.
7 years ago
<dl class="apidl">
<dt><strong>Parameters</strong></dt>
<dd><span class="apidef">uri</span> A URI string of user site's home path.</dd>
</dl></p>
<h4 id="host">host<a class="headerlink" href="#host" title="Permanent link">&para;</a></h4>
6 years ago
<p>Returns the reference of the ESP8266WebServer/WebServer which is allocated in AutoConnect automatically.</p>
<ul>
<li>For ESP8266</li>
</ul>
<div class="codehilite"><pre><span></span><span class="n">ESP8266WebServer</span><span class="o">&amp;</span> <span class="n">host</span><span class="p">()</span>
</pre></div>
<ul>
<li>For ESP32</li>
</ul>
<p><div class="codehilite"><pre><span></span><span class="n">WebServer</span><span class="o">&amp;</span> <span class="n">host</span><span class="p">()</span>
7 years ago
</pre></div>
<dl class="apidl">
<dt><strong>Return value</strong></dt>
6 years ago
<dd>A reference of the ESP8266WebServer/WebServer.</dd>
7 years ago
</dl></p>
<div class="admonition note">
<p class="admonition-title">&amp;reference is not a pointer</p>
<p>A reference cannot be re-assigned, and must be assigned at initialization. It's like as bind as alias. <br />
<div class="codehilite"><pre><span></span><span class="n">ESP8266WebServer</span><span class="o">&amp;</span> <span class="n">server</span> <span class="o">=</span> <span class="n">portal</span><span class="p">.</span><span class="n">host</span><span class="p">();</span>
<span class="n">server</span><span class="p">.</span><span class="n">handleClient</span><span class="p">();</span>
</pre></div>
or<br />
<div class="codehilite"><pre><span></span><span class="n">portal</span><span class="p">.</span><span class="n">host</span><span class="p">().</span><span class="n">handleClient</span><span class="p">();</span>
</pre></div></p>
</div>
<h4 id="ondetect">onDetect<a class="headerlink" href="#ondetect" title="Permanent link">&para;</a></h4>
<p><div class="codehilite"><pre><span></span><span class="kt">void</span> <span class="n">onDetect</span><span class="p">(</span><span class="n">DetectExit_ft</span> <span class="n">fn</span><span class="p">)</span>
</pre></div>
Register the function which will call from AutoConnect at the start of the captive portal.
<dl class="apidl">
<dt><strong>Parameters</strong></dt>
<dd><span class="apidef">fn</span>Function called at the captive portal start.</dd></p>
</dl>
<p>An <em>fn</em> specifies the function called when the captive portal starts. Its prototype declaration is defined as "<em>DetectExit_ft</em>".</p>
7 years ago
<p><div class="codehilite"><pre><span></span><span class="k">typedef</span> <span class="n">std</span><span class="o">::</span><span class="n">function</span><span class="o">&lt;</span><span class="kt">bool</span><span class="p">(</span><span class="n">IPAddress</span> <span class="n">softapIP</span><span class="p">)</span><span class="o">&gt;</span> <span class="n">DetectExit_ft</span>
</pre></div>
<dl class="apidl">
<dt><strong>Parameters</strong></dt>
<dd><span class="apidef">softapIP</span>An IP address of SoftAP for the captive portal.</dd>
<dt><strong>Retuen value</strong></dt>
<dd><span class="apidef">true</span>Continues captive portal handling.</dd>
<dd><span class="apidef">false</span>Cancel the captive portal. AutoConnect::begin function will return with a false.</dd>
</dl></p>
<h4 id="onnotfound">onNotFound<a class="headerlink" href="#onnotfound" title="Permanent link">&para;</a></h4>
6 years ago
<ul>
<li>For ESP8266</li>
</ul>
<div class="codehilite"><pre><span></span><span class="kt">void</span> <span class="n">onNotFound</span><span class="p">(</span><span class="n">ESP8266WebServer</span><span class="o">::</span><span class="n">THandlerFunction</span> <span class="n">fn</span><span class="p">)</span>
</pre></div>
<ul>
<li>For ESP32</li>
</ul>
<p><div class="codehilite"><pre><span></span><span class="kt">void</span> <span class="n">onNotFound</span><span class="p">(</span><span class="n">WebServer</span><span class="o">::</span><span class="n">THandlerFunction</span> <span class="n">fn</span><span class="p">)</span>
7 years ago
</pre></div>
Register the handler function for undefined URL request detected.
<dl class="apidl">
<dt><strong>Parameters</strong></dt>
<dd><span class="apidef">fn</span>A function of the "not found" handler.</dd>
</dl></p>
<h2 id="autoconnectconfig-api">AutoConnectConfig API<a class="headerlink" href="#autoconnectconfig-api" title="Permanent link">&para;</a></h2>
<h3 id="constructor"><i class="fa fa-code"></i> Constructor<a class="headerlink" href="#constructor" title="Permanent link">&para;</a></h3>
<h4 id="autoconnectconfig">AutoConnectConfig<a class="headerlink" href="#autoconnectconfig" title="Permanent link">&para;</a></h4>
<p><div class="codehilite"><pre><span></span><span class="n">AutoConnectConfig</span><span class="p">();</span>
</pre></div>
<div class="codehilite"><pre><span></span><span class="n">AutoConnectConfig</span><span class="p">(</span><span class="k">const</span> <span class="kt">char</span><span class="o">*</span> <span class="n">ap</span><span class="p">,</span> <span class="k">const</span> <span class="kt">char</span><span class="o">*</span> <span class="n">password</span><span class="p">);</span>
</pre></div>
<dl class="apidl">
<dt><strong>Parameters</strong></dt>
6 years ago
<dd><span class="apidef">ap</span>SSID for SoftAP. The length should be up to 31. The default value is <strong>esp8266ap</strong> for ESP8266, <strong>esp32ap</strong> for ESP32.</dd>
7 years ago
<dd><span class="apidef">password</span>Password for SodtAP. The length should be from 8 to up to 63. The default value is <strong>12345678</strong>.</dd>
</dl></p>
<h3 id="public-member-variables"><i class="fa fa-code"></i> Public member variables<a class="headerlink" href="#public-member-variables" title="Permanent link">&para;</a></h3>
<h4 id="apid">apid<a class="headerlink" href="#apid" title="Permanent link">&para;</a></h4>
<p>SoftAP's SSID.
<dl class="apidl">
<dt><strong>Type</strong></dt>
<dd>String</dd>
</dl></p>
<h4 id="apip">apip<a class="headerlink" href="#apip" title="Permanent link">&para;</a></h4>
<p>Sets IP address for Soft AP in captive portal. When AutoConnect fails the initial WiFi.begin, it starts the captive portal with the IP address specified this.
<dl class="apidl">
<dt><strong>Type</strong></dt>
<dd><span class="apidef" style="width:230px;">IPAddress</span>The default value is <strong>192.168.244.1</strong></dd>
7 years ago
</dl></p>
<h4 id="autoreconnect">autoReconnect<a class="headerlink" href="#autoreconnect" title="Permanent link">&para;</a></h4>
6 years ago
<p>Automatically will try to reconnect with the past established access point (BSSID) when the current configured SSID in ESP8266/ESP32 could not be connected. By enabling this option, <em>AutoConnect::begin()</em> function will attempt to reconnect to a known access point using credentials stored in the EEPROM, even if the connection failed by current SSID.<br />
If the connection fails, starts the captive portal in SoftAP + STA mode.<br />
<dl class="apidl">
<dt><strong>Type</strong></dt>
<dd>bool</dd>
<dt><strong>Value</strong></dt>
<dd><span class="apidef" style="width:230px;">true</span>Reconnect automatically.</dd>
<dd><span class="apidef" style="width:230px;">false</span>Starts Captive Portal in SoftAP + STA mode without trying to reconnect. This is the default.</dd>
</dl></p>
<p>When the autoReconnect option is enabled, an automatic connection will behave if the following conditions are satisfied.</p>
<ul>
<li>Invokes <em>AutoConnect::begin</em> without user name and password parameter as <code class="codehilite">begin()</code>.</li>
<li>If one of the saved BSSIDs (not the SSID) of the credentials matches the BSSID detected by the network scan.</li>
</ul>
7 years ago
<h4 id="autoreset">autoReset<a class="headerlink" href="#autoreset" title="Permanent link">&para;</a></h4>
<p>Reset ESP8266 module automatically after WLAN disconnected.
7 years ago
<dl class="apidl">
<dt><strong>Type</strong></dt>
<dd>bool</dd>
<dt><strong>Value</strong></dt>
<dd><span class="apidef" style="width:230px;">true</span>Reset after WiFi disconnected automatically.</dd>
<dd><span class="apidef" style="width:230px;">false</span>No reset.</dd>
</dl></p>
<h4 id="autorise">autoRise<a class="headerlink" href="#autorise" title="Permanent link">&para;</a></h4>
<p>Captive portal activation switch. False for disabling the captive portal. It prevents starting the captive portal even if the connection at the first <em>WiFi.begin</em> fails.
<dl class="apidl">
<dt><strong>Type</strong></dt>
<dd>bool</dd>
<dt><strong>Value</strong></dt>
<dd><span class="apidef" style="width:230px;">true</span>Enable the captive portal. This is the default.</dd>
<dd><span class="apidef" style="width:230px;">false</span>Disable the captive portal.</dd>
</dl></p>
7 years ago
<h4 id="autosave">autoSave<a class="headerlink" href="#autosave" title="Permanent link">&para;</a></h4>
<p>The credential saved automatically at the connection establishment.
<dl class="apidl">
<dt><strong>Type</strong></dt>
<dd>AC_SAVECREDENTIAL_t</dd>
<dt><strong>Value</strong></dt>
<dd><span class="apidef" style="width:230px;">AC_SAVECREDENTIAL_AUTO</span>The credential saved automatically. This is the default.</dd>
7 years ago
<dd><span class="apidef" style="width:230px;">AC_SAVECREDENTIAL_NEVER</span>The credential no saved.</dd>
</dl></p>
<h4 id="boundaryoffset">boundaryOffset<a class="headerlink" href="#boundaryoffset" title="Permanent link">&para;</a></h4>
<p>Sets the offset address of the credential storage area for EEPROM. This value must be between greater than 4 and less than flash sector size. (4096 by SDK)<br />
The default value is 0.
<dl class="apidl">
<dt><strong>Type</strong></dt>
<dd>uint16_t</dd>
</dl></p>
<div class="admonition warning">
<p class="admonition-title">It will conflict with user data.</p>
<p>If the sketch leaves this offset at zero, it will conflict the storage area of credentials with the user sketch owned data. It needs to use the behind of credential area.</p>
</div>
7 years ago
<h4 id="channel">channel<a class="headerlink" href="#channel" title="Permanent link">&para;</a></h4>
<p>The channel number of WIFi when SoftAP starts.
<dl class="apidl">
<dt><strong>Type</strong></dt>
<dd>uint8_t</dd>
<dt><strong>Value</strong></dt>
<dd>1 ~ 14. The default value is 1.</dd>
</dl></p>
<div class="admonition info">
<p class="admonition-title">How do I choose Channel</p>
7 years ago
<p>Espressif Systems had announced the <a href="https://www.espressif.com/sites/default/files/esp8266_wi-fi_channel_selection_guidelines.pdf">application note</a> about Wi-Fi channel selection.</p>
</div>
<h4 id="dns1">dns1<a class="headerlink" href="#dns1" title="Permanent link">&para;</a></h4>
<p>Set primary DNS server address when using static IP address.
<dl class="apidl">
<dt><strong>Type</strong></dt>
<dd>IPAddress</dd>
</dl></p>
<h4 id="dns2">dns2<a class="headerlink" href="#dns2" title="Permanent link">&para;</a></h4>
<p>Set secondary DNS server address when using static IP address.
<dl class="apidl">
<dt><strong>Type</strong></dt>
<dd>IPAddress</dd>
</dl></p>
7 years ago
<h4 id="gateway">gateway<a class="headerlink" href="#gateway" title="Permanent link">&para;</a></h4>
<p>Sets gateway address for Soft AP in captive portal. When AutoConnect fails the initial WiFi.begin, it starts the captive portal with the IP address specified this.
<dl class="apidl">
<dt><strong>Type</strong></dt>
<dd><span class="apidef" style="width:230px;">IPAddress</span>The default value is <strong>192.168.244.1</strong></dd>
7 years ago
</dl></p>
<h4 id="hidden">hidden<a class="headerlink" href="#hidden" title="Permanent link">&para;</a></h4>
<p>Sets SoftAP to hidden SSID.
<dl class="apidl">
<dt><strong>Type</strong></dt>
<dd>uint8_t</dd>
<dt><strong>Value</strong></dt>
<dd><span class="apidef" style="width:230px;">0</span>SSID will be appeared. This is the default.</dd>
<dd><span class="apidef" style="width:230px;">1</span>SSID will be hidden.</dd>
</dl></p>
<h4 id="homeuri">homeUri<a class="headerlink" href="#homeuri" title="Permanent link">&para;</a></h4>
<p>Sets the home path of user sketch. This path would be linked from 'HOME' in the AutoConnect menu.
<dl class="apidl">
<dt><strong>Type</strong></dt>
<dd>String</dd>
</dl></p>
<h4 id="netmask">netmask<a class="headerlink" href="#netmask" title="Permanent link">&para;</a></h4>
<p>Sets subnet mask for Soft AP in captive portal. When AutoConnect fails the initial WiFi.begin, it starts the captive portal with the IP address specified this.
<dl class="apidl">
<dt><strong>Type</strong></dt>
<dd><span class="apidef" style="width:230px;">IPAddress</span>The default value is <strong>255.255.255.0</strong></dd>
7 years ago
</dl></p>
<h4 id="psk">psk<a class="headerlink" href="#psk" title="Permanent link">&para;</a></h4>
<p>Sets password for SoftAP. The length should be from 8 to up to 63. The default value is <strong>12345678</strong>.
<dl class="apidl">
<dt><strong>Type</strong></dt>
<dd>String</dd>
</dl></p>
<h4 id="staip">staip<a class="headerlink" href="#staip" title="Permanent link">&para;</a></h4>
<p>Set a static IP address. The IP will behave with STA mode.
<dl class="apidl">
<dt><strong>Type</strong></dt>
<dd>IPAddress</dd>
</dl></p>
<h4 id="stagateway">staGateway<a class="headerlink" href="#stagateway" title="Permanent link">&para;</a></h4>
<p>Set the gateway address when using static IP address.
<dl class="apidl">
<dt><strong>Type</strong></dt>
<dd>IPAddress</dd>
</dl></p>
<h4 id="stanetmask">staNetmask<a class="headerlink" href="#stanetmask" title="Permanent link">&para;</a></h4>
<p>Set the subnetmask when using static IP address.
<dl class="apidl">
<dt><strong>Type</strong></dt>
<dd>IPAddress</dd>
</dl></p>
7 years ago
<h3 id="autoconnectconfig-example"><i class="fa fa-code"></i> AutoConnectConfig example<a class="headerlink" href="#autoconnectconfig-example" title="Permanent link">&para;</a></h3>
<div class="codehilite"><pre><span></span><span class="n">AutoConenct</span> <span class="n">Portal</span><span class="p">;</span>
<span class="n">AutoConenctConfig</span> <span class="nf">Config</span><span class="p">(</span><span class="s">&quot;&quot;</span><span class="p">,</span> <span class="s">&quot;passpass&quot;</span><span class="p">);</span> <span class="c1">// SoftAp name is determined at runtime</span>
<span class="n">Config</span><span class="p">.</span><span class="n">apid</span> <span class="o">=</span> <span class="n">ESP</span><span class="p">.</span><span class="n">hostname</span><span class="p">();</span> <span class="c1">// Retrieve host name to SotAp identification</span>
<span class="n">Config</span><span class="p">.</span><span class="n">apip</span> <span class="o">=</span> <span class="nf">IPAddress</span><span class="p">(</span><span class="mi">192</span><span class="p">,</span><span class="mi">168</span><span class="p">,</span><span class="mi">10</span><span class="p">,</span><span class="mi">101</span><span class="p">);</span> <span class="c1">// Sets SoftAP IP address</span>
<span class="n">Config</span><span class="p">.</span><span class="n">gateway</span> <span class="o">=</span> <span class="nf">IPAddress</span><span class="p">(</span><span class="mi">192</span><span class="p">,</span><span class="mi">168</span><span class="p">,</span><span class="mi">10</span><span class="p">,</span><span class="mi">1</span><span class="p">);</span> <span class="c1">// Sets WLAN router IP address</span>
<span class="n">Config</span><span class="p">.</span><span class="n">netmask</span> <span class="o">=</span> <span class="nf">IPAddress</span><span class="p">(</span><span class="mi">255</span><span class="p">,</span><span class="mi">255</span><span class="p">,</span><span class="mi">255</span><span class="p">,</span><span class="mi">0</span><span class="p">);</span> <span class="c1">// Sets WLAN scope</span>
<span class="n">Config</span><span class="p">.</span><span class="n">autoReconnect</span> <span class="o">=</span> <span class="kr">true</span><span class="p">;</span> <span class="c1">// Enable auto-reconnect</span>
7 years ago
<span class="n">Config</span><span class="p">.</span><span class="n">autoSave</span> <span class="o">=</span> <span class="n">AC_SAVECREDENTIAL_NEVER</span><span class="p">;</span> <span class="c1">// No save credential</span>
<span class="n">COnfig</span><span class="p">.</span><span class="n">boundaryOffet</span> <span class="o">=</span> <span class="mi">64</span><span class="p">;</span> <span class="c1">// Reserve 64 bytes for the user data in EEPROM. </span>
7 years ago
<span class="n">Config</span><span class="p">.</span><span class="n">homeUri</span> <span class="o">=</span> <span class="s">&quot;/index.html&quot;</span> <span class="c1">// Sets home path of the sketch application</span>
<span class="n">Config</span><span class="p">.</span><span class="n">staip</span> <span class="o">=</span> <span class="nf">IPAddress</span><span class="p">(</span><span class="mi">192</span><span class="p">,</span><span class="mi">168</span><span class="p">,</span><span class="mi">10</span><span class="p">,</span><span class="mi">10</span><span class="p">);</span> <span class="c1">// Sets static IP</span>
<span class="n">Config</span><span class="p">.</span><span class="n">staGateway</span> <span class="o">=</span> <span class="nf">IPAddress</span><span class="p">(</span><span class="mi">192</span><span class="p">,</span><span class="mi">168</span><span class="p">,</span><span class="mi">10</span><span class="p">,</span><span class="mi">1</span><span class="p">);</span> <span class="c1">// Sets WiFi router address</span>
<span class="n">Config</span><span class="p">.</span><span class="n">staNetmask</span> <span class="o">=</span> <span class="nf">IPAddress</span><span class="p">(</span><span class="mi">255</span><span class="p">,</span><span class="mi">255</span><span class="p">,</span><span class="mi">255</span><span class="p">,</span><span class="mi">0</span><span class="p">);</span> <span class="c1">// Sets WLAN scope</span>
<span class="n">Config</span><span class="p">.</span><span class="n">dns1</span> <span class="o">=</span> <span class="nf">IPAddress</span><span class="p">(</span><span class="mi">192</span><span class="p">,</span><span class="mi">168</span><span class="p">,</span><span class="mi">10</span><span class="p">,</span><span class="mi">1</span><span class="p">);</span> <span class="c1">// Sets primary DNS address</span>
7 years ago
<span class="n">Portal</span><span class="p">.</span><span class="nf">config</span><span class="p">(</span><span class="n">Config</span><span class="p">);</span> <span class="c1">// Configure AutoConnect</span>
<span class="n">Portal</span><span class="p">.</span><span class="nf">begin</span><span class="p">();</span> <span class="c1">// Starts and behaves captive portal</span>
</pre></div>
<h2 id="something-extra"><i class="fa fa-gift"></i> Something extra<a class="headerlink" href="#something-extra" title="Permanent link">&para;</a></h2>
<p>The library presents two PNG icons which can be used to embed a hyperlink to the AutoConnect menu.</p>
<ul>
<li>Bar type <img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAApklEQVRYR2NkGGDAOMD2M4w6YDQEkEMgEJggZwCxGI0T5mug+alAvBFkD7IDXtLBcpjfXgEZ4ugOeAETpHEIgIwHeVYC3QH+0CgAS9AQgCwHRcFmdAfQ0E7cRo9mw0EVAqPlAKhwEKVTVsBZDsyiQ2k4Wg6gxPKgyoZ0Sn+o1iCHQBBQaiYQi9DYJTjbAyAJWluOtz0wWg7QOOqxGz+aDUdDYMBDAACA0x4hs/MPrwAAAABJRU5ErkJggg==" title="AutoConnect menu" alt="AutoConnect menu" /></li>
<li>Cog type <img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAC2klEQVRIS61VvWsUQRSfmU2pon9BUIkQUaKFaCBKgooSb2d3NSSFKbQR/KrEIiIKBiGF2CgRxEpjQNHs7mwOUcghwUQ7g58IsbGxEBWsb2f8zR177s3t3S2cA8ftzPu993vzvoaSnMu2vRKlaqgKp74Q/tE8qjQPyHGcrUrRjwlWShmDbFMURd/a6TcQwNiYUmpFCPElUebcuQ2vz6aNATMVReHEPwzfSSntDcNwNo2rI+DcvQzhpAbA40VKyV0p1Q9snzBG1qYVcYufXV1sREraDcxpyHdXgkfpRBj6Uwm2RsC5dxxmZ9pdOY9cKTISRcHTCmGiUCh4fYyplTwG2mAUbtMTBMHXOgK9QfyXEZr+TkgQ1oUwDA40hEgfIAfj+HuQRaBzAs9eKyUZ5Htx+T3ZODKG8DzOJMANhmGomJVMXPll+hx9UUAlzZrJJ4QNCDG3VEfguu7mcpmcB/gkBOtShhQhchAlu5jlLUgc9ENgyP5gf9+y6LTv+58p5zySkgwzLNOIGc8sEoT1Lc53NMlbCQQuvMxeCME1NNPVVkmH/i3IzzXDtCSA0qQQwZWOCJDY50jsQRjJmkslEOxvTcDRO6zPxOh5xZglKkYLhWM9jMVnkIsTyMT6NBj7IbOCEjm6HxNVVTo2WXqEWJZ1T8rytB6GxizyDkPhWVpBqfiXUtbo/HywYJSpA9kMamNNPZ71R9Hcm+TMHHZNGw3EuraXEUldbfvw25UdOjqOt+JhMwJd7+jSTpZaEiIcaCDwPK83jtWnTkwnunFMtxeL/ge9r4XItt1RNNaj/0GAcV2bR3U5sG3nEh6M61US+Qrfd9Bs31GGulI2GOS/8dgcQZV1w+ApjIxB7TDwF9GcNzJzoA+rD0/8HvPnXQJCt2qFCwbBTfRI7UyXumWVt+HJ9NO4XI++bdsb0YyrqXmlh+AWOLHaLqS5CLQR5EggR3YlcVS9gKeH2hnX8r8Kmi1CAsl36QAAAABJRU5ErkJggg==" title="AutoConnect menu" alt="AutoConnect menu" /></li>
</ul>
<p>To reference the icon, use the <strong>AUTOCONNECT_LINK</strong> macro in the sketch. It expands into the string literal as an HTML <code class="codehilite"><span class="nt">&lt;a&gt;&lt;/a&gt;</span></code> tag with PNG embedded of the AutoConnect menu hyperlinks. Icon type is specified by the parameter of the macro.</p>
<dl class="apidl">
<dd><span class="apidef">BAR_24</span>Bars icon, 24x24.</dd>
7 years ago
<dd><span class="apidef">BAR_32</span>Bars icon, 32x32.</dd>
<dd><span class="apidef">BAR_48</span>Bars icon, 48x48.</dd>
<dd><span class="apidef">COG_24</span>Cog icon, 24x24.</dd>
<dd><span class="apidef">COG_32</span>Cog icon, 32x32.</dd>
</dl>
<div class="admonition note">
<p class="admonition-title">Usage</p>
<div class="codehilite"><pre><span></span><span class="kr">String</span> <span class="n">html</span> <span class="o">=</span> <span class="s">&quot;&lt;html&gt;&quot;</span><span class="p">;</span>
<span class="n">html</span> <span class="o">+=</span> <span class="n">AUTOCONNECT_LINK</span><span class="p">(</span><span class="n">BAR_32</span><span class="p">);</span>
<span class="n">html</span> <span class="o">+=</span> <span class="s">&quot;&lt;/html&gt;&quot;</span><span class="p">;</span>
<span class="n">server</span><span class="p">.</span><span class="n">send</span><span class="p">(</span><span class="mi">200</span><span class="p">,</span> <span class="s">&quot;text/html&quot;</span><span class="p">,</span> <span class="n">html</span><span class="p">);</span>
</pre></div>
</div>
</article>
</div>
</div>
</main>
<footer class="md-footer">
<div class="md-footer-nav">
<nav class="md-footer-nav__inner md-grid">
<a href="../advancedusage/index.html" title="Advanced usage" class="md-flex md-footer-nav__link md-footer-nav__link--prev" rel="prev">
7 years ago
<div class="md-flex__cell md-flex__cell--shrink">
<i class="md-icon md-icon--arrow-back md-footer-nav__button"></i>
</div>
<div class="md-flex__cell md-flex__cell--stretch md-footer-nav__title">
<span class="md-flex__ellipsis">
<span class="md-footer-nav__direction">
Previous
</span>
Advanced usage
7 years ago
</span>
</div>
</a>
<a href="../examples/index.html" title="Examples" class="md-flex md-footer-nav__link md-footer-nav__link--next" rel="next">
<div class="md-flex__cell md-flex__cell--stretch md-footer-nav__title">
<span class="md-flex__ellipsis">
<span class="md-footer-nav__direction">
Next
</span>
Examples
</span>
</div>
<div class="md-flex__cell md-flex__cell--shrink">
<i class="md-icon md-icon--arrow-forward md-footer-nav__button"></i>
</div>
</a>
</nav>
</div>
<div class="md-footer-meta md-typeset">
<div class="md-footer-meta__inner md-grid">
<div class="md-footer-copyright">
<div class="md-footer-copyright__highlight">
Copyright &copy; 2018 Hieromon Ikasamo
</div>
powered by
<a href="http://www.mkdocs.org">MkDocs</a>
and
<a href="https://squidfunk.github.io/mkdocs-material/">
Material for MkDocs</a>
</div>
<div class="md-footer-social">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<a href="https://github.com/Hieromon" class="md-footer-social__link fa fa-github"></a>
<a href="https://twitter.com/hieromon" class="md-footer-social__link fa fa-twitter"></a>
</div>
</div>
</div>
</footer>
</div>
<script src="../assets/javascripts/application.8eb9be28.js"></script>
<script>app.initialize({version:"0.17.3",url:{base:".."}})</script>
<script src="../js/gifffer.min.js"></script>
<script>!function(e,a,t,n,o,c,i){e.GoogleAnalyticsObject=o,e.ga=e.ga||function(){(e.ga.q=e.ga.q||[]).push(arguments)},e.ga.l=1*new Date,c=a.createElement(t),i=a.getElementsByTagName(t)[0],c.async=1,c.src="https://www.google-analytics.com/analytics.js",i.parentNode.insertBefore(c,i)}(window,document,"script",0,"ga"),ga("create","UA-116150854-1","auto"),ga("set","anonymizeIp",!0),ga("send","pageview");var links=document.getElementsByTagName("a");if(Array.prototype.map.call(links,function(e){e.host!=document.location.host&&e.addEventListener("click",function(){var a=e.getAttribute("data-md-action")||"follow";ga("send","event","outbound",a,e.href)})}),document.forms.search){var query=document.forms.search.query;query.addEventListener("blur",function(){if(this.value){var e=document.location.pathname;ga("send","pageview",e+"?q="+this.value)}})}</script>
7 years ago
</body>
</html>