Browse Source

Merge branch 'fabaff-master' into dev

pyserial_fix
Scott Petersen 8 years ago
parent
commit
78ab171fd4
28 changed files with 255 additions and 108 deletions
  1. +22
    -9
      README.rst
  2. BIN
      docs/build/doctrees/alarmdecoder.doctree
  3. BIN
      docs/build/doctrees/environment.pickle
  4. +2
    -2
      docs/build/html/.buildinfo
  5. +30
    -6
      docs/build/html/_modules/alarmdecoder/decoder.html
  6. +80
    -16
      docs/build/html/_modules/alarmdecoder/devices.html
  7. +1
    -1
      docs/build/html/_modules/alarmdecoder/event/event.html
  8. +3
    -4
      docs/build/html/_modules/alarmdecoder/messages.html
  9. +1
    -1
      docs/build/html/_modules/alarmdecoder/util.html
  10. +42
    -19
      docs/build/html/_modules/alarmdecoder/zonetracking.html
  11. +1
    -1
      docs/build/html/_modules/index.html
  12. +2
    -5
      docs/build/html/_static/basic.css
  13. +1
    -1
      docs/build/html/_static/default.css
  14. +4
    -1
      docs/build/html/_static/doctools.js
  15. +2
    -4
      docs/build/html/_static/jquery.js
  16. +4
    -4
      docs/build/html/_static/searchtools.js
  17. +2
    -2
      docs/build/html/_static/sidebar.js
  18. +1
    -1
      docs/build/html/_static/websupport.js
  19. +1
    -1
      docs/build/html/alarmdecoder.event.html
  20. +40
    -20
      docs/build/html/alarmdecoder.html
  21. +9
    -1
      docs/build/html/genindex.html
  22. +2
    -4
      docs/build/html/index.html
  23. +1
    -1
      docs/build/html/modules.html
  24. BIN
      docs/build/html/objects.inv
  25. +1
    -1
      docs/build/html/py-modindex.html
  26. +1
    -1
      docs/build/html/search.html
  27. +1
    -1
      docs/build/html/searchindex.js
  28. +1
    -1
      setup.py

+ 22
- 9
README.rst View File

@@ -15,44 +15,57 @@ AlarmDecoder
Summary
-------

This Python library aims to provide a consistent interface for the `AlarmDecoder`_ product line. (AD2USB, AD2SERIAL and AD2PI)
This Python library aims to provide a consistent interface for the
`AlarmDecoder`_ product line. (AD2USB, AD2SERIAL and AD2PI).
This also includes devices that have been exposed via `ser2sock`_, which
supports encryption via SSL/TLS.

------------
Installation
------------
AlarmDecoder can be installed through pip:

AlarmDecoder can be installed through ``pip``::

pip install alarmdecoder

or from source:
or from source::

python setup.py install

* Note: python-setuptools is required for installation.
* Note: ``python-setuptools`` is required for installation.

------------
Requirements
------------

Required:

* An `AlarmDecoder`_ device
* Python 2.7
* `pyserial`_ >= 2.7

Optional:

* `pyftdi`_ >= 0.9.0
* `pyusb`_ >= 1.0.0b1
* `pyserial`_ >= 2.7
* `pyopenssl`_

-------------
Documentation
-------------

API documentation can be found at `readthedocs`_.

--------
Examples
--------
A basic example is included below. Please see the `examples`_ directory for more.::

A basic example is included below. Please see the `examples`_ directory for
more.::

import time
from alarmdecoder import AlarmDecoder
from alarmdecoder.devices import USBDevice
from alarmdecoder.devices import SerialDevice

def main():
"""
@@ -60,11 +73,11 @@ A basic example is included below. Please see the `examples`_ directory for mor
"""
try:
# Retrieve the first USB device
device = AlarmDecoder(USBDevice.find())
device = AlarmDecoder(SerialDevice(interface='/dev/ttyUSB0'))

# Set up an event handler and open the device
device.on_message += handle_message
with device.open():
with device.open(baudrate=115200):
while True:
time.sleep(1)



BIN
docs/build/doctrees/alarmdecoder.doctree View File


BIN
docs/build/doctrees/environment.pickle View File


+ 2
- 2
docs/build/html/.buildinfo View File

@@ -1,4 +1,4 @@
# Sphinx build info version 1
# This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done.
config: d1da78485e879674427d47d917d46635
tags: a205e9ed8462ae86fdd2f73488852ba9
config: 8fd355ab18ea10d4d654aef01edd4d38
tags: 645f666f9bcd5a90fca523b33c5a78b7

+ 30
- 6
docs/build/html/_modules/alarmdecoder/decoder.html View File

@@ -74,7 +74,8 @@
<span class="n">on_arm</span> <span class="o">=</span> <span class="n">event</span><span class="o">.</span><span class="n">Event</span><span class="p">(</span><span class="s">&quot;This event is called when the panel is armed.</span><span class="se">\n\n</span><span class="s">**Callback definition:** *def callback(device)*&quot;</span><span class="p">)</span>
<span class="n">on_disarm</span> <span class="o">=</span> <span class="n">event</span><span class="o">.</span><span class="n">Event</span><span class="p">(</span><span class="s">&quot;This event is called when the panel is disarmed.</span><span class="se">\n\n</span><span class="s">**Callback definition:** *def callback(device)*&quot;</span><span class="p">)</span>
<span class="n">on_power_changed</span> <span class="o">=</span> <span class="n">event</span><span class="o">.</span><span class="n">Event</span><span class="p">(</span><span class="s">&quot;This event is called when panel power switches between AC and DC.</span><span class="se">\n\n</span><span class="s">**Callback definition:** *def callback(device, status)*&quot;</span><span class="p">)</span>
<span class="n">on_alarm</span> <span class="o">=</span> <span class="n">event</span><span class="o">.</span><span class="n">Event</span><span class="p">(</span><span class="s">&quot;This event is called when the alarm is triggered.</span><span class="se">\n\n</span><span class="s">**Callback definition:** *def callback(device, status)*&quot;</span><span class="p">)</span>
<span class="n">on_alarm</span> <span class="o">=</span> <span class="n">event</span><span class="o">.</span><span class="n">Event</span><span class="p">(</span><span class="s">&quot;This event is called when the alarm is triggered.</span><span class="se">\n\n</span><span class="s">**Callback definition:** *def callback(device, zone)*&quot;</span><span class="p">)</span>
<span class="n">on_alarm_restored</span> <span class="o">=</span> <span class="n">event</span><span class="o">.</span><span class="n">Event</span><span class="p">(</span><span class="s">&quot;This event is called when the alarm stops sounding.</span><span class="se">\n\n</span><span class="s">**Callback definition:** *def callback(device, zone)*&quot;</span><span class="p">)</span>
<span class="n">on_fire</span> <span class="o">=</span> <span class="n">event</span><span class="o">.</span><span class="n">Event</span><span class="p">(</span><span class="s">&quot;This event is called when a fire is detected.</span><span class="se">\n\n</span><span class="s">**Callback definition:** *def callback(device, status)*&quot;</span><span class="p">)</span>
<span class="n">on_bypass</span> <span class="o">=</span> <span class="n">event</span><span class="o">.</span><span class="n">Event</span><span class="p">(</span><span class="s">&quot;This event is called when a zone is bypassed. </span><span class="se">\n\n\n\n</span><span class="s">**Callback definition:** *def callback(device, status)*&quot;</span><span class="p">)</span>
<span class="n">on_boot</span> <span class="o">=</span> <span class="n">event</span><span class="o">.</span><span class="n">Event</span><span class="p">(</span><span class="s">&quot;This event is called when the device finishes booting.</span><span class="se">\n\n</span><span class="s">**Callback definition:** *def callback(device)*&quot;</span><span class="p">)</span>
@@ -142,7 +143,7 @@
<span class="sd"> :type device: Device</span>
<span class="sd"> &quot;&quot;&quot;</span>
<span class="bp">self</span><span class="o">.</span><span class="n">_device</span> <span class="o">=</span> <span class="n">device</span>
<span class="bp">self</span><span class="o">.</span><span class="n">_zonetracker</span> <span class="o">=</span> <span class="n">Zonetracker</span><span class="p">()</span>
<span class="bp">self</span><span class="o">.</span><span class="n">_zonetracker</span> <span class="o">=</span> <span class="n">Zonetracker</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span>

<span class="bp">self</span><span class="o">.</span><span class="n">_battery_timeout</span> <span class="o">=</span> <span class="n">AlarmDecoder</span><span class="o">.</span><span class="n">BATTERY_TIMEOUT</span>
<span class="bp">self</span><span class="o">.</span><span class="n">_fire_timeout</span> <span class="o">=</span> <span class="n">AlarmDecoder</span><span class="o">.</span><span class="n">FIRE_TIMEOUT</span>
@@ -154,6 +155,7 @@
<span class="bp">self</span><span class="o">.</span><span class="n">_battery_status</span> <span class="o">=</span> <span class="p">(</span><span class="bp">False</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span>
<span class="bp">self</span><span class="o">.</span><span class="n">_panic_status</span> <span class="o">=</span> <span class="bp">None</span>
<span class="bp">self</span><span class="o">.</span><span class="n">_relay_status</span> <span class="o">=</span> <span class="p">{}</span>
<span class="bp">self</span><span class="o">.</span><span class="n">_internal_address_mask</span> <span class="o">=</span> <span class="mh">0xFFFFFFFF</span>

<span class="bp">self</span><span class="o">.</span><span class="n">address</span> <span class="o">=</span> <span class="mi">18</span>
<span class="bp">self</span><span class="o">.</span><span class="n">configbits</span> <span class="o">=</span> <span class="mh">0xFF00</span>
@@ -224,6 +226,25 @@
<span class="sd"> :type value: int</span>
<span class="sd"> &quot;&quot;&quot;</span>
<span class="bp">self</span><span class="o">.</span><span class="n">_fire_timeout</span> <span class="o">=</span> <span class="n">value</span>
</div>
<span class="nd">@property</span>
<span class="k">def</span> <span class="nf">internal_address_mask</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
<span class="sd">&quot;&quot;&quot;</span>
<span class="sd"> Retrieves the address mask used for updating internal status.</span>

<span class="sd"> :returns: address mask</span>
<span class="sd"> &quot;&quot;&quot;</span>
<span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_internal_address_mask</span>

<span class="nd">@internal_address_mask.setter</span>
<div class="viewcode-block" id="AlarmDecoder.internal_address_mask"><a class="viewcode-back" href="../../alarmdecoder.html#alarmdecoder.decoder.AlarmDecoder.internal_address_mask">[docs]</a> <span class="k">def</span> <span class="nf">internal_address_mask</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">value</span><span class="p">):</span>
<span class="sd">&quot;&quot;&quot;</span>
<span class="sd"> Sets the address mask used internally for updating status.</span>

<span class="sd"> :param value: address mask</span>
<span class="sd"> :type value: int</span>
<span class="sd"> &quot;&quot;&quot;</span>
<span class="bp">self</span><span class="o">.</span><span class="n">_internal_address_mask</span> <span class="o">=</span> <span class="n">value</span>
</div>
<div class="viewcode-block" id="AlarmDecoder.open"><a class="viewcode-back" href="../../alarmdecoder.html#alarmdecoder.decoder.AlarmDecoder.open">[docs]</a> <span class="k">def</span> <span class="nf">open</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">baudrate</span><span class="o">=</span><span class="bp">None</span><span class="p">,</span> <span class="n">no_reader_thread</span><span class="o">=</span><span class="bp">False</span><span class="p">):</span>
<span class="sd">&quot;&quot;&quot;</span>
@@ -392,10 +413,10 @@
<span class="sd"> &quot;&quot;&quot;</span>
<span class="n">msg</span> <span class="o">=</span> <span class="n">Message</span><span class="p">(</span><span class="n">data</span><span class="p">)</span>

<span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">address_mask</span> <span class="o">&amp;</span> <span class="n">msg</span><span class="o">.</span><span class="n">mask</span> <span class="o">&gt;</span> <span class="mi">0</span><span class="p">:</span>
<span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_internal_address_mask</span> <span class="o">&amp;</span> <span class="n">msg</span><span class="o">.</span><span class="n">mask</span> <span class="o">&gt;</span> <span class="mi">0</span><span class="p">:</span>
<span class="bp">self</span><span class="o">.</span><span class="n">_update_internal_states</span><span class="p">(</span><span class="n">msg</span><span class="p">)</span>

<span class="bp">self</span><span class="o">.</span><span class="n">on_message</span><span class="p">(</span><span class="n">message</span><span class="o">=</span><span class="n">msg</span><span class="p">)</span>
<span class="bp">self</span><span class="o">.</span><span class="n">on_message</span><span class="p">(</span><span class="n">message</span><span class="o">=</span><span class="n">msg</span><span class="p">)</span>

<span class="k">return</span> <span class="n">msg</span>

@@ -551,7 +572,10 @@
<span class="bp">self</span><span class="o">.</span><span class="n">_alarm_status</span><span class="p">,</span> <span class="n">old_status</span> <span class="o">=</span> <span class="n">message</span><span class="o">.</span><span class="n">alarm_sounding</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">_alarm_status</span>

<span class="k">if</span> <span class="n">old_status</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span><span class="p">:</span>
<span class="bp">self</span><span class="o">.</span><span class="n">on_alarm</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_alarm_status</span><span class="p">)</span>
<span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_alarm_status</span><span class="p">:</span>
<span class="bp">self</span><span class="o">.</span><span class="n">on_alarm</span><span class="p">(</span><span class="n">zone</span><span class="o">=</span><span class="n">message</span><span class="o">.</span><span class="n">numeric_code</span><span class="p">)</span>
<span class="k">else</span><span class="p">:</span>
<span class="bp">self</span><span class="o">.</span><span class="n">on_alarm_restored</span><span class="p">(</span><span class="n">zone</span><span class="o">=</span><span class="n">message</span><span class="o">.</span><span class="n">numeric_code</span><span class="p">)</span>

