esp-nimble-cpp/class_nim_b_l_e_server.html
2021-08-05 01:02:30 +00:00

745 lines
41 KiB
HTML

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://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"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.9.0"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>esp-nimble-cpp / NimBLE-Arduino: NimBLEServer Class Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td id="projectalign" style="padding-left: 0.5em;">
<div id="projectname">esp-nimble-cpp / NimBLE-Arduino
&#160;<span id="projectnumber">1.3.1</span>
</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.9.0 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
var searchBox = new SearchBox("searchBox", "search",false,'Search','.html');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(function() {
initMenu('',true,false,'search.php','Search');
$(document).ready(function() { init_search(); });
});
/* @license-end */</script>
<div id="main-nav"></div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
<div id="nav-tree">
<div id="nav-tree-contents">
<div id="nav-sync" class="sync"></div>
</div>
</div>
<div id="splitbar" style="-moz-user-select:none;"
class="ui-resizable-handle">
</div>
</div>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(document).ready(function(){initNavTree('class_nim_b_l_e_server.html',''); initResizable(); });
/* @license-end */
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>
<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0"
name="MSearchResults" id="MSearchResults">
</iframe>
</div>
<div class="header">
<div class="summary">
<a href="#pub-methods">Public Member Functions</a> &#124;
<a href="class_nim_b_l_e_server-members.html">List of all members</a> </div>
<div class="headertitle">
<div class="title">NimBLEServer Class Reference</div> </div>
</div><!--header-->
<div class="contents">
<p>The model of a BLE server.
<a href="class_nim_b_l_e_server.html#details">More...</a></p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-methods"></a>
Public Member Functions</h2></td></tr>
<tr class="memitem:a98ea12f57c10c0477b0c1c5efab23ee5"><td class="memItemLeft" align="right" valign="top">size_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_nim_b_l_e_server.html#a98ea12f57c10c0477b0c1c5efab23ee5">getConnectedCount</a> ()</td></tr>
<tr class="memdesc:a98ea12f57c10c0477b0c1c5efab23ee5"><td class="mdescLeft">&#160;</td><td class="mdescRight">Return the number of connected clients. <a href="class_nim_b_l_e_server.html#a98ea12f57c10c0477b0c1c5efab23ee5">More...</a><br /></td></tr>
<tr class="separator:a98ea12f57c10c0477b0c1c5efab23ee5"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:aaeb58b4de85754d1aac6964e9248aa35"><td class="memItemLeft" align="right" valign="top"><a class="el" href="class_nim_b_l_e_service.html">NimBLEService</a> *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_nim_b_l_e_server.html#aaeb58b4de85754d1aac6964e9248aa35">createService</a> (const char *uuid)</td></tr>
<tr class="memdesc:aaeb58b4de85754d1aac6964e9248aa35"><td class="mdescLeft">&#160;</td><td class="mdescRight">Create a BLE Service. <a href="class_nim_b_l_e_server.html#aaeb58b4de85754d1aac6964e9248aa35">More...</a><br /></td></tr>
<tr class="separator:aaeb58b4de85754d1aac6964e9248aa35"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:addc0753b57de87e172cc2d5f158bd6c6"><td class="memItemLeft" align="right" valign="top"><a class="el" href="class_nim_b_l_e_service.html">NimBLEService</a> *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_nim_b_l_e_server.html#addc0753b57de87e172cc2d5f158bd6c6">createService</a> (const <a class="el" href="class_nim_b_l_e_u_u_i_d.html">NimBLEUUID</a> &amp;uuid, uint32_t numHandles=15, uint8_t inst_id=0)</td></tr>
<tr class="memdesc:addc0753b57de87e172cc2d5f158bd6c6"><td class="mdescLeft">&#160;</td><td class="mdescRight">Create a BLE Service. <a href="class_nim_b_l_e_server.html#addc0753b57de87e172cc2d5f158bd6c6">More...</a><br /></td></tr>
<tr class="separator:addc0753b57de87e172cc2d5f158bd6c6"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a00c92f62f41ec1c499dfaf042b487d75"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_nim_b_l_e_server.html#a00c92f62f41ec1c499dfaf042b487d75">removeService</a> (<a class="el" href="class_nim_b_l_e_service.html">NimBLEService</a> *service, bool deleteSvc=false)</td></tr>
<tr class="memdesc:a00c92f62f41ec1c499dfaf042b487d75"><td class="mdescLeft">&#160;</td><td class="mdescRight">Remove a service from the server. <a href="class_nim_b_l_e_server.html#a00c92f62f41ec1c499dfaf042b487d75">More...</a><br /></td></tr>
<tr class="separator:a00c92f62f41ec1c499dfaf042b487d75"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a6eda4c9e0ac1dd031c678d4bf7da1d56"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_nim_b_l_e_server.html#a6eda4c9e0ac1dd031c678d4bf7da1d56">addService</a> (<a class="el" href="class_nim_b_l_e_service.html">NimBLEService</a> *service)</td></tr>
<tr class="memdesc:a6eda4c9e0ac1dd031c678d4bf7da1d56"><td class="mdescLeft">&#160;</td><td class="mdescRight">Adds a service which was either already created but removed from availability,<br />
or created and later added to services list. <a href="class_nim_b_l_e_server.html#a6eda4c9e0ac1dd031c678d4bf7da1d56">More...</a><br /></td></tr>
<tr class="separator:a6eda4c9e0ac1dd031c678d4bf7da1d56"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ab41d8bb9b334734f95a726f1e15200fc"><td class="memItemLeft" align="right" valign="top"><a class="el" href="class_nim_b_l_e_advertising.html">NimBLEAdvertising</a> *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_nim_b_l_e_server.html#ab41d8bb9b334734f95a726f1e15200fc">getAdvertising</a> ()</td></tr>
<tr class="memdesc:ab41d8bb9b334734f95a726f1e15200fc"><td class="mdescLeft">&#160;</td><td class="mdescRight">Retrieve the advertising object that can be used to advertise the existence of the server. <a href="class_nim_b_l_e_server.html#ab41d8bb9b334734f95a726f1e15200fc">More...</a><br /></td></tr>
<tr class="separator:ab41d8bb9b334734f95a726f1e15200fc"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a485c90ce36275f9e4ec26a7f3d348cd9"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_nim_b_l_e_server.html#a485c90ce36275f9e4ec26a7f3d348cd9">setCallbacks</a> (<a class="el" href="class_nim_b_l_e_server_callbacks.html">NimBLEServerCallbacks</a> *pCallbacks, bool deleteCallbacks=true)</td></tr>
<tr class="memdesc:a485c90ce36275f9e4ec26a7f3d348cd9"><td class="mdescLeft">&#160;</td><td class="mdescRight">Set the server callbacks. <a href="class_nim_b_l_e_server.html#a485c90ce36275f9e4ec26a7f3d348cd9">More...</a><br /></td></tr>
<tr class="separator:a485c90ce36275f9e4ec26a7f3d348cd9"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a2540ae7b61fc6513f794da2512d66f74"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_nim_b_l_e_server.html#a2540ae7b61fc6513f794da2512d66f74">startAdvertising</a> ()</td></tr>
<tr class="memdesc:a2540ae7b61fc6513f794da2512d66f74"><td class="mdescLeft">&#160;</td><td class="mdescRight">Start advertising. <a href="class_nim_b_l_e_server.html#a2540ae7b61fc6513f794da2512d66f74">More...</a><br /></td></tr>
<tr class="separator:a2540ae7b61fc6513f794da2512d66f74"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ab713fd5619ddbfc1a88bf43a1686f454"><td class="memItemLeft" align="right" valign="top"><a id="ab713fd5619ddbfc1a88bf43a1686f454"></a>
void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_nim_b_l_e_server.html#ab713fd5619ddbfc1a88bf43a1686f454">stopAdvertising</a> ()</td></tr>
<tr class="memdesc:ab713fd5619ddbfc1a88bf43a1686f454"><td class="mdescLeft">&#160;</td><td class="mdescRight">Stop advertising. <br /></td></tr>
<tr class="separator:ab713fd5619ddbfc1a88bf43a1686f454"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ae94ad52f3c97f62553af9765acdb7bcb"><td class="memItemLeft" align="right" valign="top"><a id="ae94ad52f3c97f62553af9765acdb7bcb"></a>
void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_nim_b_l_e_server.html#ae94ad52f3c97f62553af9765acdb7bcb">start</a> ()</td></tr>
<tr class="memdesc:ae94ad52f3c97f62553af9765acdb7bcb"><td class="mdescLeft">&#160;</td><td class="mdescRight">Start the GATT server. Required to be called after setup of all services and characteristics / descriptors for the NimBLE host to register them. <br /></td></tr>
<tr class="separator:ae94ad52f3c97f62553af9765acdb7bcb"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a87ebb3d230e98a6b3cf85bc403d227e0"><td class="memItemLeft" align="right" valign="top"><a class="el" href="class_nim_b_l_e_service.html">NimBLEService</a> *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_nim_b_l_e_server.html#a87ebb3d230e98a6b3cf85bc403d227e0">getServiceByUUID</a> (const char *uuid, uint16_t instanceId=0)</td></tr>
<tr class="memdesc:a87ebb3d230e98a6b3cf85bc403d227e0"><td class="mdescLeft">&#160;</td><td class="mdescRight">Get a BLE Service by its UUID. <a href="class_nim_b_l_e_server.html#a87ebb3d230e98a6b3cf85bc403d227e0">More...</a><br /></td></tr>
<tr class="separator:a87ebb3d230e98a6b3cf85bc403d227e0"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ac28df6ead4d7151df3e84f4fa991eb1f"><td class="memItemLeft" align="right" valign="top"><a class="el" href="class_nim_b_l_e_service.html">NimBLEService</a> *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_nim_b_l_e_server.html#ac28df6ead4d7151df3e84f4fa991eb1f">getServiceByUUID</a> (const <a class="el" href="class_nim_b_l_e_u_u_i_d.html">NimBLEUUID</a> &amp;uuid, uint16_t instanceId=0)</td></tr>
<tr class="memdesc:ac28df6ead4d7151df3e84f4fa991eb1f"><td class="mdescLeft">&#160;</td><td class="mdescRight">Get a BLE Service by its UUID. <a href="class_nim_b_l_e_server.html#ac28df6ead4d7151df3e84f4fa991eb1f">More...</a><br /></td></tr>
<tr class="separator:ac28df6ead4d7151df3e84f4fa991eb1f"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a1ff39fc5235d1374d99b4f3d3acb5ddb"><td class="memItemLeft" align="right" valign="top"><a class="el" href="class_nim_b_l_e_service.html">NimBLEService</a> *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_nim_b_l_e_server.html#a1ff39fc5235d1374d99b4f3d3acb5ddb">getServiceByHandle</a> (uint16_t handle)</td></tr>
<tr class="memdesc:a1ff39fc5235d1374d99b4f3d3acb5ddb"><td class="mdescLeft">&#160;</td><td class="mdescRight">Get a BLE Service by its handle. <a href="class_nim_b_l_e_server.html#a1ff39fc5235d1374d99b4f3d3acb5ddb">More...</a><br /></td></tr>
<tr class="separator:a1ff39fc5235d1374d99b4f3d3acb5ddb"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a63c9dce5c4bbc1c6bc720b6c51bcf3e1"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_nim_b_l_e_server.html#a63c9dce5c4bbc1c6bc720b6c51bcf3e1">disconnect</a> (uint16_t connID, uint8_t reason=BLE_ERR_REM_USER_CONN_TERM)</td></tr>
<tr class="memdesc:a63c9dce5c4bbc1c6bc720b6c51bcf3e1"><td class="mdescLeft">&#160;</td><td class="mdescRight">Disconnect the specified client with optional reason. <a href="class_nim_b_l_e_server.html#a63c9dce5c4bbc1c6bc720b6c51bcf3e1">More...</a><br /></td></tr>
<tr class="separator:a63c9dce5c4bbc1c6bc720b6c51bcf3e1"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a9b08738766de90d7065263761314030a"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_nim_b_l_e_server.html#a9b08738766de90d7065263761314030a">updateConnParams</a> (uint16_t conn_handle, uint16_t minInterval, uint16_t maxInterval, uint16_t latency, uint16_t timeout)</td></tr>
<tr class="memdesc:a9b08738766de90d7065263761314030a"><td class="mdescLeft">&#160;</td><td class="mdescRight">Request an Update the connection parameters: <a href="class_nim_b_l_e_server.html#a9b08738766de90d7065263761314030a">More...</a><br /></td></tr>
<tr class="separator:a9b08738766de90d7065263761314030a"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a9eb1f32b72ac93736585d6d89f393021"><td class="memItemLeft" align="right" valign="top">uint16_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_nim_b_l_e_server.html#a9eb1f32b72ac93736585d6d89f393021">getPeerMTU</a> (uint16_t conn_id)</td></tr>
<tr class="memdesc:a9eb1f32b72ac93736585d6d89f393021"><td class="mdescLeft">&#160;</td><td class="mdescRight">Get the MTU of the client. <a href="class_nim_b_l_e_server.html#a9eb1f32b72ac93736585d6d89f393021">More...</a><br /></td></tr>
<tr class="separator:a9eb1f32b72ac93736585d6d89f393021"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ab95c428ddc94eb019a26d91e70f5974b"><td class="memItemLeft" align="right" valign="top"><a id="ab95c428ddc94eb019a26d91e70f5974b"></a>
std::vector&lt; uint16_t &gt;&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_nim_b_l_e_server.html#ab95c428ddc94eb019a26d91e70f5974b">getPeerDevices</a> ()</td></tr>
<tr class="memdesc:ab95c428ddc94eb019a26d91e70f5974b"><td class="mdescLeft">&#160;</td><td class="mdescRight">Get the vector of the connected client ID's. <br /></td></tr>
<tr class="separator:ab95c428ddc94eb019a26d91e70f5974b"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a347c74f4ad6e2bcc2e301da11ae13e91"><td class="memItemLeft" align="right" valign="top"><a class="el" href="class_nim_b_l_e_conn_info.html">NimBLEConnInfo</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_nim_b_l_e_server.html#a347c74f4ad6e2bcc2e301da11ae13e91">getPeerInfo</a> (size_t index)</td></tr>
<tr class="memdesc:a347c74f4ad6e2bcc2e301da11ae13e91"><td class="mdescLeft">&#160;</td><td class="mdescRight">Get the connection information of a connected peer by vector index. <a href="class_nim_b_l_e_server.html#a347c74f4ad6e2bcc2e301da11ae13e91">More...</a><br /></td></tr>
<tr class="separator:a347c74f4ad6e2bcc2e301da11ae13e91"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ad91fbcb2717aa1969329f365692e1072"><td class="memItemLeft" align="right" valign="top"><a class="el" href="class_nim_b_l_e_conn_info.html">NimBLEConnInfo</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_nim_b_l_e_server.html#ad91fbcb2717aa1969329f365692e1072">getPeerInfo</a> (const <a class="el" href="class_nim_b_l_e_address.html">NimBLEAddress</a> &amp;address)</td></tr>
<tr class="memdesc:ad91fbcb2717aa1969329f365692e1072"><td class="mdescLeft">&#160;</td><td class="mdescRight">Get the connection information of a connected peer by address. <a href="class_nim_b_l_e_server.html#ad91fbcb2717aa1969329f365692e1072">More...</a><br /></td></tr>
<tr class="separator:ad91fbcb2717aa1969329f365692e1072"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ad241eb42e9775fb2f8aaa87c9fb9a76b"><td class="memItemLeft" align="right" valign="top"><a class="el" href="class_nim_b_l_e_conn_info.html">NimBLEConnInfo</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_nim_b_l_e_server.html#ad241eb42e9775fb2f8aaa87c9fb9a76b">getPeerIDInfo</a> (uint16_t id)</td></tr>
<tr class="memdesc:ad241eb42e9775fb2f8aaa87c9fb9a76b"><td class="mdescLeft">&#160;</td><td class="mdescRight">Get the connection information of a connected peer by connection ID. <a href="class_nim_b_l_e_server.html#ad241eb42e9775fb2f8aaa87c9fb9a76b">More...</a><br /></td></tr>
<tr class="separator:ad241eb42e9775fb2f8aaa87c9fb9a76b"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a6bfd923ecd0ea06d5564343ab7209122"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_nim_b_l_e_server.html#a6bfd923ecd0ea06d5564343ab7209122">advertiseOnDisconnect</a> (bool)</td></tr>
<tr class="memdesc:a6bfd923ecd0ea06d5564343ab7209122"><td class="mdescLeft">&#160;</td><td class="mdescRight">Set the server to automatically start advertising when a client disconnects. <a href="class_nim_b_l_e_server.html#a6bfd923ecd0ea06d5564343ab7209122">More...</a><br /></td></tr>
<tr class="separator:a6bfd923ecd0ea06d5564343ab7209122"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><p>The model of a BLE server. </p>
</div><h2 class="groupheader">Member Function Documentation</h2>
<a id="a6eda4c9e0ac1dd031c678d4bf7da1d56"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a6eda4c9e0ac1dd031c678d4bf7da1d56">&#9670;&nbsp;</a></span>addService()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void NimBLEServer::addService </td>
<td>(</td>
<td class="paramtype"><a class="el" href="class_nim_b_l_e_service.html">NimBLEService</a> *&#160;</td>
<td class="paramname"><em>service</em></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Adds a service which was either already created but removed from availability,<br />
or created and later added to services list. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramdir">[in]</td><td class="paramname">service</td><td>The service object to add. </td></tr>
</table>
</dd>
</dl>
<dl class="section note"><dt>Note</dt><dd>If it is desired to advertise the service it must be added by calling <a class="el" href="class_nim_b_l_e_advertising.html#a4f334752ea04223185292fe9ab524b69" title="Add a service uuid to exposed list of services.">NimBLEAdvertising::addServiceUUID</a>. </dd></dl>
</div>
</div>
<a id="a6bfd923ecd0ea06d5564343ab7209122"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a6bfd923ecd0ea06d5564343ab7209122">&#9670;&nbsp;</a></span>advertiseOnDisconnect()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void NimBLEServer::advertiseOnDisconnect </td>
<td>(</td>
<td class="paramtype">bool&#160;</td>
<td class="paramname"><em>aod</em></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Set the server to automatically start advertising when a client disconnects. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramdir">[in]</td><td class="paramname">aod</td><td>true == advertise, false == don't advertise. </td></tr>
</table>
</dd>
</dl>
</div>
</div>
<a id="aaeb58b4de85754d1aac6964e9248aa35"></a>
<h2 class="memtitle"><span class="permalink"><a href="#aaeb58b4de85754d1aac6964e9248aa35">&#9670;&nbsp;</a></span>createService() <span class="overload">[1/2]</span></h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="class_nim_b_l_e_service.html">NimBLEService</a> * NimBLEServer::createService </td>
<td>(</td>
<td class="paramtype">const char *&#160;</td>
<td class="paramname"><em>uuid</em></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Create a BLE Service. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramdir">[in]</td><td class="paramname">uuid</td><td>The UUID of the new service. </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>A reference to the new service object. </dd></dl>
</div>
</div>
<a id="addc0753b57de87e172cc2d5f158bd6c6"></a>
<h2 class="memtitle"><span class="permalink"><a href="#addc0753b57de87e172cc2d5f158bd6c6">&#9670;&nbsp;</a></span>createService() <span class="overload">[2/2]</span></h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="class_nim_b_l_e_service.html">NimBLEService</a> * NimBLEServer::createService </td>
<td>(</td>
<td class="paramtype">const <a class="el" href="class_nim_b_l_e_u_u_i_d.html">NimBLEUUID</a> &amp;&#160;</td>
<td class="paramname"><em>uuid</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint32_t&#160;</td>
<td class="paramname"><em>numHandles</em> = <code>15</code>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint8_t&#160;</td>
<td class="paramname"><em>inst_id</em> = <code>0</code>&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Create a BLE Service. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramdir">[in]</td><td class="paramname">uuid</td><td>The UUID of the new service. </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">numHandles</td><td>The maximum number of handles associated with this service. </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">inst_id</td><td>if we have multiple services with the same UUID we need to provide inst_id value different for each service. </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>A reference to the new service object. </dd></dl>
</div>
</div>
<a id="a63c9dce5c4bbc1c6bc720b6c51bcf3e1"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a63c9dce5c4bbc1c6bc720b6c51bcf3e1">&#9670;&nbsp;</a></span>disconnect()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int NimBLEServer::disconnect </td>
<td>(</td>
<td class="paramtype">uint16_t&#160;</td>
<td class="paramname"><em>connId</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint8_t&#160;</td>
<td class="paramname"><em>reason</em> = <code>BLE_ERR_REM_USER_CONN_TERM</code>&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Disconnect the specified client with optional reason. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramdir">[in]</td><td class="paramname">connId</td><td>Connection Id of the client to disconnect. </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">reason</td><td>code for disconnecting. </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>NimBLE host return code. </dd></dl>
</div>
</div>
<a id="ab41d8bb9b334734f95a726f1e15200fc"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ab41d8bb9b334734f95a726f1e15200fc">&#9670;&nbsp;</a></span>getAdvertising()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="class_nim_b_l_e_advertising.html">NimBLEAdvertising</a> * NimBLEServer::getAdvertising </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Retrieve the advertising object that can be used to advertise the existence of the server. </p>
<dl class="section return"><dt>Returns</dt><dd>An advertising object. </dd></dl>
</div>
</div>
<a id="a98ea12f57c10c0477b0c1c5efab23ee5"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a98ea12f57c10c0477b0c1c5efab23ee5">&#9670;&nbsp;</a></span>getConnectedCount()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">size_t NimBLEServer::getConnectedCount </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Return the number of connected clients. </p>
<dl class="section return"><dt>Returns</dt><dd>The number of connected clients. </dd></dl>
</div>
</div>
<a id="ad241eb42e9775fb2f8aaa87c9fb9a76b"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ad241eb42e9775fb2f8aaa87c9fb9a76b">&#9670;&nbsp;</a></span>getPeerIDInfo()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="class_nim_b_l_e_conn_info.html">NimBLEConnInfo</a> NimBLEServer::getPeerIDInfo </td>
<td>(</td>
<td class="paramtype">uint16_t&#160;</td>
<td class="paramname"><em>id</em></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Get the connection information of a connected peer by connection ID. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramdir">[in]</td><td class="paramname">id</td><td>The connection id of the peer. </td></tr>
</table>
</dd>
</dl>
</div>
</div>
<a id="ad91fbcb2717aa1969329f365692e1072"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ad91fbcb2717aa1969329f365692e1072">&#9670;&nbsp;</a></span>getPeerInfo() <span class="overload">[1/2]</span></h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="class_nim_b_l_e_conn_info.html">NimBLEConnInfo</a> NimBLEServer::getPeerInfo </td>
<td>(</td>
<td class="paramtype">const <a class="el" href="class_nim_b_l_e_address.html">NimBLEAddress</a> &amp;&#160;</td>
<td class="paramname"><em>address</em></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Get the connection information of a connected peer by address. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramdir">[in]</td><td class="paramname">address</td><td>The address of the peer. </td></tr>
</table>
</dd>
</dl>
</div>
</div>
<a id="a347c74f4ad6e2bcc2e301da11ae13e91"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a347c74f4ad6e2bcc2e301da11ae13e91">&#9670;&nbsp;</a></span>getPeerInfo() <span class="overload">[2/2]</span></h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="class_nim_b_l_e_conn_info.html">NimBLEConnInfo</a> NimBLEServer::getPeerInfo </td>
<td>(</td>
<td class="paramtype">size_t&#160;</td>
<td class="paramname"><em>index</em></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Get the connection information of a connected peer by vector index. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramdir">[in]</td><td class="paramname">index</td><td>The vector index of the peer. </td></tr>
</table>
</dd>
</dl>
</div>
</div>
<a id="a9eb1f32b72ac93736585d6d89f393021"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a9eb1f32b72ac93736585d6d89f393021">&#9670;&nbsp;</a></span>getPeerMTU()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">uint16_t NimBLEServer::getPeerMTU </td>
<td>(</td>
<td class="paramtype">uint16_t&#160;</td>
<td class="paramname"><em>conn_id</em></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Get the MTU of the client. </p>
<dl class="section return"><dt>Returns</dt><dd>The client MTU or 0 if not found/connected. </dd></dl>
</div>
</div>
<a id="a1ff39fc5235d1374d99b4f3d3acb5ddb"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a1ff39fc5235d1374d99b4f3d3acb5ddb">&#9670;&nbsp;</a></span>getServiceByHandle()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="class_nim_b_l_e_service.html">NimBLEService</a> * NimBLEServer::getServiceByHandle </td>
<td>(</td>
<td class="paramtype">uint16_t&#160;</td>
<td class="paramname"><em>handle</em></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Get a BLE Service by its handle. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">handle</td><td>The handle of the service. </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>A pointer to the service object or nullptr if not found. </dd></dl>
</div>
</div>
<a id="a87ebb3d230e98a6b3cf85bc403d227e0"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a87ebb3d230e98a6b3cf85bc403d227e0">&#9670;&nbsp;</a></span>getServiceByUUID() <span class="overload">[1/2]</span></h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="class_nim_b_l_e_service.html">NimBLEService</a> * NimBLEServer::getServiceByUUID </td>
<td>(</td>
<td class="paramtype">const char *&#160;</td>
<td class="paramname"><em>uuid</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint16_t&#160;</td>
<td class="paramname"><em>instanceId</em> = <code>0</code>&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Get a BLE Service by its UUID. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramdir">[in]</td><td class="paramname">uuid</td><td>The UUID of the service. </td></tr>
<tr><td class="paramdir"></td><td class="paramname">instanceId</td><td>The index of the service to return (used when multiple services have the same UUID). </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>A pointer to the service object or nullptr if not found. </dd></dl>
</div>
</div>
<a id="ac28df6ead4d7151df3e84f4fa991eb1f"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ac28df6ead4d7151df3e84f4fa991eb1f">&#9670;&nbsp;</a></span>getServiceByUUID() <span class="overload">[2/2]</span></h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="class_nim_b_l_e_service.html">NimBLEService</a> * NimBLEServer::getServiceByUUID </td>
<td>(</td>
<td class="paramtype">const <a class="el" href="class_nim_b_l_e_u_u_i_d.html">NimBLEUUID</a> &amp;&#160;</td>
<td class="paramname"><em>uuid</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint16_t&#160;</td>
<td class="paramname"><em>instanceId</em> = <code>0</code>&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Get a BLE Service by its UUID. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramdir">[in]</td><td class="paramname">uuid</td><td>The UUID of the service. </td></tr>
<tr><td class="paramdir"></td><td class="paramname">instanceId</td><td>The index of the service to return (used when multiple services have the same UUID). </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>A pointer to the service object or nullptr if not found. </dd></dl>
</div>
</div>
<a id="a00c92f62f41ec1c499dfaf042b487d75"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a00c92f62f41ec1c499dfaf042b487d75">&#9670;&nbsp;</a></span>removeService()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void NimBLEServer::removeService </td>
<td>(</td>
<td class="paramtype"><a class="el" href="class_nim_b_l_e_service.html">NimBLEService</a> *&#160;</td>
<td class="paramname"><em>service</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">bool&#160;</td>
<td class="paramname"><em>deleteSvc</em> = <code>false</code>&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Remove a service from the server. </p>
<p>Immediately removes access to the service by clients, sends a service changed indication, and removes the service (if applicable) from the advertisments. The service is not deleted unless the deleteSvc parameter is true, otherwise the service remains available and can be re-added in the future. If desired a removed but not deleted service can be deleted later by calling this method with deleteSvc set to true.</p>
<dl class="section note"><dt>Note</dt><dd>The service will not be removed from the database until all open connections are closed as it requires resetting the GATT server. In the interim the service will have it's visibility disabled.</dd>
<dd>
Advertising will need to be restarted by the user after calling this as we must stop advertising in order to remove the service.</dd></dl>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramdir">[in]</td><td class="paramname">service</td><td>The service object to remove. </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">deleteSvc</td><td>true if the service should be deleted. </td></tr>
</table>
</dd>
</dl>
</div>
</div>
<a id="a485c90ce36275f9e4ec26a7f3d348cd9"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a485c90ce36275f9e4ec26a7f3d348cd9">&#9670;&nbsp;</a></span>setCallbacks()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void NimBLEServer::setCallbacks </td>
<td>(</td>
<td class="paramtype"><a class="el" href="class_nim_b_l_e_server_callbacks.html">NimBLEServerCallbacks</a> *&#160;</td>
<td class="paramname"><em>pCallbacks</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">bool&#160;</td>
<td class="paramname"><em>deleteCallbacks</em> = <code>true</code>&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Set the server callbacks. </p>
<p>As a BLE server operates, it will generate server level events such as a new client connecting or a previous client disconnecting. This function can be called to register a callback handler that will be invoked when these events are detected.</p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramdir">[in]</td><td class="paramname">pCallbacks</td><td>The callbacks to be invoked. </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">deleteCallbacks</td><td>if true callback class will be deleted when server is destructed. </td></tr>
</table>
</dd>
</dl>
</div>
</div>
<a id="a2540ae7b61fc6513f794da2512d66f74"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a2540ae7b61fc6513f794da2512d66f74">&#9670;&nbsp;</a></span>startAdvertising()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void NimBLEServer::startAdvertising </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Start advertising. </p>
<p>Start the server advertising its existence. This is a convenience function and is equivalent to retrieving the advertising object and invoking start upon it. </p>
</div>
</div>
<a id="a9b08738766de90d7065263761314030a"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a9b08738766de90d7065263761314030a">&#9670;&nbsp;</a></span>updateConnParams()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void NimBLEServer::updateConnParams </td>
<td>(</td>
<td class="paramtype">uint16_t&#160;</td>
<td class="paramname"><em>conn_handle</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint16_t&#160;</td>
<td class="paramname"><em>minInterval</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint16_t&#160;</td>
<td class="paramname"><em>maxInterval</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint16_t&#160;</td>
<td class="paramname"><em>latency</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint16_t&#160;</td>
<td class="paramname"><em>timeout</em>&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Request an Update the connection parameters: </p>
<ul>
<li>Can only be used after a connection has been established. <dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramdir">[in]</td><td class="paramname">conn_handle</td><td>The connection handle of the peer to send the request to. </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">minInterval</td><td>The minimum connection interval in 1.25ms units. </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">maxInterval</td><td>The maximum connection interval in 1.25ms units. </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">latency</td><td>The number of packets allowed to skip (extends max interval). </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">timeout</td><td>The timeout time in 10ms units before disconnecting. </td></tr>
</table>
</dd>
</dl>
</li>
</ul>
</div>
</div>
</div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
<ul>
<li class="navelem"><a class="el" href="class_nim_b_l_e_server.html">NimBLEServer</a></li>
<li class="footer">Generated by <a href="https://www.doxygen.org/index.html"><img class="footer" src="doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.9.0 </li>
</ul>
</div>
</body>
</html>