123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451 |
-
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
- "http://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/html; charset=utf-8" />
- <title>Welcome to stringtools’s documentation! — stringtools documentation</title>
- <link rel="stylesheet" href="_static/alabaster.css" type="text/css" />
- <link rel="stylesheet" href="_static/pygments.css" type="text/css" />
- <script type="text/javascript">
- var DOCUMENTATION_OPTIONS = {
- URL_ROOT: './',
- VERSION: '',
- COLLAPSE_INDEX: false,
- FILE_SUFFIX: '.html',
- HAS_SOURCE: true,
- SOURCELINK_SUFFIX: '.txt'
- };
- </script>
- <script type="text/javascript" src="_static/jquery.js"></script>
- <script type="text/javascript" src="_static/underscore.js"></script>
- <script type="text/javascript" src="_static/doctools.js"></script>
- <link rel="index" title="Index" href="genindex.html" />
- <link rel="search" title="Search" href="search.html" />
-
- <link rel="stylesheet" href="_static/custom.css" type="text/css" />
-
- <meta name="viewport" content="width=device-width, initial-scale=0.9, maximum-scale=0.9" />
-
- </head>
- <body>
-
-
- <div class="document">
- <div class="documentwrapper">
- <div class="bodywrapper">
- <div class="body" role="main">
-
- <div class="section" id="module-stringtools">
- <span id="welcome-to-stringtools-s-documentation"></span><h1>Welcome to stringtools’s documentation!<a class="headerlink" href="#module-stringtools" title="Permalink to this headline">¶</a></h1>
- <div class="section" id="stringtools-stringtools">
- <h2>stringtools (Stringtools)<a class="headerlink" href="#stringtools-stringtools" title="Permalink to this headline">¶</a></h2>
- <p><strong>Author:</strong></p>
- <ul class="simple">
- <li>Dirk Alders <<a class="reference external" href="mailto:sudo-dirk%40mount-mockery.de">sudo-dirk<span>@</span>mount-mockery<span>.</span>de</a>></li>
- </ul>
- <p><strong>Description:</strong></p>
- <blockquote>
- <div>This Module supports functionality around string operations.</div></blockquote>
- <p><strong>Submodules:</strong></p>
- <ul class="simple">
- <li><a class="reference internal" href="#module-stringtools.csp" title="stringtools.csp"><code class="xref py py-mod docutils literal"><span class="pre">stringtools.csp</span></code></a></li>
- <li><a class="reference internal" href="#module-stringtools.stp" title="stringtools.stp"><code class="xref py py-mod docutils literal"><span class="pre">stringtools.stp</span></code></a></li>
- <li><a class="reference internal" href="#stringtools.gzip_compress" title="stringtools.gzip_compress"><code class="xref py py-func docutils literal"><span class="pre">gzip_compress()</span></code></a></li>
- <li><a class="reference internal" href="#stringtools.gzip_extract" title="stringtools.gzip_extract"><code class="xref py py-func docutils literal"><span class="pre">gzip_extract()</span></code></a></li>
- <li><a class="reference internal" href="#stringtools.hexlify" title="stringtools.hexlify"><code class="xref py py-func docutils literal"><span class="pre">hexlify()</span></code></a></li>
- </ul>
- <p><strong>Unittest:</strong></p>
- <blockquote>
- <div>See also the <a class="reference download internal" href="_downloads/unittest.pdf" download=""><code class="xref download docutils literal"><span class="pre">unittest</span></code></a> documentation.</div></blockquote>
- <p><strong>Module Documentation:</strong></p>
- <dl class="function">
- <dt id="stringtools.gzip_compress">
- <code class="descclassname">stringtools.</code><code class="descname">gzip_compress</code><span class="sig-paren">(</span><em>s</em>, <em>compresslevel=9</em><span class="sig-paren">)</span><a class="headerlink" href="#stringtools.gzip_compress" title="Permalink to this definition">¶</a></dt>
- <dd><p>Method to compress a stream of bytes.</p>
- <table class="docutils field-list" frame="void" rules="none">
- <col class="field-name" />
- <col class="field-body" />
- <tbody valign="top">
- <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
- <li><strong>s</strong> (<em>str</em>) – The bytestream (string) to be compressed</li>
- <li><strong>compresslevel</strong> (<em>int</em>) – An optional compressionn level (default is 9)</li>
- </ul>
- </td>
- </tr>
- <tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">The compressed bytestream</p>
- </td>
- </tr>
- <tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">str</p>
- </td>
- </tr>
- </tbody>
- </table>
- <p><strong>Example:</strong></p>
- <div class="highlight-default"><div class="highlight"><pre><span></span><span class="kn">import</span> <span class="nn">stringtools</span>
- <span class="kn">import</span> <span class="nn">report</span>
-
-
- <span class="n">report</span><span class="o">.</span><span class="n">stdoutLoggingConfigure</span><span class="p">(</span><span class="n">log_name_lvl</span><span class="o">=</span><span class="p">[(</span><span class="n">stringtools</span><span class="o">.</span><span class="n">logger_name</span><span class="p">,</span> <span class="s1">'DEBUG'</span><span class="p">),</span> <span class="p">])</span>
- <span class="nb">print</span><span class="p">(</span><span class="n">stringtools</span><span class="o">.</span><span class="n">hexlify</span><span class="p">(</span><span class="n">stringtools</span><span class="o">.</span><span class="n">gzip_compress</span><span class="p">(</span><span class="mi">15</span> <span class="o">*</span> <span class="sa">b</span><span class="s1">'</span><span class="se">\x00</span><span class="s1">'</span> <span class="o">+</span> <span class="mi">15</span> <span class="o">*</span> <span class="sa">b</span><span class="s1">'</span><span class="se">\xff</span><span class="s1">'</span><span class="p">)))</span>
- </pre></div>
- </div>
- <p>Will result to the following output:</p>
- <div class="highlight-default"><div class="highlight"><pre><span></span><span class="mi">2020</span><span class="o">-</span><span class="mi">01</span><span class="o">-</span><span class="mi">28</span> <span class="mi">21</span><span class="p">:</span><span class="mi">45</span><span class="p">:</span><span class="mi">24</span><span class="p">,</span><span class="mi">558</span><span class="p">:</span> <span class="n">STRINGTOOLS</span> <span class="o">-</span> <span class="n">DEBUG</span> <span class="o">-</span> <span class="n">GZIP</span><span class="p">:</span> <span class="n">Finished</span> <span class="n">to</span> <span class="n">compress</span> <span class="n">a</span> <span class="n">string</span> <span class="p">(</span><span class="n">compression_rate</span><span class="o">=</span><span class="mf">0.867</span><span class="p">,</span> <span class="n">consumed_time</span><span class="o">=</span><span class="mf">0.0</span><span class="n">s</span><span class="p">)</span><span class="o">.</span>
- <span class="p">(</span><span class="mi">26</span><span class="p">):</span> <span class="mi">1</span><span class="n">f</span> <span class="mi">8</span><span class="n">b</span> <span class="mi">08</span> <span class="mi">00</span> <span class="mi">64</span> <span class="mi">9</span><span class="n">d</span> <span class="mi">30</span> <span class="mi">5</span><span class="n">e</span> <span class="mi">02</span> <span class="n">ff</span> <span class="mi">63</span> <span class="mi">60</span> <span class="mi">40</span> <span class="mi">01</span> <span class="n">ff</span> <span class="mi">51</span> <span class="mi">01</span> <span class="mi">00</span> <span class="mi">2</span><span class="n">d</span> <span class="mi">8</span><span class="n">a</span> <span class="mi">7</span><span class="n">d</span> <span class="n">de</span> <span class="mi">1</span><span class="n">e</span> <span class="mi">00</span> <span class="mi">00</span> <span class="mi">00</span>
- </pre></div>
- </div>
- </dd></dl>
-
- <dl class="function">
- <dt id="stringtools.gzip_extract">
- <code class="descclassname">stringtools.</code><code class="descname">gzip_extract</code><span class="sig-paren">(</span><em>s</em><span class="sig-paren">)</span><a class="headerlink" href="#stringtools.gzip_extract" title="Permalink to this definition">¶</a></dt>
- <dd><p>Method to extract data from a compress stream of bytes.</p>
- <table class="docutils field-list" frame="void" rules="none">
- <col class="field-name" />
- <col class="field-body" />
- <tbody valign="top">
- <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>s</strong> (<em>str</em>) – The compressed bytestream (string) to be extracted</td>
- </tr>
- <tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">The extracted data</td>
- </tr>
- <tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body">str</td>
- </tr>
- </tbody>
- </table>
- <p><strong>Example:</strong></p>
- <div class="highlight-default"><div class="highlight"><pre><span></span><span class="kn">import</span> <span class="nn">stringtools</span>
- <span class="kn">import</span> <span class="nn">report</span>
-
-
- <span class="n">report</span><span class="o">.</span><span class="n">stdoutLoggingConfigure</span><span class="p">(</span><span class="n">log_name_lvl</span><span class="o">=</span><span class="p">[(</span><span class="n">stringtools</span><span class="o">.</span><span class="n">logger_name</span><span class="p">,</span> <span class="s1">'DEBUG'</span><span class="p">),</span> <span class="p">])</span>
- <span class="nb">print</span><span class="p">(</span><span class="n">stringtools</span><span class="o">.</span><span class="n">hexlify</span><span class="p">(</span><span class="n">stringtools</span><span class="o">.</span><span class="n">gzip_extract</span><span class="p">(</span><span class="sa">b</span><span class="s1">'</span><span class="se">\x1f\x8b\x08\x00\xd0\x82\xe5\x5c\x02\xff\x63\x60\x40\x01\xff\x51\x01\x00\x2d\x8a\x7d\xde\x1e\x00\x00\x00</span><span class="s1">'</span><span class="p">)))</span>
- </pre></div>
- </div>
- <p>Will result to the following output:</p>
- <div class="highlight-default"><div class="highlight"><pre><span></span><span class="mi">2020</span><span class="o">-</span><span class="mi">01</span><span class="o">-</span><span class="mi">28</span> <span class="mi">21</span><span class="p">:</span><span class="mi">45</span><span class="p">:</span><span class="mi">39</span><span class="p">,</span><span class="mi">899</span><span class="p">:</span> <span class="n">STRINGTOOLS</span> <span class="o">-</span> <span class="n">DEBUG</span> <span class="o">-</span> <span class="n">GZIP</span><span class="p">:</span> <span class="n">Finished</span> <span class="n">to</span> <span class="n">extract</span> <span class="n">a</span> <span class="n">string</span> <span class="p">(</span><span class="n">compression_rate</span><span class="o">=</span><span class="mf">0.867</span><span class="p">,</span> <span class="n">consumed_time</span><span class="o">=</span><span class="mf">0.0</span><span class="n">s</span><span class="p">)</span><span class="o">.</span>
- <span class="p">(</span><span class="mi">30</span><span class="p">):</span> <span class="mi">00</span> <span class="mi">00</span> <span class="mi">00</span> <span class="mi">00</span> <span class="mi">00</span> <span class="mi">00</span> <span class="mi">00</span> <span class="mi">00</span> <span class="mi">00</span> <span class="mi">00</span> <span class="mi">00</span> <span class="mi">00</span> <span class="mi">00</span> <span class="mi">00</span> <span class="mi">00</span> <span class="n">ff</span> <span class="n">ff</span> <span class="n">ff</span> <span class="n">ff</span> <span class="n">ff</span> <span class="n">ff</span> <span class="n">ff</span> <span class="n">ff</span> <span class="n">ff</span> <span class="n">ff</span> <span class="n">ff</span> <span class="n">ff</span> <span class="n">ff</span> <span class="n">ff</span> <span class="n">ff</span>
- </pre></div>
- </div>
- </dd></dl>
-
- <dl class="function">
- <dt id="stringtools.hexlify">
- <code class="descclassname">stringtools.</code><code class="descname">hexlify</code><span class="sig-paren">(</span><em>s</em><span class="sig-paren">)</span><a class="headerlink" href="#stringtools.hexlify" title="Permalink to this definition">¶</a></dt>
- <dd><p>Method to hexlify a string.</p>
- <table class="docutils field-list" frame="void" rules="none">
- <col class="field-name" />
- <col class="field-body" />
- <tbody valign="top">
- <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>s</strong> (<em>str</em>) – A string including the bytes to be hexlified.</td>
- </tr>
- <tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">The hexlified string</td>
- </tr>
- <tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body">str</td>
- </tr>
- </tbody>
- </table>
- <p><strong>Example:</strong></p>
- <div class="highlight-default"><div class="highlight"><pre><span></span><span class="kn">import</span> <span class="nn">stringtools</span>
-
-
- <span class="nb">print</span><span class="p">(</span><span class="n">stringtools</span><span class="o">.</span><span class="n">hexlify</span><span class="p">(</span><span class="sa">b</span><span class="s1">'A stringexample with non printable characters like </span><span class="se">\x12</span><span class="s1">'</span><span class="p">))</span>
- </pre></div>
- </div>
- <p>Will result to the following output:</p>
- <div class="highlight-default"><div class="highlight"><pre><span></span><span class="p">(</span><span class="mi">52</span><span class="p">):</span> <span class="mi">41</span> <span class="mi">20</span> <span class="mi">73</span> <span class="mi">74</span> <span class="mi">72</span> <span class="mi">69</span> <span class="mi">6</span><span class="n">e</span> <span class="mi">67</span> <span class="mi">65</span> <span class="mi">78</span> <span class="mi">61</span> <span class="mi">6</span><span class="n">d</span> <span class="mi">70</span> <span class="mi">6</span><span class="n">c</span> <span class="mi">65</span> <span class="mi">20</span> <span class="mi">77</span> <span class="mi">69</span> <span class="mi">74</span> <span class="mi">68</span> <span class="mi">20</span> <span class="mi">6</span><span class="n">e</span> <span class="mi">6</span><span class="n">f</span> <span class="mi">6</span><span class="n">e</span> <span class="mi">20</span> <span class="mi">70</span> <span class="mi">72</span> <span class="mi">69</span> <span class="mi">6</span><span class="n">e</span> <span class="mi">74</span> <span class="mi">61</span> <span class="mi">62</span> <span class="mi">6</span><span class="n">c</span> <span class="mi">65</span> <span class="mi">20</span> <span class="mi">63</span> <span class="mi">68</span> <span class="mi">61</span> <span class="mi">72</span> <span class="mi">61</span> <span class="mi">63</span> <span class="mi">74</span> <span class="mi">65</span> <span class="mi">72</span> <span class="mi">73</span> <span class="mi">20</span> <span class="mi">6</span><span class="n">c</span> <span class="mi">69</span> <span class="mi">6</span><span class="n">b</span> <span class="mi">65</span> <span class="mi">20</span> <span class="mi">12</span>
- </pre></div>
- </div>
- </dd></dl>
-
- </div>
- <span class="target" id="module-stringtools.csp"></span><div class="section" id="csp-carriage-return-seperation-protocol">
- <h2>csp (Carriage-Return seperation protocol)<a class="headerlink" href="#csp-carriage-return-seperation-protocol" title="Permalink to this headline">¶</a></h2>
- <p><strong>Author:</strong></p>
- <ul class="simple">
- <li>Dirk Alders <<a class="reference external" href="mailto:sudo-dirk%40mount-mockery.de">sudo-dirk<span>@</span>mount-mockery<span>.</span>de</a>></li>
- </ul>
- <p><strong>Description:</strong></p>
- <blockquote>
- <div>This module is a submodule of <a class="reference internal" href="#module-stringtools" title="stringtools"><code class="xref py py-mod docutils literal"><span class="pre">stringtools</span></code></a> and creates an frame to transmit and receive messages via an serial interface.</div></blockquote>
- <p><strong>Submodules:</strong></p>
- <ul class="simple">
- <li><a class="reference internal" href="#stringtools.csp.csp" title="stringtools.csp.csp"><code class="xref py py-class docutils literal"><span class="pre">stringtools.csp.csp</span></code></a></li>
- <li><a class="reference internal" href="#stringtools.csp.build_frame" title="stringtools.csp.build_frame"><code class="xref py py-func docutils literal"><span class="pre">stringtools.csp.build_frame()</span></code></a></li>
- </ul>
- <dl class="function">
- <dt id="stringtools.csp.build_frame">
- <code class="descclassname">stringtools.csp.</code><code class="descname">build_frame</code><span class="sig-paren">(</span><em>msg</em>, <em>seperator='\n'</em><span class="sig-paren">)</span><a class="headerlink" href="#stringtools.csp.build_frame" title="Permalink to this definition">¶</a></dt>
- <dd><p>This Method builds an “csp-frame” to be transfered via a stream.</p>
- <table class="docutils field-list" frame="void" rules="none">
- <col class="field-name" />
- <col class="field-body" />
- <tbody valign="top">
- <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>data</strong> (<em>str</em>) – A String (Bytes) to be framed</td>
- </tr>
- <tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">The “csp-framed” message to be sent</td>
- </tr>
- <tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body">str</td>
- </tr>
- </tbody>
- </table>
- <p><strong>Example:</strong></p>
- <div class="highlight-default"><div class="highlight"><pre><span></span><span class="kn">import</span> <span class="nn">stringtools</span>
-
- <span class="n">data</span> <span class="o">=</span> <span class="sa">b</span><span class="s1">'message'</span>
- <span class="nb">print</span><span class="p">(</span><span class="n">stringtools</span><span class="o">.</span><span class="n">hexlify</span><span class="p">(</span><span class="n">data</span><span class="p">))</span>
- <span class="nb">print</span><span class="p">(</span><span class="n">stringtools</span><span class="o">.</span><span class="n">hexlify</span><span class="p">(</span><span class="n">stringtools</span><span class="o">.</span><span class="n">csp</span><span class="o">.</span><span class="n">build_frame</span><span class="p">(</span><span class="n">data</span><span class="p">)))</span>
-
- </pre></div>
- </div>
- <p>Will result to the following output:</p>
- <div class="highlight-default"><div class="highlight"><pre><span></span><span class="p">(</span><span class="mi">7</span><span class="p">):</span> <span class="mi">6</span><span class="n">d</span> <span class="mi">65</span> <span class="mi">73</span> <span class="mi">73</span> <span class="mi">61</span> <span class="mi">67</span> <span class="mi">65</span>
- <span class="p">(</span><span class="mi">8</span><span class="p">):</span> <span class="mi">6</span><span class="n">d</span> <span class="mi">65</span> <span class="mi">73</span> <span class="mi">73</span> <span class="mi">61</span> <span class="mi">67</span> <span class="mi">65</span> <span class="mi">0</span><span class="n">a</span>
- </pre></div>
- </div>
- </dd></dl>
-
- <dl class="class">
- <dt id="stringtools.csp.csp">
- <em class="property">class </em><code class="descclassname">stringtools.csp.</code><code class="descname">csp</code><span class="sig-paren">(</span><em>seperator='n'</em><span class="sig-paren">)</span><a class="headerlink" href="#stringtools.csp.csp" title="Permalink to this definition">¶</a></dt>
- <dd><p>This class extracts messages from an “csp-stream”.</p>
- <p><strong>Example:</strong></p>
- <div class="highlight-default"><div class="highlight"><pre><span></span><span class="kn">import</span> <span class="nn">report</span>
- <span class="kn">import</span> <span class="nn">stringtools</span>
-
- <span class="n">report</span><span class="o">.</span><span class="n">stdoutLoggingConfigure</span><span class="p">(</span><span class="n">log_name_lvl</span><span class="o">=</span><span class="p">[(</span><span class="n">stringtools</span><span class="o">.</span><span class="n">logger_name</span><span class="p">,</span> <span class="s1">'DEBUG'</span><span class="p">),</span> <span class="p">])</span>
- <span class="n">s</span> <span class="o">=</span> <span class="n">stringtools</span><span class="o">.</span><span class="n">csp</span><span class="o">.</span><span class="n">csp</span><span class="p">()</span>
- <span class="k">for</span> <span class="n">byte</span> <span class="ow">in</span> <span class="sa">b</span><span class="s1">'message</span><span class="se">\n</span><span class="s1">'</span><span class="p">:</span>
- <span class="n">data</span> <span class="o">=</span> <span class="n">s</span><span class="o">.</span><span class="n">process</span><span class="p">(</span><span class="nb">bytes</span><span class="p">([</span><span class="n">byte</span><span class="p">]))</span>
- <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">data</span><span class="p">)</span> <span class="o">></span> <span class="mi">0</span><span class="p">:</span>
- <span class="nb">print</span><span class="p">(</span><span class="n">data</span><span class="p">)</span>
- </pre></div>
- </div>
- <p>Will result to the following output:</p>
- <div class="highlight-default"><div class="highlight"><pre><span></span><span class="mi">2020</span><span class="o">-</span><span class="mi">01</span><span class="o">-</span><span class="mi">28</span> <span class="mi">21</span><span class="p">:</span><span class="mi">31</span><span class="p">:</span><span class="mi">22</span><span class="p">,</span><span class="mi">093</span><span class="p">:</span> <span class="n">STRINGTOOLS</span> <span class="o">-</span> <span class="n">DEBUG</span> <span class="o">-</span> <span class="n">CSP</span><span class="p">:</span> <span class="n">Leaving</span> <span class="n">data</span> <span class="ow">in</span> <span class="n">buffer</span> <span class="p">(</span><span class="n">to</span> <span class="n">be</span> <span class="n">processed</span> <span class="nb">next</span> <span class="n">time</span><span class="p">):</span> <span class="p">(</span><span class="mi">5</span><span class="p">):</span> <span class="mi">5</span><span class="n">b</span> <span class="mi">27</span> <span class="mi">6</span><span class="n">d</span> <span class="mi">27</span> <span class="mi">5</span><span class="n">d</span>
- <span class="mi">2020</span><span class="o">-</span><span class="mi">01</span><span class="o">-</span><span class="mi">28</span> <span class="mi">21</span><span class="p">:</span><span class="mi">31</span><span class="p">:</span><span class="mi">22</span><span class="p">,</span><span class="mi">094</span><span class="p">:</span> <span class="n">STRINGTOOLS</span> <span class="o">-</span> <span class="n">DEBUG</span> <span class="o">-</span> <span class="n">CSP</span><span class="p">:</span> <span class="n">Leaving</span> <span class="n">data</span> <span class="ow">in</span> <span class="n">buffer</span> <span class="p">(</span><span class="n">to</span> <span class="n">be</span> <span class="n">processed</span> <span class="nb">next</span> <span class="n">time</span><span class="p">):</span> <span class="p">(</span><span class="mi">10</span><span class="p">):</span> <span class="mi">5</span><span class="n">b</span> <span class="mi">27</span> <span class="mi">6</span><span class="n">d</span> <span class="mi">27</span> <span class="mi">5</span><span class="n">d</span> <span class="mi">5</span><span class="n">b</span> <span class="mi">27</span> <span class="mi">65</span> <span class="mi">27</span> <span class="mi">5</span><span class="n">d</span>
- <span class="mi">2020</span><span class="o">-</span><span class="mi">01</span><span class="o">-</span><span class="mi">28</span> <span class="mi">21</span><span class="p">:</span><span class="mi">31</span><span class="p">:</span><span class="mi">22</span><span class="p">,</span><span class="mi">094</span><span class="p">:</span> <span class="n">STRINGTOOLS</span> <span class="o">-</span> <span class="n">DEBUG</span> <span class="o">-</span> <span class="n">CSP</span><span class="p">:</span> <span class="n">Leaving</span> <span class="n">data</span> <span class="ow">in</span> <span class="n">buffer</span> <span class="p">(</span><span class="n">to</span> <span class="n">be</span> <span class="n">processed</span> <span class="nb">next</span> <span class="n">time</span><span class="p">):</span> <span class="p">(</span><span class="mi">15</span><span class="p">):</span> <span class="mi">5</span><span class="n">b</span> <span class="mi">27</span> <span class="mi">6</span><span class="n">d</span> <span class="mi">27</span> <span class="mi">5</span><span class="n">d</span> <span class="mi">5</span><span class="n">b</span> <span class="mi">27</span> <span class="mi">65</span> <span class="mi">27</span> <span class="mi">5</span><span class="n">d</span> <span class="mi">5</span><span class="n">b</span> <span class="mi">27</span> <span class="mi">73</span> <span class="mi">27</span> <span class="mi">5</span><span class="n">d</span>
- <span class="mi">2020</span><span class="o">-</span><span class="mi">01</span><span class="o">-</span><span class="mi">28</span> <span class="mi">21</span><span class="p">:</span><span class="mi">31</span><span class="p">:</span><span class="mi">22</span><span class="p">,</span><span class="mi">095</span><span class="p">:</span> <span class="n">STRINGTOOLS</span> <span class="o">-</span> <span class="n">DEBUG</span> <span class="o">-</span> <span class="n">CSP</span><span class="p">:</span> <span class="n">Leaving</span> <span class="n">data</span> <span class="ow">in</span> <span class="n">buffer</span> <span class="p">(</span><span class="n">to</span> <span class="n">be</span> <span class="n">processed</span> <span class="nb">next</span> <span class="n">time</span><span class="p">):</span> <span class="p">(</span><span class="mi">20</span><span class="p">):</span> <span class="mi">5</span><span class="n">b</span> <span class="mi">27</span> <span class="mi">6</span><span class="n">d</span> <span class="mi">27</span> <span class="mi">5</span><span class="n">d</span> <span class="mi">5</span><span class="n">b</span> <span class="mi">27</span> <span class="mi">65</span> <span class="mi">27</span> <span class="mi">5</span><span class="n">d</span> <span class="mi">5</span><span class="n">b</span> <span class="mi">27</span> <span class="mi">73</span> <span class="mi">27</span> <span class="mi">5</span><span class="n">d</span> <span class="mi">5</span><span class="n">b</span> <span class="mi">27</span> <span class="mi">73</span> <span class="mi">27</span> <span class="mi">5</span><span class="n">d</span>
- <span class="mi">2020</span><span class="o">-</span><span class="mi">01</span><span class="o">-</span><span class="mi">28</span> <span class="mi">21</span><span class="p">:</span><span class="mi">31</span><span class="p">:</span><span class="mi">22</span><span class="p">,</span><span class="mi">095</span><span class="p">:</span> <span class="n">STRINGTOOLS</span> <span class="o">-</span> <span class="n">DEBUG</span> <span class="o">-</span> <span class="n">CSP</span><span class="p">:</span> <span class="n">Leaving</span> <span class="n">data</span> <span class="ow">in</span> <span class="n">buffer</span> <span class="p">(</span><span class="n">to</span> <span class="n">be</span> <span class="n">processed</span> <span class="nb">next</span> <span class="n">time</span><span class="p">):</span> <span class="p">(</span><span class="mi">25</span><span class="p">):</span> <span class="mi">5</span><span class="n">b</span> <span class="mi">27</span> <span class="mi">6</span><span class="n">d</span> <span class="mi">27</span> <span class="mi">5</span><span class="n">d</span> <span class="mi">5</span><span class="n">b</span> <span class="mi">27</span> <span class="mi">65</span> <span class="mi">27</span> <span class="mi">5</span><span class="n">d</span> <span class="mi">5</span><span class="n">b</span> <span class="mi">27</span> <span class="mi">73</span> <span class="mi">27</span> <span class="mi">5</span><span class="n">d</span> <span class="mi">5</span><span class="n">b</span> <span class="mi">27</span> <span class="mi">73</span> <span class="mi">27</span> <span class="mi">5</span><span class="n">d</span> <span class="mi">5</span><span class="n">b</span> <span class="mi">27</span> <span class="mi">61</span> <span class="mi">27</span> <span class="mi">5</span><span class="n">d</span>
- <span class="mi">2020</span><span class="o">-</span><span class="mi">01</span><span class="o">-</span><span class="mi">28</span> <span class="mi">21</span><span class="p">:</span><span class="mi">31</span><span class="p">:</span><span class="mi">22</span><span class="p">,</span><span class="mi">095</span><span class="p">:</span> <span class="n">STRINGTOOLS</span> <span class="o">-</span> <span class="n">DEBUG</span> <span class="o">-</span> <span class="n">CSP</span><span class="p">:</span> <span class="n">Leaving</span> <span class="n">data</span> <span class="ow">in</span> <span class="n">buffer</span> <span class="p">(</span><span class="n">to</span> <span class="n">be</span> <span class="n">processed</span> <span class="nb">next</span> <span class="n">time</span><span class="p">):</span> <span class="p">(</span><span class="mi">30</span><span class="p">):</span> <span class="mi">5</span><span class="n">b</span> <span class="mi">27</span> <span class="mi">6</span><span class="n">d</span> <span class="mi">27</span> <span class="mi">5</span><span class="n">d</span> <span class="mi">5</span><span class="n">b</span> <span class="mi">27</span> <span class="mi">65</span> <span class="mi">27</span> <span class="mi">5</span><span class="n">d</span> <span class="mi">5</span><span class="n">b</span> <span class="mi">27</span> <span class="mi">73</span> <span class="mi">27</span> <span class="mi">5</span><span class="n">d</span> <span class="mi">5</span><span class="n">b</span> <span class="mi">27</span> <span class="mi">73</span> <span class="mi">27</span> <span class="mi">5</span><span class="n">d</span> <span class="mi">5</span><span class="n">b</span> <span class="mi">27</span> <span class="mi">61</span> <span class="mi">27</span> <span class="mi">5</span><span class="n">d</span> <span class="mi">5</span><span class="n">b</span> <span class="mi">27</span> <span class="mi">67</span> <span class="mi">27</span> <span class="mi">5</span><span class="n">d</span>
- <span class="mi">2020</span><span class="o">-</span><span class="mi">01</span><span class="o">-</span><span class="mi">28</span> <span class="mi">21</span><span class="p">:</span><span class="mi">31</span><span class="p">:</span><span class="mi">22</span><span class="p">,</span><span class="mi">096</span><span class="p">:</span> <span class="n">STRINGTOOLS</span> <span class="o">-</span> <span class="n">DEBUG</span> <span class="o">-</span> <span class="n">CSP</span><span class="p">:</span> <span class="n">Leaving</span> <span class="n">data</span> <span class="ow">in</span> <span class="n">buffer</span> <span class="p">(</span><span class="n">to</span> <span class="n">be</span> <span class="n">processed</span> <span class="nb">next</span> <span class="n">time</span><span class="p">):</span> <span class="p">(</span><span class="mi">35</span><span class="p">):</span> <span class="mi">5</span><span class="n">b</span> <span class="mi">27</span> <span class="mi">6</span><span class="n">d</span> <span class="mi">27</span> <span class="mi">5</span><span class="n">d</span> <span class="mi">5</span><span class="n">b</span> <span class="mi">27</span> <span class="mi">65</span> <span class="mi">27</span> <span class="mi">5</span><span class="n">d</span> <span class="mi">5</span><span class="n">b</span> <span class="mi">27</span> <span class="mi">73</span> <span class="mi">27</span> <span class="mi">5</span><span class="n">d</span> <span class="mi">5</span><span class="n">b</span> <span class="mi">27</span> <span class="mi">73</span> <span class="mi">27</span> <span class="mi">5</span><span class="n">d</span> <span class="mi">5</span><span class="n">b</span> <span class="mi">27</span> <span class="mi">61</span> <span class="mi">27</span> <span class="mi">5</span><span class="n">d</span> <span class="mi">5</span><span class="n">b</span> <span class="mi">27</span> <span class="mi">67</span> <span class="mi">27</span> <span class="mi">5</span><span class="n">d</span> <span class="mi">5</span><span class="n">b</span> <span class="mi">27</span> <span class="mi">65</span> <span class="mi">27</span> <span class="mi">5</span><span class="n">d</span>
- <span class="mi">2020</span><span class="o">-</span><span class="mi">01</span><span class="o">-</span><span class="mi">28</span> <span class="mi">21</span><span class="p">:</span><span class="mi">31</span><span class="p">:</span><span class="mi">22</span><span class="p">,</span><span class="mi">096</span><span class="p">:</span> <span class="n">STRINGTOOLS</span> <span class="o">-</span> <span class="n">DEBUG</span> <span class="o">-</span> <span class="n">CSP</span><span class="p">:</span> <span class="n">Leaving</span> <span class="n">data</span> <span class="ow">in</span> <span class="n">buffer</span> <span class="p">(</span><span class="n">to</span> <span class="n">be</span> <span class="n">processed</span> <span class="nb">next</span> <span class="n">time</span><span class="p">):</span> <span class="p">(</span><span class="mi">41</span><span class="p">):</span> <span class="mi">5</span><span class="n">b</span> <span class="mi">27</span> <span class="mi">6</span><span class="n">d</span> <span class="mi">27</span> <span class="mi">5</span><span class="n">d</span> <span class="mi">5</span><span class="n">b</span> <span class="mi">27</span> <span class="mi">65</span> <span class="mi">27</span> <span class="mi">5</span><span class="n">d</span> <span class="mi">5</span><span class="n">b</span> <span class="mi">27</span> <span class="mi">73</span> <span class="mi">27</span> <span class="mi">5</span><span class="n">d</span> <span class="mi">5</span><span class="n">b</span> <span class="mi">27</span> <span class="mi">73</span> <span class="mi">27</span> <span class="mi">5</span><span class="n">d</span> <span class="mi">5</span><span class="n">b</span> <span class="mi">27</span> <span class="mi">61</span> <span class="mi">27</span> <span class="mi">5</span><span class="n">d</span> <span class="mi">5</span><span class="n">b</span> <span class="mi">27</span> <span class="mi">67</span> <span class="mi">27</span> <span class="mi">5</span><span class="n">d</span> <span class="mi">5</span><span class="n">b</span> <span class="mi">27</span> <span class="mi">65</span> <span class="mi">27</span> <span class="mi">5</span><span class="n">d</span> <span class="mi">5</span><span class="n">b</span> <span class="mi">27</span> <span class="mi">5</span><span class="n">c</span> <span class="mi">6</span><span class="n">e</span> <span class="mi">27</span> <span class="mi">5</span><span class="n">d</span>
- </pre></div>
- </div>
- <dl class="method">
- <dt id="stringtools.csp.csp.process">
- <code class="descname">process</code><span class="sig-paren">(</span><em>data</em><span class="sig-paren">)</span><a class="headerlink" href="#stringtools.csp.csp.process" title="Permalink to this definition">¶</a></dt>
- <dd><p>This processes a byte out of a “stp-stream”.</p>
- <table class="docutils field-list" frame="void" rules="none">
- <col class="field-name" />
- <col class="field-body" />
- <tbody valign="top">
- <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>data</strong> (<em>bytes</em>) – A byte stream</td>
- </tr>
- <tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">A list of the extracted message(s)</td>
- </tr>
- <tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body">list</td>
- </tr>
- </tbody>
- </table>
- </dd></dl>
-
- </dd></dl>
-
- </div>
- <span class="target" id="module-stringtools.stp"></span><div class="section" id="stp-serial-transfer-protocol">
- <h2>stp (Serial transfer protocol)<a class="headerlink" href="#stp-serial-transfer-protocol" title="Permalink to this headline">¶</a></h2>
- <p><strong>Author:</strong></p>
- <ul class="simple">
- <li>Dirk Alders <<a class="reference external" href="mailto:sudo-dirk%40mount-mockery.de">sudo-dirk<span>@</span>mount-mockery<span>.</span>de</a>></li>
- </ul>
- <p><strong>Description:</strong></p>
- <blockquote>
- <div>This module is a submodule of <a class="reference internal" href="#module-stringtools" title="stringtools"><code class="xref py py-mod docutils literal"><span class="pre">stringtools</span></code></a> and creates an serial frame to transmit and receive messages via an serial interface.</div></blockquote>
- <p><strong>Submodules:</strong></p>
- <ul class="simple">
- <li><a class="reference internal" href="#stringtools.stp.stp" title="stringtools.stp.stp"><code class="xref py py-class docutils literal"><span class="pre">stringtools.stp.stp</span></code></a></li>
- <li><a class="reference internal" href="#stringtools.stp.build_frame" title="stringtools.stp.build_frame"><code class="xref py py-func docutils literal"><span class="pre">stringtools.stp.build_frame()</span></code></a></li>
- </ul>
- <dl class="data">
- <dt id="stringtools.stp.DATA_CLEAR_BUFFER">
- <code class="descclassname">stringtools.stp.</code><code class="descname">DATA_CLEAR_BUFFER</code><em class="property"> = '<'</em><a class="headerlink" href="#stringtools.stp.DATA_CLEAR_BUFFER" title="Permalink to this definition">¶</a></dt>
- <dd><p>The clear buffer byte (‘\x3a\x3c’ -> start of message)</p>
- </dd></dl>
-
- <dl class="data">
- <dt id="stringtools.stp.DATA_STORE_SYNC_VALUE">
- <code class="descclassname">stringtools.stp.</code><code class="descname">DATA_STORE_SYNC_VALUE</code><em class="property"> = '='</em><a class="headerlink" href="#stringtools.stp.DATA_STORE_SYNC_VALUE" title="Permalink to this definition">¶</a></dt>
- <dd><p>The store sync value byte (‘\x3a\x3d’ -> ‘\x3a’ inside a message)</p>
- </dd></dl>
-
- <dl class="data">
- <dt id="stringtools.stp.DATA_SYNC">
- <code class="descclassname">stringtools.stp.</code><code class="descname">DATA_SYNC</code><em class="property"> = ':'</em><a class="headerlink" href="#stringtools.stp.DATA_SYNC" title="Permalink to this definition">¶</a></dt>
- <dd><p>The data sync byte</p>
- </dd></dl>
-
- <dl class="data">
- <dt id="stringtools.stp.DATA_VALID_MSG">
- <code class="descclassname">stringtools.stp.</code><code class="descname">DATA_VALID_MSG</code><em class="property"> = '>'</em><a class="headerlink" href="#stringtools.stp.DATA_VALID_MSG" title="Permalink to this definition">¶</a></dt>
- <dd><p>The valid message byte (‘\x3a\x3e’ -> end of message)</p>
- </dd></dl>
-
- <dl class="data">
- <dt id="stringtools.stp.STP_STATE_ESCAPE_1">
- <code class="descclassname">stringtools.stp.</code><code class="descname">STP_STATE_ESCAPE_1</code><em class="property"> = 1</em><a class="headerlink" href="#stringtools.stp.STP_STATE_ESCAPE_1" title="Permalink to this definition">¶</a></dt>
- <dd><p>Escape 1 state definition (‘\x3a\x3c’ found)</p>
- </dd></dl>
-
- <dl class="data">
- <dt id="stringtools.stp.STP_STATE_ESCAPE_2">
- <code class="descclassname">stringtools.stp.</code><code class="descname">STP_STATE_ESCAPE_2</code><em class="property"> = 2</em><a class="headerlink" href="#stringtools.stp.STP_STATE_ESCAPE_2" title="Permalink to this definition">¶</a></dt>
- <dd><p>Escape 2 state definition (‘\x3a’ found inside a message)</p>
- </dd></dl>
-
- <dl class="data">
- <dt id="stringtools.stp.STP_STATE_IDLE">
- <code class="descclassname">stringtools.stp.</code><code class="descname">STP_STATE_IDLE</code><em class="property"> = 0</em><a class="headerlink" href="#stringtools.stp.STP_STATE_IDLE" title="Permalink to this definition">¶</a></dt>
- <dd><p>Idle state definition (default)</p>
- </dd></dl>
-
- <dl class="data">
- <dt id="stringtools.stp.STP_STATE_STORE_DATA">
- <code class="descclassname">stringtools.stp.</code><code class="descname">STP_STATE_STORE_DATA</code><em class="property"> = 3</em><a class="headerlink" href="#stringtools.stp.STP_STATE_STORE_DATA" title="Permalink to this definition">¶</a></dt>
- <dd><p>Store data state definition (start of message found; data will be stored)</p>
- </dd></dl>
-
- <dl class="function">
- <dt id="stringtools.stp.build_frame">
- <code class="descclassname">stringtools.stp.</code><code class="descname">build_frame</code><span class="sig-paren">(</span><em>data</em><span class="sig-paren">)</span><a class="headerlink" href="#stringtools.stp.build_frame" title="Permalink to this definition">¶</a></dt>
- <dd><p>This Method builds an “stp-frame” to be transfered via a stream.</p>
- <table class="docutils field-list" frame="void" rules="none">
- <col class="field-name" />
- <col class="field-body" />
- <tbody valign="top">
- <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>data</strong> (<em>str</em>) – A String (Bytes) to be framed</td>
- </tr>
- <tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">The “stp-framed” message to be sent</td>
- </tr>
- <tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body">str</td>
- </tr>
- </tbody>
- </table>
- <p><strong>Example:</strong></p>
- <div class="highlight-default"><div class="highlight"><pre><span></span><span class="kn">import</span> <span class="nn">stringtools</span>
-
- <span class="nb">print</span><span class="p">(</span><span class="nb">repr</span><span class="p">(</span><span class="n">stringtools</span><span class="o">.</span><span class="n">stp</span><span class="o">.</span><span class="n">build_frame</span><span class="p">(</span><span class="sa">b</span><span class="s1">':message:'</span><span class="p">)))</span>
- </pre></div>
- </div>
- <p>Will result to the following output:</p>
- <div class="highlight-default"><div class="highlight"><pre><span></span><span class="sa">b</span><span class="s1">':<:=message:=:>'</span>
- </pre></div>
- </div>
- </dd></dl>
-
- <dl class="class">
- <dt id="stringtools.stp.stp">
- <em class="property">class </em><code class="descclassname">stringtools.stp.</code><code class="descname">stp</code><a class="headerlink" href="#stringtools.stp.stp" title="Permalink to this definition">¶</a></dt>
- <dd><p>This class extracts messages from an “stp-stream”.</p>
- <p><strong>Example:</strong></p>
- <div class="highlight-default"><div class="highlight"><pre><span></span><span class="kn">import</span> <span class="nn">report</span>
- <span class="kn">import</span> <span class="nn">stringtools</span>
-
- <span class="n">report</span><span class="o">.</span><span class="n">stdoutLoggingConfigure</span><span class="p">(</span><span class="n">log_name_lvl</span><span class="o">=</span><span class="p">[(</span><span class="n">stringtools</span><span class="o">.</span><span class="n">logger_name</span><span class="p">,</span> <span class="s1">'DEBUG'</span><span class="p">),</span> <span class="p">])</span>
- <span class="n">s</span> <span class="o">=</span> <span class="n">stringtools</span><span class="o">.</span><span class="n">stp</span><span class="o">.</span><span class="n">stp</span><span class="p">()</span>
- <span class="k">for</span> <span class="n">byte</span> <span class="ow">in</span> <span class="sa">b</span><span class="s1">':<:=message:=:>'</span><span class="p">:</span>
- <span class="n">data</span> <span class="o">=</span> <span class="n">s</span><span class="o">.</span><span class="n">process</span><span class="p">(</span><span class="nb">bytes</span><span class="p">([</span><span class="n">byte</span><span class="p">]))</span>
- <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">data</span><span class="p">)</span> <span class="o">></span> <span class="mi">0</span><span class="p">:</span>
- <span class="nb">print</span><span class="p">(</span><span class="n">data</span><span class="p">)</span>
- </pre></div>
- </div>
- <p>Will result to the following output:</p>
- <div class="highlight-default"><div class="highlight"><pre><span></span><span class="mi">2020</span><span class="o">-</span><span class="mi">01</span><span class="o">-</span><span class="mi">28</span> <span class="mi">21</span><span class="p">:</span><span class="mi">38</span><span class="p">:</span><span class="mi">27</span><span class="p">,</span><span class="mi">329</span><span class="p">:</span> <span class="n">STRINGTOOLS</span> <span class="o">-</span> <span class="n">DEBUG</span> <span class="o">-</span> <span class="n">STP</span><span class="p">:</span> <span class="n">data</span> <span class="n">sync</span> <span class="p">(</span><span class="mi">3</span><span class="n">a</span><span class="p">)</span> <span class="n">received</span> <span class="o">=></span> <span class="n">changing</span> <span class="n">state</span> <span class="n">STP_STATE_IDLE</span> <span class="o">-></span> <span class="n">STP_STATE_ESCAPE_1</span>
- <span class="mi">2020</span><span class="o">-</span><span class="mi">01</span><span class="o">-</span><span class="mi">28</span> <span class="mi">21</span><span class="p">:</span><span class="mi">38</span><span class="p">:</span><span class="mi">27</span><span class="p">,</span><span class="mi">329</span><span class="p">:</span> <span class="n">STRINGTOOLS</span> <span class="o">-</span> <span class="n">DEBUG</span> <span class="o">-</span> <span class="n">STP</span><span class="p">:</span> <span class="n">start</span> <span class="n">pattern</span> <span class="p">(</span><span class="mi">3</span><span class="n">a</span> <span class="mi">3</span><span class="n">c</span><span class="p">)</span> <span class="n">received</span> <span class="o">=></span> <span class="n">changing</span> <span class="n">state</span> <span class="n">STP_STATE_ESCAPE_1</span> <span class="o">-></span> <span class="n">STP_STATE_STORE_DATA</span>
- <span class="mi">2020</span><span class="o">-</span><span class="mi">01</span><span class="o">-</span><span class="mi">28</span> <span class="mi">21</span><span class="p">:</span><span class="mi">38</span><span class="p">:</span><span class="mi">27</span><span class="p">,</span><span class="mi">329</span><span class="p">:</span> <span class="n">STRINGTOOLS</span> <span class="o">-</span> <span class="n">DEBUG</span> <span class="o">-</span> <span class="n">STP</span><span class="p">:</span> <span class="n">data</span> <span class="n">sync</span> <span class="p">(</span><span class="mi">3</span><span class="n">a</span><span class="p">)</span> <span class="n">received</span> <span class="o">=></span> <span class="n">changing</span> <span class="n">state</span> <span class="n">STP_STATE_STORE_DATA</span> <span class="o">-></span> <span class="n">STP_STATE_ESCAPE_2</span>
- <span class="mi">2020</span><span class="o">-</span><span class="mi">01</span><span class="o">-</span><span class="mi">28</span> <span class="mi">21</span><span class="p">:</span><span class="mi">38</span><span class="p">:</span><span class="mi">27</span><span class="p">,</span><span class="mi">329</span><span class="p">:</span> <span class="n">STRINGTOOLS</span> <span class="o">-</span> <span class="n">DEBUG</span> <span class="o">-</span> <span class="n">STP</span><span class="p">:</span> <span class="n">store</span> <span class="n">sync</span> <span class="n">pattern</span> <span class="p">(</span><span class="mi">3</span><span class="n">a</span> <span class="mi">3</span><span class="n">d</span><span class="p">)</span> <span class="n">received</span> <span class="o">=></span> <span class="n">changing</span> <span class="n">state</span> <span class="n">STP_STATE_ESCAPE_2</span> <span class="o">-></span> <span class="n">STP_STATE_STORE_DATA</span>
- <span class="mi">2020</span><span class="o">-</span><span class="mi">01</span><span class="o">-</span><span class="mi">28</span> <span class="mi">21</span><span class="p">:</span><span class="mi">38</span><span class="p">:</span><span class="mi">27</span><span class="p">,</span><span class="mi">329</span><span class="p">:</span> <span class="n">STRINGTOOLS</span> <span class="o">-</span> <span class="n">DEBUG</span> <span class="o">-</span> <span class="n">STP</span><span class="p">:</span> <span class="n">data</span> <span class="n">sync</span> <span class="p">(</span><span class="mi">3</span><span class="n">a</span><span class="p">)</span> <span class="n">received</span> <span class="o">=></span> <span class="n">changing</span> <span class="n">state</span> <span class="n">STP_STATE_STORE_DATA</span> <span class="o">-></span> <span class="n">STP_STATE_ESCAPE_2</span>
- <span class="mi">2020</span><span class="o">-</span><span class="mi">01</span><span class="o">-</span><span class="mi">28</span> <span class="mi">21</span><span class="p">:</span><span class="mi">38</span><span class="p">:</span><span class="mi">27</span><span class="p">,</span><span class="mi">329</span><span class="p">:</span> <span class="n">STRINGTOOLS</span> <span class="o">-</span> <span class="n">DEBUG</span> <span class="o">-</span> <span class="n">STP</span><span class="p">:</span> <span class="n">store</span> <span class="n">sync</span> <span class="n">pattern</span> <span class="p">(</span><span class="mi">3</span><span class="n">a</span> <span class="mi">3</span><span class="n">d</span><span class="p">)</span> <span class="n">received</span> <span class="o">=></span> <span class="n">changing</span> <span class="n">state</span> <span class="n">STP_STATE_ESCAPE_2</span> <span class="o">-></span> <span class="n">STP_STATE_STORE_DATA</span>
- <span class="mi">2020</span><span class="o">-</span><span class="mi">01</span><span class="o">-</span><span class="mi">28</span> <span class="mi">21</span><span class="p">:</span><span class="mi">38</span><span class="p">:</span><span class="mi">27</span><span class="p">,</span><span class="mi">329</span><span class="p">:</span> <span class="n">STRINGTOOLS</span> <span class="o">-</span> <span class="n">DEBUG</span> <span class="o">-</span> <span class="n">STP</span><span class="p">:</span> <span class="n">data</span> <span class="n">sync</span> <span class="p">(</span><span class="mi">3</span><span class="n">a</span><span class="p">)</span> <span class="n">received</span> <span class="o">=></span> <span class="n">changing</span> <span class="n">state</span> <span class="n">STP_STATE_STORE_DATA</span> <span class="o">-></span> <span class="n">STP_STATE_ESCAPE_2</span>
- <span class="mi">2020</span><span class="o">-</span><span class="mi">01</span><span class="o">-</span><span class="mi">28</span> <span class="mi">21</span><span class="p">:</span><span class="mi">38</span><span class="p">:</span><span class="mi">27</span><span class="p">,</span><span class="mi">329</span><span class="p">:</span> <span class="n">STRINGTOOLS</span> <span class="o">-</span> <span class="n">DEBUG</span> <span class="o">-</span> <span class="n">STP</span><span class="p">:</span> <span class="n">end</span> <span class="n">pattern</span> <span class="p">(</span><span class="mi">3</span><span class="n">a</span> <span class="mi">3</span><span class="n">e</span><span class="p">)</span> <span class="n">received</span> <span class="o">=></span> <span class="n">storing</span> <span class="n">message</span> <span class="ow">and</span> <span class="n">changing</span> <span class="n">state</span> <span class="n">STP_STATE_ESCAPE_2</span> <span class="o">-></span> <span class="n">STP_STATE_IDLE</span>
- <span class="mi">2020</span><span class="o">-</span><span class="mi">01</span><span class="o">-</span><span class="mi">28</span> <span class="mi">21</span><span class="p">:</span><span class="mi">38</span><span class="p">:</span><span class="mi">27</span><span class="p">,</span><span class="mi">329</span><span class="p">:</span> <span class="n">STRINGTOOLS</span> <span class="o">-</span> <span class="n">INFO</span> <span class="o">-</span> <span class="n">STP</span><span class="p">:</span> <span class="n">message</span> <span class="n">identified</span> <span class="o">-</span> <span class="p">(</span><span class="mi">9</span><span class="p">):</span> <span class="mi">3</span><span class="n">a</span> <span class="mi">6</span><span class="n">d</span> <span class="mi">65</span> <span class="mi">73</span> <span class="mi">73</span> <span class="mi">61</span> <span class="mi">67</span> <span class="mi">65</span> <span class="mi">3</span><span class="n">a</span>
- <span class="p">[</span><span class="sa">b</span><span class="s1">':message:'</span><span class="p">]</span>
- </pre></div>
- </div>
- <dl class="method">
- <dt id="stringtools.stp.stp.process">
- <code class="descname">process</code><span class="sig-paren">(</span><em>data</em><span class="sig-paren">)</span><a class="headerlink" href="#stringtools.stp.stp.process" title="Permalink to this definition">¶</a></dt>
- <dd><p>This processes a byte out of a “stp-stream”.</p>
- <table class="docutils field-list" frame="void" rules="none">
- <col class="field-name" />
- <col class="field-body" />
- <tbody valign="top">
- <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>data</strong> (<em>bytes</em>) – A byte stream</td>
- </tr>
- <tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">The extracted message or None, if no message is identified yet</td>
- </tr>
- <tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body">str</td>
- </tr>
- </tbody>
- </table>
- </dd></dl>
-
- </dd></dl>
-
- </div>
- <div class="toctree-wrapper compound">
- </div>
- </div>
- <div class="section" id="indices-and-tables">
- <h1>Indices and tables<a class="headerlink" href="#indices-and-tables" title="Permalink to this headline">¶</a></h1>
- <ul class="simple">
- <li><a class="reference internal" href="genindex.html"><span class="std std-ref">Index</span></a></li>
- <li><a class="reference internal" href="py-modindex.html"><span class="std std-ref">Module Index</span></a></li>
- <li><a class="reference internal" href="search.html"><span class="std std-ref">Search Page</span></a></li>
- </ul>
- </div>
-
-
- </div>
- </div>
- </div>
- <div class="sphinxsidebar" role="navigation" aria-label="main navigation">
- <div class="sphinxsidebarwrapper"><div class="relations">
- <h3>Related Topics</h3>
- <ul>
- <li><a href="#">Documentation overview</a><ul>
- </ul></li>
- </ul>
- </div>
- <div id="searchbox" style="display: none" role="search">
- <h3>Quick search</h3>
- <form class="search" action="search.html" method="get">
- <div><input type="text" name="q" /></div>
- <div><input type="submit" value="Go" /></div>
- <input type="hidden" name="check_keywords" value="yes" />
- <input type="hidden" name="area" value="default" />
- </form>
- </div>
- <script type="text/javascript">$('#searchbox').show(0);</script>
- </div>
- </div>
- <div class="clearer"></div>
- </div>
- <div class="footer">
- ©2019, Dirk Alders.
-
- |
- Powered by <a href="http://sphinx-doc.org/">Sphinx 1.6.7</a>
- & <a href="https://github.com/bitprophet/alabaster">Alabaster 0.7.8</a>
-
- |
- <a href="_sources/index.rst.txt"
- rel="nofollow">Page source</a>
- </div>
-
-
-
-
- </body>
- </html>
|