A clone of: https://github.com/nutechsoftware/alarmdecoder This is requires as they dropped support for older firmware releases w/o building in backward compatibility code, and they had previously hardcoded pyserial to a python2 only version.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

170 lines
9.1 KiB

  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  2. "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  3. <html xmlns="http://www.w3.org/1999/xhtml">
  4. <head>
  5. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  6. <title>Welcome to Alarm Decoder’s documentation! &mdash; alarmdecoder documentation</title>
  7. <link rel="stylesheet" href="_static/default.css" type="text/css" />
  8. <link rel="stylesheet" href="_static/pygments.css" type="text/css" />
  9. <script type="text/javascript">
  10. var DOCUMENTATION_OPTIONS = {
  11. URL_ROOT: './',
  12. VERSION: '',
  13. COLLAPSE_INDEX: false,
  14. FILE_SUFFIX: '.html',
  15. HAS_SOURCE: true
  16. };
  17. </script>
  18. <script type="text/javascript" src="_static/jquery.js"></script>
  19. <script type="text/javascript" src="_static/underscore.js"></script>
  20. <script type="text/javascript" src="_static/doctools.js"></script>
  21. <link rel="top" title="alarmdecoder documentation" href="#" />
  22. <link rel="next" title="alarmdecoder Package" href="alarmdecoder.html" />
  23. </head>
  24. <body>
  25. <div class="related">
  26. <h3>Navigation</h3>
  27. <ul>
  28. <li class="right" style="margin-right: 10px">
  29. <a href="genindex.html" title="General Index"
  30. accesskey="I">index</a></li>
  31. <li class="right" >
  32. <a href="py-modindex.html" title="Python Module Index"
  33. >modules</a> |</li>
  34. <li class="right" >
  35. <a href="alarmdecoder.html" title="alarmdecoder Package"
  36. accesskey="N">next</a> |</li>
  37. <li><a href="#">alarmdecoder documentation</a> &raquo;</li>
  38. </ul>
  39. </div>
  40. <div class="document">
  41. <div class="documentwrapper">
  42. <div class="bodywrapper">
  43. <div class="body">
  44. <div class="section" id="welcome-to-alarm-decoder-s-documentation">
  45. <h1>Welcome to Alarm Decoder&#8217;s documentation!<a class="headerlink" href="#welcome-to-alarm-decoder-s-documentation" title="Permalink to this headline">¶</a></h1>
  46. <p>This is the API documentation for the <a class="reference external" href="http://www.alarmdecoder.com">Alarm Decoder</a> Python library. It provides support for interacting with the <a class="reference external" href="http://www.alarmdecoder.com">Alarm Decoder</a> (AD2) family of security alarm devices, including the AD2USB, AD2SERIAL and AD2PI.</p>
  47. <p>The source code, requirements and examples for this project may be found <a class="reference external" href="http://github.com/nutechsoftware/alarmdecoder">here</a>.</p>
  48. <p>Please see the <a class="reference external" href="http://github.com/nutechsoftware/alarmdecoder/tree/master/examples">examples</a> directory for more samples, but a basic one is included below:</p>
  49. <div class="highlight-python"><div class="highlight"><pre><span class="kn">import</span> <span class="nn">time</span>
  50. <span class="kn">from</span> <span class="nn">alarmdecoder</span> <span class="kn">import</span> <span class="n">AlarmDecoder</span>
  51. <span class="kn">from</span> <span class="nn">alarmdecoder.devices</span> <span class="kn">import</span> <span class="n">USBDevice</span>
  52. <span class="k">def</span> <span class="nf">main</span><span class="p">():</span>
  53. <span class="sd">&quot;&quot;&quot;</span>
  54. <span class="sd"> Example application that prints messages from the panel to the terminal.</span>
  55. <span class="sd"> &quot;&quot;&quot;</span>
  56. <span class="k">try</span><span class="p">:</span>
  57. <span class="c"># Retrieve the first USB device</span>
  58. <span class="n">device</span> <span class="o">=</span> <span class="n">AlarmDecoder</span><span class="p">(</span><span class="n">USBDevice</span><span class="o">.</span><span class="n">find</span><span class="p">())</span>
  59. <span class="c"># Set up an event handler and open the device</span>
  60. <span class="n">device</span><span class="o">.</span><span class="n">on_message</span> <span class="o">+=</span> <span class="n">handle_message</span>
  61. <span class="k">with</span> <span class="n">device</span><span class="o">.</span><span class="n">open</span><span class="p">():</span>
  62. <span class="k">while</span> <span class="bp">True</span><span class="p">:</span>
  63. <span class="n">time</span><span class="o">.</span><span class="n">sleep</span><span class="p">(</span><span class="mi">1</span><span class="p">)</span>
  64. <span class="k">except</span> <span class="ne">Exception</span><span class="p">,</span> <span class="n">ex</span><span class="p">:</span>
  65. <span class="k">print</span> <span class="s">&#39;Exception:&#39;</span><span class="p">,</span> <span class="n">ex</span>
  66. <span class="k">def</span> <span class="nf">handle_message</span><span class="p">(</span><span class="n">sender</span><span class="p">,</span> <span class="n">message</span><span class="p">):</span>
  67. <span class="sd">&quot;&quot;&quot;</span>
  68. <span class="sd"> Handles message events from the AlarmDecoder.</span>
  69. <span class="sd"> &quot;&quot;&quot;</span>
  70. <span class="k">print</span> <span class="n">sender</span><span class="p">,</span> <span class="n">message</span><span class="o">.</span><span class="n">raw</span>
  71. <span class="k">if</span> <span class="n">__name__</span> <span class="o">==</span> <span class="s">&#39;__main__&#39;</span><span class="p">:</span>
  72. <span class="n">main</span><span class="p">()</span>
  73. </pre></div>
  74. </div>
  75. <p>Table of Contents:</p>
  76. <div class="toctree-wrapper compound">
  77. <ul>
  78. <li class="toctree-l1"><a class="reference internal" href="alarmdecoder.html">alarmdecoder Package</a><ul>
  79. <li class="toctree-l2"><a class="reference internal" href="alarmdecoder.html#module-alarmdecoder.decoder"><tt class="docutils literal"><span class="pre">decoder</span></tt> Module</a></li>
  80. <li class="toctree-l2"><a class="reference internal" href="alarmdecoder.html#module-alarmdecoder.devices"><tt class="docutils literal"><span class="pre">devices</span></tt> Module</a></li>
  81. <li class="toctree-l2"><a class="reference internal" href="alarmdecoder.html#module-alarmdecoder.messages"><tt class="docutils literal"><span class="pre">messages</span></tt> Module</a></li>
  82. <li class="toctree-l2"><a class="reference internal" href="alarmdecoder.html#module-alarmdecoder.zonetracking"><tt class="docutils literal"><span class="pre">zonetracking</span></tt> Module</a></li>
  83. <li class="toctree-l2"><a class="reference internal" href="alarmdecoder.html#module-alarmdecoder.util"><tt class="docutils literal"><span class="pre">util</span></tt> Module</a></li>
  84. <li class="toctree-l2"><a class="reference internal" href="alarmdecoder.html#module-alarmdecoder.panels"><tt class="docutils literal"><span class="pre">panels</span></tt> Module</a></li>
  85. </ul>
  86. </li>
  87. </ul>
  88. </div>
  89. </div>
  90. <div class="section" id="indices-and-tables">
  91. <h1>Indices and tables<a class="headerlink" href="#indices-and-tables" title="Permalink to this headline">¶</a></h1>
  92. <ul class="simple">
  93. <li><a class="reference internal" href="genindex.html"><em>Index</em></a></li>
  94. <li><a class="reference internal" href="py-modindex.html"><em>Module Index</em></a></li>
  95. <li><a class="reference internal" href="search.html"><em>Search Page</em></a></li>
  96. </ul>
  97. </div>
  98. </div>
  99. </div>
  100. </div>
  101. <div class="sphinxsidebar">
  102. <div class="sphinxsidebarwrapper">
  103. <h3><a href="#">Table Of Contents</a></h3>
  104. <ul>
  105. <li><a class="reference internal" href="#">Welcome to Alarm Decoder&#8217;s documentation!</a><ul>
  106. </ul>
  107. </li>
  108. <li><a class="reference internal" href="#indices-and-tables">Indices and tables</a></li>
  109. </ul>
  110. <h4>Next topic</h4>
  111. <p class="topless"><a href="alarmdecoder.html"
  112. title="next chapter">alarmdecoder Package</a></p>
  113. <h3>This Page</h3>
  114. <ul class="this-page-menu">
  115. <li><a href="_sources/index.txt"
  116. rel="nofollow">Show Source</a></li>
  117. </ul>
  118. <div id="searchbox" style="display: none">
  119. <h3>Quick search</h3>
  120. <form class="search" action="search.html" method="get">
  121. <input type="text" name="q" />
  122. <input type="submit" value="Go" />
  123. <input type="hidden" name="check_keywords" value="yes" />
  124. <input type="hidden" name="area" value="default" />
  125. </form>
  126. <p class="searchtip" style="font-size: 90%">
  127. Enter search terms or a module, class or function name.
  128. </p>
  129. </div>
  130. <script type="text/javascript">$('#searchbox').show(0);</script>
  131. </div>
  132. </div>
  133. <div class="clearer"></div>
  134. </div>
  135. <div class="related">
  136. <h3>Navigation</h3>
  137. <ul>
  138. <li class="right" style="margin-right: 10px">
  139. <a href="genindex.html" title="General Index"
  140. >index</a></li>
  141. <li class="right" >
  142. <a href="py-modindex.html" title="Python Module Index"
  143. >modules</a> |</li>
  144. <li class="right" >
  145. <a href="alarmdecoder.html" title="alarmdecoder Package"
  146. >next</a> |</li>
  147. <li><a href="#">alarmdecoder documentation</a> &raquo;</li>
  148. </ul>
  149. </div>
  150. <div class="footer">
  151. &copy; Copyright 2013, Nu Tech Software Solutions, Inc..
  152. Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.2b1.
  153. </div>
  154. </body>
  155. </html>