esp-nimble-cpp/_nim_b_l_e_conn_info_8h_source.html
2022-10-30 17:19:11 +00:00

155 lines
19 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.1"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>esp-nimble-cpp: /github/workspace/src/NimBLEConnInfo.h Source File</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
&#160;<span id="projectnumber">1.4.1</span>
</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.9.1 -->
<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('_nim_b_l_e_conn_info_8h_source.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="headertitle">
<div class="title">NimBLEConnInfo.h</div> </div>
</div><!--header-->
<div class="contents">
<div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno"> 1</span>&#160;<span class="preprocessor">#ifndef NIMBLECONNINFO_H_</span></div>
<div class="line"><a name="l00002"></a><span class="lineno"> 2</span>&#160;<span class="preprocessor">#define NIMBLECONNINFO_H_</span></div>
<div class="line"><a name="l00003"></a><span class="lineno"> 3</span>&#160; </div>
<div class="line"><a name="l00004"></a><span class="lineno"> 4</span>&#160;<span class="preprocessor">#include &quot;NimBLEAddress.h&quot;</span></div>
<div class="line"><a name="l00005"></a><span class="lineno"> 5</span>&#160; </div>
<div class="line"><a name="l00009"></a><span class="lineno"><a class="line" href="class_nim_b_l_e_conn_info.html"> 9</a></span>&#160;<span class="keyword">class </span><a class="code" href="class_nim_b_l_e_conn_info.html">NimBLEConnInfo</a> {</div>
<div class="line"><a name="l00010"></a><span class="lineno"> 10</span>&#160;<span class="keyword">friend</span> <span class="keyword">class </span><a class="code" href="class_nim_b_l_e_server.html">NimBLEServer</a>;</div>
<div class="line"><a name="l00011"></a><span class="lineno"> 11</span>&#160;<span class="keyword">friend</span> <span class="keyword">class </span><a class="code" href="class_nim_b_l_e_client.html">NimBLEClient</a>;</div>
<div class="line"><a name="l00012"></a><span class="lineno"> 12</span>&#160; ble_gap_conn_desc m_desc;</div>
<div class="line"><a name="l00013"></a><span class="lineno"> 13</span>&#160; <a class="code" href="class_nim_b_l_e_conn_info.html">NimBLEConnInfo</a>() { m_desc = {}; }</div>
<div class="line"><a name="l00014"></a><span class="lineno"> 14</span>&#160; <a class="code" href="class_nim_b_l_e_conn_info.html">NimBLEConnInfo</a>(ble_gap_conn_desc desc) { m_desc = desc; }</div>
<div class="line"><a name="l00015"></a><span class="lineno"> 15</span>&#160;<span class="keyword">public</span>:</div>
<div class="line"><a name="l00017"></a><span class="lineno"><a class="line" href="class_nim_b_l_e_conn_info.html#af17023ca06c3d1b9e142dcd5f8c54847"> 17</a></span>&#160; <a class="code" href="class_nim_b_l_e_address.html">NimBLEAddress</a> <a class="code" href="class_nim_b_l_e_conn_info.html#af17023ca06c3d1b9e142dcd5f8c54847">getAddress</a>() { <span class="keywordflow">return</span> <a class="code" href="class_nim_b_l_e_address.html">NimBLEAddress</a>(m_desc.peer_ota_addr); }</div>
<div class="line"><a name="l00018"></a><span class="lineno"> 18</span>&#160; </div>
<div class="line"><a name="l00020"></a><span class="lineno"><a class="line" href="class_nim_b_l_e_conn_info.html#a7bc23f09eb7dd53be902cb67d2ba745a"> 20</a></span>&#160; <a class="code" href="class_nim_b_l_e_address.html">NimBLEAddress</a> <a class="code" href="class_nim_b_l_e_conn_info.html#a7bc23f09eb7dd53be902cb67d2ba745a">getIdAddress</a>() { <span class="keywordflow">return</span> <a class="code" href="class_nim_b_l_e_address.html">NimBLEAddress</a>(m_desc.peer_id_addr); }</div>
<div class="line"><a name="l00021"></a><span class="lineno"> 21</span>&#160; </div>
<div class="line"><a name="l00023"></a><span class="lineno"><a class="line" href="class_nim_b_l_e_conn_info.html#a77e212f3e236b05da0978ea482e3efb4"> 23</a></span>&#160; uint16_t <a class="code" href="class_nim_b_l_e_conn_info.html#a77e212f3e236b05da0978ea482e3efb4">getConnHandle</a>() { <span class="keywordflow">return</span> m_desc.conn_handle; }</div>
<div class="line"><a name="l00024"></a><span class="lineno"> 24</span>&#160; </div>
<div class="line"><a name="l00026"></a><span class="lineno"><a class="line" href="class_nim_b_l_e_conn_info.html#aa43374d84b7564f6d187fd0c637b1049"> 26</a></span>&#160; uint16_t <a class="code" href="class_nim_b_l_e_conn_info.html#aa43374d84b7564f6d187fd0c637b1049">getConnInterval</a>() { <span class="keywordflow">return</span> m_desc.conn_itvl; }</div>
<div class="line"><a name="l00027"></a><span class="lineno"> 27</span>&#160; </div>
<div class="line"><a name="l00029"></a><span class="lineno"><a class="line" href="class_nim_b_l_e_conn_info.html#a8e885d340f1ab4e477c69ed7ea99b082"> 29</a></span>&#160; uint16_t <a class="code" href="class_nim_b_l_e_conn_info.html#a8e885d340f1ab4e477c69ed7ea99b082">getConnTimeout</a>() { <span class="keywordflow">return</span> m_desc.supervision_timeout; }</div>
<div class="line"><a name="l00030"></a><span class="lineno"> 30</span>&#160; </div>
<div class="line"><a name="l00032"></a><span class="lineno"><a class="line" href="class_nim_b_l_e_conn_info.html#a10c6093ca2f92ea61b82815909106430"> 32</a></span>&#160; uint16_t <a class="code" href="class_nim_b_l_e_conn_info.html#a10c6093ca2f92ea61b82815909106430">getConnLatency</a>() { <span class="keywordflow">return</span> m_desc.conn_latency; }</div>
<div class="line"><a name="l00033"></a><span class="lineno"> 33</span>&#160; </div>
<div class="line"><a name="l00035"></a><span class="lineno"><a class="line" href="class_nim_b_l_e_conn_info.html#a94796b6446ef40c0ae0d1f8af1ff9462"> 35</a></span>&#160; uint16_t <a class="code" href="class_nim_b_l_e_conn_info.html#a94796b6446ef40c0ae0d1f8af1ff9462">getMTU</a>() { <span class="keywordflow">return</span> ble_att_mtu(m_desc.conn_handle); }</div>
<div class="line"><a name="l00036"></a><span class="lineno"> 36</span>&#160; </div>
<div class="line"><a name="l00038"></a><span class="lineno"><a class="line" href="class_nim_b_l_e_conn_info.html#a63ff245a8848bf1cc5839adee7aa41c4"> 38</a></span>&#160; <span class="keywordtype">bool</span> <a class="code" href="class_nim_b_l_e_conn_info.html#a63ff245a8848bf1cc5839adee7aa41c4">isMaster</a>() { <span class="keywordflow">return</span> (m_desc.role == BLE_GAP_ROLE_MASTER); }</div>
<div class="line"><a name="l00039"></a><span class="lineno"> 39</span>&#160; </div>
<div class="line"><a name="l00041"></a><span class="lineno"><a class="line" href="class_nim_b_l_e_conn_info.html#abfb91b833cb200f795bc63d5affff6af"> 41</a></span>&#160; <span class="keywordtype">bool</span> <a class="code" href="class_nim_b_l_e_conn_info.html#abfb91b833cb200f795bc63d5affff6af">isSlave</a>() { <span class="keywordflow">return</span> (m_desc.role == BLE_GAP_ROLE_SLAVE); }</div>
<div class="line"><a name="l00042"></a><span class="lineno"> 42</span>&#160; </div>
<div class="line"><a name="l00044"></a><span class="lineno"><a class="line" href="class_nim_b_l_e_conn_info.html#af281a25921d36dc75cf1e37561940125"> 44</a></span>&#160; <span class="keywordtype">bool</span> <a class="code" href="class_nim_b_l_e_conn_info.html#af281a25921d36dc75cf1e37561940125">isBonded</a>() { <span class="keywordflow">return</span> (m_desc.sec_state.bonded == 1); }</div>
<div class="line"><a name="l00045"></a><span class="lineno"> 45</span>&#160; </div>
<div class="line"><a name="l00047"></a><span class="lineno"><a class="line" href="class_nim_b_l_e_conn_info.html#a8ecf3c58da6ffb529215ce6f13c96744"> 47</a></span>&#160; <span class="keywordtype">bool</span> <a class="code" href="class_nim_b_l_e_conn_info.html#a8ecf3c58da6ffb529215ce6f13c96744">isEncrypted</a>() { <span class="keywordflow">return</span> (m_desc.sec_state.encrypted == 1); }</div>
<div class="line"><a name="l00048"></a><span class="lineno"> 48</span>&#160; </div>
<div class="line"><a name="l00050"></a><span class="lineno"><a class="line" href="class_nim_b_l_e_conn_info.html#a7229e53d21c9c6b5b9fb5bd232862c89"> 50</a></span>&#160; <span class="keywordtype">bool</span> <a class="code" href="class_nim_b_l_e_conn_info.html#a7229e53d21c9c6b5b9fb5bd232862c89">isAuthenticated</a>() { <span class="keywordflow">return</span> (m_desc.sec_state.authenticated == 1); }</div>
<div class="line"><a name="l00051"></a><span class="lineno"> 51</span>&#160; </div>
<div class="line"><a name="l00053"></a><span class="lineno"><a class="line" href="class_nim_b_l_e_conn_info.html#a278a8456f9d7df9cea7d776e61b36782"> 53</a></span>&#160; uint8_t <a class="code" href="class_nim_b_l_e_conn_info.html#a278a8456f9d7df9cea7d776e61b36782">getSecKeySize</a>() { <span class="keywordflow">return</span> m_desc.sec_state.key_size; }</div>
<div class="line"><a name="l00054"></a><span class="lineno"> 54</span>&#160;};</div>
<div class="line"><a name="l00055"></a><span class="lineno"> 55</span>&#160;<span class="preprocessor">#endif</span></div>
<div class="ttc" id="aclass_nim_b_l_e_address_html"><div class="ttname"><a href="class_nim_b_l_e_address.html">NimBLEAddress</a></div><div class="ttdoc">A BLE device address.</div><div class="ttdef"><b>Definition:</b> NimBLEAddress.h:39</div></div>
<div class="ttc" id="aclass_nim_b_l_e_client_html"><div class="ttname"><a href="class_nim_b_l_e_client.html">NimBLEClient</a></div><div class="ttdoc">A model of a BLE client.</div><div class="ttdef"><b>Definition:</b> NimBLEClient.h:39</div></div>
<div class="ttc" id="aclass_nim_b_l_e_conn_info_html"><div class="ttname"><a href="class_nim_b_l_e_conn_info.html">NimBLEConnInfo</a></div><div class="ttdoc">Connection information.</div><div class="ttdef"><b>Definition:</b> NimBLEConnInfo.h:9</div></div>
<div class="ttc" id="aclass_nim_b_l_e_conn_info_html_a10c6093ca2f92ea61b82815909106430"><div class="ttname"><a href="class_nim_b_l_e_conn_info.html#a10c6093ca2f92ea61b82815909106430">NimBLEConnInfo::getConnLatency</a></div><div class="ttdeci">uint16_t getConnLatency()</div><div class="ttdoc">Gets the allowable latency for this connection (unit = number of intervals)</div><div class="ttdef"><b>Definition:</b> NimBLEConnInfo.h:32</div></div>
<div class="ttc" id="aclass_nim_b_l_e_conn_info_html_a278a8456f9d7df9cea7d776e61b36782"><div class="ttname"><a href="class_nim_b_l_e_conn_info.html#a278a8456f9d7df9cea7d776e61b36782">NimBLEConnInfo::getSecKeySize</a></div><div class="ttdeci">uint8_t getSecKeySize()</div><div class="ttdoc">Gets the key size used to encrypt the connection.</div><div class="ttdef"><b>Definition:</b> NimBLEConnInfo.h:53</div></div>
<div class="ttc" id="aclass_nim_b_l_e_conn_info_html_a63ff245a8848bf1cc5839adee7aa41c4"><div class="ttname"><a href="class_nim_b_l_e_conn_info.html#a63ff245a8848bf1cc5839adee7aa41c4">NimBLEConnInfo::isMaster</a></div><div class="ttdeci">bool isMaster()</div><div class="ttdoc">Check if we are in the master role in this connection.</div><div class="ttdef"><b>Definition:</b> NimBLEConnInfo.h:38</div></div>
<div class="ttc" id="aclass_nim_b_l_e_conn_info_html_a7229e53d21c9c6b5b9fb5bd232862c89"><div class="ttname"><a href="class_nim_b_l_e_conn_info.html#a7229e53d21c9c6b5b9fb5bd232862c89">NimBLEConnInfo::isAuthenticated</a></div><div class="ttdeci">bool isAuthenticated()</div><div class="ttdoc">Check if the the connection has been authenticated.</div><div class="ttdef"><b>Definition:</b> NimBLEConnInfo.h:50</div></div>
<div class="ttc" id="aclass_nim_b_l_e_conn_info_html_a77e212f3e236b05da0978ea482e3efb4"><div class="ttname"><a href="class_nim_b_l_e_conn_info.html#a77e212f3e236b05da0978ea482e3efb4">NimBLEConnInfo::getConnHandle</a></div><div class="ttdeci">uint16_t getConnHandle()</div><div class="ttdoc">Gets the connection handle of the connected peer.</div><div class="ttdef"><b>Definition:</b> NimBLEConnInfo.h:23</div></div>
<div class="ttc" id="aclass_nim_b_l_e_conn_info_html_a7bc23f09eb7dd53be902cb67d2ba745a"><div class="ttname"><a href="class_nim_b_l_e_conn_info.html#a7bc23f09eb7dd53be902cb67d2ba745a">NimBLEConnInfo::getIdAddress</a></div><div class="ttdeci">NimBLEAddress getIdAddress()</div><div class="ttdoc">Gets the ID address of the connected peer.</div><div class="ttdef"><b>Definition:</b> NimBLEConnInfo.h:20</div></div>
<div class="ttc" id="aclass_nim_b_l_e_conn_info_html_a8e885d340f1ab4e477c69ed7ea99b082"><div class="ttname"><a href="class_nim_b_l_e_conn_info.html#a8e885d340f1ab4e477c69ed7ea99b082">NimBLEConnInfo::getConnTimeout</a></div><div class="ttdeci">uint16_t getConnTimeout()</div><div class="ttdoc">Gets the supervision timeout for this connection (in 10ms units)</div><div class="ttdef"><b>Definition:</b> NimBLEConnInfo.h:29</div></div>
<div class="ttc" id="aclass_nim_b_l_e_conn_info_html_a8ecf3c58da6ffb529215ce6f13c96744"><div class="ttname"><a href="class_nim_b_l_e_conn_info.html#a8ecf3c58da6ffb529215ce6f13c96744">NimBLEConnInfo::isEncrypted</a></div><div class="ttdeci">bool isEncrypted()</div><div class="ttdoc">Check if the connection in encrypted.</div><div class="ttdef"><b>Definition:</b> NimBLEConnInfo.h:47</div></div>
<div class="ttc" id="aclass_nim_b_l_e_conn_info_html_a94796b6446ef40c0ae0d1f8af1ff9462"><div class="ttname"><a href="class_nim_b_l_e_conn_info.html#a94796b6446ef40c0ae0d1f8af1ff9462">NimBLEConnInfo::getMTU</a></div><div class="ttdeci">uint16_t getMTU()</div><div class="ttdoc">Gets the maximum transmission unit size for this connection (in bytes)</div><div class="ttdef"><b>Definition:</b> NimBLEConnInfo.h:35</div></div>
<div class="ttc" id="aclass_nim_b_l_e_conn_info_html_aa43374d84b7564f6d187fd0c637b1049"><div class="ttname"><a href="class_nim_b_l_e_conn_info.html#aa43374d84b7564f6d187fd0c637b1049">NimBLEConnInfo::getConnInterval</a></div><div class="ttdeci">uint16_t getConnInterval()</div><div class="ttdoc">Gets the connection interval for this connection (in 1.25ms units)</div><div class="ttdef"><b>Definition:</b> NimBLEConnInfo.h:26</div></div>
<div class="ttc" id="aclass_nim_b_l_e_conn_info_html_abfb91b833cb200f795bc63d5affff6af"><div class="ttname"><a href="class_nim_b_l_e_conn_info.html#abfb91b833cb200f795bc63d5affff6af">NimBLEConnInfo::isSlave</a></div><div class="ttdeci">bool isSlave()</div><div class="ttdoc">Check if we are in the slave role in this connection.</div><div class="ttdef"><b>Definition:</b> NimBLEConnInfo.h:41</div></div>
<div class="ttc" id="aclass_nim_b_l_e_conn_info_html_af17023ca06c3d1b9e142dcd5f8c54847"><div class="ttname"><a href="class_nim_b_l_e_conn_info.html#af17023ca06c3d1b9e142dcd5f8c54847">NimBLEConnInfo::getAddress</a></div><div class="ttdeci">NimBLEAddress getAddress()</div><div class="ttdoc">Gets the over-the-air address of the connected peer.</div><div class="ttdef"><b>Definition:</b> NimBLEConnInfo.h:17</div></div>
<div class="ttc" id="aclass_nim_b_l_e_conn_info_html_af281a25921d36dc75cf1e37561940125"><div class="ttname"><a href="class_nim_b_l_e_conn_info.html#af281a25921d36dc75cf1e37561940125">NimBLEConnInfo::isBonded</a></div><div class="ttdeci">bool isBonded()</div><div class="ttdoc">Check if we are connected to a bonded peer.</div><div class="ttdef"><b>Definition:</b> NimBLEConnInfo.h:44</div></div>
<div class="ttc" id="aclass_nim_b_l_e_server_html"><div class="ttname"><a href="class_nim_b_l_e_server.html">NimBLEServer</a></div><div class="ttdoc">The model of a BLE server.</div><div class="ttdef"><b>Definition:</b> NimBLEServer.h:46</div></div>
</div><!-- fragment --></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="dir_68267d1309a1af8e8297ef4c3efbcdba.html">src</a></li><li class="navelem"><b>NimBLEConnInfo.h</b></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.1 </li>
</ul>
</div>
</body>
</html>