<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="utf-8">
<meta name="generator" content="pdf2htmlEX">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<link rel="stylesheet" href="https://static.pudn.com/base/css/base.min.css">
<link rel="stylesheet" href="https://static.pudn.com/base/css/fancy.min.css">
<link rel="stylesheet" href="https://static.pudn.com/prod/directory_preview_static/62587650be9ad24cfa860ead/raw.css">
<script src="https://static.pudn.com/base/js/compatibility.min.js"></script>
<script src="https://static.pudn.com/base/js/pdf2htmlEX.min.js"></script>
<script>
try{
pdf2htmlEX.defaultViewer = new pdf2htmlEX.Viewer({});
}catch(e){}
</script>
<title></title>
</head>
<body>
<div id="sidebar" style="display: none">
<div id="outline">
</div>
</div>
<div id="pf1" class="pf w0 h0" data-page-no="1"><div class="pc pc1 w0 h0"><img class="bi x0 y0 w1 h1" alt="" src="https://static.pudn.com/prod/directory_preview_static/62587650be9ad24cfa860ead/bg1.jpg"><div class="t m0 x1 h2 y1 ff1 fs0 fc0 sc0 ls0 ws0">Copyright 2019, Nordic Semi<span class="_ _0"></span>conductor ASA </div><div class="t m0 x2 h3 y2 ff2 fs1 fc1 sc0 ls0 ws0">Nordic Semiconductor Sniffer API Gu<span class="_ _1"></span>ide </div><div class="t m0 x3 h4 y3 ff3 fs0 fc0 sc0 ls0 ws0">Version 0.5 </div><div class="t m0 x4 h4 y4 ff3 fs0 fc0 sc0 ls0 ws0"> </div><div class="t m0 x4 h4 y5 ff3 fs0 fc0 sc0 ls0 ws0"> </div><div class="t m0 x1 h2 y6 ff1 fs0 fc0 sc0 ls0 ws0">The Sniffer API guide provides <span class="_ _0"></span>the documentation of t<span class="_ _0"></span>he Python API used to </div><div class="t m0 x1 h2 y7 ff1 fs0 fc0 sc0 ls0 ws0">interface with the nRF S<span class="_ _0"></span>niffer for Bluetooth low energy. The nRF Sniffe<span class="_ _0"></span>r is available </div><div class="t m0 x1 h2 y8 ff1 fs0 fc0 sc0 ls0 ws0">for download at nordicsem<span class="_ _0"></span>i.com. </div><div class="t m0 x1 h2 y9 ff1 fs0 fc0 sc0 ls0 ws0"> </div><div class="t m0 x1 h2 ya ff1 fs0 fc0 sc0 ls0 ws0">Revision History </div><div class="t m0 x1 h5 yb ff4 fs0 fc0 sc0 ls0 ws0">Revision <span class="_ _2"> </span>Changes </div><div class="c x1 yc w2 h6"><div class="t m0 x0 h2 yd ff1 fs0 fc0 sc0 ls0 ws0">0.1</div></div><div class="c x5 yc w3 h6"><div class="t m0 x0 h2 yd ff1 fs0 fc0 sc0 ls0 ws0"> </div></div><div class="c x6 yc w4 h6"><div class="t m0 x0 h2 yd ff1 fs0 fc0 sc0 ls0 ws0">Initial version</div></div><div class="c x7 yc w5 h6"><div class="t m0 x0 h2 yd ff1 fs0 fc0 sc0 ls0 ws0"> </div></div><div class="c x1 ye w2 h7"><div class="t m0 x0 h2 yf ff1 fs0 fc0 sc0 ls0 ws0">0.2</div></div><div class="c x5 ye w3 h7"><div class="t m0 x0 h2 yf ff1 fs0 fc0 sc0 ls0 ws0"> </div></div><div class="c x6 ye w6 h7"><div class="t m0 x0 h2 yf ff1 fs0 fc0 sc0 ls0 ws0">Added description of LED and GP<span class="_ _0"></span>IO.</div></div><div class="c x8 ye w7 h7"><div class="t m0 x0 h2 yf ff1 fs0 fc0 sc0 ls0 ws0"> </div></div><div class="t m0 x1 h2 y10 ff1 fs0 fc0 sc0 ls0 ws0">0.3 <span class="_ _3"> </span>Updated documentation to <span class="_ _0"></span>reflect API </div><div class="c x6 y11 w8 h8"><div class="t m0 x0 h2 y12 ff1 fs0 fc0 sc0 ls0 ws0">changes after 0.9.7</div></div><div class="c x9 y11 w7 h8"><div class="t m0 x0 h2 y12 ff1 fs0 fc0 sc0 ls0 ws0"> </div></div><div class="c x1 y13 w2 h9"><div class="t m0 x0 h2 y14 ff1 fs0 fc0 sc0 ls0 ws0">0.4</div></div><div class="c x5 y13 w3 h9"><div class="t m0 x0 h2 y14 ff1 fs0 fc0 sc0 ls0 ws0"> </div></div><div class="c x6 y13 w9 h9"><div class="t m0 x0 h2 y14 ff1 fs0 fc0 sc0 ls0 ws0">Updated documentation for version 2.0.0</div></div><div class="c xa y13 wa h9"><div class="t m0 x0 h2 y14 ff1 fs0 fc0 sc0 ls0 ws0"> </div></div><div class="c x1 y15 w2 h8"><div class="t m0 x0 h2 y12 ff1 fs0 fc0 sc0 ls0 ws0">0.5</div></div><div class="c x5 y15 w3 h8"><div class="t m0 x0 h2 y12 ff1 fs0 fc0 sc0 ls0 ws0"> </div></div><div class="c x6 y15 wb h8"><div class="t m0 x0 h2 y12 ff1 fs0 fc0 sc0 ls0 ws0">Updated </div></div><div class="c xb y15 wc h8"><div class="t m0 x0 h2 y12 ff1 fs0 fc0 sc0 ls0 ws0">documentation for version 3.0.0</div></div><div class="c xa y15 wa h8"><div class="t m0 x0 h2 y12 ff1 fs0 fc0 sc0 ls0 ws0"> </div></div><div class="t m0 x1 h2 y16 ff1 fs0 fc0 sc0 ls0 ws0"> </div><div class="t m0 x1 h2 y17 ff1 fs0 fc0 sc0 ls0 ws0"> <span class="_ _4"> </span> </div></div><div class="pi" data-data='{"ctm":[1.568627,0.000000,0.000000,1.568627,0.000000,0.000000]}'></div></div>
</body>
</html>
<div id="pf2" class="pf w0 h0" data-page-no="2"><div class="pc pc2 w0 h0"><img class="bi x0 y0 w1 h1" alt="" src="https://static.pudn.com/prod/directory_preview_static/62587650be9ad24cfa860ead/bg2.jpg"><div class="t m1 x1 ha y18 ff1 fs2 fc0 sc0 ls0 ws0">Copyright 2019,<span class="_ _0"></span> Nordic Semiconductor ASA </div><div class="t m2 x1 hb y19 ff2 fs3 fc1 sc0 ls0 ws0">Introduction </div><div class="t m1 x1 ha y1a ff1 fs2 fc0 sc0 ls0 ws0"> </div><div class="t m1 x1 ha y1b ff1 fs2 fc0 sc0 ls0 ws0">The Sniffer AP<span class="_ _0"></span>I <span class="_ _1"></span>is a Pyt<span class="_ _0"></span>hon API that <span class="_ _0"></span>allows scripted use of the Nordi<span class="_ _0"></span>c Semiconduc<span class="_ _0"></span>tor </div><div class="t m1 x1 ha y1c ff1 fs2 fc0 sc0 ls0 ws0">BLE Sniffer. <span class="_ _0"></span>It allows discovery of devi<span class="_ _0"></span>ces and sniffi<span class="_ _0"></span>ng of a single device<span class="_ _0"></span>. It provides </div><div class="t m1 x1 ha y1d ff1 fs2 fc0 sc0 ls0 ws0">access to all the <span class="_ _0"></span>BLE packets rec<span class="_ _0"></span>eived by the sniffer and the d<span class="_ _0"></span>evices discovered. </div><div class="t m1 x1 ha y1e ff1 fs2 fc0 sc0 ls0 ws0"> </div><div class="t m1 x1 ha y1f ff1 fs2 fc0 sc0 ls0 ws0">The sniffer consist<span class="_ _0"></span>s of four parts as seen in <span class="_ _0"></span>Figure 1. Code<span class="_ _0"></span> that uses the Sniffer A<span class="_ _0"></span>PI </div><div class="t m1 x1 ha y20 ff1 fs2 fc0 sc0 ls0 ws0">directly will <span class="_ _0"></span>effectively replace th<span class="_ _0"></span>e “Sniffer extca<span class="_ _0"></span>p” and “Wireshark” com<span class="_ _0"></span>ponents. </div><div class="t m1 x1 ha y21 ff1 fs2 fc0 sc0 ls0 ws0"> </div><div class="t m1 x1 ha y22 ff1 fs2 fc0 sc0 ls0 ws0"> </div><div class="t m1 xc ha y23 ff1 fs2 fc0 sc0 ls0 ws0"> </div><div class="t m0 x1 hc y24 ff4 fs4 fc0 sc0 ls0 ws0">Figure 1 - Th<span class="_ _0"></span>e parts of the sniffer. </div><div class="t m1 x1 ha y25 ff1 fs2 fc0 sc0 ls0 ws0">The “Sniffer extc<span class="_ _0"></span>ap” is included under ext<span class="_ _0"></span>cap/nrf_sni<span class="_ _0"></span>ffer.py (and the helper script </div><div class="t m1 x1 ha y26 ff1 fs2 fc0 sc0 ls0 ws0">extcap/nrf_sniffer.b<span class="_ _0"></span>at for Windows). See </div><div class="t m1 x1 ha y27 ff1 fs2 fc2 sc0 ls0 ws0">https:/<span class="_ _0"></span>/www.wireshark.org/docs/wsdg_htm<span class="_ _0"></span>l_chunked/C<span class="_ _0"></span>hCaptureExtcap.html<span class="_ _0"></span><span class="fc0"> for </span></div><div class="t m1 x1 hd y28 ff1 fs2 fc0 sc0 ls0 ws0">more information on ho<span class="_ _0"></span>w the extcap system<span class="_ _0"></span> works. Note<span class="_ _0"></span>: you do <span class="ff4">not</span> need t<span class="_ _0"></span>o use the </div><div class="t m1 x1 ha y29 ff1 fs2 fc0 sc0 ls0 ws0">extcap if you are using th<span class="_ _0"></span>e Sniffer AP<span class="_ _0"></span>I directly. </div><div class="t m2 x1 hb y2a ff2 fs3 fc1 sc0 ls0 ws0">Dependencies </div><div class="t m1 x1 ha y2b ff1 fs2 fc0 sc0 ls0 ws0"> </div><div class="t m1 x1 ha y2c ff1 fs2 fc0 sc0 ls0 ws0">The API has been dev<span class="_ _0"></span>eloped using Python <span class="_ _0"></span>3.7, but should be compatib<span class="_ _0"></span>le with any </div><div class="t m1 x1 hd y2d ff1 fs2 fc0 sc0 ls0 ws0">Python runtim<span class="_ _0"></span>e 3.5 and above. It is howeve<span class="_ _0"></span>r <span class="ff4">not</span> compatible wit<span class="_ _0"></span>h Python 2. The AP<span class="_ _0"></span>I </div><div class="t m1 x1 ha y2e ff1 fs2 fc0 sc0 ls0 ws0">also requires one thi<span class="_ _0"></span>rd party Python<span class="_ _0"></span> library: </div><div class="t m1 xd he y2f ff1 fs2 fc2 sc0 ls0 ws0">1.<span class="ff5"> <span class="_ _5"> </span></span><span class="fc0">Pyserial (cross platform<span class="_ _0"></span>) version 3.4 or <span class="_ _0"></span>higher. Download using pi<span class="_ _0"></span>p: “pip </span></div><div class="t m1 xe ha y30 ff1 fs2 fc0 sc0 ls0 ws0">install pyseria<span class="_ _0"></span>l>=3.4” or us<span class="_ _0"></span>e the included “requireme<span class="_ _0"></span>nts.txt”.<span class="fc2"> </span></div><div class="t m1 x1 ha y31 ff1 fs2 fc0 sc0 ls0 ws0"> </div><div class="t m1 x1 ha y32 ff1 fs2 fc0 sc0 ls0 ws0">See the Sniffer User Gui<span class="_ _0"></span>de for additional inform<span class="_ _0"></span>atio<span class="_ _0"></span>n. </div><div class="t m2 x1 hb y33 ff2 fs3 fc1 sc0 ls0 ws0">Using <span class="_ _0"></span>the Sniffer A<span class="_ _1"></span>PI </div><div class="t m1 x1 ha y34 ff1 fs2 fc0 sc0 ls0 ws0"> </div><div class="t m1 x1 hd y35 ff4 fs2 fc0 sc0 ls0 ws0">Getting Started </div><div class="t m1 xd he y36 ff1 fs2 fc0 sc0 ls0 ws0">1.<span class="ff5"> <span class="_ _5"> </span></span>Install dependen<span class="_ _0"></span>cies. </div><div class="t m1 xd he y37 ff1 fs2 fc0 sc0 ls0 ws0">2.<span class="ff5"> <span class="_ _5"> </span></span>Include the SnifferAPI fo<span class="_ _0"></span>lder in your Python <span class="_ _0"></span>project. </div><div class="t m1 xd he y38 ff1 fs2 fc0 sc0 ls0 ws0">3.<span class="ff5"> <span class="_ _5"> </span></span>Import the AP<span class="_ _0"></span>I with </div><div class="t m0 xf hf y39 ff6 fs5 fc0 sc0 ls0 ws0">from Sniff<span class="_ _0"></span>erAPI impor<span class="_ _0"></span>t Sniffer </div><div class="t m1 xd he y3a ff1 fs2 fc0 sc0 ls0 ws0">4.<span class="ff5"> <span class="_ _5"> </span></span>Optional: discove<span class="_ _0"></span>r a list of the conne<span class="_ _0"></span>cted sniffers <span class="_ _0"></span>using: </div><div class="t m1 xe ha y3b ff1 fs2 fc0 sc0 ls0 ws0"> </div><div class="t m0 x10 hf y3c ff6 fs5 fc0 sc0 ls0 ws0">from Sniff<span class="_ _0"></span>erAPI impor<span class="_ _0"></span>t UART </div><div class="t m1 xe ha y3d ff1 fs2 fc0 sc0 ls0 ws0"> </div><div class="t m0 x10 hf y3e ff6 fs5 fc0 sc0 ls0 ws0">ports = UA<span class="_ _0"></span>RT.find_sni<span class="_ _0"></span>ffer()</div><div class="t m1 x11 ha y3d ff1 fs2 fc0 sc0 ls0 ws0"> </div><div class="t m1 xd he y3f ff1 fs2 fc0 sc0 ls0 ws0">5.<span class="ff5"> <span class="_ _5"> </span></span>Instantiate the Sni<span class="_ _0"></span>ffer class wit<span class="_ _0"></span>h e.g </div><div class="t m1 xe ha y40 ff1 fs2 fc0 sc0 ls0 ws0"> </div><div class="t m0 x10 hf y41 ff6 fs5 fc0 sc0 ls0 ws0"># For firm<span class="_ _0"></span>ware < 2.0.<span class="_ _0"></span>0, use baud<span class="_ _0"></span>rate=46<span class="_ _0"></span>0800 or omit<span class="_ _0"></span> </div><div class="t m0 xe hf y42 ff6 fs5 fc0 sc0 ls0 ws0">baudrate</div><div class="t m1 x12 ha y43 ff1 fs2 fc0 sc0 ls0 ws0"> </div><div class="t m0 xf hf y44 ff6 fs5 fc0 sc0 ls0 ws0">mySniffer <span class="_ _0"></span>= Sniffer(p<span class="_ _0"></span>ortnum=”COM<span class="_ _0"></span>40”, ba<span class="_ _0"></span>udrate=10000<span class="_ _0"></span>00) </div></div><div class="pi" data-data='{"ctm":[1.568627,0.000000,0.000000,1.568627,0.000000,0.000000]}'></div></div>