RadioLibSmol/_lo_ra_w_a_n_8h_source.html
2023-07-15 17:14:12 +00:00

374 lines
60 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>RadioLib: src/protocols/LoRaWAN/LoRaWAN.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">RadioLib
</div>
<div id="projectbrief">Universal wireless communication library for Arduino</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('_lo_ra_w_a_n_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">LoRaWAN.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">#if !defined(_RADIOLIB_LORAWAN_H) &amp;&amp; !defined(RADIOLIB_EXCLUDE_LORAWAN)</span></div>
<div class="line"><a name="l00002"></a><span class="lineno"> 2</span>&#160;<span class="preprocessor">#define _RADIOLIB_LORAWAN_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;../../TypeDef.h&quot;</span></div>
<div class="line"><a name="l00005"></a><span class="lineno"> 5</span>&#160;<span class="preprocessor">#include &quot;../PhysicalLayer/PhysicalLayer.h&quot;</span></div>
<div class="line"><a name="l00006"></a><span class="lineno"> 6</span>&#160;<span class="preprocessor">#include &quot;../../utils/Cryptography.h&quot;</span></div>
<div class="line"><a name="l00007"></a><span class="lineno"> 7</span>&#160; </div>
<div class="line"><a name="l00008"></a><span class="lineno"> 8</span>&#160;<span class="comment">// preamble format</span></div>
<div class="line"><a name="l00009"></a><span class="lineno"> 9</span>&#160;<span class="preprocessor">#define RADIOLIB_LORAWAN_LORA_SYNC_WORD (0x34)</span></div>
<div class="line"><a name="l00010"></a><span class="lineno"> 10</span>&#160;<span class="preprocessor">#define RADIOLIB_LORAWAN_LORA_PREAMBLE_LEN (8)</span></div>
<div class="line"><a name="l00011"></a><span class="lineno"> 11</span>&#160;<span class="preprocessor">#define RADIOLIB_LORAWAN_GFSK_SYNC_WORD (0xC194C1)</span></div>
<div class="line"><a name="l00012"></a><span class="lineno"> 12</span>&#160;<span class="preprocessor">#define RADIOLIB_LORAWAN_GFSK_PREAMBLE_LEN (5)</span></div>
<div class="line"><a name="l00013"></a><span class="lineno"> 13</span>&#160; </div>
<div class="line"><a name="l00014"></a><span class="lineno"> 14</span>&#160;<span class="comment">// MAC header field encoding MSB LSB DESCRIPTION</span></div>
<div class="line"><a name="l00015"></a><span class="lineno"> 15</span>&#160;<span class="preprocessor">#define RADIOLIB_LORAWAN_MHDR_MTYPE_JOIN_REQUEST (0x00 &lt;&lt; 5) </span><span class="comment">// 7 5 message type: join request</span></div>
<div class="line"><a name="l00016"></a><span class="lineno"> 16</span>&#160;<span class="preprocessor">#define RADIOLIB_LORAWAN_MHDR_MTYPE_JOIN_ACCEPT (0x01 &lt;&lt; 5) </span><span class="comment">// 7 5 join accept</span></div>
<div class="line"><a name="l00017"></a><span class="lineno"> 17</span>&#160;<span class="preprocessor">#define RADIOLIB_LORAWAN_MHDR_MTYPE_UNCONF_DATA_UP (0x02 &lt;&lt; 5) </span><span class="comment">// 7 5 unconfirmed data up</span></div>
<div class="line"><a name="l00018"></a><span class="lineno"> 18</span>&#160;<span class="preprocessor">#define RADIOLIB_LORAWAN_MHDR_MTYPE_UNCONF_DATA_DOWN (0x03 &lt;&lt; 5) </span><span class="comment">// 7 5 unconfirmed data down</span></div>
<div class="line"><a name="l00019"></a><span class="lineno"> 19</span>&#160;<span class="preprocessor">#define RADIOLIB_LORAWAN_MHDR_MTYPE_CONF_DATA_UP (0x04 &lt;&lt; 5) </span><span class="comment">// 7 5 confirmed data up</span></div>
<div class="line"><a name="l00020"></a><span class="lineno"> 20</span>&#160;<span class="preprocessor">#define RADIOLIB_LORAWAN_MHDR_MTYPE_CONF_DATA_DOWN (0x05 &lt;&lt; 5) </span><span class="comment">// 7 5 confirmed data down</span></div>
<div class="line"><a name="l00021"></a><span class="lineno"> 21</span>&#160;<span class="preprocessor">#define RADIOLIB_LORAWAN_MHDR_MTYPE_PROPRIETARY (0x07 &lt;&lt; 5) </span><span class="comment">// 7 5 proprietary</span></div>
<div class="line"><a name="l00022"></a><span class="lineno"> 22</span>&#160;<span class="preprocessor">#define RADIOLIB_LORAWAN_MHDR_MTYPE_MASK (0x07 &lt;&lt; 5) </span><span class="comment">// 7 5 bitmask of all possible options</span></div>
<div class="line"><a name="l00023"></a><span class="lineno"> 23</span>&#160;<span class="preprocessor">#define RADIOLIB_LORAWAN_MHDR_MAJOR_R1 (0x00 &lt;&lt; 0) </span><span class="comment">// 1 0 major version: LoRaWAN R1</span></div>
<div class="line"><a name="l00024"></a><span class="lineno"> 24</span>&#160; </div>
<div class="line"><a name="l00025"></a><span class="lineno"> 25</span>&#160;<span class="comment">// frame control field encoding</span></div>
<div class="line"><a name="l00026"></a><span class="lineno"> 26</span>&#160;<span class="preprocessor">#define RADIOLIB_LORAWAN_FCTRL_ADR_ENABLED (0x01 &lt;&lt; 7) </span><span class="comment">// 7 7 adaptive data rate: enabled</span></div>
<div class="line"><a name="l00027"></a><span class="lineno"> 27</span>&#160;<span class="preprocessor">#define RADIOLIB_LORAWAN_FCTRL_ADR_DISABLED (0x00 &lt;&lt; 7) </span><span class="comment">// 7 7 disabled</span></div>
<div class="line"><a name="l00028"></a><span class="lineno"> 28</span>&#160;<span class="preprocessor">#define RADIOLIB_LORAWAN_FCTRL_ADR_ACK_REQ (0x01 &lt;&lt; 6) </span><span class="comment">// 6 6 adaptive data rate ACK request</span></div>
<div class="line"><a name="l00029"></a><span class="lineno"> 29</span>&#160;<span class="preprocessor">#define RADIOLIB_LORAWAN_FCTRL_ACK (0x01 &lt;&lt; 5) </span><span class="comment">// 5 5 confirmed message acknowledge</span></div>
<div class="line"><a name="l00030"></a><span class="lineno"> 30</span>&#160;<span class="preprocessor">#define RADIOLIB_LORAWAN_FCTRL_FRAME_PENDING (0x01 &lt;&lt; 4) </span><span class="comment">// 4 4 downlink frame is pending</span></div>
<div class="line"><a name="l00031"></a><span class="lineno"> 31</span>&#160; </div>
<div class="line"><a name="l00032"></a><span class="lineno"> 32</span>&#160;<span class="comment">// port field</span></div>
<div class="line"><a name="l00033"></a><span class="lineno"> 33</span>&#160;<span class="preprocessor">#define RADIOLIB_LORAWAN_FPORT_MAC_COMMAND (0x00 &lt;&lt; 0) </span><span class="comment">// 7 0 payload contains MAC commands only</span></div>
<div class="line"><a name="l00034"></a><span class="lineno"> 34</span>&#160;<span class="preprocessor">#define RADIOLIB_LORAWAN_FPORT_RESERVED (0xE0 &lt;&lt; 0) </span><span class="comment">// 7 0 reserved port values</span></div>
<div class="line"><a name="l00035"></a><span class="lineno"> 35</span>&#160; </div>
<div class="line"><a name="l00036"></a><span class="lineno"> 36</span>&#160;<span class="comment">// MAC commands - only those sent from end-device to gateway</span></div>
<div class="line"><a name="l00037"></a><span class="lineno"> 37</span>&#160;<span class="preprocessor">#define RADIOLIB_LORAWAN_LINK_CHECK_REQ (0x02 &lt;&lt; 0) </span><span class="comment">// 7 0 MAC command: request to check connectivity to network</span></div>
<div class="line"><a name="l00038"></a><span class="lineno"> 38</span>&#160;<span class="preprocessor">#define RADIOLIB_LORAWAN_LINK_ADR_ANS (0x03 &lt;&lt; 0) </span><span class="comment">// 7 0 answer to ADR change</span></div>
<div class="line"><a name="l00039"></a><span class="lineno"> 39</span>&#160;<span class="preprocessor">#define RADIOLIB_LORAWAN_DUTY_CYCLE_ANS (0x04 &lt;&lt; 0) </span><span class="comment">// 7 0 answer to duty cycle change</span></div>
<div class="line"><a name="l00040"></a><span class="lineno"> 40</span>&#160;<span class="preprocessor">#define RADIOLIB_LORAWAN_RX_PARAM_SETUP_ANS (0x05 &lt;&lt; 0) </span><span class="comment">// 7 0 answer to reception slot setup request</span></div>
<div class="line"><a name="l00041"></a><span class="lineno"> 41</span>&#160;<span class="preprocessor">#define RADIOLIB_LORAWAN_DEV_STATUS_ANS (0x06 &lt;&lt; 0) </span><span class="comment">// 7 0 device status information</span></div>
<div class="line"><a name="l00042"></a><span class="lineno"> 42</span>&#160;<span class="preprocessor">#define RADIOLIB_LORAWAN_NEW_CHANNEL_ANS (0x07 &lt;&lt; 0) </span><span class="comment">// 7 0 acknowledges change of a radio channel</span></div>
<div class="line"><a name="l00043"></a><span class="lineno"> 43</span>&#160;<span class="preprocessor">#define RADIOLIB_LORAWAN_RX_TIMING_SETUP_ANS (0x08 &lt;&lt; 0) </span><span class="comment">// 7 0 acknowledges change of a reception slots timing</span></div>
<div class="line"><a name="l00044"></a><span class="lineno"> 44</span>&#160; </div>
<div class="line"><a name="l00045"></a><span class="lineno"> 45</span>&#160;<span class="preprocessor">#define RADIOLIB_LORAWAN_NOPTS_LEN (8)</span></div>
<div class="line"><a name="l00046"></a><span class="lineno"> 46</span>&#160; </div>
<div class="line"><a name="l00047"></a><span class="lineno"> 47</span>&#160;<span class="comment">// data rat encoding</span></div>
<div class="line"><a name="l00048"></a><span class="lineno"> 48</span>&#160;<span class="preprocessor">#define RADIOLIB_LORAWAN_DATA_RATE_SF_12 (0x06 &lt;&lt; 4) </span><span class="comment">// 7 4 LoRaWAN spreading factor: SF12</span></div>
<div class="line"><a name="l00049"></a><span class="lineno"> 49</span>&#160;<span class="preprocessor">#define RADIOLIB_LORAWAN_DATA_RATE_SF_11 (0x05 &lt;&lt; 4) </span><span class="comment">// 7 4 SF11</span></div>
<div class="line"><a name="l00050"></a><span class="lineno"> 50</span>&#160;<span class="preprocessor">#define RADIOLIB_LORAWAN_DATA_RATE_SF_10 (0x04 &lt;&lt; 4) </span><span class="comment">// 7 4 SF10</span></div>
<div class="line"><a name="l00051"></a><span class="lineno"> 51</span>&#160;<span class="preprocessor">#define RADIOLIB_LORAWAN_DATA_RATE_SF_9 (0x03 &lt;&lt; 4) </span><span class="comment">// 7 4 SF9</span></div>
<div class="line"><a name="l00052"></a><span class="lineno"> 52</span>&#160;<span class="preprocessor">#define RADIOLIB_LORAWAN_DATA_RATE_SF_8 (0x02 &lt;&lt; 4) </span><span class="comment">// 7 4 SF8</span></div>
<div class="line"><a name="l00053"></a><span class="lineno"> 53</span>&#160;<span class="preprocessor">#define RADIOLIB_LORAWAN_DATA_RATE_SF_7 (0x01 &lt;&lt; 4) </span><span class="comment">// 7 4 SF7</span></div>
<div class="line"><a name="l00054"></a><span class="lineno"> 54</span>&#160;<span class="preprocessor">#define RADIOLIB_LORAWAN_DATA_RATE_FSK_50_K (0x00 &lt;&lt; 4) </span><span class="comment">// 7 4 FSK @ 50 kbps</span></div>
<div class="line"><a name="l00055"></a><span class="lineno"> 55</span>&#160;<span class="preprocessor">#define RADIOLIB_LORAWAN_DATA_RATE_BW_500_KHZ (0x00 &lt;&lt; 0) </span><span class="comment">// 3 0 LoRaWAN bandwidth: 500 kHz</span></div>
<div class="line"><a name="l00056"></a><span class="lineno"> 56</span>&#160;<span class="preprocessor">#define RADIOLIB_LORAWAN_DATA_RATE_BW_250_KHZ (0x01 &lt;&lt; 0) </span><span class="comment">// 3 0 250 kHz</span></div>
<div class="line"><a name="l00057"></a><span class="lineno"> 57</span>&#160;<span class="preprocessor">#define RADIOLIB_LORAWAN_DATA_RATE_BW_125_KHZ (0x02 &lt;&lt; 0) </span><span class="comment">// 3 0 125 kHz</span></div>
<div class="line"><a name="l00058"></a><span class="lineno"> 58</span>&#160;<span class="preprocessor">#define RADIOLIB_LORAWAN_DATA_RATE_UNUSED (0xFF &lt;&lt; 0) </span><span class="comment">// 7 0 unused data rate</span></div>
<div class="line"><a name="l00059"></a><span class="lineno"> 59</span>&#160; </div>
<div class="line"><a name="l00060"></a><span class="lineno"> 60</span>&#160;<span class="preprocessor">#define RADIOLIB_LORAWAN_CHANNEL_DIR_UPLINK (0x00 &lt;&lt; 0)</span></div>
<div class="line"><a name="l00061"></a><span class="lineno"> 61</span>&#160;<span class="preprocessor">#define RADIOLIB_LORAWAN_CHANNEL_DIR_DOWNLINK (0x01 &lt;&lt; 0)</span></div>
<div class="line"><a name="l00062"></a><span class="lineno"> 62</span>&#160;<span class="preprocessor">#define RADIOLIB_LORAWAN_CHANNEL_DIR_BOTH (0x02 &lt;&lt; 0)</span></div>
<div class="line"><a name="l00063"></a><span class="lineno"> 63</span>&#160;<span class="preprocessor">#define RADIOLIB_LORAWAN_CHANNEL_DIR_NONE (0x03 &lt;&lt; 0)</span></div>
<div class="line"><a name="l00064"></a><span class="lineno"> 64</span>&#160;<span class="preprocessor">#define RADIOLIB_LORAWAN_CFLIST_TYPE_FREQUENCIES (0)</span></div>
<div class="line"><a name="l00065"></a><span class="lineno"> 65</span>&#160;<span class="preprocessor">#define RADIOLIB_LORAWAN_CFLIST_TYPE_MASK (1)</span></div>
<div class="line"><a name="l00066"></a><span class="lineno"> 66</span>&#160;<span class="preprocessor">#define RADIOLIB_LORAWAN_CHANNEL_NUM_DATARATES (16)</span></div>
<div class="line"><a name="l00067"></a><span class="lineno"> 67</span>&#160; </div>
<div class="line"><a name="l00068"></a><span class="lineno"> 68</span>&#160;<span class="comment">// recommended default settings</span></div>
<div class="line"><a name="l00069"></a><span class="lineno"> 69</span>&#160;<span class="preprocessor">#define RADIOLIB_LORAWAN_RECEIVE_DELAY_1_MS (1000)</span></div>
<div class="line"><a name="l00070"></a><span class="lineno"> 70</span>&#160;<span class="preprocessor">#define RADIOLIB_LORAWAN_RECEIVE_DELAY_2_MS ((RADIOLIB_LORAWAN_RECEIVE_DELAY_1_MS) + 1000)</span></div>
<div class="line"><a name="l00071"></a><span class="lineno"> 71</span>&#160;<span class="preprocessor">#define RADIOLIB_LORAWAN_RX1_DR_OFFSET (0)</span></div>
<div class="line"><a name="l00072"></a><span class="lineno"> 72</span>&#160;<span class="preprocessor">#define RADIOLIB_LORAWAN_JOIN_ACCEPT_DELAY_1_MS (5000)</span></div>
<div class="line"><a name="l00073"></a><span class="lineno"> 73</span>&#160;<span class="preprocessor">#define RADIOLIB_LORAWAN_JOIN_ACCEPT_DELAY_2_MS (6000)</span></div>
<div class="line"><a name="l00074"></a><span class="lineno"> 74</span>&#160;<span class="preprocessor">#define RADIOLIB_LORAWAN_MAX_FCNT_GAP (16384)</span></div>
<div class="line"><a name="l00075"></a><span class="lineno"> 75</span>&#160;<span class="preprocessor">#define RADIOLIB_LORAWAN_ADR_ACK_LIMIT (64)</span></div>
<div class="line"><a name="l00076"></a><span class="lineno"> 76</span>&#160;<span class="preprocessor">#define RADIOLIB_LORAWAN_ADR_ACK_DELAY (32)</span></div>
<div class="line"><a name="l00077"></a><span class="lineno"> 77</span>&#160;<span class="preprocessor">#define RADIOLIB_LORAWAN_RETRANSMIT_TIMEOUT_MIN_MS (1000)</span></div>
<div class="line"><a name="l00078"></a><span class="lineno"> 78</span>&#160;<span class="preprocessor">#define RADIOLIB_LORAWAN_RETRANSMIT_TIMEOUT_MAX_MS (3000)</span></div>
<div class="line"><a name="l00079"></a><span class="lineno"> 79</span>&#160;<span class="preprocessor">#define RADIOLIB_LORAWAN_POWER_STEP_SIZE_DBM (-2)</span></div>
<div class="line"><a name="l00080"></a><span class="lineno"> 80</span>&#160; </div>
<div class="line"><a name="l00081"></a><span class="lineno"> 81</span>&#160;<span class="comment">// join request message layout</span></div>
<div class="line"><a name="l00082"></a><span class="lineno"> 82</span>&#160;<span class="preprocessor">#define RADIOLIB_LORAWAN_JOIN_REQUEST_LEN (23)</span></div>
<div class="line"><a name="l00083"></a><span class="lineno"> 83</span>&#160;<span class="preprocessor">#define RADIOLIB_LORAWAN_JOIN_REQUEST_JOIN_EUI_POS (1)</span></div>
<div class="line"><a name="l00084"></a><span class="lineno"> 84</span>&#160;<span class="preprocessor">#define RADIOLIB_LORAWAN_JOIN_REQUEST_DEV_EUI_POS (9)</span></div>
<div class="line"><a name="l00085"></a><span class="lineno"> 85</span>&#160;<span class="preprocessor">#define RADIOLIB_LORAWAN_JOIN_REQUEST_DEV_NONCE_POS (17)</span></div>
<div class="line"><a name="l00086"></a><span class="lineno"> 86</span>&#160; </div>
<div class="line"><a name="l00087"></a><span class="lineno"> 87</span>&#160;<span class="comment">// join accept message layout</span></div>
<div class="line"><a name="l00088"></a><span class="lineno"> 88</span>&#160;<span class="preprocessor">#define RADIOLIB_LORAWAN_JOIN_ACCEPT_MAX_LEN (33)</span></div>
<div class="line"><a name="l00089"></a><span class="lineno"> 89</span>&#160;<span class="preprocessor">#define RADIOLIB_LORAWAN_JOIN_ACCEPT_JOIN_NONCE_POS (1)</span></div>
<div class="line"><a name="l00090"></a><span class="lineno"> 90</span>&#160;<span class="preprocessor">#define RADIOLIB_LORAWAN_JOIN_ACCEPT_HOME_NET_ID_POS (4)</span></div>
<div class="line"><a name="l00091"></a><span class="lineno"> 91</span>&#160;<span class="preprocessor">#define RADIOLIB_LORAWAN_JOIN_ACCEPT_DEV_ADDR_POS (7)</span></div>
<div class="line"><a name="l00092"></a><span class="lineno"> 92</span>&#160;<span class="preprocessor">#define RADIOLIB_LORAWAN_JOIN_ACCEPT_DL_SETTINGS_POS (11)</span></div>
<div class="line"><a name="l00093"></a><span class="lineno"> 93</span>&#160;<span class="preprocessor">#define RADIOLIB_LORAWAN_JOIN_ACCEPT_RX_DELAY_POS (12)</span></div>
<div class="line"><a name="l00094"></a><span class="lineno"> 94</span>&#160;<span class="preprocessor">#define RADIOLIB_LORAWAN_JOIN_ACCEPT_CFLIST_POS (13)</span></div>
<div class="line"><a name="l00095"></a><span class="lineno"> 95</span>&#160;<span class="preprocessor">#define RADIOLIB_LORAWAN_JOIN_ACCEPT_CFLIST_LEN (16)</span></div>
<div class="line"><a name="l00096"></a><span class="lineno"> 96</span>&#160;<span class="preprocessor">#define RADIOLIB_LORAWAN_JOIN_ACCEPT_CFLIST_TYPE_POS (RADIOLIB_LORAWAN_JOIN_ACCEPT_CFLIST_POS + RADIOLIB_LORAWAN_JOIN_ACCEPT_CFLIST_LEN - 1)</span></div>
<div class="line"><a name="l00097"></a><span class="lineno"> 97</span>&#160; </div>
<div class="line"><a name="l00098"></a><span class="lineno"> 98</span>&#160;<span class="comment">// join accept message variables</span></div>
<div class="line"><a name="l00099"></a><span class="lineno"> 99</span>&#160;<span class="preprocessor">#define RADIOLIB_LORAWAN_JOIN_ACCEPT_R_1_0 (0x00 &lt;&lt; 7) </span><span class="comment">// 7 7 LoRaWAN revision: 1.0</span></div>
<div class="line"><a name="l00100"></a><span class="lineno"> 100</span>&#160;<span class="preprocessor">#define RADIOLIB_LORAWAN_JOIN_ACCEPT_R_1_1 (0x01 &lt;&lt; 7) </span><span class="comment">// 7 7 1.1</span></div>
<div class="line"><a name="l00101"></a><span class="lineno"> 101</span>&#160;<span class="preprocessor">#define RADIOLIB_LORAWAN_JOIN_ACCEPT_F_NWK_S_INT_KEY (0x01)</span></div>
<div class="line"><a name="l00102"></a><span class="lineno"> 102</span>&#160;<span class="preprocessor">#define RADIOLIB_LORAWAN_JOIN_ACCEPT_APP_S_KEY (0x02)</span></div>
<div class="line"><a name="l00103"></a><span class="lineno"> 103</span>&#160;<span class="preprocessor">#define RADIOLIB_LORAWAN_JOIN_ACCEPT_S_NWK_S_INT_KEY (0x03)</span></div>
<div class="line"><a name="l00104"></a><span class="lineno"> 104</span>&#160;<span class="preprocessor">#define RADIOLIB_LORAWAN_JOIN_ACCEPT_NWK_S_ENC_KEY (0x04)</span></div>
<div class="line"><a name="l00105"></a><span class="lineno"> 105</span>&#160; </div>
<div class="line"><a name="l00106"></a><span class="lineno"> 106</span>&#160;<span class="comment">// uplink message layout</span></div>
<div class="line"><a name="l00107"></a><span class="lineno"> 107</span>&#160;<span class="preprocessor">#define RADIOLIB_LORAWAN_UPLINK_LEN(PAYLOAD, FOPTS) (16 + 13 + (PAYLOAD) + (FOPTS))</span></div>
<div class="line"><a name="l00108"></a><span class="lineno"> 108</span>&#160;<span class="preprocessor">#define RADIOLIB_LORAWAN_UPLINK_LEN_START_OFFS (16)</span></div>
<div class="line"><a name="l00109"></a><span class="lineno"> 109</span>&#160;<span class="preprocessor">#define RADIOLIB_LORAWAN_UPLINK_DEV_ADDR_POS (RADIOLIB_LORAWAN_UPLINK_LEN_START_OFFS + 1)</span></div>
<div class="line"><a name="l00110"></a><span class="lineno"> 110</span>&#160;<span class="preprocessor">#define RADIOLIB_LORAWAN_UPLINK_FCTRL_POS (RADIOLIB_LORAWAN_UPLINK_LEN_START_OFFS + 5)</span></div>
<div class="line"><a name="l00111"></a><span class="lineno"> 111</span>&#160;<span class="preprocessor">#define RADIOLIB_LORAWAN_UPLINK_FCNT_POS (RADIOLIB_LORAWAN_UPLINK_LEN_START_OFFS + 6)</span></div>
<div class="line"><a name="l00112"></a><span class="lineno"> 112</span>&#160;<span class="preprocessor">#define RADIOLIB_LORAWAN_UPLINK_FOPTS_POS (RADIOLIB_LORAWAN_UPLINK_LEN_START_OFFS + 8)</span></div>
<div class="line"><a name="l00113"></a><span class="lineno"> 113</span>&#160;<span class="preprocessor">#define RADIOLIB_LORAWAN_UPLINK_FOPTS_MAX_LEN (RADIOLIB_LORAWAN_UPLINK_LEN_START_OFFS + 16)</span></div>
<div class="line"><a name="l00114"></a><span class="lineno"> 114</span>&#160;<span class="preprocessor">#define RADIOLIB_LORAWAN_UPLINK_FPORT_POS(FOPTS) (RADIOLIB_LORAWAN_UPLINK_LEN_START_OFFS + 8 + (FOPTS))</span></div>
<div class="line"><a name="l00115"></a><span class="lineno"> 115</span>&#160;<span class="preprocessor">#define RADIOLIB_LORAWAN_UPLINK_PAYLOAD_POS(FOPTS) (RADIOLIB_LORAWAN_UPLINK_LEN_START_OFFS + 9 + (FOPTS))</span></div>
<div class="line"><a name="l00116"></a><span class="lineno"> 116</span>&#160; </div>
<div class="line"><a name="l00117"></a><span class="lineno"> 117</span>&#160;<span class="comment">// payload encryption/MIC blocks common layout</span></div>
<div class="line"><a name="l00118"></a><span class="lineno"> 118</span>&#160;<span class="preprocessor">#define RADIOLIB_LORAWAN_BLOCK_MAGIC_POS (0)</span></div>
<div class="line"><a name="l00119"></a><span class="lineno"> 119</span>&#160;<span class="preprocessor">#define RADIOLIB_LORAWAN_BLOCK_DIR_POS (5)</span></div>
<div class="line"><a name="l00120"></a><span class="lineno"> 120</span>&#160;<span class="preprocessor">#define RADIOLIB_LORAWAN_BLOCK_DEV_ADDR_POS (6)</span></div>
<div class="line"><a name="l00121"></a><span class="lineno"> 121</span>&#160;<span class="preprocessor">#define RADIOLIB_LORAWAN_BLOCK_FCNT_POS (10)</span></div>
<div class="line"><a name="l00122"></a><span class="lineno"> 122</span>&#160; </div>
<div class="line"><a name="l00123"></a><span class="lineno"> 123</span>&#160;<span class="comment">// payload encryption block layout</span></div>
<div class="line"><a name="l00124"></a><span class="lineno"> 124</span>&#160;<span class="preprocessor">#define RADIOLIB_LORAWAN_ENC_BLOCK_MAGIC (0x01)</span></div>
<div class="line"><a name="l00125"></a><span class="lineno"> 125</span>&#160;<span class="preprocessor">#define RADIOLIB_LORAWAN_ENC_BLOCK_COUNTER_POS (15)</span></div>
<div class="line"><a name="l00126"></a><span class="lineno"> 126</span>&#160; </div>
<div class="line"><a name="l00127"></a><span class="lineno"> 127</span>&#160;<span class="comment">// payload MIC blocks layout</span></div>
<div class="line"><a name="l00128"></a><span class="lineno"> 128</span>&#160;<span class="preprocessor">#define RADIOLIB_LORAWAN_MIC_BLOCK_MAGIC (0x49)</span></div>
<div class="line"><a name="l00129"></a><span class="lineno"> 129</span>&#160;<span class="preprocessor">#define RADIOLIB_LORAWAN_MIC_BLOCK_LEN_POS (15)</span></div>
<div class="line"><a name="l00130"></a><span class="lineno"> 130</span>&#160;<span class="preprocessor">#define RADIOLIB_LORAWAN_MIC_DATA_RATE_POS (3)</span></div>
<div class="line"><a name="l00131"></a><span class="lineno"> 131</span>&#160;<span class="preprocessor">#define RADIOLIB_LORAWAN_MIC_CH_INDEX_POS (4)</span></div>
<div class="line"><a name="l00132"></a><span class="lineno"> 132</span>&#160; </div>
<div class="line"><a name="l00133"></a><span class="lineno"> 133</span>&#160;<span class="preprocessor">#define RADIOLIB_LORAWAN_MAGIC (0x12AD101B)</span></div>
<div class="line"><a name="l00134"></a><span class="lineno"> 134</span>&#160; </div>
<div class="line"><a name="l00140"></a><span class="lineno"><a class="line" href="struct_lo_ra_w_a_n_channel_span__t.html"> 140</a></span>&#160;<span class="keyword">struct </span><a class="code" href="struct_lo_ra_w_a_n_channel_span__t.html">LoRaWANChannelSpan_t</a> {</div>
<div class="line"><a name="l00142"></a><span class="lineno"><a class="line" href="struct_lo_ra_w_a_n_channel_span__t.html#acf5d4a1d5a71e4b8b13b7565cb162abb"> 142</a></span>&#160; uint8_t <a class="code" href="struct_lo_ra_w_a_n_channel_span__t.html#acf5d4a1d5a71e4b8b13b7565cb162abb">direction</a>;</div>
<div class="line"><a name="l00143"></a><span class="lineno"> 143</span>&#160; </div>
<div class="line"><a name="l00145"></a><span class="lineno"><a class="line" href="struct_lo_ra_w_a_n_channel_span__t.html#a09bbd5a4bc1f458769f0d28bdeb4a502"> 145</a></span>&#160; uint8_t <a class="code" href="struct_lo_ra_w_a_n_channel_span__t.html#a09bbd5a4bc1f458769f0d28bdeb4a502">joinRequestDataRate</a>;</div>
<div class="line"><a name="l00146"></a><span class="lineno"> 146</span>&#160; </div>
<div class="line"><a name="l00148"></a><span class="lineno"><a class="line" href="struct_lo_ra_w_a_n_channel_span__t.html#a50f5701ae19b79a0c8c487673135b2f2"> 148</a></span>&#160; uint8_t <a class="code" href="struct_lo_ra_w_a_n_channel_span__t.html#a50f5701ae19b79a0c8c487673135b2f2">numChannels</a>;</div>
<div class="line"><a name="l00149"></a><span class="lineno"> 149</span>&#160; </div>
<div class="line"><a name="l00151"></a><span class="lineno"><a class="line" href="struct_lo_ra_w_a_n_channel_span__t.html#a4ecf8a94d53fb140a07d88d1d0776206"> 151</a></span>&#160; <span class="keywordtype">float</span> <a class="code" href="struct_lo_ra_w_a_n_channel_span__t.html#a4ecf8a94d53fb140a07d88d1d0776206">freqStart</a>;</div>
<div class="line"><a name="l00152"></a><span class="lineno"> 152</span>&#160; </div>
<div class="line"><a name="l00154"></a><span class="lineno"><a class="line" href="struct_lo_ra_w_a_n_channel_span__t.html#aa18000d2e0cde0236e6f984bd782dc02"> 154</a></span>&#160; <span class="keywordtype">float</span> <a class="code" href="struct_lo_ra_w_a_n_channel_span__t.html#aa18000d2e0cde0236e6f984bd782dc02">freqStep</a>;</div>
<div class="line"><a name="l00155"></a><span class="lineno"> 155</span>&#160; </div>
<div class="line"><a name="l00157"></a><span class="lineno"><a class="line" href="struct_lo_ra_w_a_n_channel_span__t.html#a6791d6e9dbde30fa4b394c91aa196138"> 157</a></span>&#160; uint8_t <a class="code" href="struct_lo_ra_w_a_n_channel_span__t.html#a6791d6e9dbde30fa4b394c91aa196138">dataRates</a>[RADIOLIB_LORAWAN_CHANNEL_NUM_DATARATES];</div>
<div class="line"><a name="l00158"></a><span class="lineno"> 158</span>&#160;};</div>
<div class="line"><a name="l00159"></a><span class="lineno"> 159</span>&#160; </div>
<div class="line"><a name="l00160"></a><span class="lineno"> 160</span>&#160;<span class="comment">// alias for unused channel span</span></div>
<div class="line"><a name="l00161"></a><span class="lineno"> 161</span>&#160;<span class="preprocessor">#define RADIOLIB_LORAWAN_CHANNEL_SPAN_NONE { .direction = RADIOLIB_LORAWAN_CHANNEL_DIR_NONE, .joinRequestDataRate = RADIOLIB_LORAWAN_DATA_RATE_UNUSED, .numChannels = 0, .freqStart = 0, .freqStep = 0, .dataRates = { 0 } }</span></div>
<div class="line"><a name="l00162"></a><span class="lineno"> 162</span>&#160; </div>
<div class="line"><a name="l00167"></a><span class="lineno"><a class="line" href="struct_lo_ra_w_a_n_band__t.html"> 167</a></span>&#160;<span class="keyword">struct </span><a class="code" href="struct_lo_ra_w_a_n_band__t.html">LoRaWANBand_t</a> {</div>
<div class="line"><a name="l00169"></a><span class="lineno"><a class="line" href="struct_lo_ra_w_a_n_band__t.html#a43a53c935e0ac482027a22e9c58ed8ed"> 169</a></span>&#160; uint8_t <a class="code" href="struct_lo_ra_w_a_n_band__t.html#a43a53c935e0ac482027a22e9c58ed8ed">downlinkDataRateBase</a>;</div>
<div class="line"><a name="l00170"></a><span class="lineno"> 170</span>&#160; </div>
<div class="line"><a name="l00172"></a><span class="lineno"><a class="line" href="struct_lo_ra_w_a_n_band__t.html#ac885c9beda28b2fcacac002ebfeaf358"> 172</a></span>&#160; uint8_t <a class="code" href="struct_lo_ra_w_a_n_band__t.html#ac885c9beda28b2fcacac002ebfeaf358">downlinkDataRateMin</a>;</div>
<div class="line"><a name="l00173"></a><span class="lineno"> 173</span>&#160; </div>
<div class="line"><a name="l00175"></a><span class="lineno"><a class="line" href="struct_lo_ra_w_a_n_band__t.html#a9b8143ac9bbf3ed45e7cc80fc71ce055"> 175</a></span>&#160; uint8_t <a class="code" href="struct_lo_ra_w_a_n_band__t.html#a9b8143ac9bbf3ed45e7cc80fc71ce055">payloadLenMax</a>[RADIOLIB_LORAWAN_CHANNEL_NUM_DATARATES];</div>
<div class="line"><a name="l00176"></a><span class="lineno"> 176</span>&#160; </div>
<div class="line"><a name="l00178"></a><span class="lineno"><a class="line" href="struct_lo_ra_w_a_n_band__t.html#a43fdafd540c93348f9b4a8958e021a4c"> 178</a></span>&#160; int8_t <a class="code" href="struct_lo_ra_w_a_n_band__t.html#a43fdafd540c93348f9b4a8958e021a4c">powerMax</a>;</div>
<div class="line"><a name="l00179"></a><span class="lineno"> 179</span>&#160; </div>
<div class="line"><a name="l00181"></a><span class="lineno"><a class="line" href="struct_lo_ra_w_a_n_band__t.html#aa22d7d7670846b36d3104439d18e5f15"> 181</a></span>&#160; int8_t <a class="code" href="struct_lo_ra_w_a_n_band__t.html#aa22d7d7670846b36d3104439d18e5f15">powerNumSteps</a>;</div>
<div class="line"><a name="l00182"></a><span class="lineno"> 182</span>&#160; </div>
<div class="line"><a name="l00184"></a><span class="lineno"><a class="line" href="struct_lo_ra_w_a_n_band__t.html#a0eec1eadd79d66bd5db12d92c3642423"> 184</a></span>&#160; uint8_t <a class="code" href="struct_lo_ra_w_a_n_band__t.html#a0eec1eadd79d66bd5db12d92c3642423">cfListType</a>;</div>
<div class="line"><a name="l00185"></a><span class="lineno"> 185</span>&#160; </div>
<div class="line"><a name="l00187"></a><span class="lineno"><a class="line" href="struct_lo_ra_w_a_n_band__t.html#ac469294eedf3ff6f621b9adef382a0c3"> 187</a></span>&#160; uint8_t <a class="code" href="struct_lo_ra_w_a_n_band__t.html#ac469294eedf3ff6f621b9adef382a0c3">numChannelSpans</a>;</div>
<div class="line"><a name="l00188"></a><span class="lineno"> 188</span>&#160; </div>
<div class="line"><a name="l00190"></a><span class="lineno"><a class="line" href="struct_lo_ra_w_a_n_band__t.html#a9435bba595e2139c09fd46fd619390a9"> 190</a></span>&#160; <a class="code" href="struct_lo_ra_w_a_n_channel_span__t.html">LoRaWANChannelSpan_t</a> <a class="code" href="struct_lo_ra_w_a_n_band__t.html#a9435bba595e2139c09fd46fd619390a9">defaultChannels</a>[3];</div>
<div class="line"><a name="l00191"></a><span class="lineno"> 191</span>&#160; </div>
<div class="line"><a name="l00193"></a><span class="lineno"><a class="line" href="struct_lo_ra_w_a_n_band__t.html#a3918faa9973af7255449d42e9d759746"> 193</a></span>&#160; <a class="code" href="struct_lo_ra_w_a_n_channel_span__t.html">LoRaWANChannelSpan_t</a> <a class="code" href="struct_lo_ra_w_a_n_band__t.html#a3918faa9973af7255449d42e9d759746">backupChannel</a>;</div>
<div class="line"><a name="l00194"></a><span class="lineno"> 194</span>&#160;};</div>
<div class="line"><a name="l00195"></a><span class="lineno"> 195</span>&#160; </div>
<div class="line"><a name="l00196"></a><span class="lineno"> 196</span>&#160;<span class="comment">// supported bands</span></div>
<div class="line"><a name="l00197"></a><span class="lineno"> 197</span>&#160;<span class="keyword">extern</span> <span class="keyword">const</span> <a class="code" href="struct_lo_ra_w_a_n_band__t.html">LoRaWANBand_t</a> EU868;</div>
<div class="line"><a name="l00198"></a><span class="lineno"> 198</span>&#160;<span class="keyword">extern</span> <span class="keyword">const</span> <a class="code" href="struct_lo_ra_w_a_n_band__t.html">LoRaWANBand_t</a> US915;</div>
<div class="line"><a name="l00199"></a><span class="lineno"> 199</span>&#160;<span class="keyword">extern</span> <span class="keyword">const</span> <a class="code" href="struct_lo_ra_w_a_n_band__t.html">LoRaWANBand_t</a> CN780;</div>
<div class="line"><a name="l00200"></a><span class="lineno"> 200</span>&#160;<span class="keyword">extern</span> <span class="keyword">const</span> <a class="code" href="struct_lo_ra_w_a_n_band__t.html">LoRaWANBand_t</a> EU433;</div>
<div class="line"><a name="l00201"></a><span class="lineno"> 201</span>&#160;<span class="keyword">extern</span> <span class="keyword">const</span> <a class="code" href="struct_lo_ra_w_a_n_band__t.html">LoRaWANBand_t</a> AU915;</div>
<div class="line"><a name="l00202"></a><span class="lineno"> 202</span>&#160;<span class="keyword">extern</span> <span class="keyword">const</span> <a class="code" href="struct_lo_ra_w_a_n_band__t.html">LoRaWANBand_t</a> CN500;</div>
<div class="line"><a name="l00203"></a><span class="lineno"> 203</span>&#160;<span class="keyword">extern</span> <span class="keyword">const</span> <a class="code" href="struct_lo_ra_w_a_n_band__t.html">LoRaWANBand_t</a> AS923;</div>
<div class="line"><a name="l00204"></a><span class="lineno"> 204</span>&#160;<span class="keyword">extern</span> <span class="keyword">const</span> <a class="code" href="struct_lo_ra_w_a_n_band__t.html">LoRaWANBand_t</a> KR920;</div>
<div class="line"><a name="l00205"></a><span class="lineno"> 205</span>&#160;<span class="keyword">extern</span> <span class="keyword">const</span> <a class="code" href="struct_lo_ra_w_a_n_band__t.html">LoRaWANBand_t</a> IN865;</div>
<div class="line"><a name="l00206"></a><span class="lineno"> 206</span>&#160; </div>
<div class="line"><a name="l00211"></a><span class="lineno"><a class="line" href="class_lo_ra_w_a_n_node.html"> 211</a></span>&#160;<span class="keyword">class </span><a class="code" href="class_lo_ra_w_a_n_node.html">LoRaWANNode</a> {</div>
<div class="line"><a name="l00212"></a><span class="lineno"> 212</span>&#160; <span class="keyword">public</span>:</div>
<div class="line"><a name="l00218"></a><span class="lineno"> 218</span>&#160; <a class="code" href="class_lo_ra_w_a_n_node.html#adc52e15b50e39f03c937b2289ad18463">LoRaWANNode</a>(<a class="code" href="class_physical_layer.html">PhysicalLayer</a>* phy, <span class="keyword">const</span> <a class="code" href="struct_lo_ra_w_a_n_band__t.html">LoRaWANBand_t</a>* band);</div>
<div class="line"><a name="l00219"></a><span class="lineno"> 219</span>&#160; </div>
<div class="line"><a name="l00224"></a><span class="lineno"> 224</span>&#160; <span class="keywordtype">void</span> <a class="code" href="class_lo_ra_w_a_n_node.html#a9613998d071bcf401be9ad57ff8591ea">wipe</a>();</div>
<div class="line"><a name="l00225"></a><span class="lineno"> 225</span>&#160; </div>
<div class="line"><a name="l00230"></a><span class="lineno"> 230</span>&#160; int16_t <a class="code" href="class_lo_ra_w_a_n_node.html#afcc515f5c2c7853df596e9096db76d28">begin</a>();</div>
<div class="line"><a name="l00231"></a><span class="lineno"> 231</span>&#160; </div>
<div class="line"><a name="l00242"></a><span class="lineno"> 242</span>&#160; int16_t <a class="code" href="class_lo_ra_w_a_n_node.html#a36e62e7273ad5a5c3d12c55243ed30f9">beginOTAA</a>(uint64_t appEUI, uint64_t devEUI, uint8_t* nwkKey, uint8_t* appKey, <span class="keywordtype">bool</span> force = <span class="keyword">false</span>);</div>
<div class="line"><a name="l00243"></a><span class="lineno"> 243</span>&#160; </div>
<div class="line"><a name="l00253"></a><span class="lineno"> 253</span>&#160; int16_t <a class="code" href="class_lo_ra_w_a_n_node.html#ab3d1dc19a43116c2f04bd59563b38904">beginAPB</a>(uint32_t addr, uint8_t net, uint8_t* nwkSKey, uint8_t* appSKey);</div>
<div class="line"><a name="l00254"></a><span class="lineno"> 254</span>&#160; </div>
<div class="line"><a name="l00255"></a><span class="lineno"> 255</span>&#160;<span class="preprocessor"> #if defined(RADIOLIB_BUILD_ARDUINO)</span></div>
<div class="line"><a name="l00262"></a><span class="lineno"> 262</span>&#160; int16_t <a class="code" href="class_lo_ra_w_a_n_node.html#afa61477a27d020ccdf0c7eef1c4d00a9">uplink</a>(String&amp; str, uint8_t port);</div>
<div class="line"><a name="l00263"></a><span class="lineno"> 263</span>&#160;<span class="preprocessor"> #endif</span></div>
<div class="line"><a name="l00264"></a><span class="lineno"> 264</span>&#160; </div>
<div class="line"><a name="l00271"></a><span class="lineno"> 271</span>&#160; int16_t <a class="code" href="class_lo_ra_w_a_n_node.html#afa61477a27d020ccdf0c7eef1c4d00a9">uplink</a>(<span class="keyword">const</span> <span class="keywordtype">char</span>* str, uint8_t port);</div>
<div class="line"><a name="l00272"></a><span class="lineno"> 272</span>&#160; </div>
<div class="line"><a name="l00280"></a><span class="lineno"> 280</span>&#160; int16_t <a class="code" href="class_lo_ra_w_a_n_node.html#afa61477a27d020ccdf0c7eef1c4d00a9">uplink</a>(uint8_t* data, <span class="keywordtype">size_t</span> len, uint8_t port);</div>
<div class="line"><a name="l00281"></a><span class="lineno"> 281</span>&#160; </div>
<div class="line"><a name="l00288"></a><span class="lineno"> 288</span>&#160; int16_t <a class="code" href="class_lo_ra_w_a_n_node.html#aeb11880cbbe657239648e4c5c4ac5c5a">configureChannel</a>(uint8_t chan, uint8_t dr);</div>
<div class="line"><a name="l00289"></a><span class="lineno"> 289</span>&#160; </div>
<div class="line"><a name="l00290"></a><span class="lineno"> 290</span>&#160;<span class="preprocessor">#if !defined(RADIOLIB_GODMODE)</span></div>
<div class="line"><a name="l00291"></a><span class="lineno"> 291</span>&#160; <span class="keyword">private</span>:</div>
<div class="line"><a name="l00292"></a><span class="lineno"> 292</span>&#160;<span class="preprocessor">#endif</span></div>
<div class="line"><a name="l00293"></a><span class="lineno"> 293</span>&#160; <a class="code" href="class_physical_layer.html">PhysicalLayer</a>* phyLayer;</div>
<div class="line"><a name="l00294"></a><span class="lineno"> 294</span>&#160; <span class="keyword">const</span> <a class="code" href="struct_lo_ra_w_a_n_band__t.html">LoRaWANBand_t</a>* band;</div>
<div class="line"><a name="l00295"></a><span class="lineno"> 295</span>&#160; </div>
<div class="line"><a name="l00296"></a><span class="lineno"> 296</span>&#160; <span class="comment">// the following is either provided by the network server (OTAA)</span></div>
<div class="line"><a name="l00297"></a><span class="lineno"> 297</span>&#160; <span class="comment">// or directly entered by the user (ABP)</span></div>
<div class="line"><a name="l00298"></a><span class="lineno"> 298</span>&#160; uint32_t devAddr;</div>
<div class="line"><a name="l00299"></a><span class="lineno"> 299</span>&#160; uint8_t appSKey[RADIOLIB_AES128_KEY_SIZE];</div>
<div class="line"><a name="l00300"></a><span class="lineno"> 300</span>&#160; uint8_t fNwkSIntKey[RADIOLIB_AES128_KEY_SIZE];</div>
<div class="line"><a name="l00301"></a><span class="lineno"> 301</span>&#160; uint8_t sNwkSIntKey[RADIOLIB_AES128_KEY_SIZE];</div>
<div class="line"><a name="l00302"></a><span class="lineno"> 302</span>&#160; uint8_t nwkSEncKey[RADIOLIB_AES128_KEY_SIZE];</div>
<div class="line"><a name="l00303"></a><span class="lineno"> 303</span>&#160; uint8_t rxDelay;</div>
<div class="line"><a name="l00304"></a><span class="lineno"> 304</span>&#160; <span class="keywordtype">float</span> availableChannelsFreq[5];</div>
<div class="line"><a name="l00305"></a><span class="lineno"> 305</span>&#160; uint16_t availableChannelsMask[6];</div>
<div class="line"><a name="l00306"></a><span class="lineno"> 306</span>&#160; </div>
<div class="line"><a name="l00307"></a><span class="lineno"> 307</span>&#160; <span class="comment">// LoRaWAN revision (1.0 vs 1.1)</span></div>
<div class="line"><a name="l00308"></a><span class="lineno"> 308</span>&#160; uint8_t rev;</div>
<div class="line"><a name="l00309"></a><span class="lineno"> 309</span>&#160; </div>
<div class="line"><a name="l00310"></a><span class="lineno"> 310</span>&#160; <span class="comment">// currently configured data rate DR0 - DR15 (band-dependent!)</span></div>
<div class="line"><a name="l00311"></a><span class="lineno"> 311</span>&#160; uint8_t dataRate;</div>
<div class="line"><a name="l00312"></a><span class="lineno"> 312</span>&#160; </div>
<div class="line"><a name="l00313"></a><span class="lineno"> 313</span>&#160; <span class="comment">// currently configured channel (band-dependent!)</span></div>
<div class="line"><a name="l00314"></a><span class="lineno"> 314</span>&#160; uint8_t chIndex;</div>
<div class="line"><a name="l00315"></a><span class="lineno"> 315</span>&#160; </div>
<div class="line"><a name="l00316"></a><span class="lineno"> 316</span>&#160; <span class="comment">// method to generate message integrity code</span></div>
<div class="line"><a name="l00317"></a><span class="lineno"> 317</span>&#160; uint32_t generateMIC(uint8_t* msg, <span class="keywordtype">size_t</span> len, uint8_t* key);</div>
<div class="line"><a name="l00318"></a><span class="lineno"> 318</span>&#160; </div>
<div class="line"><a name="l00319"></a><span class="lineno"> 319</span>&#160; <span class="comment">// method to verify message integrity code</span></div>
<div class="line"><a name="l00320"></a><span class="lineno"> 320</span>&#160; <span class="comment">// it assumes that the MIC is the last 4 bytes of the message</span></div>
<div class="line"><a name="l00321"></a><span class="lineno"> 321</span>&#160; <span class="keywordtype">bool</span> verifyMIC(uint8_t* msg, <span class="keywordtype">size_t</span> len, uint8_t* key);</div>
<div class="line"><a name="l00322"></a><span class="lineno"> 322</span>&#160; </div>
<div class="line"><a name="l00323"></a><span class="lineno"> 323</span>&#160; int16_t setPhyProperties();</div>
<div class="line"><a name="l00324"></a><span class="lineno"> 324</span>&#160; </div>
<div class="line"><a name="l00325"></a><span class="lineno"> 325</span>&#160; <span class="comment">// network-to-host conversion method - takes data from network packet and converts it to the host endians</span></div>
<div class="line"><a name="l00326"></a><span class="lineno"> 326</span>&#160; <span class="keyword">template</span>&lt;<span class="keyword">typename</span> T&gt;</div>
<div class="line"><a name="l00327"></a><span class="lineno"> 327</span>&#160; <span class="keyword">static</span> T ntoh(uint8_t* buff, <span class="keywordtype">size_t</span> size = 0);</div>
<div class="line"><a name="l00328"></a><span class="lineno"> 328</span>&#160; </div>
<div class="line"><a name="l00329"></a><span class="lineno"> 329</span>&#160; <span class="comment">// host-to-network conversion method - takes data from host variable and and converts it to network packet endians</span></div>
<div class="line"><a name="l00330"></a><span class="lineno"> 330</span>&#160; <span class="keyword">template</span>&lt;<span class="keyword">typename</span> T&gt;</div>
<div class="line"><a name="l00331"></a><span class="lineno"> 331</span>&#160; <span class="keyword">static</span> <span class="keywordtype">void</span> hton(uint8_t* buff, T val, <span class="keywordtype">size_t</span> size = 0);</div>
<div class="line"><a name="l00332"></a><span class="lineno"> 332</span>&#160;};</div>
<div class="line"><a name="l00333"></a><span class="lineno"> 333</span>&#160; </div>
<div class="line"><a name="l00334"></a><span class="lineno"> 334</span>&#160;<span class="preprocessor">#endif</span></div>
<div class="ttc" id="aclass_lo_ra_w_a_n_node_html"><div class="ttname"><a href="class_lo_ra_w_a_n_node.html">LoRaWANNode</a></div><div class="ttdoc">LoRaWAN-compatible node (class A device).</div><div class="ttdef"><b>Definition:</b> LoRaWAN.h:211</div></div>
<div class="ttc" id="aclass_lo_ra_w_a_n_node_html_a36e62e7273ad5a5c3d12c55243ed30f9"><div class="ttname"><a href="class_lo_ra_w_a_n_node.html#a36e62e7273ad5a5c3d12c55243ed30f9">LoRaWANNode::beginOTAA</a></div><div class="ttdeci">int16_t beginOTAA(uint64_t appEUI, uint64_t devEUI, uint8_t *nwkKey, uint8_t *appKey, bool force=false)</div><div class="ttdoc">Join network by performing over-the-air activation. By this procedure, the device will perform an exc...</div><div class="ttdef"><b>Definition:</b> LoRaWAN.cpp:49</div></div>
<div class="ttc" id="aclass_lo_ra_w_a_n_node_html_a9613998d071bcf401be9ad57ff8591ea"><div class="ttname"><a href="class_lo_ra_w_a_n_node.html#a9613998d071bcf401be9ad57ff8591ea">LoRaWANNode::wipe</a></div><div class="ttdeci">void wipe()</div><div class="ttdoc">Wipe internal persistent parameters. This will reset all counters and saved variables,...</div><div class="ttdef"><b>Definition:</b> LoRaWAN.cpp:23</div></div>
<div class="ttc" id="aclass_lo_ra_w_a_n_node_html_ab3d1dc19a43116c2f04bd59563b38904"><div class="ttname"><a href="class_lo_ra_w_a_n_node.html#ab3d1dc19a43116c2f04bd59563b38904">LoRaWANNode::beginAPB</a></div><div class="ttdeci">int16_t beginAPB(uint32_t addr, uint8_t net, uint8_t *nwkSKey, uint8_t *appSKey)</div><div class="ttdoc">Join network by performing activation by personalization. In this procedure, all necessary configurat...</div><div class="ttdef"><b>Definition:</b> LoRaWAN.cpp:227</div></div>
<div class="ttc" id="aclass_lo_ra_w_a_n_node_html_adc52e15b50e39f03c937b2289ad18463"><div class="ttname"><a href="class_lo_ra_w_a_n_node.html#adc52e15b50e39f03c937b2289ad18463">LoRaWANNode::LoRaWANNode</a></div><div class="ttdeci">LoRaWANNode(PhysicalLayer *phy, const LoRaWANBand_t *band)</div><div class="ttdoc">Default constructor.</div><div class="ttdef"><b>Definition:</b> LoRaWAN.cpp:18</div></div>
<div class="ttc" id="aclass_lo_ra_w_a_n_node_html_aeb11880cbbe657239648e4c5c4ac5c5a"><div class="ttname"><a href="class_lo_ra_w_a_n_node.html#aeb11880cbbe657239648e4c5c4ac5c5a">LoRaWANNode::configureChannel</a></div><div class="ttdeci">int16_t configureChannel(uint8_t chan, uint8_t dr)</div><div class="ttdoc">Configure the radio to a given channel frequency and data rate.</div><div class="ttdef"><b>Definition:</b> LoRaWAN.cpp:366</div></div>
<div class="ttc" id="aclass_lo_ra_w_a_n_node_html_afa61477a27d020ccdf0c7eef1c4d00a9"><div class="ttname"><a href="class_lo_ra_w_a_n_node.html#afa61477a27d020ccdf0c7eef1c4d00a9">LoRaWANNode::uplink</a></div><div class="ttdeci">int16_t uplink(const char *str, uint8_t port)</div><div class="ttdoc">Send a message to the server.</div><div class="ttdef"><b>Definition:</b> LoRaWAN.cpp:240</div></div>
<div class="ttc" id="aclass_lo_ra_w_a_n_node_html_afcc515f5c2c7853df596e9096db76d28"><div class="ttname"><a href="class_lo_ra_w_a_n_node.html#afcc515f5c2c7853df596e9096db76d28">LoRaWANNode::begin</a></div><div class="ttdeci">int16_t begin()</div><div class="ttdoc">Join network by loading information from persistent storage.</div><div class="ttdef"><b>Definition:</b> LoRaWAN.cpp:28</div></div>
<div class="ttc" id="aclass_physical_layer_html"><div class="ttname"><a href="class_physical_layer.html">PhysicalLayer</a></div><div class="ttdoc">Provides common interface for protocols that run on LoRa/FSK modules, such as RTTY or LoRaWAN....</div><div class="ttdef"><b>Definition:</b> PhysicalLayer.h:33</div></div>
<div class="ttc" id="astruct_lo_ra_w_a_n_band__t_html"><div class="ttname"><a href="struct_lo_ra_w_a_n_band__t.html">LoRaWANBand_t</a></div><div class="ttdoc">Structure to save information about LoRaWAN band.</div><div class="ttdef"><b>Definition:</b> LoRaWAN.h:167</div></div>
<div class="ttc" id="astruct_lo_ra_w_a_n_band__t_html_a0eec1eadd79d66bd5db12d92c3642423"><div class="ttname"><a href="struct_lo_ra_w_a_n_band__t.html#a0eec1eadd79d66bd5db12d92c3642423">LoRaWANBand_t::cfListType</a></div><div class="ttdeci">uint8_t cfListType</div><div class="ttdoc">Whether the optional channels are defined as list of frequencies or bit mask.</div><div class="ttdef"><b>Definition:</b> LoRaWAN.h:184</div></div>
<div class="ttc" id="astruct_lo_ra_w_a_n_band__t_html_a3918faa9973af7255449d42e9d759746"><div class="ttname"><a href="struct_lo_ra_w_a_n_band__t.html#a3918faa9973af7255449d42e9d759746">LoRaWANBand_t::backupChannel</a></div><div class="ttdeci">LoRaWANChannelSpan_t backupChannel</div><div class="ttdoc">Backup downlink (RX2) channel - just a single channel, but using the same structure for convenience.</div><div class="ttdef"><b>Definition:</b> LoRaWAN.h:193</div></div>
<div class="ttc" id="astruct_lo_ra_w_a_n_band__t_html_a43a53c935e0ac482027a22e9c58ed8ed"><div class="ttname"><a href="struct_lo_ra_w_a_n_band__t.html#a43a53c935e0ac482027a22e9c58ed8ed">LoRaWANBand_t::downlinkDataRateBase</a></div><div class="ttdeci">uint8_t downlinkDataRateBase</div><div class="ttdoc">The base downlink data rate. Used to calculate data rate changes for adaptive data rate.</div><div class="ttdef"><b>Definition:</b> LoRaWAN.h:169</div></div>
<div class="ttc" id="astruct_lo_ra_w_a_n_band__t_html_a43fdafd540c93348f9b4a8958e021a4c"><div class="ttname"><a href="struct_lo_ra_w_a_n_band__t.html#a43fdafd540c93348f9b4a8958e021a4c">LoRaWANBand_t::powerMax</a></div><div class="ttdeci">int8_t powerMax</div><div class="ttdoc">Maximum allowed output power in this band in dBm.</div><div class="ttdef"><b>Definition:</b> LoRaWAN.h:178</div></div>
<div class="ttc" id="astruct_lo_ra_w_a_n_band__t_html_a9435bba595e2139c09fd46fd619390a9"><div class="ttname"><a href="struct_lo_ra_w_a_n_band__t.html#a9435bba595e2139c09fd46fd619390a9">LoRaWANBand_t::defaultChannels</a></div><div class="ttdeci">LoRaWANChannelSpan_t defaultChannels[3]</div><div class="ttdoc">Default uplink (TX/RX1) channels defined by LoRaWAN Regional Parameters.</div><div class="ttdef"><b>Definition:</b> LoRaWAN.h:190</div></div>
<div class="ttc" id="astruct_lo_ra_w_a_n_band__t_html_a9b8143ac9bbf3ed45e7cc80fc71ce055"><div class="ttname"><a href="struct_lo_ra_w_a_n_band__t.html#a9b8143ac9bbf3ed45e7cc80fc71ce055">LoRaWANBand_t::payloadLenMax</a></div><div class="ttdeci">uint8_t payloadLenMax[RADIOLIB_LORAWAN_CHANNEL_NUM_DATARATES]</div><div class="ttdoc">Array of allowed maximum payload lengths for each data rate.</div><div class="ttdef"><b>Definition:</b> LoRaWAN.h:175</div></div>
<div class="ttc" id="astruct_lo_ra_w_a_n_band__t_html_aa22d7d7670846b36d3104439d18e5f15"><div class="ttname"><a href="struct_lo_ra_w_a_n_band__t.html#aa22d7d7670846b36d3104439d18e5f15">LoRaWANBand_t::powerNumSteps</a></div><div class="ttdeci">int8_t powerNumSteps</div><div class="ttdoc">Number of power steps in this band.</div><div class="ttdef"><b>Definition:</b> LoRaWAN.h:181</div></div>
<div class="ttc" id="astruct_lo_ra_w_a_n_band__t_html_ac469294eedf3ff6f621b9adef382a0c3"><div class="ttname"><a href="struct_lo_ra_w_a_n_band__t.html#ac469294eedf3ff6f621b9adef382a0c3">LoRaWANBand_t::numChannelSpans</a></div><div class="ttdeci">uint8_t numChannelSpans</div><div class="ttdoc">Number of channel spans in the band.</div><div class="ttdef"><b>Definition:</b> LoRaWAN.h:187</div></div>
<div class="ttc" id="astruct_lo_ra_w_a_n_band__t_html_ac885c9beda28b2fcacac002ebfeaf358"><div class="ttname"><a href="struct_lo_ra_w_a_n_band__t.html#ac885c9beda28b2fcacac002ebfeaf358">LoRaWANBand_t::downlinkDataRateMin</a></div><div class="ttdeci">uint8_t downlinkDataRateMin</div><div class="ttdoc">The minimum allowed downlink data rate. Used to calculate data rate changes for adaptive data rate.</div><div class="ttdef"><b>Definition:</b> LoRaWAN.h:172</div></div>
<div class="ttc" id="astruct_lo_ra_w_a_n_channel_span__t_html"><div class="ttname"><a href="struct_lo_ra_w_a_n_channel_span__t.html">LoRaWANChannelSpan_t</a></div><div class="ttdoc">Structure to save information about LoRaWAN channels. To save space, adjacent channels are saved in &quot;...</div><div class="ttdef"><b>Definition:</b> LoRaWAN.h:140</div></div>
<div class="ttc" id="astruct_lo_ra_w_a_n_channel_span__t_html_a09bbd5a4bc1f458769f0d28bdeb4a502"><div class="ttname"><a href="struct_lo_ra_w_a_n_channel_span__t.html#a09bbd5a4bc1f458769f0d28bdeb4a502">LoRaWANChannelSpan_t::joinRequestDataRate</a></div><div class="ttdeci">uint8_t joinRequestDataRate</div><div class="ttdoc">Allowed data rates for a join request message.</div><div class="ttdef"><b>Definition:</b> LoRaWAN.h:145</div></div>
<div class="ttc" id="astruct_lo_ra_w_a_n_channel_span__t_html_a4ecf8a94d53fb140a07d88d1d0776206"><div class="ttname"><a href="struct_lo_ra_w_a_n_channel_span__t.html#a4ecf8a94d53fb140a07d88d1d0776206">LoRaWANChannelSpan_t::freqStart</a></div><div class="ttdeci">float freqStart</div><div class="ttdoc">Center frequency of the first channel in span.</div><div class="ttdef"><b>Definition:</b> LoRaWAN.h:151</div></div>
<div class="ttc" id="astruct_lo_ra_w_a_n_channel_span__t_html_a50f5701ae19b79a0c8c487673135b2f2"><div class="ttname"><a href="struct_lo_ra_w_a_n_channel_span__t.html#a50f5701ae19b79a0c8c487673135b2f2">LoRaWANChannelSpan_t::numChannels</a></div><div class="ttdeci">uint8_t numChannels</div><div class="ttdoc">Total number of channels in the span.</div><div class="ttdef"><b>Definition:</b> LoRaWAN.h:148</div></div>
<div class="ttc" id="astruct_lo_ra_w_a_n_channel_span__t_html_a6791d6e9dbde30fa4b394c91aa196138"><div class="ttname"><a href="struct_lo_ra_w_a_n_channel_span__t.html#a6791d6e9dbde30fa4b394c91aa196138">LoRaWANChannelSpan_t::dataRates</a></div><div class="ttdeci">uint8_t dataRates[RADIOLIB_LORAWAN_CHANNEL_NUM_DATARATES]</div><div class="ttdoc">Array of datarates supported by all channels in the span.</div><div class="ttdef"><b>Definition:</b> LoRaWAN.h:157</div></div>
<div class="ttc" id="astruct_lo_ra_w_a_n_channel_span__t_html_aa18000d2e0cde0236e6f984bd782dc02"><div class="ttname"><a href="struct_lo_ra_w_a_n_channel_span__t.html#aa18000d2e0cde0236e6f984bd782dc02">LoRaWANChannelSpan_t::freqStep</a></div><div class="ttdeci">float freqStep</div><div class="ttdoc">Frequency step between adjacent channels.</div><div class="ttdef"><b>Definition:</b> LoRaWAN.h:154</div></div>
<div class="ttc" id="astruct_lo_ra_w_a_n_channel_span__t_html_acf5d4a1d5a71e4b8b13b7565cb162abb"><div class="ttname"><a href="struct_lo_ra_w_a_n_channel_span__t.html#acf5d4a1d5a71e4b8b13b7565cb162abb">LoRaWANChannelSpan_t::direction</a></div><div class="ttdeci">uint8_t direction</div><div class="ttdoc">Whether this channel span is for uplink, downlink, or both directions.</div><div class="ttdef"><b>Definition:</b> LoRaWAN.h:142</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"><a class="el" href="dir_79690749eba542503bb1a9a3dbb495e1.html">protocols</a></li><li class="navelem"><a class="el" href="dir_476f96e9e2af087ba14ea5b60a229ae6.html">LoRaWAN</a></li><li class="navelem"><b>LoRaWAN.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>