<span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_alarm_status</span>

@@ -748,7 +772,7 @@
</div>
<div class="footer">
&copy; Copyright 2013, Nu Tech Software Solutions, Inc..
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.2b1.
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.2.2.
</div>
</body>
</html>

+ 80
- 16
docs/build/html/_modules/alarmdecoder/devices.html View File

@@ -64,19 +64,35 @@
<span class="sd">.. moduleauthor:: Scott Petersen &lt;scott@nutech.com&gt;</span>
<span class="sd">&quot;&quot;&quot;</span>

<span class="kn">import</span> <span class="nn">usb.core</span>
<span class="kn">import</span> <span class="nn">usb.util</span>
<span class="kn">import</span> <span class="nn">time</span>
<span class="kn">import</span> <span class="nn">threading</span>
<span class="kn">import</span> <span class="nn">serial</span>
<span class="kn">import</span> <span class="nn">serial.tools.list_ports</span>
<span class="kn">import</span> <span class="nn">socket</span>

<span class="kn">from</span> <span class="nn">OpenSSL</span> <span class="kn">import</span> <span class="n">SSL</span><span class="p">,</span> <span class="n">crypto</span>
<span class="kn">from</span> <span class="nn">pyftdi.pyftdi.ftdi</span> <span class="kn">import</span> <span class="n">Ftdi</span><span class="p">,</span> <span class="n">FtdiError</span>
<span class="kn">from</span> <span class="nn">.util</span> <span class="kn">import</span> <span class="n">CommError</span><span class="p">,</span> <span class="n">TimeoutError</span><span class="p">,</span> <span class="n">NoDeviceError</span><span class="p">,</span> <span class="n">InvalidMessageError</span>
<span class="kn">from</span> <span class="nn">.event</span> <span class="kn">import</span> <span class="n">event</span>

<span class="k">try</span><span class="p">:</span>
<span class="kn">from</span> <span class="nn">pyftdi.pyftdi.ftdi</span> <span class="kn">import</span> <span class="n">Ftdi</span><span class="p">,</span> <span class="n">FtdiError</span>
<span class="kn">import</span> <span class="nn">usb.core</span>
<span class="kn">import</span> <span class="nn">usb.util</span>

<span class="n">have_pyftdi</span> <span class="o">=</span> <span class="bp">True</span>

<span class="k">except</span> <span class="ne">ImportError</span><span class="p">:</span>
<span class="n">have_pyftdi</span> <span class="o">=</span> <span class="bp">False</span>

<span class="k">try</span><span class="p">:</span>
<span class="kn">from</span> <span class="nn">OpenSSL</span> <span class="kn">import</span> <span class="n">SSL</span><span class="p">,</span> <span class="n">crypto</span>

<span class="n">have_openssl</span> <span class="o">=</span> <span class="bp">True</span>

<span class="k">except</span> <span class="ne">ImportError</span><span class="p">:</span>
<span class="kn">from</span> <span class="nn">collections</span> <span class="kn">import</span> <span class="n">namedtuple</span>
<span class="n">SSL</span> <span class="o">=</span> <span class="n">namedtuple</span><span class="p">(</span><span class="s">&#39;SSL&#39;</span><span class="p">,</span> <span class="p">[</span><span class="s">&#39;Error&#39;</span><span class="p">,</span> <span class="s">&#39;WantReadError&#39;</span><span class="p">,</span> <span class="s">&#39;SysCallError&#39;</span><span class="p">])</span>
<span class="n">have_openssl</span> <span class="o">=</span> <span class="bp">False</span>


<div class="viewcode-block" id="Device"><a class="viewcode-back" href="../../alarmdecoder.html#alarmdecoder.devices.Device">[docs]</a><span class="k">class</span> <span class="nc">Device</span><span class="p">(</span><span class="nb">object</span><span class="p">):</span>
<span class="sd">&quot;&quot;&quot;</span>
@@ -97,7 +113,7 @@
<span class="bp">self</span><span class="o">.</span><span class="n">_buffer</span> <span class="o">=</span> <span class="s">&#39;&#39;</span>
<span class="bp">self</span><span class="o">.</span><span class="n">_device</span> <span class="o">=</span> <span class="bp">None</span>
<span class="bp">self</span><span class="o">.</span><span class="n">_running</span> <span class="o">=</span> <span class="bp">False</span>
<span class="bp">self</span><span class="o">.</span><span class="n">_read_thread</span> <span class="o">=</span> <span class="n">Device</span><span class="o">.</span><span class="n">ReadThread</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span>
<span class="bp">self</span><span class="o">.</span><span class="n">_read_thread</span> <span class="o">=</span> <span class="bp">None</span>

<span class="k">def</span> <span class="nf">__enter__</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
<span class="sd">&quot;&quot;&quot;</span>
@@ -219,10 +235,20 @@
<span class="sd"> &quot;&quot;&quot;</span>

<span class="c"># Constants</span>
<span class="n">FTDI_VENDOR_ID</span> <span class="o">=</span> <span class="mh">0x0403</span>
<span class="sd">&quot;&quot;&quot;Vendor ID used to recognize `AD2USB`_ devices.&quot;&quot;&quot;</span>
<span class="n">FTDI_PRODUCT_ID</span> <span class="o">=</span> <span class="mh">0x6001</span>
<span class="sd">&quot;&quot;&quot;Product ID used to recognize `AD2USB`_ devices.&quot;&quot;&quot;</span>
<span class="n">PRODUCT_IDS</span> <span class="o">=</span> <span class="p">((</span><span class="mh">0x0403</span><span class="p">,</span> <span class="mh">0x6001</span><span class="p">),</span> <span class="p">(</span><span class="mh">0x0403</span><span class="p">,</span> <span class="mh">0x6015</span><span class="p">))</span>
<span class="sd">&quot;&quot;&quot;List of Vendor and Product IDs used to recognize `AD2USB`_ devices.&quot;&quot;&quot;</span>
<span class="n">DEFAULT_VENDOR_ID</span> <span class="o">=</span> <span class="n">PRODUCT_IDS</span><span class="p">[</span><span class="mi">0</span><span class="p">][</span><span class="mi">0</span><span class="p">]</span>
<span class="sd">&quot;&quot;&quot;Default Vendor ID used to recognize `AD2USB`_ devices.&quot;&quot;&quot;</span>
<span class="n">DEFAULT_PRODUCT_ID</span> <span class="o">=</span> <span class="n">PRODUCT_IDS</span><span class="p">[</span><span class="mi">0</span><span class="p">][</span><span class="mi">1</span><span class="p">]</span>
<span class="sd">&quot;&quot;&quot;Default Product ID used to recognize `AD2USB`_ devices.&quot;&quot;&quot;</span>

<span class="c"># Deprecated constants</span>
<span class="n">FTDI_VENDOR_ID</span> <span class="o">=</span> <span class="n">DEFAULT_VENDOR_ID</span>
<span class="sd">&quot;&quot;&quot;DEPRECATED: Vendor ID used to recognize `AD2USB`_ devices.&quot;&quot;&quot;</span>
<span class="n">FTDI_PRODUCT_ID</span> <span class="o">=</span> <span class="n">DEFAULT_PRODUCT_ID</span>
<span class="sd">&quot;&quot;&quot;DEPRECATED: Product ID used to recognize `AD2USB`_ devices.&quot;&quot;&quot;</span>


<span class="n">BAUDRATE</span> <span class="o">=</span> <span class="mi">115200</span>
<span class="sd">&quot;&quot;&quot;Default baudrate for `AD2USB`_ devices.&quot;&quot;&quot;</span>

@@ -230,17 +256,24 @@
<span class="n">__detect_thread</span> <span class="o">=</span> <span class="bp">None</span>

<span class="nd">@classmethod</span>
<div class="viewcode-block" id="USBDevice.find_all"><a class="viewcode-back" href="../../alarmdecoder.html#alarmdecoder.devices.USBDevice.find_all">[docs]</a> <span class="k">def</span> <span class="nf">find_all</span><span class="p">(</span><span class="n">cls</span><span class="p">,</span> <span class="n">vid</span><span class="o">=</span><span class="n">FTDI_VENDOR_ID</span><span class="p">,</span> <span class="n">pid</span><span class="o">=</span><span class="n">FTDI_PRODUCT_ID</span><span class="p">):</span>
<div class="viewcode-block" id="USBDevice.find_all"><a class="viewcode-back" href="../../alarmdecoder.html#alarmdecoder.devices.USBDevice.find_all">[docs]</a> <span class="k">def</span> <span class="nf">find_all</span><span class="p">(</span><span class="n">cls</span><span class="p">,</span> <span class="n">vid</span><span class="o">=</span><span class="bp">None</span><span class="p">,</span> <span class="n">pid</span><span class="o">=</span><span class="bp">None</span><span class="p">):</span>
<span class="sd">&quot;&quot;&quot;</span>
<span class="sd"> Returns all FTDI devices matching our vendor and product IDs.</span>

<span class="sd"> :returns: list of devices</span>
<span class="sd"> :raises: :py:class:`~alarmdecoder.util.CommError`</span>
<span class="sd"> &quot;&quot;&quot;</span>
<span class="k">if</span> <span class="ow">not</span> <span class="n">have_pyftdi</span><span class="p">:</span>
<span class="k">raise</span> <span class="ne">ImportError</span><span class="p">(</span><span class="s">&#39;The USBDevice class has been disabled due to missing requirement: pyftdi or pyusb.&#39;</span><span class="p">)</span>

<span class="n">cls</span><span class="o">.</span><span class="n">__devices</span> <span class="o">=</span> <span class="p">[]</span>

<span class="n">query</span> <span class="o">=</span> <span class="n">cls</span><span class="o">.</span><span class="n">PRODUCT_IDS</span>
<span class="k">if</span> <span class="n">vid</span> <span class="ow">and</span> <span class="n">pid</span><span class="p">:</span>
<span class="n">query</span> <span class="o">=</span> <span class="p">[(</span><span class="n">vid</span><span class="p">,</span> <span class="n">pid</span><span class="p">)]</span>

<span class="k">try</span><span class="p">:</span>
<span class="n">cls</span><span class="o">.</span><span class="n">__devices</span> <span class="o">=</span> <span class="n">Ftdi</span><span class="o">.</span><span class="n">find_all</span><span class="p">([(</span><span class="n">vid</span><span class="p">,</span> <span class="n">pid</span><span class="p">)],</span> <span class="n">nocache</span><span class="o">=</span><span class="bp">True</span><span class="p">)</span>
<span class="n">cls</span><span class="o">.</span><span class="n">__devices</span> <span class="o">=</span> <span class="n">Ftdi</span><span class="o">.</span><span class="n">find_all</span><span class="p">(</span><span class="n">query</span><span class="p">,</span> <span class="n">nocache</span><span class="o">=</span><span class="bp">True</span><span class="p">)</span>

<span class="k">except</span> <span class="p">(</span><span class="n">usb</span><span class="o">.</span><span class="n">core</span><span class="o">.</span><span class="n">USBError</span><span class="p">,</span> <span class="n">FtdiError</span><span class="p">),</span> <span class="n">err</span><span class="p">:</span>
<span class="k">raise</span> <span class="n">CommError</span><span class="p">(</span><span class="s">&#39;Error enumerating AD2USB devices: {0}&#39;</span><span class="o">.</span><span class="n">format</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="n">err</span><span class="p">)),</span> <span class="n">err</span><span class="p">)</span>
@@ -269,6 +302,9 @@
<span class="sd"> :returns: :py:class:`USBDevice` object utilizing the specified device</span>
<span class="sd"> :raises: :py:class:`~alarmdecoder.util.NoDeviceError`</span>
<span class="sd"> &quot;&quot;&quot;</span>
<span class="k">if</span> <span class="ow">not</span> <span class="n">have_pyftdi</span><span class="p">:</span>
<span class="k">raise</span> <span class="ne">ImportError</span><span class="p">(</span><span class="s">&#39;The USBDevice class has been disabled due to missing requirement: pyftdi or pyusb.&#39;</span><span class="p">)</span>

<span class="n">cls</span><span class="o">.</span><span class="n">find_all</span><span class="p">()</span>

<span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">cls</span><span class="o">.</span><span class="n">__devices</span><span class="p">)</span> <span class="o">==</span> <span class="mi">0</span><span class="p">:</span>
@@ -279,7 +315,7 @@

<span class="n">vendor</span><span class="p">,</span> <span class="n">product</span><span class="p">,</span> <span class="n">sernum</span><span class="p">,</span> <span class="n">ifcount</span><span class="p">,</span> <span class="n">description</span> <span class="o">=</span> <span class="n">device</span>

<span class="k">return</span> <span class="n">USBDevice</span><span class="p">(</span><span class="n">interface</span><span class="o">=</span><span class="n">sernum</span><span class="p">)</span>
<span class="k">return</span> <span class="n">USBDevice</span><span class="p">(</span><span class="n">interface</span><span class="o">=</span><span class="n">sernum</span><span class="p">,</span> <span class="n">vid</span><span class="o">=</span><span class="n">vendor</span><span class="p">,</span> <span class="n">pid</span><span class="o">=</span><span class="n">product</span><span class="p">)</span>
</div>
<span class="nd">@classmethod</span>
<div class="viewcode-block" id="USBDevice.start_detection"><a class="viewcode-back" href="../../alarmdecoder.html#alarmdecoder.devices.USBDevice.start_detection">[docs]</a> <span class="k">def</span> <span class="nf">start_detection</span><span class="p">(</span><span class="n">cls</span><span class="p">,</span> <span class="n">on_attached</span><span class="o">=</span><span class="bp">None</span><span class="p">,</span> <span class="n">on_detached</span><span class="o">=</span><span class="bp">None</span><span class="p">):</span>
@@ -292,6 +328,9 @@

<span class="sd"> :type on_detached: function</span>
<span class="sd"> &quot;&quot;&quot;</span>
<span class="k">if</span> <span class="ow">not</span> <span class="n">have_pyftdi</span><span class="p">:</span>
<span class="k">raise</span> <span class="ne">ImportError</span><span class="p">(</span><span class="s">&#39;The USBDevice class has been disabled due to missing requirement: pyftdi or pyusb.&#39;</span><span class="p">)</span>

<span class="n">cls</span><span class="o">.</span><span class="n">__detect_thread</span> <span class="o">=</span> <span class="n">USBDevice</span><span class="o">.</span><span class="n">DetectThread</span><span class="p">(</span><span class="n">on_attached</span><span class="p">,</span> <span class="n">on_detached</span><span class="p">)</span>

<span class="k">try</span><span class="p">:</span>
@@ -306,6 +345,9 @@
<span class="sd">&quot;&quot;&quot;</span>
<span class="sd"> Stops the device detection thread.</span>
<span class="sd"> &quot;&quot;&quot;</span>
<span class="k">if</span> <span class="ow">not</span> <span class="n">have_pyftdi</span><span class="p">:</span>
<span class="k">raise</span> <span class="ne">ImportError</span><span class="p">(</span><span class="s">&#39;The USBDevice class has been disabled due to missing requirement: pyftdi or pyusb.&#39;</span><span class="p">)</span>

<span class="k">try</span><span class="p">:</span>
<span class="n">cls</span><span class="o">.</span><span class="n">__detect_thread</span><span class="o">.</span><span class="n">stop</span><span class="p">()</span>

@@ -374,7 +416,7 @@
<span class="sd"> &quot;&quot;&quot;</span>
<span class="bp">self</span><span class="o">.</span><span class="n">_description</span> <span class="o">=</span> <span class="n">value</span>
</div>
<span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">interface</span><span class="o">=</span><span class="mi">0</span><span class="p">):</span>
<span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">interface</span><span class="o">=</span><span class="mi">0</span><span class="p">,</span> <span class="n">vid</span><span class="o">=</span><span class="bp">None</span><span class="p">,</span> <span class="n">pid</span><span class="o">=</span><span class="bp">None</span><span class="p">):</span>
<span class="sd">&quot;&quot;&quot;</span>
<span class="sd"> Constructor</span>

@@ -382,6 +424,9 @@
<span class="sd"> index.</span>
<span class="sd"> :type interface: string or int</span>
<span class="sd"> &quot;&quot;&quot;</span>
<span class="k">if</span> <span class="ow">not</span> <span class="n">have_pyftdi</span><span class="p">:</span>
<span class="k">raise</span> <span class="ne">ImportError</span><span class="p">(</span><span class="s">&#39;The USBDevice class has been disabled due to missing requirement: pyftdi or pyusb.&#39;</span><span class="p">)</span>

<span class="n">Device</span><span class="o">.</span><span class="n">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span>

<span class="bp">self</span><span class="o">.</span><span class="n">_device</span> <span class="o">=</span> <span class="n">Ftdi</span><span class="p">()</span>
@@ -389,8 +434,15 @@
<span class="bp">self</span><span class="o">.</span><span class="n">_interface</span> <span class="o">=</span> <span class="mi">0</span>
<span class="bp">self</span><span class="o">.</span><span class="n">_device_number</span> <span class="o">=</span> <span class="mi">0</span>
<span class="bp">self</span><span class="o">.</span><span class="n">_serial_number</span> <span class="o">=</span> <span class="bp">None</span>
<span class="bp">self</span><span class="o">.</span><span class="n">_vendor_id</span> <span class="o">=</span> <span class="n">USBDevice</span><span class="o">.</span><span class="n">FTDI_VENDOR_ID</span>
<span class="bp">self</span><span class="o">.</span><span class="n">_product_id</span> <span class="o">=</span> <span class="n">USBDevice</span><span class="o">.</span><span class="n">FTDI_PRODUCT_ID</span>

<span class="bp">self</span><span class="o">.</span><span class="n">_vendor_id</span> <span class="o">=</span> <span class="n">USBDevice</span><span class="o">.</span><span class="n">DEFAULT_VENDOR_ID</span>
<span class="k">if</span> <span class="n">vid</span><span class="p">:</span>
<span class="bp">self</span><span class="o">.</span><span class="n">_vendor_id</span> <span class="o">=</span> <span class="n">vid</span>

<span class="bp">self</span><span class="o">.</span><span class="n">_product_id</span> <span class="o">=</span> <span class="n">USBDevice</span><span class="o">.</span><span class="n">DEFAULT_PRODUCT_ID</span>
<span class="k">if</span> <span class="n">pid</span><span class="p">:</span>
<span class="bp">self</span><span class="o">.</span><span class="n">_product_id</span> <span class="o">=</span> <span class="n">pid</span>

<span class="bp">self</span><span class="o">.</span><span class="n">_endpoint</span> <span class="o">=</span> <span class="mi">0</span>
<span class="bp">self</span><span class="o">.</span><span class="n">_description</span> <span class="o">=</span> <span class="bp">None</span>

@@ -412,6 +464,8 @@
<span class="k">if</span> <span class="n">baudrate</span> <span class="ow">is</span> <span class="bp">None</span><span class="p">:</span>
<span class="n">baudrate</span> <span class="o">=</span> <span class="n">USBDevice</span><span class="o">.</span><span class="n">BAUDRATE</span>

<span class="bp">self</span><span class="o">.</span><span class="n">_read_thread</span> <span class="o">=</span> <span class="n">Device</span><span class="o">.</span><span class="n">ReadThread</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span>

<span class="c"># Open the device and start up the thread.</span>
<span class="k">try</span><span class="p">:</span>
<span class="bp">self</span><span class="o">.</span><span class="n">_device</span><span class="o">.</span><span class="n">open</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_vendor_id</span><span class="p">,</span>
@@ -431,6 +485,9 @@
<span class="k">except</span> <span class="p">(</span><span class="n">usb</span><span class="o">.</span><span class="n">core</span><span class="o">.</span><span class="n">USBError</span><span class="p">,</span> <span class="n">FtdiError</span><span class="p">),</span> <span class="n">err</span><span class="p">:</span>
<span class="k">raise</span> <span class="n">NoDeviceError</span><span class="p">(</span><span class="s">&#39;Error opening device: {0}&#39;</span><span class="o">.</span><span class="n">format</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="n">err</span><span class="p">)),</span> <span class="n">err</span><span class="p">)</span>

<span class="k">except</span> <span class="ne">KeyError</span><span class="p">,</span> <span class="n">err</span><span class="p">:</span>
<span class="k">raise</span> <span class="n">NoDeviceError</span><span class="p">(</span><span class="s">&#39;Unsupported device. ({0:04x}:{1:04x}) You probably need a newer version of pyftdi.&#39;</span><span class="o">.</span><span class="n">format</span><span class="p">(</span><span class="n">err</span><span class="p">[</span><span class="mi">0</span><span class="p">][</span><span class="mi">0</span><span class="p">],</span> <span class="n">err</span><span class="p">[</span><span class="mi">0</span><span class="p">][</span><span class="mi">1</span><span class="p">]))</span>

<span class="k">else</span><span class="p">:</span>
<span class="bp">self</span><span class="o">.</span><span class="n">_running</span> <span class="o">=</span> <span class="bp">True</span>
<span class="bp">self</span><span class="o">.</span><span class="n">on_open</span><span class="p">()</span>
@@ -702,6 +759,8 @@
<span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_port</span> <span class="ow">is</span> <span class="bp">None</span><span class="p">:</span>
<span class="k">raise</span> <span class="n">NoDeviceError</span><span class="p">(</span><span class="s">&#39;No device interface specified.&#39;</span><span class="p">)</span>

<span class="bp">self</span><span class="o">.</span><span class="n">_read_thread</span> <span class="o">=</span> <span class="n">Device</span><span class="o">.</span><span class="n">ReadThread</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span>

<span class="c"># Open the device and start up the reader thread.</span>
<span class="k">try</span><span class="p">:</span>
<span class="bp">self</span><span class="o">.</span><span class="n">_device</span><span class="o">.</span><span class="n">port</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_port</span>
@@ -971,6 +1030,8 @@
<span class="sd"> &quot;&quot;&quot;</span>

<span class="k">try</span><span class="p">:</span>
<span class="bp">self</span><span class="o">.</span><span class="n">_read_thread</span> <span class="o">=</span> <span class="n">Device</span><span class="o">.</span><span class="n">ReadThread</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span>

<span class="bp">self</span><span class="o">.</span><span class="n">_device</span> <span class="o">=</span> <span class="n">socket</span><span class="o">.</span><span class="n">socket</span><span class="p">(</span><span class="n">socket</span><span class="o">.</span><span class="n">AF_INET</span><span class="p">,</span> <span class="n">socket</span><span class="o">.</span><span class="n">SOCK_STREAM</span><span class="p">)</span>

<span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_use_ssl</span><span class="p">:</span>
@@ -1139,6 +1200,9 @@
<span class="sd"> :raises: :py:class:`~alarmdecoder.util.CommError`</span>
<span class="sd"> &quot;&quot;&quot;</span>

<span class="k">if</span> <span class="ow">not</span> <span class="n">have_openssl</span><span class="p">:</span>
<span class="k">raise</span> <span class="ne">ImportError</span><span class="p">(</span><span class="s">&#39;SSL sockets have been disabled due to missing requirement: pyopenssl.&#39;</span><span class="p">)</span>

<span class="k">try</span><span class="p">:</span>
<span class="n">ctx</span> <span class="o">=</span> <span class="n">SSL</span><span class="o">.</span><span class="n">Context</span><span class="p">(</span><span class="n">SSL</span><span class="o">.</span><span class="n">TLSv1_METHOD</span><span class="p">)</span>

@@ -1209,7 +1273,7 @@
</div>
<div class="footer">
&copy; Copyright 2013, Nu Tech Software Solutions, Inc..
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.2b1.
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.2.2.
</div>
</body>
</html>

+ 1
- 1
docs/build/html/_modules/alarmdecoder/event/event.html View File

@@ -170,7 +170,7 @@
</div>
<div class="footer">
&copy; Copyright 2013, Nu Tech Software Solutions, Inc..
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.2b1.
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.2.2.
</div>
</body>
</html>

+ 3
- 4
docs/build/html/_modules/alarmdecoder/messages.html View File

@@ -216,13 +216,12 @@
<span class="bp">self</span><span class="o">.</span><span class="n">panel_type</span> <span class="o">=</span> <span class="n">PANEL_TYPES</span><span class="p">[</span><span class="bp">self</span><span class="o">.</span><span class="n">bitfield</span><span class="p">[</span><span class="mi">18</span><span class="p">]]</span>
<span class="c"># pos 20-21 - Unused.</span>
<span class="bp">self</span><span class="o">.</span><span class="n">text</span> <span class="o">=</span> <span class="n">alpha</span><span class="o">.</span><span class="n">strip</span><span class="p">(</span><span class="s">&#39;&quot;&#39;</span><span class="p">)</span>
<span class="bp">self</span><span class="o">.</span><span class="n">mask</span> <span class="o">=</span> <span class="nb">int</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">panel_data</span><span class="p">[</span><span class="mi">3</span><span class="p">:</span><span class="mi">3</span><span class="o">+</span><span class="mi">8</span><span class="p">],</span> <span class="mi">16</span><span class="p">)</span>

<span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">panel_type</span> <span class="o">==</span> <span class="n">ADEMCO</span><span class="p">:</span>
<span class="bp">self</span><span class="o">.</span><span class="n">mask</span> <span class="o">=</span> <span class="nb">int</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">panel_data</span><span class="p">[</span><span class="mi">3</span><span class="p">:</span><span class="mi">3</span><span class="o">+</span><span class="mi">8</span><span class="p">],</span> <span class="mi">16</span><span class="p">)</span>

<span class="k">if</span> <span class="nb">int</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">panel_data</span><span class="p">[</span><span class="mi">19</span><span class="p">:</span><span class="mi">21</span><span class="p">],</span> <span class="mi">16</span><span class="p">)</span> <span class="o">&amp;</span> <span class="mh">0x01</span> <span class="o">&gt;</span> <span class="mi">0</span><span class="p">:</span>
<span class="c"># Current cursor location on the alpha display.</span>
<span class="bp">self</span><span class="o">.</span><span class="n">cursor_location</span> <span class="o">=</span> <span class="nb">int</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">bitfield</span><span class="p">[</span><span class="mi">21</span><span class="p">:</span><span class="mi">23</span><span class="p">],</span> <span class="mi">16</span><span class="p">)</span>
<span class="bp">self</span><span class="o">.</span><span class="n">cursor_location</span> <span class="o">=</span> <span class="nb">int</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">panel_data</span><span class="p">[</span><span class="mi">21</span><span class="p">:</span><span class="mi">23</span><span class="p">],</span> <span class="mi">16</span><span class="p">)</span>

<div class="viewcode-block" id="Message.dict"><a class="viewcode-back" href="../../alarmdecoder.html#alarmdecoder.messages.Message.dict">[docs]</a> <span class="k">def</span> <span class="nf">dict</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">):</span>
<span class="sd">&quot;&quot;&quot;</span>
@@ -492,7 +491,7 @@
</div>
<div class="footer">
&copy; Copyright 2013, Nu Tech Software Solutions, Inc..
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.2b1.
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.2.2.
</div>
</body>
</html>

+ 1
- 1
docs/build/html/_modules/alarmdecoder/util.html View File

@@ -243,7 +243,7 @@
</div>
<div class="footer">
&copy; Copyright 2013, Nu Tech Software Solutions, Inc..
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.2b1.
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.2.2.
</div>
</body>
</html>

+ 42
- 19
docs/build/html/_modules/alarmdecoder/zonetracking.html View File

@@ -60,6 +60,7 @@

<span class="kn">from</span> <span class="nn">.event</span> <span class="kn">import</span> <span class="n">event</span>
<span class="kn">from</span> <span class="nn">.messages</span> <span class="kn">import</span> <span class="n">ExpanderMessage</span>
<span class="kn">from</span> <span class="nn">.panels</span> <span class="kn">import</span> <span class="n">ADEMCO</span><span class="p">,</span> <span class="n">DSC</span>


<div class="viewcode-block" id="Zone"><a class="viewcode-back" href="../../alarmdecoder.html#alarmdecoder.zonetracking.Zone">[docs]</a><span class="k">class</span> <span class="nc">Zone</span><span class="p">(</span><span class="nb">object</span><span class="p">):</span>
@@ -86,8 +87,10 @@
<span class="sd">&quot;&quot;&quot;Zone status&quot;&quot;&quot;</span>
<span class="n">timestamp</span> <span class="o">=</span> <span class="bp">None</span>
<span class="sd">&quot;&quot;&quot;Timestamp of last update&quot;&quot;&quot;</span>
<span class="n">expander</span> <span class="o">=</span> <span class="bp">False</span>
<span class="sd">&quot;&quot;&quot;Does this zone exist on an expander?&quot;&quot;&quot;</span>

<span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">zone</span><span class="o">=</span><span class="mi">0</span><span class="p">,</span> <span class="n">name</span><span class="o">=</span><span class="s">&#39;&#39;</span><span class="p">,</span> <span class="n">status</span><span class="o">=</span><span class="n">CLEAR</span><span class="p">):</span>
<span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">zone</span><span class="o">=</span><span class="mi">0</span><span class="p">,</span> <span class="n">name</span><span class="o">=</span><span class="s">&#39;&#39;</span><span class="p">,</span> <span class="n">status</span><span class="o">=</span><span class="n">CLEAR</span><span class="p">,</span> <span class="n">expander</span><span class="o">=</span><span class="bp">False</span><span class="p">):</span>
<span class="sd">&quot;&quot;&quot;</span>
<span class="sd"> Constructor</span>

@@ -102,6 +105,7 @@
<span class="bp">self</span><span class="o">.</span><span class="n">name</span> <span class="o">=</span> <span class="n">name</span>
<span class="bp">self</span><span class="o">.</span><span class="n">status</span> <span class="o">=</span> <span class="n">status</span>
<span class="bp">self</span><span class="o">.</span><span class="n">timestamp</span> <span class="o">=</span> <span class="n">time</span><span class="o">.</span><span class="n">time</span><span class="p">()</span>
<span class="bp">self</span><span class="o">.</span><span class="n">expander</span> <span class="o">=</span> <span class="n">expander</span>

<span class="k">def</span> <span class="nf">__str__</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
<span class="sd">&quot;&quot;&quot;</span>
@@ -165,7 +169,7 @@
<span class="sd"> &quot;&quot;&quot;</span>
<span class="bp">self</span><span class="o">.</span><span class="n">_zones_faulted</span> <span class="o">=</span> <span class="n">value</span>
</div>
<span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
<span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">alarmdecoder_object</span><span class="p">):</span>
<span class="sd">&quot;&quot;&quot;</span>
<span class="sd"> Constructor</span>
<span class="sd"> &quot;&quot;&quot;</span>
@@ -173,6 +177,8 @@
<span class="bp">self</span><span class="o">.</span><span class="n">_zones_faulted</span> <span class="o">=</span> <span class="p">[]</span>
<span class="bp">self</span><span class="o">.</span><span class="n">_last_zone_fault</span> <span class="o">=</span> <span class="mi">0</span>

<span class="bp">self</span><span class="o">.</span><span class="n">alarmdecoder_object</span> <span class="o">=</span> <span class="n">alarmdecoder_object</span>

<div class="viewcode-block" id="Zonetracker.update"><a class="viewcode-back" href="../../alarmdecoder.html#alarmdecoder.zonetracking.Zonetracker.update">[docs]</a> <span class="k">def</span> <span class="nf">update</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">message</span><span class="p">):</span>
<span class="sd">&quot;&quot;&quot;</span>
<span class="sd"> Update zone statuses based on the current message.</span>
@@ -181,9 +187,12 @@
<span class="sd"> :type message: :py:class:`~alarmdecoder.messages.Message` or :py:class:`~alarmdecoder.messages.ExpanderMessage`</span>
<span class="sd"> &quot;&quot;&quot;</span>
<span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">message</span><span class="p">,</span> <span class="n">ExpanderMessage</span><span class="p">):</span>
<span class="n">zone</span> <span class="o">=</span> <span class="o">-</span><span class="mi">1</span>

<span class="k">if</span> <span class="n">message</span><span class="o">.</span><span class="n">type</span> <span class="o">==</span> <span class="n">ExpanderMessage</span><span class="o">.</span><span class="n">ZONE</span><span class="p">:</span>
<span class="n">zone</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expander_to_zone</span><span class="p">(</span><span class="n">message</span><span class="o">.</span><span class="n">address</span><span class="p">,</span> <span class="n">message</span><span class="o">.</span><span class="n">channel</span><span class="p">)</span>
<span class="n">zone</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expander_to_zone</span><span class="p">(</span><span class="n">message</span><span class="o">.</span><span class="n">address</span><span class="p">,</span> <span class="n">message</span><span class="o">.</span><span class="n">channel</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">alarmdecoder_object</span><span class="o">.</span><span class="n">mode</span><span class="p">)</span>

<span class="k">if</span> <span class="n">zone</span> <span class="o">!=</span> <span class="o">-</span><span class="mi">1</span><span class="p">:</span>
<span class="n">status</span> <span class="o">=</span> <span class="n">Zone</span><span class="o">.</span><span class="n">CLEAR</span>
<span class="k">if</span> <span class="n">message</span><span class="o">.</span><span class="n">value</span> <span class="o">==</span> <span class="mi">1</span><span class="p">:</span>
<span class="n">status</span> <span class="o">=</span> <span class="n">Zone</span><span class="o">.</span><span class="n">FAULT</span>
@@ -198,7 +207,7 @@
<span class="bp">self</span><span class="o">.</span><span class="n">_update_zone</span><span class="p">(</span><span class="n">zone</span><span class="p">,</span> <span class="n">status</span><span class="o">=</span><span class="n">status</span><span class="p">)</span>

<span class="k">except</span> <span class="ne">IndexError</span><span class="p">:</span>
<span class="bp">self</span><span class="o">.</span><span class="n">_add_zone</span><span class="p">(</span><span class="n">zone</span><span class="p">,</span> <span class="n">status</span><span class="o">=</span><span class="n">status</span><span class="p">)</span>
<span class="bp">self</span><span class="o">.</span><span class="n">_add_zone</span><span class="p">(</span><span class="n">zone</span><span class="p">,</span> <span class="n">status</span><span class="o">=</span><span class="n">status</span><span class="p">,</span> <span class="n">expander</span><span class="o">=</span><span class="bp">True</span><span class="p">)</span>

<span class="k">else</span><span class="p">:</span>
<span class="c"># Panel is ready, restore all zones.</span>
@@ -207,14 +216,17 @@
<span class="c"># multiple partitions. In it&#39;s current state a ready on</span>
<span class="c"># partition #1 will end up clearing all zones, even if they</span>
<span class="c"># exist elsewhere and it shouldn&#39;t.</span>
<span class="k">if</span> <span class="n">message</span><span class="o">.</span><span class="n">ready</span><span class="p">:</span>
<span class="c">#</span>
<span class="c"># NOTE: SYSTEM messages provide inconsistent ready statuses. This</span>
<span class="c"># may need to be extended later for other panels.</span>
<span class="k">if</span> <span class="n">message</span><span class="o">.</span><span class="n">ready</span> <span class="ow">and</span> <span class="ow">not</span> <span class="n">message</span><span class="o">.</span><span class="n">text</span><span class="o">.</span><span class="n">startswith</span><span class="p">(</span><span class="s">&quot;SYSTEM&quot;</span><span class="p">):</span>
<span class="k">for</span> <span class="n">zone</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">_zones_faulted</span><span class="p">:</span>
<span class="bp">self</span><span class="o">.</span><span class="n">_update_zone</span><span class="p">(</span><span class="n">zone</span><span class="p">,</span> <span class="n">Zone</span><span class="o">.</span><span class="n">CLEAR</span><span class="p">)</span>

<span class="bp">self</span><span class="o">.</span><span class="n">_last_zone_fault</span> <span class="o">=</span> <span class="mi">0</span>

<span class="c"># Process fault</span>
<span class="k">elif</span> <span class="s">&quot;FAULT&quot;</span> <span class="ow">in</span> <span class="n">message</span><span class="o">.</span><span class="n">text</span> <span class="ow">or</span> <span class="n">message</span><span class="o">.</span><span class="n">check_zone</span><span class="p">:</span>
<span class="k">elif</span> <span class="n">message</span><span class="o">.</span><span class="n">check_zone</span> <span class="ow">or</span> <span class="n">message</span><span class="o">.</span><span class="n">text</span><span class="o">.</span><span class="n">startswith</span><span class="p">(</span><span class="s">&quot;FAULT&quot;</span><span class="p">):</span>
<span class="c"># Apparently this representation can be both base 10</span>
<span class="c"># or base 16, depending on where the message came</span>
<span class="c"># from.</span>
@@ -255,7 +267,7 @@

<span class="bp">self</span><span class="o">.</span><span class="n">_clear_expired_zones</span><span class="p">()</span>
</div>
<div class="viewcode-block" id="Zonetracker.expander_to_zone"><a class="viewcode-back" href="../../alarmdecoder.html#alarmdecoder.zonetracking.Zonetracker.expander_to_zone">[docs]</a> <span class="k">def</span> <span class="nf">expander_to_zone</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">address</span><span class="p">,</span> <span class="n">channel</span><span class="p">):</span>
<div class="viewcode-block" id="Zonetracker.expander_to_zone"><a class="viewcode-back" href="../../alarmdecoder.html#alarmdecoder.zonetracking.Zonetracker.expander_to_zone">[docs]</a> <span class="k">def</span> <span class="nf">expander_to_zone</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">address</span><span class="p">,</span> <span class="n">channel</span><span class="p">,</span> <span class="n">panel_type</span><span class="o">=</span><span class="n">ADEMCO</span><span class="p">):</span>
<span class="sd">&quot;&quot;&quot;</span>
<span class="sd"> Convert an address and channel into a zone number.</span>

@@ -267,12 +279,19 @@
<span class="sd"> :returns: zone number associated with an address and channel</span>
<span class="sd"> &quot;&quot;&quot;</span>

<span class="c"># TODO: This is going to need to be reworked to support the larger</span>
<span class="c"># panels without fixed addressing on the expanders.</span>
<span class="n">zone</span> <span class="o">=</span> <span class="o">-</span><span class="mi">1</span>

<span class="n">idx</span> <span class="o">=</span> <span class="n">address</span> <span class="o">-</span> <span class="mi">7</span> <span class="c"># Expanders start at address 7.</span>
<span class="k">if</span> <span class="n">panel_type</span> <span class="o">==</span> <span class="n">ADEMCO</span><span class="p">:</span>
<span class="c"># TODO: This is going to need to be reworked to support the larger</span>
<span class="c"># panels without fixed addressing on the expanders.</span>

<span class="k">return</span> <span class="n">address</span> <span class="o">+</span> <span class="n">channel</span> <span class="o">+</span> <span class="p">(</span><span class="n">idx</span> <span class="o">*</span> <span class="mi">7</span><span class="p">)</span> <span class="o">+</span> <span class="mi">1</span>
<span class="n">idx</span> <span class="o">=</span> <span class="n">address</span> <span class="o">-</span> <span class="mi">7</span> <span class="c"># Expanders start at address 7.</span>
<span class="n">zone</span> <span class="o">=</span> <span class="n">address</span> <span class="o">+</span> <span class="n">channel</span> <span class="o">+</span> <span class="p">(</span><span class="n">idx</span> <span class="o">*</span> <span class="mi">7</span><span class="p">)</span> <span class="o">+</span> <span class="mi">1</span>

<span class="k">elif</span> <span class="n">panel_type</span> <span class="o">==</span> <span class="n">DSC</span><span class="p">:</span>
<span class="n">zone</span> <span class="o">=</span> <span class="p">(</span><span class="n">address</span> <span class="o">*</span> <span class="mi">8</span><span class="p">)</span> <span class="o">+</span> <span class="n">channel</span>

<span class="k">return</span> <span class="n">zone</span>
</div>
<span class="k">def</span> <span class="nf">_clear_zones</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">zone</span><span class="p">):</span>
<span class="sd">&quot;&quot;&quot;</span>
@@ -347,7 +366,7 @@
<span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_zones</span><span class="p">[</span><span class="n">z</span><span class="p">]</span><span class="o">.</span><span class="n">status</span> <span class="o">!=</span> <span class="n">Zone</span><span class="o">.</span><span class="n">CLEAR</span> <span class="ow">and</span> <span class="bp">self</span><span class="o">.</span><span class="n">_zone_expired</span><span class="p">(</span><span class="n">z</span><span class="p">):</span>
<span class="bp">self</span><span class="o">.</span><span class="n">_update_zone</span><span class="p">(</span><span class="n">z</span><span class="p">,</span> <span class="n">Zone</span><span class="o">.</span><span class="n">CLEAR</span><span class="p">)</span>

<span class="k">def</span> <span class="nf">_add_zone</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">zone</span><span class="p">,</span> <span class="n">name</span><span class="o">=</span><span class="s">&#39;&#39;</span><span class="p">,</span> <span class="n">status</span><span class="o">=</span><span class="n">Zone</span><span class="o">.</span><span class="n">CLEAR</span><span class="p">):</span>
<span class="k">def</span> <span class="nf">_add_zone</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">zone</span><span class="p">,</span> <span class="n">name</span><span class="o">=</span><span class="s">&#39;&#39;</span><span class="p">,</span> <span class="n">status</span><span class="o">=</span><span class="n">Zone</span><span class="o">.</span><span class="n">CLEAR</span><span class="p">,</span> <span class="n">expander</span><span class="o">=</span><span class="bp">False</span><span class="p">):</span>
<span class="sd">&quot;&quot;&quot;</span>
<span class="sd"> Adds a zone to the internal zone list.</span>

@@ -359,10 +378,9 @@
<span class="sd"> :type status: int</span>
<span class="sd"> &quot;&quot;&quot;</span>
<span class="k">if</span> <span class="ow">not</span> <span class="n">zone</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">_zones</span><span class="p">:</span>
<span class="bp">self</span><span class="o">.</span><span class="n">_zones</span><span class="p">[</span><span class="n">zone</span><span class="p">]</span> <span class="o">=</span> <span class="n">Zone</span><span class="p">(</span><span class="n">zone</span><span class="o">=</span><span class="n">zone</span><span class="p">,</span> <span class="n">name</span><span class="o">=</span><span class="n">name</span><span class="p">,</span> <span class="n">status</span><span class="o">=</span><span class="n">status</span><span class="p">)</span>
<span class="bp">self</span><span class="o">.</span><span class="n">_zones</span><span class="p">[</span><span class="n">zone</span><span class="p">]</span> <span class="o">=</span> <span class="n">Zone</span><span class="p">(</span><span class="n">zone</span><span class="o">=</span><span class="n">zone</span><span class="p">,</span> <span class="n">name</span><span class="o">=</span><span class="n">name</span><span class="p">,</span> <span class="n">status</span><span class="o">=</span><span class="bp">None</span><span class="p">,</span> <span class="n">expander</span><span class="o">=</span><span class="n">expander</span><span class="p">)</span>

<span class="k">if</span> <span class="n">status</span> <span class="o">!=</span> <span class="n">Zone</span><span class="o">.</span><span class="n">CLEAR</span><span class="p">:</span>
<span class="bp">self</span><span class="o">.</span><span class="n">on_fault</span><span class="p">(</span><span class="n">zone</span><span class="o">=</span><span class="n">zone</span><span class="p">)</span>
<span class="bp">self</span><span class="o">.</span><span class="n">_update_zone</span><span class="p">(</span><span class="n">zone</span><span class="p">,</span> <span class="n">status</span><span class="o">=</span><span class="n">status</span><span class="p">)</span>

<span class="k">def</span> <span class="nf">_update_zone</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">zone</span><span class="p">,</span> <span class="n">status</span><span class="o">=</span><span class="bp">None</span><span class="p">):</span>
<span class="sd">&quot;&quot;&quot;</span>
@@ -378,9 +396,11 @@
<span class="k">if</span> <span class="ow">not</span> <span class="n">zone</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">_zones</span><span class="p">:</span>
<span class="k">raise</span> <span class="ne">IndexError</span><span class="p">(</span><span class="s">&#39;Zone does not exist and cannot be updated: </span><span class="si">%d</span><span class="s">&#39;</span><span class="p">,</span> <span class="n">zone</span><span class="p">)</span>

<span class="k">if</span> <span class="n">status</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span><span class="p">:</span>
<span class="bp">self</span><span class="o">.</span><span class="n">_zones</span><span class="p">[</span><span class="n">zone</span><span class="p">]</span><span class="o">.</span><span class="n">status</span> <span class="o">=</span> <span class="n">status</span>
<span class="n">old_status</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_zones</span><span class="p">[</span><span class="n">zone</span><span class="p">]</span><span class="o">.</span><span class="n">status</span>
<span class="k">if</span> <span class="n">status</span> <span class="ow">is</span> <span class="bp">None</span><span class="p">:</span>
<span class="n">status</span> <span class="o">=</span> <span class="n">old_status</span>

<span class="bp">self</span><span class="o">.</span><span class="n">_zones</span><span class="p">[</span><span class="n">zone</span><span class="p">]</span><span class="o">.</span><span class="n">status</span> <span class="o">=</span> <span class="n">status</span>
<span class="bp">self</span><span class="o">.</span><span class="n">_zones</span><span class="p">[</span><span class="n">zone</span><span class="p">]</span><span class="o">.</span><span class="n">timestamp</span> <span class="o">=</span> <span class="n">time</span><span class="o">.</span><span class="n">time</span><span class="p">()</span>

<span class="k">if</span> <span class="n">status</span> <span class="o">==</span> <span class="n">Zone</span><span class="o">.</span><span class="n">CLEAR</span><span class="p">:</span>
@@ -388,6 +408,9 @@
<span class="bp">self</span><span class="o">.</span><span class="n">_zones_faulted</span><span class="o">.</span><span class="n">remove</span><span class="p">(</span><span class="n">zone</span><span class="p">)</span>

<span class="bp">self</span><span class="o">.</span><span class="n">on_restore</span><span class="p">(</span><span class="n">zone</span><span class="o">=</span><span class="n">zone</span><span class="p">)</span>
<span class="k">else</span><span class="p">:</span>
<span class="k">if</span> <span class="n">old_status</span> <span class="o">!=</span> <span class="n">status</span> <span class="ow">and</span> <span class="n">status</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span><span class="p">:</span>
<span class="bp">self</span><span class="o">.</span><span class="n">on_fault</span><span class="p">(</span><span class="n">zone</span><span class="o">=</span><span class="n">zone</span><span class="p">)</span>

<span class="k">def</span> <span class="nf">_zone_expired</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">zone</span><span class="p">):</span>
<span class="sd">&quot;&quot;&quot;</span>
@@ -398,7 +421,7 @@

<span class="sd"> :returns: whether or not the zone is expired</span>
<span class="sd"> &quot;&quot;&quot;</span>
<span class="k">return</span> <span class="n">time</span><span class="o">.</span><span class="n">time</span><span class="p">()</span> <span class="o">&gt;</span> <span class="bp">self</span><span class="o">.</span><span class="n">_zones</span><span class="p">[</span><span class="n">zone</span><span class="p">]</span><span class="o">.</span><span class="n">timestamp</span> <span class="o">+</span> <span class="n">Zonetracker</span><span class="o">.</span><span class="n">EXPIRE</span></div>
<span class="k">return</span> <span class="p">(</span><span class="n">time</span><span class="o">.</span><span class="n">time</span><span class="p">()</span> <span class="o">&gt;</span> <span class="bp">self</span><span class="o">.</span><span class="n">_zones</span><span class="p">[</span><span class="n">zone</span><span class="p">]</span><span class="o">.</span><span class="n">timestamp</span> <span class="o">+</span> <span class="n">Zonetracker</span><span class="o">.</span><span class="n">EXPIRE</span><span class="p">)</span> <span class="ow">and</span> <span class="bp">self</span><span class="o">.</span><span class="n">_zones</span><span class="p">[</span><span class="n">zone</span><span class="p">]</span><span class="o">.</span><span class="n">expander</span> <span class="ow">is</span> <span class="bp">False</span></div>
</pre></div>

</div>
@@ -438,7 +461,7 @@
</div>
<div class="footer">
&copy; Copyright 2013, Nu Tech Software Solutions, Inc..
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.2b1.
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.2.2.
</div>
</body>
</html>

+ 1
- 1
docs/build/html/_modules/index.html View File

@@ -89,7 +89,7 @@
</div>
<div class="footer">
&copy; Copyright 2013, Nu Tech Software Solutions, Inc..
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.2b1.
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.2.2.
</div>
</body>
</html>

+ 2
- 5
docs/build/html/_static/basic.css View File

@@ -4,7 +4,7 @@
*
* Sphinx stylesheet -- basic theme.
*
* :copyright: Copyright 2007-2013 by the Sphinx team, see AUTHORS.
* :copyright: Copyright 2007-2014 by the Sphinx team, see AUTHORS.
* :license: BSD, see LICENSE for details.
*
*/
@@ -89,6 +89,7 @@ div.sphinxsidebar #searchbox input[type="submit"] {

img {
border: 0;
max-width: 100%;
}

/* -- search page ----------------------------------------------------------- */
@@ -401,10 +402,6 @@ dl.glossary dt {
margin: 0;
}

.refcount {
color: #060;
}

.optional {
font-size: 1.3em;
}


+ 1
- 1
docs/build/html/_static/default.css View File

@@ -4,7 +4,7 @@
*
* Sphinx stylesheet -- default theme.
*
* :copyright: Copyright 2007-2013 by the Sphinx team, see AUTHORS.
* :copyright: Copyright 2007-2014 by the Sphinx team, see AUTHORS.
* :license: BSD, see LICENSE for details.
*
*/


+ 4
- 1
docs/build/html/_static/doctools.js View File

@@ -4,7 +4,7 @@
*
* Sphinx JavaScript utilities for all documentation.
*
* :copyright: Copyright 2007-2013 by the Sphinx team, see AUTHORS.
* :copyright: Copyright 2007-2014 by the Sphinx team, see AUTHORS.
* :license: BSD, see LICENSE for details.
*
*/
@@ -168,6 +168,9 @@ var Documentation = {
var terms = (params.highlight) ? params.highlight[0].split(/\s+/) : [];
if (terms.length) {
var body = $('div.body');
if (!body.length) {
body = $('body');
}
window.setTimeout(function() {
$.each(terms, function() {
body.highlightText(this.toLowerCase(), 'highlighted');


+ 2
- 4
docs/build/html/_static/jquery.js
File diff suppressed because it is too large
View File


+ 4
- 4
docs/build/html/_static/searchtools.js View File

@@ -4,7 +4,7 @@
*
* Sphinx JavaScript utilties for the full-text search.
*
* :copyright: Copyright 2007-2013 by the Sphinx team, see AUTHORS.
* :copyright: Copyright 2007-2014 by the Sphinx team, see AUTHORS.
* :license: BSD, see LICENSE for details.
*
*/
@@ -330,13 +330,13 @@ var Search = {
objectterms.push(tmp[i].toLowerCase());
}

if ($u.indexOf(stopwords, tmp[i]) != -1 || tmp[i].match(/^\d+$/) ||
if ($u.indexOf(stopwords, tmp[i].toLowerCase()) != -1 || tmp[i].match(/^\d+$/) ||
tmp[i] === "") {
// skip this "word"
continue;
}
// stem the word
var word = stemmer.stemWord(tmp[i]).toLowerCase();
var word = stemmer.stemWord(tmp[i].toLowerCase());
var toAppend;
// select the correct list
if (word[0] == '-') {
@@ -550,7 +550,7 @@ var Search = {
for (i = 0; i < searchterms.length; i++) {
var word = searchterms[i];
// no match but word was a required one
if (!(files = terms[word]))
if ((files = terms[word]) === undefined)
break;
if (files.length === undefined) {
files = [files];


+ 2
- 2
docs/build/html/_static/sidebar.js View File

@@ -16,7 +16,7 @@
* Once the browser is closed the cookie is deleted and the position
* reset to the default (expanded).
*
* :copyright: Copyright 2007-2013 by the Sphinx team, see AUTHORS.
* :copyright: Copyright 2007-2014 by the Sphinx team, see AUTHORS.
* :license: BSD, see LICENSE for details.
*
*/
@@ -142,7 +142,7 @@ $(function() {
var items = document.cookie.split(';');
for(var k=0; k<items.length; k++) {
var key_val = items[k].split('=');
var key = key_val[0];
var key = key_val[0].replace(/ /, ""); // strip leading spaces
if (key == 'sidebar') {
var value = key_val[1];
if ((value == 'collapsed') && (!sidebar_is_collapsed()))


+ 1
- 1
docs/build/html/_static/websupport.js View File

@@ -4,7 +4,7 @@
*
* sphinx.websupport utilties for all documentation.
*
* :copyright: Copyright 2007-2013 by the Sphinx team, see AUTHORS.
* :copyright: Copyright 2007-2014 by the Sphinx team, see AUTHORS.
* :license: BSD, see LICENSE for details.
*
*/


+ 1
- 1
docs/build/html/alarmdecoder.event.html View File

@@ -140,7 +140,7 @@ e.fire(<a href="#id6"><span class="problematic" id="id7">*</span></a>args, <a hr
</div>
<div class="footer">
&copy; Copyright 2013, Nu Tech Software Solutions, Inc..
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.2b1.
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.2.2.
</div>
</body>
</html>

+ 40
- 20
docs/build/html/alarmdecoder.html View File

@@ -351,6 +351,20 @@
</table>
</dd></dl>

<dl class="attribute">
<dt id="alarmdecoder.decoder.AlarmDecoder.internal_address_mask">
<tt class="descname">internal_address_mask</tt><a class="reference internal" href="_modules/alarmdecoder/decoder.html#AlarmDecoder.internal_address_mask"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#alarmdecoder.decoder.AlarmDecoder.internal_address_mask" title="Permalink to this definition">¶</a></dt>
<dd><p>Retrieves the address mask used for updating internal status.</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">Returns:</th><td class="field-body">address mask</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="method">
<dt id="alarmdecoder.decoder.AlarmDecoder.open">
<tt class="descname">open</tt><big>(</big><em>baudrate=None</em>, <em>no_reader_thread=False</em><big>)</big><a class="reference internal" href="_modules/alarmdecoder/decoder.html#AlarmDecoder.open"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#alarmdecoder.decoder.AlarmDecoder.open" title="Permalink to this definition">¶</a></dt>
@@ -603,7 +617,7 @@ Also supports SSL if using <a class="reference external" href="http://github.com
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">list of devices</td>
</tr>
<tr class="field-even field"><th class="field-name">Raises :</th><td class="field-body"><a class="reference internal" href="#alarmdecoder.util.CommError" title="alarmdecoder.util.CommError"><tt class="xref py py-class docutils literal"><span class="pre">CommError</span></tt></a></td>
<tr class="field-even field"><th class="field-name">Raises:</th><td class="field-body"><a class="reference internal" href="#alarmdecoder.util.CommError" title="alarmdecoder.util.CommError"><tt class="xref py py-class docutils literal"><span class="pre">CommError</span></tt></a></td>
</tr>
</tbody>
</table>
@@ -637,7 +651,7 @@ by find_all().</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><a class="reference internal" href="#alarmdecoder.devices.USBDevice" title="alarmdecoder.devices.USBDevice"><tt class="xref py py-class docutils literal"><span class="pre">USBDevice</span></tt></a> object utilizing the specified device</td>
</tr>
<tr class="field-odd field"><th class="field-name">Raises :</th><td class="field-body"><a class="reference internal" href="#alarmdecoder.util.NoDeviceError" title="alarmdecoder.util.NoDeviceError"><tt class="xref py py-class docutils literal"><span class="pre">NoDeviceError</span></tt></a></td>
<tr class="field-odd field"><th class="field-name">Raises:</th><td class="field-body"><a class="reference internal" href="#alarmdecoder.util.NoDeviceError" title="alarmdecoder.util.NoDeviceError"><tt class="xref py py-class docutils literal"><span class="pre">NoDeviceError</span></tt></a></td>
</tr>
</tbody>
</table>
@@ -724,7 +738,7 @@ reader thread.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Raises :</th><td class="field-body"><p class="first last"><a class="reference internal" href="#alarmdecoder.util.NoDeviceError" title="alarmdecoder.util.NoDeviceError"><tt class="xref py py-class docutils literal"><span class="pre">NoDeviceError</span></tt></a></p>
<tr class="field-even field"><th class="field-name">Raises:</th><td class="field-body"><p class="first last"><a class="reference internal" href="#alarmdecoder.util.NoDeviceError" title="alarmdecoder.util.NoDeviceError"><tt class="xref py py-class docutils literal"><span class="pre">NoDeviceError</span></tt></a></p>
</td>
</tr>
</tbody>
@@ -752,7 +766,7 @@ reader thread.</li>
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>data</strong> (<em>string</em>) &#8211; data to write</td>
</tr>
<tr class="field-even field"><th class="field-name">Raises :</th><td class="field-body"><a class="reference internal" href="#alarmdecoder.util.CommError" title="alarmdecoder.util.CommError"><tt class="xref py py-class docutils literal"><span class="pre">CommError</span></tt></a></td>
<tr class="field-even field"><th class="field-name">Raises:</th><td class="field-body"><a class="reference internal" href="#alarmdecoder.util.CommError" title="alarmdecoder.util.CommError"><tt class="xref py py-class docutils literal"><span class="pre">CommError</span></tt></a></td>
</tr>
</tbody>
</table>
@@ -768,7 +782,7 @@ reader thread.</li>
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">character read from the device</td>
</tr>
<tr class="field-even field"><th class="field-name">Raises :</th><td class="field-body"><a class="reference internal" href="#alarmdecoder.util.CommError" title="alarmdecoder.util.CommError"><tt class="xref py py-class docutils literal"><span class="pre">CommError</span></tt></a></td>
<tr class="field-even field"><th class="field-name">Raises:</th><td class="field-body"><a class="reference internal" href="#alarmdecoder.util.CommError" title="alarmdecoder.util.CommError"><tt class="xref py py-class docutils literal"><span class="pre">CommError</span></tt></a></td>
</tr>
</tbody>
</table>
@@ -792,7 +806,7 @@ reading.</li>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">line that was read</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Raises :</th><td class="field-body"><p class="first last"><a class="reference internal" href="#alarmdecoder.util.CommError" title="alarmdecoder.util.CommError"><tt class="xref py py-class docutils literal"><span class="pre">CommError</span></tt></a>, <a class="reference internal" href="#alarmdecoder.util.TimeoutError" title="alarmdecoder.util.TimeoutError"><tt class="xref py py-class docutils literal"><span class="pre">TimeoutError</span></tt></a></p>
<tr class="field-odd field"><th class="field-name">Raises:</th><td class="field-body"><p class="first last"><a class="reference internal" href="#alarmdecoder.util.CommError" title="alarmdecoder.util.CommError"><tt class="xref py py-class docutils literal"><span class="pre">CommError</span></tt></a>, <a class="reference internal" href="#alarmdecoder.util.TimeoutError" title="alarmdecoder.util.TimeoutError"><tt class="xref py py-class docutils literal"><span class="pre">TimeoutError</span></tt></a></p>
</td>
</tr>
</tbody>
@@ -857,7 +871,7 @@ reading.</li>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">list of devices</td>
</tr>
<tr class="field-odd field"><th class="field-name">Raises :</th><td class="field-body"><a class="reference internal" href="#alarmdecoder.util.CommError" title="alarmdecoder.util.CommError"><tt class="xref py py-class docutils literal"><span class="pre">CommError</span></tt></a></td>
<tr class="field-odd field"><th class="field-name">Raises:</th><td class="field-body"><a class="reference internal" href="#alarmdecoder.util.CommError" title="alarmdecoder.util.CommError"><tt class="xref py py-class docutils literal"><span class="pre">CommError</span></tt></a></td>
</tr>
</tbody>
</table>
@@ -892,7 +906,7 @@ reader thread.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Raises :</th><td class="field-body"><p class="first last"><a class="reference internal" href="#alarmdecoder.util.NoDeviceError" title="alarmdecoder.util.NoDeviceError"><tt class="xref py py-class docutils literal"><span class="pre">NoDeviceError</span></tt></a></p>
<tr class="field-even field"><th class="field-name">Raises:</th><td class="field-body"><p class="first last"><a class="reference internal" href="#alarmdecoder.util.NoDeviceError" title="alarmdecoder.util.NoDeviceError"><tt class="xref py py-class docutils literal"><span class="pre">NoDeviceError</span></tt></a></p>
</td>
</tr>
</tbody>
@@ -920,7 +934,7 @@ reader thread.</li>
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>data</strong> (<em>string</em>) &#8211; data to write</td>
</tr>
<tr class="field-even field"><th class="field-name">Raises :</th><td class="field-body">py:class:<cite>~alarmdecoder.util.CommError</cite></td>
<tr class="field-even field"><th class="field-name">Raises:</th><td class="field-body">py:class:<cite>~alarmdecoder.util.CommError</cite></td>
</tr>
</tbody>
</table>
@@ -936,7 +950,7 @@ reader thread.</li>
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">character read from the device</td>
</tr>
<tr class="field-even field"><th class="field-name">Raises :</th><td class="field-body"><a class="reference internal" href="#alarmdecoder.util.CommError" title="alarmdecoder.util.CommError"><tt class="xref py py-class docutils literal"><span class="pre">CommError</span></tt></a></td>
<tr class="field-even field"><th class="field-name">Raises:</th><td class="field-body"><a class="reference internal" href="#alarmdecoder.util.CommError" title="alarmdecoder.util.CommError"><tt class="xref py py-class docutils literal"><span class="pre">CommError</span></tt></a></td>
</tr>
</tbody>
</table>
@@ -960,7 +974,7 @@ reading.</li>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">line that was read</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Raises :</th><td class="field-body"><p class="first last"><a class="reference internal" href="#alarmdecoder.util.CommError" title="alarmdecoder.util.CommError"><tt class="xref py py-class docutils literal"><span class="pre">CommError</span></tt></a>, <a class="reference internal" href="#alarmdecoder.util.TimeoutError" title="alarmdecoder.util.TimeoutError"><tt class="xref py py-class docutils literal"><span class="pre">TimeoutError</span></tt></a></p>
<tr class="field-odd field"><th class="field-name">Raises:</th><td class="field-body"><p class="first last"><a class="reference internal" href="#alarmdecoder.util.CommError" title="alarmdecoder.util.CommError"><tt class="xref py py-class docutils literal"><span class="pre">CommError</span></tt></a>, <a class="reference internal" href="#alarmdecoder.util.TimeoutError" title="alarmdecoder.util.TimeoutError"><tt class="xref py py-class docutils literal"><span class="pre">TimeoutError</span></tt></a></p>
</td>
</tr>
</tbody>
@@ -1061,7 +1075,7 @@ thread.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Raises :</th><td class="field-body"><p class="first last"><a class="reference internal" href="#alarmdecoder.util.NoDeviceError" title="alarmdecoder.util.NoDeviceError"><tt class="xref py py-class docutils literal"><span class="pre">NoDeviceError</span></tt></a>, <a class="reference internal" href="#alarmdecoder.util.CommError" title="alarmdecoder.util.CommError"><tt class="xref py py-class docutils literal"><span class="pre">CommError</span></tt></a></p>
<tr class="field-even field"><th class="field-name">Raises:</th><td class="field-body"><p class="first last"><a class="reference internal" href="#alarmdecoder.util.NoDeviceError" title="alarmdecoder.util.NoDeviceError"><tt class="xref py py-class docutils literal"><span class="pre">NoDeviceError</span></tt></a>, <a class="reference internal" href="#alarmdecoder.util.CommError" title="alarmdecoder.util.CommError"><tt class="xref py py-class docutils literal"><span class="pre">CommError</span></tt></a></p>
</td>
</tr>
</tbody>
@@ -1091,7 +1105,7 @@ thread.</li>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">number of bytes sent</td>
</tr>
<tr class="field-odd field"><th class="field-name">Raises :</th><td class="field-body"><a class="reference internal" href="#alarmdecoder.util.CommError" title="alarmdecoder.util.CommError"><tt class="xref py py-class docutils literal"><span class="pre">CommError</span></tt></a></td>
<tr class="field-odd field"><th class="field-name">Raises:</th><td class="field-body"><a class="reference internal" href="#alarmdecoder.util.CommError" title="alarmdecoder.util.CommError"><tt class="xref py py-class docutils literal"><span class="pre">CommError</span></tt></a></td>
</tr>
</tbody>
</table>
@@ -1107,7 +1121,7 @@ thread.</li>
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">character read from the device</td>
</tr>
<tr class="field-even field"><th class="field-name">Raises :</th><td class="field-body"><a class="reference internal" href="#alarmdecoder.util.CommError" title="alarmdecoder.util.CommError"><tt class="xref py py-class docutils literal"><span class="pre">CommError</span></tt></a></td>
<tr class="field-even field"><th class="field-name">Raises:</th><td class="field-body"><a class="reference internal" href="#alarmdecoder.util.CommError" title="alarmdecoder.util.CommError"><tt class="xref py py-class docutils literal"><span class="pre">CommError</span></tt></a></td>
</tr>
</tbody>
</table>
@@ -1131,7 +1145,7 @@ reading.</li>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">line that was read</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Raises :</th><td class="field-body"><p class="first last"><a class="reference internal" href="#alarmdecoder.util.CommError" title="alarmdecoder.util.CommError"><tt class="xref py py-class docutils literal"><span class="pre">CommError</span></tt></a>, <a class="reference internal" href="#alarmdecoder.util.TimeoutError" title="alarmdecoder.util.TimeoutError"><tt class="xref py py-class docutils literal"><span class="pre">TimeoutError</span></tt></a></p>
<tr class="field-odd field"><th class="field-name">Raises:</th><td class="field-body"><p class="first last"><a class="reference internal" href="#alarmdecoder.util.CommError" title="alarmdecoder.util.CommError"><tt class="xref py py-class docutils literal"><span class="pre">CommError</span></tt></a>, <a class="reference internal" href="#alarmdecoder.util.TimeoutError" title="alarmdecoder.util.TimeoutError"><tt class="xref py py-class docutils literal"><span class="pre">TimeoutError</span></tt></a></p>
</td>
</tr>
</tbody>
@@ -1462,7 +1476,7 @@ devices.</p>
<p>Provides zone tracking functionality for the <a class="reference external" href="http://www.alarmdecoder.com">AlarmDecoder</a> (AD2) device family.</p>
<dl class="class">
<dt id="alarmdecoder.zonetracking.Zone">
<em class="property">class </em><tt class="descclassname">alarmdecoder.zonetracking.</tt><tt class="descname">Zone</tt><big>(</big><em>zone=0</em>, <em>name=''</em>, <em>status=0</em><big>)</big><a class="reference internal" href="_modules/alarmdecoder/zonetracking.html#Zone"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#alarmdecoder.zonetracking.Zone" title="Permalink to this definition">¶</a></dt>
<em class="property">class </em><tt class="descclassname">alarmdecoder.zonetracking.</tt><tt class="descname">Zone</tt><big>(</big><em>zone=0</em>, <em>name=''</em>, <em>status=0</em>, <em>expander=False</em><big>)</big><a class="reference internal" href="_modules/alarmdecoder/zonetracking.html#Zone"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#alarmdecoder.zonetracking.Zone" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <tt class="xref py py-class docutils literal"><span class="pre">object</span></tt></p>
<p>Representation of a panel zone.</p>
<dl class="attribute">
@@ -1512,11 +1526,17 @@ devices.</p>
<dd><p>Timestamp of last update</p>
</dd></dl>

<dl class="attribute">
<dt id="alarmdecoder.zonetracking.Zone.expander">
<tt class="descname">expander</tt><em class="property"> = False</em><a class="headerlink" href="#alarmdecoder.zonetracking.Zone.expander" title="Permalink to this definition">¶</a></dt>
<dd><p>Does this zone exist on an expander?</p>
</dd></dl>

</dd></dl>

<dl class="class">
<dt id="alarmdecoder.zonetracking.Zonetracker">
<em class="property">class </em><tt class="descclassname">alarmdecoder.zonetracking.</tt><tt class="descname">Zonetracker</tt><a class="reference internal" href="_modules/alarmdecoder/zonetracking.html#Zonetracker"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#alarmdecoder.zonetracking.Zonetracker" title="Permalink to this definition">¶</a></dt>
<em class="property">class </em><tt class="descclassname">alarmdecoder.zonetracking.</tt><tt class="descname">Zonetracker</tt><big>(</big><em>alarmdecoder_object</em><big>)</big><a class="reference internal" href="_modules/alarmdecoder/zonetracking.html#Zonetracker"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#alarmdecoder.zonetracking.Zonetracker" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <tt class="xref py py-class docutils literal"><span class="pre">object</span></tt></p>
<p>Handles tracking of zones and their statuses.</p>
<dl class="attribute">
@@ -1583,7 +1603,7 @@ devices.</p>

<dl class="method">
<dt id="alarmdecoder.zonetracking.Zonetracker.expander_to_zone">
<tt class="descname">expander_to_zone</tt><big>(</big><em>address</em>, <em>channel</em><big>)</big><a class="reference internal" href="_modules/alarmdecoder/zonetracking.html#Zonetracker.expander_to_zone"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#alarmdecoder.zonetracking.Zonetracker.expander_to_zone" title="Permalink to this definition">¶</a></dt>
<tt class="descname">expander_to_zone</tt><big>(</big><em>address</em>, <em>channel</em>, <em>panel_type=0</em><big>)</big><a class="reference internal" href="_modules/alarmdecoder/zonetracking.html#Zonetracker.expander_to_zone"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#alarmdecoder.zonetracking.Zonetracker.expander_to_zone" title="Permalink to this definition">¶</a></dt>
<dd><p>Convert an address and channel into a zone number.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
@@ -1685,7 +1705,7 @@ devices.</p>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Raises :</th><td class="field-body"><p class="first last"><a class="reference internal" href="#alarmdecoder.util.NoDeviceError" title="alarmdecoder.util.NoDeviceError"><tt class="xref py py-class docutils literal"><span class="pre">NoDeviceError</span></tt></a>, <a class="reference internal" href="#alarmdecoder.util.TimeoutError" title="alarmdecoder.util.TimeoutError"><tt class="xref py py-class docutils literal"><span class="pre">TimeoutError</span></tt></a></p>
<tr class="field-even field"><th class="field-name">Raises:</th><td class="field-body"><p class="first last"><a class="reference internal" href="#alarmdecoder.util.NoDeviceError" title="alarmdecoder.util.NoDeviceError"><tt class="xref py py-class docutils literal"><span class="pre">NoDeviceError</span></tt></a>, <a class="reference internal" href="#alarmdecoder.util.TimeoutError" title="alarmdecoder.util.TimeoutError"><tt class="xref py py-class docutils literal"><span class="pre">TimeoutError</span></tt></a></p>
</td>
</tr>
</tbody>
@@ -1762,7 +1782,7 @@ devices.</p>
</div>
<div class="footer">
&copy; Copyright 2013, Nu Tech Software Solutions, Inc..
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.2b1.
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.2.2.
</div>
</body>
</html>

+ 9
- 1
docs/build/html/genindex.html View File

@@ -366,6 +366,10 @@
</dt>

<dt><a href="alarmdecoder.html#alarmdecoder.zonetracking.Zone.expander">expander (alarmdecoder.zonetracking.Zone attribute)</a>
</dt>

<dt><a href="alarmdecoder.html#alarmdecoder.zonetracking.Zonetracker.expander_to_zone">expander_to_zone() (alarmdecoder.zonetracking.Zonetracker method)</a>
</dt>

@@ -493,6 +497,10 @@
</dt>

</dl></dd>
<dt><a href="alarmdecoder.html#alarmdecoder.decoder.AlarmDecoder.internal_address_mask">internal_address_mask (alarmdecoder.decoder.AlarmDecoder attribute)</a>
</dt>

</dl></td>
<td style="width: 33%" valign="top"><dl>
@@ -1129,7 +1137,7 @@
</div>
<div class="footer">
&copy; Copyright 2013, Nu Tech Software Solutions, Inc..
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.2b1.
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.2.2.
</div>
</body>
</html>

+ 2
- 4
docs/build/html/index.html View File

@@ -116,9 +116,7 @@
<div class="sphinxsidebarwrapper">
<h3><a href="#">Table Of Contents</a></h3>
<ul>
<li><a class="reference internal" href="#">Welcome to Alarm Decoder&#8217;s documentation!</a><ul>
</ul>
</li>
<li><a class="reference internal" href="#">Welcome to Alarm Decoder&#8217;s documentation!</a></li>
<li><a class="reference internal" href="#indices-and-tables">Indices and tables</a></li>
</ul>

@@ -164,7 +162,7 @@
</div>
<div class="footer">
&copy; Copyright 2013, Nu Tech Software Solutions, Inc..
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.2b1.
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.2.2.
</div>
</body>
</html>

+ 1
- 1
docs/build/html/modules.html View File

@@ -103,7 +103,7 @@
</div>
<div class="footer">
&copy; Copyright 2013, Nu Tech Software Solutions, Inc..
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.2b1.
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.2.2.
</div>
</body>
</html>

BIN
docs/build/html/objects.inv View File


+ 1
- 1
docs/build/html/py-modindex.html View File

@@ -143,7 +143,7 @@
</div>
<div class="footer">
&copy; Copyright 2013, Nu Tech Software Solutions, Inc..
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.2b1.
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.2.2.
</div>
</body>
</html>

+ 1
- 1
docs/build/html/search.html View File

@@ -99,7 +99,7 @@
</div>
<div class="footer">
&copy; Copyright 2013, Nu Tech Software Solutions, Inc..
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.2b1.
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.2.2.
</div>
</body>
</html>

+ 1
- 1
docs/build/html/searchindex.js
File diff suppressed because it is too large
View File


+ 1
- 1
setup.py View File

@@ -9,7 +9,7 @@ def readme():
return readme_file.read()

setup(name='alarmdecoder',
version='0.9.1',
version='0.10.3',
description='Python interface for the AlarmDecoder (AD2) family '
'of alarm devices which includes the AD2USB, AD2SERIAL and AD2PI.',
long_description=readme(),


Loading…
Cancel
Save