Browse Source

Updated docs and setup.py for 0.7

pyserial_fix
Scott Petersen 10 years ago
parent
commit
8f9911e31e
16 changed files with 690 additions and 314 deletions
  1. BIN
      docs/build/doctrees/alarmdecoder.doctree
  2. BIN
      docs/build/doctrees/alarmdecoder.event.doctree
  3. BIN
      docs/build/doctrees/environment.pickle
  4. BIN
      docs/build/doctrees/index.doctree
  5. BIN
      docs/build/doctrees/modules.doctree
  6. +170
    -95
      docs/build/html/_modules/alarmdecoder/decoder.html
  7. +159
    -105
      docs/build/html/_modules/alarmdecoder/devices.html
  8. +3
    -0
      docs/build/html/_modules/alarmdecoder/event/event.html
  9. +152
    -75
      docs/build/html/_modules/alarmdecoder/messages.html
  10. +9
    -7
      docs/build/html/_modules/alarmdecoder/util.html
  11. +73
    -22
      docs/build/html/_modules/alarmdecoder/zonetracking.html
  12. +67
    -3
      docs/build/html/alarmdecoder.html
  13. +55
    -5
      docs/build/html/genindex.html
  14. BIN
      docs/build/html/objects.inv
  15. +1
    -1
      docs/build/html/searchindex.js
  16. +1
    -1
      setup.py

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


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


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


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


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


+ 170
- 95
docs/build/html/_modules/alarmdecoder/decoder.html View File

@@ -48,12 +48,15 @@
<h1>Source code for alarmdecoder.decoder</h1><div class="highlight"><pre>
<span class="sd">&quot;&quot;&quot;</span>
<span class="sd">Provides the full AlarmDecoder class.</span>
<span class="sd">Provides the main AlarmDecoder class.</span>

<span class="sd">.. _AlarmDecoder: http://www.alarmdecoder.com</span>

<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">time</span>
<span class="kn">import</span> <span class="nn">re</span>

<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">.util</span> <span class="kn">import</span> <span class="n">InvalidMessageError</span>
@@ -63,34 +66,36 @@

<div class="viewcode-block" id="AlarmDecoder"><a class="viewcode-back" href="../../alarmdecoder.html#alarmdecoder.decoder.AlarmDecoder">[docs]</a><span class="k">class</span> <span class="nc">AlarmDecoder</span><span class="p">(</span><span class="nb">object</span><span class="p">):</span>
<span class="sd">&quot;&quot;&quot;</span>
<span class="sd"> High-level wrapper around Alarm Decoder (AD2) devices.</span>
<span class="sd"> High-level wrapper around `AlarmDecoder`_ (AD2) devices.</span>
<span class="sd"> &quot;&quot;&quot;</span>

<span class="c"># High-level Events</span>
<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">&#39;Called when the panel is armed.&#39;</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">&#39;Called when the panel is disarmed.&#39;</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">&#39;Called when panel power switches between AC and DC.&#39;</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">&#39;Called when the alarm is triggered.&#39;</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">&#39;Called when a fire is detected.&#39;</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">&#39;Called when a zone is bypassed.&#39;</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">&#39;Called when the device finishes bootings.&#39;</span><span class="p">)</span>
<span class="n">on_config_received</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">&#39;Called when the device receives its configuration.&#39;</span><span class="p">)</span>
<span class="n">on_zone_fault</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">&#39;Called when the device detects a zone fault.&#39;</span><span class="p">)</span>
<span class="n">on_zone_restore</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">&#39;Called when the device detects that a fault is restored.&#39;</span><span class="p">)</span>
<span class="n">on_low_battery</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">&#39;Called when the device detects a low battery.&#39;</span><span class="p">)</span>
<span class="n">on_panic</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">&#39;Called when the device detects a panic.&#39;</span><span class="p">)</span>
<span class="n">on_relay_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">&#39;Called when a relay is opened or closed on an expander board.&#39;</span><span class="p">)</span>
<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_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>
<span class="n">on_config_received</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 receives its configuration. </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_zone_fault</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 :py:class:`~alarmdecoder.zonetracking.Zonetracker` detects a zone fault.</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_zone_restore</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 :py:class:`~alarmdecoder.zonetracking.Zonetracker` detects that a fault is restored.</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_low_battery</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 detects a low battery.</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_panic</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 detects a panic.</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_relay_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 a relay is opened or closed on an expander board.</span><span class="se">\n\n</span><span class="s">**Callback definition:** *def callback(device, message)*&quot;</span><span class="p">)</span>

<span class="c"># Mid-level Events</span>
<span class="n">on_message</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">&#39;Called when a message has been received from the device.&#39;</span><span class="p">)</span>
<span class="n">on_lrr_message</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">&#39;Called when an LRR message is received.&#39;</span><span class="p">)</span>
<span class="n">on_rfx_message</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">&#39;Called when an RFX message is received.&#39;</span><span class="p">)</span>
<span class="n">on_message</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 standard panel :py:class:`~alarmdecoder.messages.Message` is received.</span><span class="se">\n\n</span><span class="s">**Callback definition:** *def callback(device, message)*&quot;</span><span class="p">)</span>
<span class="n">on_expander_message</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 an :py:class:`~alarmdecoder.messages.ExpanderMessage` is received.</span><span class="se">\n\n</span><span class="s">**Callback definition:** *def callback(device, message)*&quot;</span><span class="p">)</span>
<span class="n">on_lrr_message</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 an :py:class:`~alarmdecoder.messages.LRRMessage` is received.</span><span class="se">\n\n</span><span class="s">**Callback definition:** *def callback(device, message)*&quot;</span><span class="p">)</span>
<span class="n">on_rfx_message</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 an :py:class:`~alarmdecoder.messages.RFMessage` is received.</span><span class="se">\n\n</span><span class="s">**Callback definition:** *def callback(device, message)*&quot;</span><span class="p">)</span>
<span class="n">on_sending_received</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 !Sending.done message is received from the AlarmDecoder.</span><span class="se">\n\n</span><span class="s">**Callback definition:** *def callback(device, status, message)*&quot;</span><span class="p">)</span>

<span class="c"># Low-level Events</span>
<span class="n">on_open</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">&#39;Called when the device has been opened.&#39;</span><span class="p">)</span>
<span class="n">on_close</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">&#39;Called when the device has been closed.&#39;</span><span class="p">)</span>
<span class="n">on_read</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">&#39;Called when a line has been read from the device.&#39;</span><span class="p">)</span>
<span class="n">on_write</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">&#39;Called when data has been written to the device.&#39;</span><span class="p">)</span>
<span class="n">on_open</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 has been opened.</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_close</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 has been closed.</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_read</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 line has been read from the device.</span><span class="se">\n\n</span><span class="s">**Callback definition:** *def callback(device, data)*&quot;</span><span class="p">)</span>
<span class="n">on_write</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 data has been written to the device.</span><span class="se">\n\n</span><span class="s">**Callback definition:** *def callback(device, data)*&quot;</span><span class="p">)</span>

<span class="c"># Constants</span>
<span class="n">KEY_F1</span> <span class="o">=</span> <span class="nb">unichr</span><span class="p">(</span><span class="mi">1</span><span class="p">)</span> <span class="o">+</span> <span class="nb">unichr</span><span class="p">(</span><span class="mi">1</span><span class="p">)</span> <span class="o">+</span> <span class="nb">unichr</span><span class="p">(</span><span class="mi">1</span><span class="p">)</span>
@@ -101,17 +106,35 @@
<span class="sd">&quot;&quot;&quot;Represents panel function key #3&quot;&quot;&quot;</span>
<span class="n">KEY_F4</span> <span class="o">=</span> <span class="nb">unichr</span><span class="p">(</span><span class="mi">4</span><span class="p">)</span> <span class="o">+</span> <span class="nb">unichr</span><span class="p">(</span><span class="mi">4</span><span class="p">)</span> <span class="o">+</span> <span class="nb">unichr</span><span class="p">(</span><span class="mi">4</span><span class="p">)</span>
<span class="sd">&quot;&quot;&quot;Represents panel function key #4&quot;&quot;&quot;</span>
<span class="n">KEY_PANIC</span> <span class="o">=</span> <span class="nb">unichr</span><span class="p">(</span><span class="mi">5</span><span class="p">)</span> <span class="o">+</span> <span class="nb">unichr</span><span class="p">(</span><span class="mi">5</span><span class="p">)</span> <span class="o">+</span> <span class="nb">unichr</span><span class="p">(</span><span class="mi">5</span><span class="p">)</span>
<span class="sd">&quot;&quot;&quot;Represents a panic keypress&quot;&quot;&quot;</span>

<span class="n">BATTERY_TIMEOUT</span> <span class="o">=</span> <span class="mi">30</span>
<span class="sd">&quot;&quot;&quot;Timeout before the battery status reverts.&quot;&quot;&quot;</span>
<span class="sd">&quot;&quot;&quot;Default timeout (in seconds) before the battery status reverts.&quot;&quot;&quot;</span>
<span class="n">FIRE_TIMEOUT</span> <span class="o">=</span> <span class="mi">30</span>
<span class="sd">&quot;&quot;&quot;Timeout before the fire status reverts.&quot;&quot;&quot;</span>
<span class="sd">&quot;&quot;&quot;Default tTimeout (in seconds) before the fire status reverts.&quot;&quot;&quot;</span>

<span class="c"># Attributes</span>
<span class="n">address</span> <span class="o">=</span> <span class="mi">18</span>
<span class="sd">&quot;&quot;&quot;The keypad address in use by the device.&quot;&quot;&quot;</span>
<span class="n">configbits</span> <span class="o">=</span> <span class="mh">0xFF00</span>
<span class="sd">&quot;&quot;&quot;The configuration bits set on the device.&quot;&quot;&quot;</span>
<span class="n">address_mask</span> <span class="o">=</span> <span class="mh">0xFFFFFFFF</span>
<span class="sd">&quot;&quot;&quot;The address mask configured on the device.&quot;&quot;&quot;</span>
<span class="n">emulate_zone</span> <span class="o">=</span> <span class="p">[</span><span class="bp">False</span> <span class="k">for</span> <span class="n">_</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="mi">5</span><span class="p">)]</span>
<span class="sd">&quot;&quot;&quot;List containing the devices zone emulation status.&quot;&quot;&quot;</span>
<span class="n">emulate_relay</span> <span class="o">=</span> <span class="p">[</span><span class="bp">False</span> <span class="k">for</span> <span class="n">_</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="mi">4</span><span class="p">)]</span>
<span class="sd">&quot;&quot;&quot;List containing the devices relay emulation status.&quot;&quot;&quot;</span>
<span class="n">emulate_lrr</span> <span class="o">=</span> <span class="bp">False</span>
<span class="sd">&quot;&quot;&quot;The status of the devices LRR emulation.&quot;&quot;&quot;</span>
<span class="n">deduplicate</span> <span class="o">=</span> <span class="bp">False</span>
<span class="sd">&quot;&quot;&quot;The status of message deduplication as configured on the device.&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">device</span><span class="p">):</span>
<span class="sd">&quot;&quot;&quot;</span>
<span class="sd"> Constructor</span>

<span class="sd"> :param device: The low-level device used for this Alarm Decoder</span>
<span class="sd"> :param device: The low-level device used for this `AlarmDecoder`_</span>
<span class="sd"> interface.</span>
<span class="sd"> :type device: Device</span>
<span class="sd"> &quot;&quot;&quot;</span>
@@ -154,9 +177,9 @@
<span class="nd">@property</span>
<div class="viewcode-block" id="AlarmDecoder.id"><a class="viewcode-back" href="../../alarmdecoder.html#alarmdecoder.decoder.AlarmDecoder.id">[docs]</a> <span class="k">def</span> <span class="nf">id</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
<span class="sd">&quot;&quot;&quot;</span>
<span class="sd"> The ID of the Alarm Decoder device.</span>
<span class="sd"> The ID of the `AlarmDecoder`_ device.</span>

<span class="sd"> :returns: The identification string for the device.</span>
<span class="sd"> :returns: identification string for the device</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">_device</span><span class="o">.</span><span class="n">id</span>
</div>
@@ -165,7 +188,7 @@
<span class="sd">&quot;&quot;&quot;</span>
<span class="sd"> Retrieves the timeout for restoring the battery status, in seconds.</span>

<span class="sd"> :returns: The battery status timeout</span>
<span class="sd"> :returns: battery status timeout</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">_battery_timeout</span>

@@ -174,7 +197,7 @@
<span class="sd">&quot;&quot;&quot;</span>
<span class="sd"> Sets the timeout for restoring the battery status, in seconds.</span>

<span class="sd"> :param value: The timeout in seconds.</span>
<span class="sd"> :param value: timeout in seconds</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">_battery_timeout</span> <span class="o">=</span> <span class="n">value</span>
@@ -184,7 +207,7 @@
<span class="sd">&quot;&quot;&quot;</span>
<span class="sd"> Retrieves the timeout for restoring the fire status, in seconds.</span>

<span class="sd"> :returns: The fire status timeout</span>
<span class="sd"> :returns: fire status timeout</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">_fire_timeout</span>

@@ -193,7 +216,7 @@
<span class="sd">&quot;&quot;&quot;</span>
<span class="sd"> Sets the timeout for restoring the fire status, in seconds.</span>

<span class="sd"> :param value: The timeout in seconds.</span>
<span class="sd"> :param value: timeout in seconds</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">_fire_timeout</span> <span class="o">=</span> <span class="n">value</span>
@@ -202,10 +225,10 @@
<span class="sd">&quot;&quot;&quot;</span>
<span class="sd"> Opens the device.</span>

<span class="sd"> :param baudrate: The baudrate used for the device.</span>
<span class="sd"> :param baudrate: baudrate used for the device. Defaults to the lower-level device default.</span>
<span class="sd"> :type baudrate: int</span>
<span class="sd"> :param no_reader_thread: Specifies whether or not the automatic reader</span>
<span class="sd"> thread should be started or not</span>
<span class="sd"> thread should be started.</span>
<span class="sd"> :type no_reader_thread: bool</span>
<span class="sd"> &quot;&quot;&quot;</span>
<span class="bp">self</span><span class="o">.</span><span class="n">_wire_events</span><span class="p">()</span>
@@ -225,17 +248,18 @@
</div>
<div class="viewcode-block" id="AlarmDecoder.send"><a class="viewcode-back" href="../../alarmdecoder.html#alarmdecoder.decoder.AlarmDecoder.send">[docs]</a> <span class="k">def</span> <span class="nf">send</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">data</span><span class="p">):</span>
<span class="sd">&quot;&quot;&quot;</span>
<span class="sd"> Sends data to the Alarm Decoder device.</span>
<span class="sd"> Sends data to the `AlarmDecoder`_ device.</span>

<span class="sd"> :param data: The data to send.</span>
<span class="sd"> :type data: str</span>
<span class="sd"> :param data: data to send</span>
<span class="sd"> :type data: string</span>
<span class="sd"> &quot;&quot;&quot;</span>

<span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_device</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">write</span><span class="p">(</span><span class="n">data</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">write</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="n">data</span><span class="p">))</span>
</div>
<div class="viewcode-block" id="AlarmDecoder.get_config"><a class="viewcode-back" href="../../alarmdecoder.html#alarmdecoder.decoder.AlarmDecoder.get_config">[docs]</a> <span class="k">def</span> <span class="nf">get_config</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 configuration from the device.</span>
<span class="sd"> Retrieves the configuration from the device. Called automatically by :py:meth:`_on_open`.</span>
<span class="sd"> &quot;&quot;&quot;</span>
<span class="bp">self</span><span class="o">.</span><span class="n">send</span><span class="p">(</span><span class="s">&quot;C</span><span class="se">\r</span><span class="s">&quot;</span><span class="p">)</span>
</div>
@@ -276,9 +300,9 @@
<span class="sd">&quot;&quot;&quot;</span>
<span class="sd"> Faults a zone if we are emulating a zone expander.</span>

<span class="sd"> :param zone: The zone to fault.</span>
<span class="sd"> :param zone: zone to fault</span>
<span class="sd"> :type zone: int</span>
<span class="sd"> :param simulate_wire_problem: Whether or not to simulate a wire fault.</span>
<span class="sd"> :param simulate_wire_problem: Whether or not to simulate a wire fault</span>
<span class="sd"> :type simulate_wire_problem: bool</span>
<span class="sd"> &quot;&quot;&quot;</span>

@@ -299,7 +323,7 @@
<span class="sd">&quot;&quot;&quot;</span>
<span class="sd"> Clears a zone if we are emulating a zone expander.</span>

<span class="sd"> :param zone: The zone to clear.</span>
<span class="sd"> :param zone: zone to clear</span>
<span class="sd"> :type zone: int</span>
<span class="sd"> &quot;&quot;&quot;</span>
<span class="bp">self</span><span class="o">.</span><span class="n">send</span><span class="p">(</span><span class="s">&quot;L{0:02}0</span><span class="se">\r</span><span class="s">&quot;</span><span class="o">.</span><span class="n">format</span><span class="p">(</span><span class="n">zone</span><span class="p">))</span>
@@ -317,29 +341,28 @@

<span class="k">def</span> <span class="nf">_handle_message</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">data</span><span class="p">):</span>
<span class="sd">&quot;&quot;&quot;</span>
<span class="sd"> Parses messages from the panel.</span>
<span class="sd"> Parses keypad messages from the panel.</span>

<span class="sd"> :param data: Panel data to parse.</span>
<span class="sd"> :type data: str</span>
<span class="sd"> :param data: keypad data to parse</span>
<span class="sd"> :type data: string</span>

<span class="sd"> :returns: An object representing the message.</span>
<span class="sd"> :returns: :py:class:`~alarmdecoder.messages.Message`</span>
<span class="sd"> &quot;&quot;&quot;</span>
<span class="k">if</span> <span class="n">data</span> <span class="ow">is</span> <span class="bp">None</span><span class="p">:</span>

<span class="k">if</span> <span class="n">data</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span><span class="p">:</span>
<span class="n">data</span> <span class="o">=</span> <span class="n">data</span><span class="o">.</span><span class="n">lstrip</span><span class="p">(</span><span class="s">&#39;</span><span class="se">\0</span><span class="s">&#39;</span><span class="p">)</span>

<span class="k">if</span> <span class="n">data</span> <span class="ow">is</span> <span class="bp">None</span> <span class="ow">or</span> <span class="n">data</span> <span class="o">==</span> <span class="s">&#39;&#39;</span><span class="p">:</span>
<span class="k">raise</span> <span class="n">InvalidMessageError</span><span class="p">()</span>

<span class="n">msg</span> <span class="o">=</span> <span class="bp">None</span>
<span class="n">header</span> <span class="o">=</span> <span class="n">data</span><span class="p">[</span><span class="mi">0</span><span class="p">:</span><span class="mi">4</span><span class="p">]</span>

<span class="k">if</span> <span class="n">header</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="o">!=</span> <span class="s">&#39;!&#39;</span> <span class="ow">or</span> <span class="n">header</span> <span class="o">==</span> <span class="s">&#39;!KPE&#39;</span><span class="p">:</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="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="k">if</span> <span class="n">header</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="o">!=</span> <span class="s">&#39;!&#39;</span> <span class="ow">or</span> <span class="n">header</span> <span class="o">==</span> <span class="s">&#39;!KPM&#39;</span><span class="p">:</span>
<span class="n">msg</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_handle_keypad_message</span><span class="p">(</span><span class="n">data</span><span class="p">)</span>

<span class="k">elif</span> <span class="n">header</span> <span class="o">==</span> <span class="s">&#39;!EXP&#39;</span> <span class="ow">or</span> <span class="n">header</span> <span class="o">==</span> <span class="s">&#39;!REL&#39;</span><span class="p">:</span>
<span class="n">msg</span> <span class="o">=</span> <span class="n">ExpanderMessage</span><span class="p">(</span><span class="n">data</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="n">msg</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_handle_expander_message</span><span class="p">(</span><span class="n">data</span><span class="p">)</span>

<span class="k">elif</span> <span class="n">header</span> <span class="o">==</span> <span class="s">&#39;!RFX&#39;</span><span class="p">:</span>
<span class="n">msg</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_handle_rfx</span><span class="p">(</span><span class="n">data</span><span class="p">)</span>
@@ -353,16 +376,53 @@
<span class="k">elif</span> <span class="n">data</span><span class="o">.</span><span class="n">startswith</span><span class="p">(</span><span class="s">&#39;!CONFIG&#39;</span><span class="p">):</span>
<span class="bp">self</span><span class="o">.</span><span class="n">_handle_config</span><span class="p">(</span><span class="n">data</span><span class="p">)</span>

<span class="k">elif</span> <span class="n">data</span><span class="o">.</span><span class="n">startswith</span><span class="p">(</span><span class="s">&#39;!Sending&#39;</span><span class="p">):</span>
<span class="bp">self</span><span class="o">.</span><span class="n">_handle_sending</span><span class="p">(</span><span class="n">data</span><span class="p">)</span>

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

<span class="k">def</span> <span class="nf">_handle_keypad_message</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">data</span><span class="p">):</span>
<span class="sd">&quot;&quot;&quot;</span>
<span class="sd"> Handle keypad messages.</span>

<span class="sd"> :param data: keypad message to parse</span>
<span class="sd"> :type data: string</span>

<span class="sd"> :returns: :py:class:`~alarmdecoder.messages.Message`</span>
<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="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="k">return</span> <span class="n">msg</span>

<span class="k">def</span> <span class="nf">_handle_expander_message</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">data</span><span class="p">):</span>
<span class="sd">&quot;&quot;&quot;</span>
<span class="sd"> Handle expander messages.</span>

<span class="sd"> :param data: expander message to parse</span>
<span class="sd"> :type data: string</span>

<span class="sd"> :returns: :py:class:`~alarmdecoder.messages.ExpanderMessage`</span>
<span class="sd"> &quot;&quot;&quot;</span>
<span class="n">msg</span> <span class="o">=</span> <span class="n">ExpanderMessage</span><span class="p">(</span><span class="n">data</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_expander_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>

<span class="k">def</span> <span class="nf">_handle_rfx</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">data</span><span class="p">):</span>
<span class="sd">&quot;&quot;&quot;</span>
<span class="sd"> Handle RF messages.</span>

<span class="sd"> :param data: RF message to parse.</span>
<span class="sd"> :type data: str</span>
<span class="sd"> :param data: RF message to parse</span>
<span class="sd"> :type data: string</span>

<span class="sd"> :returns: An object representing the RF message.</span>
<span class="sd"> :returns: :py:class:`~alarmdecoder.messages.RFMessage`</span>
<span class="sd"> &quot;&quot;&quot;</span>
<span class="n">msg</span> <span class="o">=</span> <span class="n">RFMessage</span><span class="p">(</span><span class="n">data</span><span class="p">)</span>

@@ -374,10 +434,10 @@
<span class="sd">&quot;&quot;&quot;</span>
<span class="sd"> Handle Long Range Radio messages.</span>

<span class="sd"> :param data: LRR message to parse.</span>
<span class="sd"> :type data: str</span>
<span class="sd"> :param data: LRR message to parse</span>
<span class="sd"> :type data: string</span>

<span class="sd"> :returns: An object representing the LRR message.</span>
<span class="sd"> :returns: :py:class:`~alarmdecoder.messages.LRRMessage`</span>
<span class="sd"> &quot;&quot;&quot;</span>
<span class="n">msg</span> <span class="o">=</span> <span class="n">LRRMessage</span><span class="p">(</span><span class="n">data</span><span class="p">)</span>

@@ -398,8 +458,8 @@
<span class="sd">&quot;&quot;&quot;</span>
<span class="sd"> Handles received configuration data.</span>

<span class="sd"> :param data: Configuration string to parse.</span>
<span class="sd"> :type data: str</span>
<span class="sd"> :param data: Configuration string to parse</span>
<span class="sd"> :type data: string</span>
<span class="sd"> &quot;&quot;&quot;</span>
<span class="n">_</span><span class="p">,</span> <span class="n">config_string</span> <span class="o">=</span> <span class="n">data</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="s">&#39;&gt;&#39;</span><span class="p">)</span>
<span class="k">for</span> <span class="n">setting</span> <span class="ow">in</span> <span class="n">config_string</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="s">&#39;&amp;&#39;</span><span class="p">):</span>
@@ -422,12 +482,28 @@

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

<span class="k">def</span> <span class="nf">_handle_sending</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">data</span><span class="p">):</span>
<span class="sd">&quot;&quot;&quot;</span>
<span class="sd"> Handles results of a keypress send.</span>

<span class="sd"> :param data: Sending string to parse</span>
<span class="sd"> :type data: string</span>
<span class="sd"> &quot;&quot;&quot;</span>

<span class="n">matches</span> <span class="o">=</span> <span class="n">re</span><span class="o">.</span><span class="n">match</span><span class="p">(</span><span class="s">&#39;^!Sending(\.{1,5})done.*&#39;</span><span class="p">,</span> <span class="n">data</span><span class="p">)</span>
<span class="k">if</span> <span class="n">matches</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span><span class="p">:</span>
<span class="n">good_send</span> <span class="o">=</span> <span class="bp">False</span>
<span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">matches</span><span class="o">.</span><span class="n">group</span><span class="p">(</span><span class="mi">1</span><span class="p">))</span> <span class="o">&lt;</span> <span class="mi">5</span><span class="p">:</span>
<span class="n">good_send</span> <span class="o">=</span> <span class="bp">True</span>

<span class="bp">self</span><span class="o">.</span><span class="n">on_sending_received</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="n">good_send</span><span class="p">,</span> <span class="n">message</span><span class="o">=</span><span class="n">data</span><span class="p">)</span>

<span class="k">def</span> <span class="nf">_update_internal_states</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"> Updates internal device states.</span>

<span class="sd"> :param message: Message to update internal states with.</span>
<span class="sd"> :type message: Message, ExpanderMessage, LRRMessage, or RFMessage</span>
<span class="sd"> :param message: :py:class:`~alarmdecoder.messages.Message` to update internal states with</span>
<span class="sd"> :type message: :py:class:`~alarmdecoder.messages.Message`, :py:class:`~alarmdecoder.messages.ExpanderMessage`, :py:class:`~alarmdecoder.messages.LRRMessage`, or :py:class:`~alarmdecoder.messages.RFMessage`</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">Message</span><span class="p">):</span>
<span class="bp">self</span><span class="o">.</span><span class="n">_update_power_status</span><span class="p">(</span><span class="n">message</span><span class="p">)</span>
@@ -446,10 +522,10 @@
<span class="sd">&quot;&quot;&quot;</span>
<span class="sd"> Uses the provided message to update the AC power state.</span>

<span class="sd"> :param message: The message to use to update.</span>
<span class="sd"> :type message: Message</span>
<span class="sd"> :param message: message to use to update</span>
<span class="sd"> :type message: :py:class:`~alarmdecoder.messages.Message`</span>

<span class="sd"> :returns: Boolean indicating the new status</span>
<span class="sd"> :returns: bool indicating the new status</span>
<span class="sd"> &quot;&quot;&quot;</span>
<span class="k">if</span> <span class="n">message</span><span class="o">.</span><span class="n">ac_power</span> <span class="o">!=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_power_status</span><span class="p">:</span>
<span class="bp">self</span><span class="o">.</span><span class="n">_power_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">ac_power</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">_power_status</span>
@@ -463,10 +539,10 @@
<span class="sd">&quot;&quot;&quot;</span>
<span class="sd"> Uses the provided message to update the alarm state.</span>

<span class="sd"> :param message: The message to use to update.</span>
<span class="sd"> :type message: Message</span>
<span class="sd"> :param message: message to use to update</span>
<span class="sd"> :type message: :py:class:`~alarmdecoder.messages.Message`</span>

<span class="sd"> :returns: Boolean indicating the new status</span>
<span class="sd"> :returns: bool indicating the new status</span>
<span class="sd"> &quot;&quot;&quot;</span>

<span class="k">if</span> <span class="n">message</span><span class="o">.</span><span class="n">alarm_sounding</span> <span class="o">!=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_alarm_status</span><span class="p">:</span>
@@ -481,10 +557,10 @@
<span class="sd">&quot;&quot;&quot;</span>
<span class="sd"> Uses the provided message to update the zone bypass state.</span>

<span class="sd"> :param message: The message to use to update.</span>
<span class="sd"> :type message: Message</span>
<span class="sd"> :param message: message to use to update</span>
<span class="sd"> :type message: :py:class:`~alarmdecoder.messages.Message`</span>

<span class="sd"> :returns: Boolean indicating the new status</span>
<span class="sd"> :returns: bool indicating the new status</span>
<span class="sd"> &quot;&quot;&quot;</span>

<span class="k">if</span> <span class="n">message</span><span class="o">.</span><span class="n">zone_bypassed</span> <span class="o">!=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_bypass_status</span><span class="p">:</span>
@@ -499,10 +575,10 @@
<span class="sd">&quot;&quot;&quot;</span>
<span class="sd"> Uses the provided message to update the armed state.</span>

<span class="sd"> :param message: The message to use to update.</span>
<span class="sd"> :type message: Message</span>
<span class="sd"> :param message: message to use to update</span>
<span class="sd"> :type message: :py:class:`~alarmdecoder.messages.Message`</span>

<span class="sd"> :returns: Boolean indicating the new status</span>
<span class="sd"> :returns: bool indicating the new status</span>
<span class="sd"> &quot;&quot;&quot;</span>

<span class="n">message_status</span> <span class="o">=</span> <span class="n">message</span><span class="o">.</span><span class="n">armed_away</span> <span class="o">|</span> <span class="n">message</span><span class="o">.</span><span class="n">armed_home</span>
@@ -521,10 +597,10 @@
<span class="sd">&quot;&quot;&quot;</span>
<span class="sd"> Uses the provided message to update the battery state.</span>

<span class="sd"> :param message: The message to use to update.</span>
<span class="sd"> :type message: Message</span>
<span class="sd"> :param message: message to use to update</span>
<span class="sd"> :type message: :py:class:`~alarmdecoder.messages.Message`</span>

<span class="sd"> :returns: Boolean indicating the new status</span>
<span class="sd"> :returns: boolean indicating the new status</span>
<span class="sd"> &quot;&quot;&quot;</span>

<span class="n">last_status</span><span class="p">,</span> <span class="n">last_update</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_battery_status</span>
@@ -541,10 +617,10 @@
<span class="sd">&quot;&quot;&quot;</span>
<span class="sd"> Uses the provided message to update the fire alarm state.</span>

<span class="sd"> :param message: The message to use to update.</span>
<span class="sd"> :type message: Message</span>
<span class="sd"> :param message: message to use to update</span>
<span class="sd"> :type message: :py:class:`~alarmdecoder.messages.Message`</span>

<span class="sd"> :returns: Boolean indicating the new status</span>
<span class="sd"> :returns: boolean indicating the new status</span>
<span class="sd"> &quot;&quot;&quot;</span>

<span class="n">last_status</span><span class="p">,</span> <span class="n">last_update</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_fire_status</span>
@@ -561,10 +637,10 @@
<span class="sd">&quot;&quot;&quot;</span>
<span class="sd"> Uses the provided message to update the expander states.</span>

<span class="sd"> :param message: The message to use to update.</span>
<span class="sd"> :type message: ExpanderMessage</span>
<span class="sd"> :param message: message to use to update</span>
<span class="sd"> :type message: :py:class:`~alarmdecoder.messages.ExpanderMessage`</span>

<span class="sd"> :returns: Boolean indicating the new status</span>
<span class="sd"> :returns: boolean indicating the new status</span>
<span class="sd"> &quot;&quot;&quot;</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">RELAY</span><span class="p">:</span>
@@ -576,10 +652,10 @@

<span class="k">def</span> <span class="nf">_update_zone_tracker</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"> Trigger an update of the zonetracker.</span>
<span class="sd"> Trigger an update of the :py:class:`~alarmdecoder.messages.Zonetracker`.</span>

<span class="sd"> :param message: The message to update the zonetracker with.</span>
<span class="sd"> :type message: Message, ExpanderMessage, LRRMessage, or RFMessage</span>
<span class="sd"> :param message: message to update the zonetracker with</span>
<span class="sd"> :type message: :py:class:`~alarmdecoder.messages.Message`, :py:class:`~alarmdecoder.messages.ExpanderMessage`, :py:class:`~alarmdecoder.messages.LRRMessage`, or :py:class:`~alarmdecoder.messages.RFMessage`</span>
<span class="sd"> &quot;&quot;&quot;</span>

<span class="c"># Retrieve a list of faults.</span>
@@ -597,29 +673,28 @@
<span class="sd"> &quot;&quot;&quot;</span>
<span class="bp">self</span><span class="o">.</span><span class="n">get_config</span><span class="p">()</span>

<span class="bp">self</span><span class="o">.</span><span class="n">on_open</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="n">kwargs</span><span class="p">)</span>
<span class="bp">self</span><span class="o">.</span><span class="n">on_open</span><span class="p">()</span>

<span class="k">def</span> <span class="nf">_on_close</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">sender</span><span class="p">,</span> <span class="o">*</span><span class="n">args</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>
<span class="sd"> Internal handler for closing the device.</span>
<span class="sd"> &quot;&quot;&quot;</span>
<span class="bp">self</span><span class="o">.</span><span class="n">on_close</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="n">kwargs</span><span class="p">)</span>
<span class="bp">self</span><span class="o">.</span><span class="n">on_close</span><span class="p">()</span>

<span class="k">def</span> <span class="nf">_on_read</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">sender</span><span class="p">,</span> <span class="o">*</span><span class="n">args</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>
<span class="sd"> Internal handler for reading from the device.</span>
<span class="sd"> &quot;&quot;&quot;</span>
<span class="bp">self</span><span class="o">.</span><span class="n">on_read</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="n">kwargs</span><span class="p">)</span>
<span class="n">data</span> <span class="o">=</span> <span class="n">kwargs</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s">&#39;data&#39;</span><span class="p">,</span> <span class="bp">None</span><span class="p">)</span>
<span class="bp">self</span><span class="o">.</span><span class="n">on_read</span><span class="p">(</span><span class="n">data</span><span class="o">=</span><span class="n">data</span><span class="p">)</span>

<span class="n">msg</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_handle_message</span><span class="p">(</span><span class="n">kwargs</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s">&#39;data&#39;</span><span class="p">,</span> <span class="bp">None</span><span class="p">))</span>
<span class="k">if</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">_handle_message</span><span class="p">(</span><span class="n">data</span><span class="p">)</span>

<span class="k">def</span> <span class="nf">_on_write</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">sender</span><span class="p">,</span> <span class="o">*</span><span class="n">args</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>
<span class="sd"> Internal handler for writing to the device.</span>
<span class="sd"> &quot;&quot;&quot;</span>
<span class="bp">self</span><span class="o">.</span><span class="n">on_write</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="n">kwargs</span><span class="p">)</span>
<span class="bp">self</span><span class="o">.</span><span class="n">on_write</span><span class="p">(</span><span class="n">data</span><span class="o">=</span><span class="n">kwargs</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s">&#39;data&#39;</span><span class="p">,</span> <span class="bp">None</span><span class="p">))</span>

<span class="k">def</span> <span class="nf">_on_zone_fault</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">sender</span><span class="p">,</span> <span class="o">*</span><span class="n">args</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>


+ 159
- 105
docs/build/html/_modules/alarmdecoder/devices.html View File

@@ -48,7 +48,18 @@
<h1>Source code for alarmdecoder.devices</h1><div class="highlight"><pre>
<span class="sd">&quot;&quot;&quot;</span>
<span class="sd">Contains different types of devices belonging to the Alarm Decoder (AD2) family.</span>
<span class="sd">This module contains different types of devices belonging to the `AlarmDecoder`_ (AD2) family.</span>

<span class="sd">* :py:class:`USBDevice`: Interfaces with the `AD2USB`_ device.</span>
<span class="sd">* :py:class:`SerialDevice`: Interfaces with the `AD2USB`_, `AD2SERIAL`_ or `AD2PI`_.</span>
<span class="sd">* :py:class:`SocketDevice`: Interfaces with devices exposed through `ser2sock`_ or another IP to Serial solution.</span>
<span class="sd"> Also supports SSL if using `ser2sock`_.</span>

<span class="sd">.. _ser2sock: http://github.com/nutechsoftware/ser2sock</span>
<span class="sd">.. _AlarmDecoder: http://www.alarmdecoder.com</span>
<span class="sd">.. _AD2USB: http://www.alarmdecoder.com</span>
<span class="sd">.. _AD2SERIAL: http://www.alarmdecoder.com</span>
<span class="sd">.. _AD2PI: http://www.alarmdecoder.com</span>

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

<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="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>


<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>
<span class="sd"> Generic parent device to all Alarm Decoder (AD2) products.</span>
<span class="sd"> Base class for all `AlarmDecoder`_ (AD2) device types.</span>
<span class="sd"> &quot;&quot;&quot;</span>

<span class="c"># Generic device events</span>
<span class="n">on_open</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">&#39;Called when the device has been opened&#39;</span><span class="p">)</span>
<span class="n">on_close</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">&#39;Called when the device has been closed&#39;</span><span class="p">)</span>
<span class="n">on_read</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">&#39;Called when a line has been read from the device&#39;</span><span class="p">)</span>
<span class="n">on_write</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">&#39;Called when data has been written to the device&#39;</span><span class="p">)</span>
<span class="n">on_open</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 has been opened.</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_close</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 has been closed.</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_read</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 line has been read from the device.</span><span class="se">\n\n</span><span class="s">**Callback definition:** def callback(device, data)*&quot;</span><span class="p">)</span>
<span class="n">on_write</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 data has been written to the device.</span><span class="se">\n\n</span><span class="s">**Callback definition:** def callback(device, data)*&quot;</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="sd">&quot;&quot;&quot;</span>
@@ -107,7 +118,7 @@
<span class="sd">&quot;&quot;&quot;</span>
<span class="sd"> Retrieve the device ID.</span>

<span class="sd"> :returns: The identification string for the device.</span>
<span class="sd"> :returns: identification string for the device</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">_id</span>

@@ -116,8 +127,8 @@
<span class="sd">&quot;&quot;&quot;</span>
<span class="sd"> Sets the device ID.</span>

<span class="sd"> :param value: The device identification.</span>
<span class="sd"> :type value: str</span>
<span class="sd"> :param value: device identification string</span>
<span class="sd"> :type value: string</span>
<span class="sd"> &quot;&quot;&quot;</span>
<span class="bp">self</span><span class="o">.</span><span class="n">_id</span> <span class="o">=</span> <span class="n">value</span>
</div>
@@ -125,7 +136,7 @@
<span class="sd">&quot;&quot;&quot;</span>
<span class="sd"> Indicates whether or not the reader thread is alive.</span>

<span class="sd"> :returns: Whether or not the reader thread is alive.</span>
<span class="sd"> :returns: whether or not the reader thread is alive</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">_read_thread</span><span class="o">.</span><span class="n">is_alive</span><span class="p">()</span>
</div>
@@ -161,8 +172,8 @@
<span class="sd">&quot;&quot;&quot;</span>
<span class="sd"> Constructor</span>

<span class="sd"> :param device: The device used by the reader thread.</span>
<span class="sd"> :type device: devices.Device</span>
<span class="sd"> :param device: device used by the reader thread</span>
<span class="sd"> :type device: :py:class:`~alarmdecoder.devices.Device`</span>
<span class="sd"> &quot;&quot;&quot;</span>
<span class="n">threading</span><span class="o">.</span><span class="n">Thread</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">device</span>
@@ -187,24 +198,33 @@
<span class="k">except</span> <span class="n">TimeoutError</span><span class="p">:</span>
<span class="k">pass</span>

<span class="k">except</span> <span class="ne">Exception</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">False</span>
<span class="k">except</span> <span class="n">InvalidMessageError</span><span class="p">:</span>
<span class="k">pass</span>

<span class="k">except</span> <span class="n">SSL</span><span class="o">.</span><span class="n">WantReadError</span><span class="p">:</span>
<span class="k">pass</span>

<span class="k">except</span> <span class="n">CommError</span><span class="p">,</span> <span class="n">err</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">close</span><span class="p">()</span>

<span class="n">time</span><span class="o">.</span><span class="n">sleep</span><span class="p">(</span><span class="mf">0.01</span><span class="p">)</span>
<span class="k">except</span> <span class="ne">Exception</span><span class="p">,</span> <span class="n">err</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">close</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">False</span>
<span class="k">raise</span>

</div></div></div>
<div class="viewcode-block" id="USBDevice"><a class="viewcode-back" href="../../alarmdecoder.html#alarmdecoder.devices.USBDevice">[docs]</a><span class="k">class</span> <span class="nc">USBDevice</span><span class="p">(</span><span class="n">Device</span><span class="p">):</span>
<span class="sd">&quot;&quot;&quot;</span>
<span class="sd"> AD2USB device exposed with PyFTDI&#39;s interface.</span>
<span class="sd"> `AD2USB`_ device utilizing PyFTDI&#39;s interface.</span>
<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="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="sd">&quot;&quot;&quot;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>
<span class="sd">&quot;&quot;&quot;Default baudrate for `AD2USB`_ devices.&quot;&quot;&quot;</span>

<span class="n">__devices</span> <span class="o">=</span> <span class="p">[]</span>
<span class="n">__detect_thread</span> <span class="o">=</span> <span class="bp">None</span>
@@ -215,7 +235,7 @@
<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: CommError</span>
<span class="sd"> :raises: :py:class:`~alarmdecoder.util.CommError`</span>
<span class="sd"> &quot;&quot;&quot;</span>
<span class="n">cls</span><span class="o">.</span><span class="n">__devices</span> <span class="o">=</span> <span class="p">[]</span>

@@ -230,24 +250,24 @@
<span class="nd">@classmethod</span>
<div class="viewcode-block" id="USBDevice.devices"><a class="viewcode-back" href="../../alarmdecoder.html#alarmdecoder.devices.USBDevice.devices">[docs]</a> <span class="k">def</span> <span class="nf">devices</span><span class="p">(</span><span class="n">cls</span><span class="p">):</span>
<span class="sd">&quot;&quot;&quot;</span>
<span class="sd"> Returns a cached list of AD2USB devices located on the system.</span>
<span class="sd"> Returns a cached list of `AD2USB`_ devices located on the system.</span>

<span class="sd"> :returns: cached list of devices found.</span>
<span class="sd"> :returns: cached list of devices found</span>
<span class="sd"> &quot;&quot;&quot;</span>
<span class="k">return</span> <span class="n">cls</span><span class="o">.</span><span class="n">__devices</span>
</div>
<span class="nd">@classmethod</span>
<div class="viewcode-block" id="USBDevice.find"><a class="viewcode-back" href="../../alarmdecoder.html#alarmdecoder.devices.USBDevice.find">[docs]</a> <span class="k">def</span> <span class="nf">find</span><span class="p">(</span><span class="n">cls</span><span class="p">,</span> <span class="n">device</span><span class="o">=</span><span class="bp">None</span><span class="p">):</span>
<span class="sd">&quot;&quot;&quot;</span>
<span class="sd"> Factory method that returns the requested USBDevice device, or the</span>
<span class="sd"> Factory method that returns the requested :py:class:`USBDevice` device, or the</span>
<span class="sd"> first device.</span>

<span class="sd"> :param device: Tuple describing the USB device to open, as returned</span>
<span class="sd"> by find_all().</span>
<span class="sd"> :type device: tuple</span>

<span class="sd"> :returns: USBDevice object utilizing the specified device.</span>
<span class="sd"> :raises: NoDeviceError</span>
<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="n">cls</span><span class="o">.</span><span class="n">find_all</span><span class="p">()</span>

@@ -266,14 +286,18 @@
<span class="sd">&quot;&quot;&quot;</span>
<span class="sd"> Starts the device detection thread.</span>

<span class="sd"> :param on_attached: function to be called when a device is attached.</span>
<span class="sd"> :param on_attached: function to be called when a device is attached **Callback definition:** *def callback(thread, device)*</span>
<span class="sd"> :type on_attached: function</span>
<span class="sd"> :param on_detached: function to be called when a device is detached.</span>
<span class="sd"> :param on_detached: function to be called when a device is detached **Callback definition:** *def callback(thread, device)*</span>

<span class="sd"> :type on_detached: function</span>
<span class="sd"> &quot;&quot;&quot;</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="n">cls</span><span class="o">.</span><span class="n">find_all</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">find_all</span><span class="p">()</span>
<span class="k">except</span> <span class="n">CommError</span><span class="p">:</span>
<span class="k">pass</span>

<span class="n">cls</span><span class="o">.</span><span class="n">__detect_thread</span><span class="o">.</span><span class="n">start</span><span class="p">()</span>
</div>
@@ -293,7 +317,7 @@
<span class="sd">&quot;&quot;&quot;</span>
<span class="sd"> Retrieves the interface used to connect to the device.</span>

<span class="sd"> :returns: the interface used to connect to the device.</span>
<span class="sd"> :returns: the interface used to connect to the device</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">_interface</span>

@@ -302,8 +326,8 @@
<span class="sd">&quot;&quot;&quot;</span>
<span class="sd"> Sets the interface used to connect to the device.</span>

<span class="sd"> :param value: May specify either the serial number or the device index.</span>
<span class="sd"> :type value: str or int</span>
<span class="sd"> :param value: may specify either the serial number or the device index</span>
<span class="sd"> :type value: string or int</span>
<span class="sd"> &quot;&quot;&quot;</span>
<span class="bp">self</span><span class="o">.</span><span class="n">_interface</span> <span class="o">=</span> <span class="n">value</span>
<span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">value</span><span class="p">,</span> <span class="nb">int</span><span class="p">):</span>
@@ -316,7 +340,7 @@
<span class="sd">&quot;&quot;&quot;</span>
<span class="sd"> Retrieves the serial number of the device.</span>

<span class="sd"> :returns: The serial number of the device.</span>
<span class="sd"> :returns: serial number of the device</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">_serial_number</span>
@@ -326,7 +350,7 @@
<span class="sd">&quot;&quot;&quot;</span>
<span class="sd"> Sets the serial number of the device.</span>

<span class="sd"> :param value: The serial number of the device.</span>
<span class="sd"> :param value: serial number of the device</span>
<span class="sd"> :type value: string</span>
<span class="sd"> &quot;&quot;&quot;</span>
<span class="bp">self</span><span class="o">.</span><span class="n">_serial_number</span> <span class="o">=</span> <span class="n">value</span>
@@ -336,7 +360,7 @@
<span class="sd">&quot;&quot;&quot;</span>
<span class="sd"> Retrieves the description of the device.</span>

<span class="sd"> :returns: The description of the device.</span>
<span class="sd"> :returns: description of the device</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">_description</span>

@@ -345,7 +369,7 @@
<span class="sd">&quot;&quot;&quot;</span>
<span class="sd"> Sets the description of the device.</span>

<span class="sd"> :param value: The description of the device.</span>
<span class="sd"> :param value: description of the device</span>
<span class="sd"> :type value: string</span>
<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>
@@ -356,7 +380,7 @@

<span class="sd"> :param interface: May specify either the serial number or the device</span>
<span class="sd"> index.</span>
<span class="sd"> :type interface: str or int</span>
<span class="sd"> :type interface: string or int</span>
<span class="sd"> &quot;&quot;&quot;</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>

@@ -376,13 +400,13 @@
<span class="sd">&quot;&quot;&quot;</span>
<span class="sd"> Opens the device.</span>

<span class="sd"> :param baudrate: The baudrate to use.</span>
<span class="sd"> :param baudrate: baudrate to use</span>
<span class="sd"> :type baudrate: int</span>
<span class="sd"> :param no_reader_thread: Whether or not to automatically start the</span>
<span class="sd"> :param no_reader_thread: whether or not to automatically start the</span>
<span class="sd"> reader thread.</span>
<span class="sd"> :type no_reader_thread: bool</span>

<span class="sd"> :raises: NoDeviceError</span>
<span class="sd"> :raises: :py:class:`~alarmdecoder.util.NoDeviceError`</span>
<span class="sd"> &quot;&quot;&quot;</span>
<span class="c"># Set up defaults</span>
<span class="k">if</span> <span class="n">baudrate</span> <span class="ow">is</span> <span class="bp">None</span><span class="p">:</span>
@@ -429,14 +453,17 @@
<span class="k">except</span> <span class="ne">Exception</span><span class="p">:</span>
<span class="k">pass</span>
</div>
<div class="viewcode-block" id="USBDevice.fileno"><a class="viewcode-back" href="../../alarmdecoder.html#alarmdecoder.devices.USBDevice.fileno">[docs]</a> <span class="k">def</span> <span class="nf">fileno</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
<span class="k">raise</span> <span class="ne">NotImplementedError</span><span class="p">(</span><span class="s">&#39;USB devices do not support fileno()&#39;</span><span class="p">)</span>
</div>
<div class="viewcode-block" id="USBDevice.write"><a class="viewcode-back" href="../../alarmdecoder.html#alarmdecoder.devices.USBDevice.write">[docs]</a> <span class="k">def</span> <span class="nf">write</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">data</span><span class="p">):</span>
<span class="sd">&quot;&quot;&quot;</span>
<span class="sd"> Writes data to the device.</span>

<span class="sd"> :param data: Data to write</span>
<span class="sd"> :type data: str</span>
<span class="sd"> :param data: data to write</span>
<span class="sd"> :type data: string</span>

<span class="sd"> :raises: CommError</span>
<span class="sd"> :raises: :py:class:`~alarmdecoder.util.CommError`</span>
<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">_device</span><span class="o">.</span><span class="n">write_data</span><span class="p">(</span><span class="n">data</span><span class="p">)</span>
@@ -450,8 +477,8 @@
<span class="sd">&quot;&quot;&quot;</span>
<span class="sd"> Reads a single character from the device.</span>

<span class="sd"> :returns: The character read from the device.</span>
<span class="sd"> :raises: CommError</span>
<span class="sd"> :returns: character read from the device</span>
<span class="sd"> :raises: :py:class:`~alarmdecoder.util.CommError`</span>
<span class="sd"> &quot;&quot;&quot;</span>
<span class="n">ret</span> <span class="o">=</span> <span class="bp">None</span>

@@ -467,14 +494,14 @@
<span class="sd">&quot;&quot;&quot;</span>
<span class="sd"> Reads a line from the device.</span>

<span class="sd"> :param timeout: The read timeout.</span>
<span class="sd"> :param timeout: read timeout</span>
<span class="sd"> :type timeout: float</span>
<span class="sd"> :param purge_buffer: Indicates whether to purge the buffer prior to</span>
<span class="sd"> reading.</span>
<span class="sd"> :type purge_buffer: bool</span>

<span class="sd"> :returns: The line that was read.</span>
<span class="sd"> :raises: CommError, TimeoutError</span>
<span class="sd"> :returns: line that was read</span>
<span class="sd"> :raises: :py:class:`~alarmdecoder.util.CommError`, :py:class:`~alarmdecoder.util.TimeoutError`</span>
<span class="sd"> &quot;&quot;&quot;</span>

<span class="k">def</span> <span class="nf">timeout_event</span><span class="p">():</span>
@@ -504,6 +531,8 @@
<span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_buffer</span><span class="p">)</span> <span class="o">&gt;</span> <span class="mi">0</span><span class="p">:</span>
<span class="n">got_line</span> <span class="o">=</span> <span class="bp">True</span>
<span class="k">break</span>
<span class="k">else</span><span class="p">:</span>
<span class="n">time</span><span class="o">.</span><span class="n">sleep</span><span class="p">(</span><span class="mf">0.01</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 reading from 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>
@@ -526,7 +555,7 @@
<span class="sd">&quot;&quot;&quot;</span>
<span class="sd"> Retrieves the FTDI device serial number.</span>

<span class="sd"> :returns: string containing the device serial number.</span>
<span class="sd"> :returns: string containing the device serial number</span>
<span class="sd"> &quot;&quot;&quot;</span>
<span class="k">return</span> <span class="n">usb</span><span class="o">.</span><span class="n">util</span><span class="o">.</span><span class="n">get_string</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">usb_dev</span><span class="p">,</span> <span class="mi">64</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">usb_dev</span><span class="o">.</span><span class="n">iSerialNumber</span><span class="p">)</span>

@@ -534,16 +563,16 @@
<span class="sd">&quot;&quot;&quot;</span>
<span class="sd"> Thread that handles detection of added/removed devices.</span>
<span class="sd"> &quot;&quot;&quot;</span>
<span class="n">on_attached</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">&#39;Called when an AD2USB device has been detected.&#39;</span><span class="p">)</span>
<span class="n">on_detached</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">&#39;Called when an AD2USB device has been removed.&#39;</span><span class="p">)</span>
<span class="n">on_attached</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 an `AD2USB`_ device has been detected.</span><span class="se">\n\n</span><span class="s">**Callback definition:** def callback(thread, device*&quot;</span><span class="p">)</span>
<span class="n">on_detached</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 an `AD2USB`_ device has been removed.</span><span class="se">\n\n</span><span class="s">**Callback definition:** def callback(thread, device*&quot;</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">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>
<span class="sd">&quot;&quot;&quot;</span>
<span class="sd"> Constructor</span>

<span class="sd"> :param on_attached: Function to call when a device is attached.</span>
<span class="sd"> :param on_attached: Function to call when a device is attached **Callback definition:** *def callback(thread, device)*</span>
<span class="sd"> :type on_attached: function</span>
<span class="sd"> :param on_detached: Function to call when a device is detached.</span>
<span class="sd"> :param on_detached: Function to call when a device is detached **Callback definition:** *def callback(thread, device)*</span>
<span class="sd"> :type on_detached: function</span>
<span class="sd"> &quot;&quot;&quot;</span>
<span class="n">threading</span><span class="o">.</span><span class="n">Thread</span><span class="o">.</span><span class="n">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span>
@@ -590,7 +619,7 @@
</div></div></div>
<div class="viewcode-block" id="SerialDevice"><a class="viewcode-back" href="../../alarmdecoder.html#alarmdecoder.devices.SerialDevice">[docs]</a><span class="k">class</span> <span class="nc">SerialDevice</span><span class="p">(</span><span class="n">Device</span><span class="p">):</span>
<span class="sd">&quot;&quot;&quot;</span>
<span class="sd"> AD2USB or AD2SERIAL device exposed with the pyserial interface.</span>
<span class="sd"> `AD2USB`_, `AD2SERIAL`_ or `AD2PI`_ device utilizing the PySerial interface.</span>
<span class="sd"> &quot;&quot;&quot;</span>

<span class="c"># Constants</span>
@@ -602,11 +631,11 @@
<span class="sd">&quot;&quot;&quot;</span>
<span class="sd"> Returns all serial ports present.</span>

<span class="sd"> :param pattern: Pattern to search for when retrieving serial ports.</span>
<span class="sd"> :type pattern: str</span>
<span class="sd"> :param pattern: pattern to search for when retrieving serial ports</span>
<span class="sd"> :type pattern: string</span>

<span class="sd"> :returns: list of devices</span>
<span class="sd"> :raises: CommError</span>
<span class="sd"> :raises: :py:class:`~alarmdecoder.util.CommError`</span>
<span class="sd"> &quot;&quot;&quot;</span>
<span class="n">devices</span> <span class="o">=</span> <span class="p">[]</span>

@@ -626,7 +655,7 @@
<span class="sd">&quot;&quot;&quot;</span>
<span class="sd"> Retrieves the interface used to connect to the device.</span>

<span class="sd"> :returns: the interface used to connect to the device.</span>
<span class="sd"> :returns: interface used to connect to the device</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">_port</span>

@@ -635,7 +664,7 @@
<span class="sd">&quot;&quot;&quot;</span>
<span class="sd"> Sets the interface used to connect to the device.</span>

<span class="sd"> :param value: The name of the serial device.</span>
<span class="sd"> :param value: name of the serial device</span>
<span class="sd"> :type value: string</span>
<span class="sd"> &quot;&quot;&quot;</span>
<span class="bp">self</span><span class="o">.</span><span class="n">_port</span> <span class="o">=</span> <span class="n">value</span>
@@ -644,8 +673,8 @@
<span class="sd">&quot;&quot;&quot;</span>
<span class="sd"> Constructor</span>

<span class="sd"> :param interface: The device to open.</span>
<span class="sd"> :type interface: str</span>
<span class="sd"> :param interface: device to open</span>
<span class="sd"> :type interface: string</span>
<span class="sd"> &quot;&quot;&quot;</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>

@@ -658,13 +687,13 @@
<span class="sd">&quot;&quot;&quot;</span>
<span class="sd"> Opens the device.</span>

<span class="sd"> :param baudrate: The baudrate to use with the device.</span>
<span class="sd"> :param baudrate: baudrate to use with the device</span>
<span class="sd"> :type baudrate: int</span>
<span class="sd"> :param no_reader_thread: Whether or not to automatically start the</span>
<span class="sd"> :param no_reader_thread: whether or not to automatically start the</span>
<span class="sd"> reader thread.</span>
<span class="sd"> :type no_reader_thread: bool</span>

<span class="sd"> :raises: NoDeviceError</span>
<span class="sd"> :raises: :py:class:`~alarmdecoder.util.NoDeviceError`</span>
<span class="sd"> &quot;&quot;&quot;</span>
<span class="c"># Set up the defaults</span>
<span class="k">if</span> <span class="n">baudrate</span> <span class="ow">is</span> <span class="bp">None</span><span class="p">:</span>
@@ -685,8 +714,8 @@
<span class="c"># all issues with it.</span>
<span class="bp">self</span><span class="o">.</span><span class="n">_device</span><span class="o">.</span><span class="n">baudrate</span> <span class="o">=</span> <span class="n">baudrate</span>

<span class="k">except</span> <span class="p">(</span><span class="n">serial</span><span class="o">.</span><span class="n">SerialException</span><span class="p">,</span> <span class="ne">ValueError</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 on port {0}.&#39;</span><span class="o">.</span><span class="n">format</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_port</span><span class="p">),</span> <span class="n">err</span><span class="p">)</span>
<span class="k">except</span> <span class="p">(</span><span class="n">serial</span><span class="o">.</span><span class="n">SerialException</span><span class="p">,</span> <span class="ne">ValueError</span><span class="p">,</span> <span class="ne">OSError</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 on {0}.&#39;</span><span class="o">.</span><span class="n">format</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_port</span><span class="p">),</span> <span class="n">err</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>
@@ -707,14 +736,17 @@
<span class="k">except</span> <span class="ne">Exception</span><span class="p">:</span>
<span class="k">pass</span>
</div>
<div class="viewcode-block" id="SerialDevice.fileno"><a class="viewcode-back" href="../../alarmdecoder.html#alarmdecoder.devices.SerialDevice.fileno">[docs]</a> <span class="k">def</span> <span class="nf">fileno</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
<span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_device</span><span class="o">.</span><span class="n">fileno</span><span class="p">()</span>
</div>
<div class="viewcode-block" id="SerialDevice.write"><a class="viewcode-back" href="../../alarmdecoder.html#alarmdecoder.devices.SerialDevice.write">[docs]</a> <span class="k">def</span> <span class="nf">write</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">data</span><span class="p">):</span>
<span class="sd">&quot;&quot;&quot;</span>
<span class="sd"> Writes data to the device.</span>

<span class="sd"> :param data: The data to write.</span>
<span class="sd"> :type data: str</span>
<span class="sd"> :param data: data to write</span>
<span class="sd"> :type data: string</span>

<span class="sd"> :raises: CommError</span>
<span class="sd"> :raises: py:class:`~alarmdecoder.util.CommError`</span>
<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">_device</span><span class="o">.</span><span class="n">write</span><span class="p">(</span><span class="n">data</span><span class="p">)</span>
@@ -732,8 +764,8 @@
<span class="sd">&quot;&quot;&quot;</span>
<span class="sd"> Reads a single character from the device.</span>

<span class="sd"> :returns: The character read from the device.</span>
<span class="sd"> :raises: CommError</span>
<span class="sd"> :returns: character read from the device</span>
<span class="sd"> :raises: :py:class:`~alarmdecoder.util.CommError`</span>
<span class="sd"> &quot;&quot;&quot;</span>
<span class="n">ret</span> <span class="o">=</span> <span class="bp">None</span>

@@ -749,14 +781,14 @@
<span class="sd">&quot;&quot;&quot;</span>
<span class="sd"> Reads a line from the device.</span>

<span class="sd"> :param timeout: The read timeout.</span>
<span class="sd"> :param timeout: read timeout</span>
<span class="sd"> :type timeout: float</span>
<span class="sd"> :param purge_buffer: Indicates whether to purge the buffer prior to</span>
<span class="sd"> reading.</span>
<span class="sd"> :type purge_buffer: bool</span>

<span class="sd"> :returns: The line that was read.</span>
<span class="sd"> :raises: CommError, TimeoutError</span>
<span class="sd"> :returns: line that was read</span>
<span class="sd"> :raises: :py:class:`~alarmdecoder.util.CommError`, :py:class:`~alarmdecoder.util.TimeoutError`</span>
<span class="sd"> &quot;&quot;&quot;</span>

<span class="k">def</span> <span class="nf">timeout_event</span><span class="p">():</span>
@@ -787,6 +819,8 @@
<span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_buffer</span><span class="p">)</span> <span class="o">&gt;</span> <span class="mi">0</span><span class="p">:</span>
<span class="n">got_line</span> <span class="o">=</span> <span class="bp">True</span>
<span class="k">break</span>
<span class="k">else</span><span class="p">:</span>
<span class="n">time</span><span class="o">.</span><span class="n">sleep</span><span class="p">(</span><span class="mf">0.01</span><span class="p">)</span>

<span class="k">except</span> <span class="p">(</span><span class="ne">OSError</span><span class="p">,</span> <span class="n">serial</span><span class="o">.</span><span class="n">SerialException</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 reading from 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>
@@ -808,8 +842,8 @@
</div></div>
<div class="viewcode-block" id="SocketDevice"><a class="viewcode-back" href="../../alarmdecoder.html#alarmdecoder.devices.SocketDevice">[docs]</a><span class="k">class</span> <span class="nc">SocketDevice</span><span class="p">(</span><span class="n">Device</span><span class="p">):</span>
<span class="sd">&quot;&quot;&quot;</span>
<span class="sd"> Device that supports communication with an Alarm Decoder (AD2) that is</span>
<span class="sd"> exposed via ser2sock or another Serial to IP interface.</span>
<span class="sd"> Device that supports communication with an `AlarmDecoder`_ (AD2) that is</span>
<span class="sd"> exposed via `ser2sock`_ or another Serial to IP interface.</span>
<span class="sd"> &quot;&quot;&quot;</span>

<span class="nd">@property</span>
@@ -817,7 +851,7 @@
<span class="sd">&quot;&quot;&quot;</span>
<span class="sd"> Retrieves the interface used to connect to the device.</span>

<span class="sd"> :returns: the interface used to connect to the device.</span>
<span class="sd"> :returns: interface used to connect to the device</span>
<span class="sd"> &quot;&quot;&quot;</span>
<span class="k">return</span> <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_host</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">_port</span><span class="p">)</span>

@@ -826,7 +860,7 @@
<span class="sd">&quot;&quot;&quot;</span>
<span class="sd"> Sets the interface used to connect to the device.</span>

<span class="sd"> :param value: Tuple containing the host and port to use.</span>
<span class="sd"> :param value: Tuple containing the host and port to use</span>
<span class="sd"> :type value: tuple</span>
<span class="sd"> &quot;&quot;&quot;</span>
<span class="bp">self</span><span class="o">.</span><span class="n">_host</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">_port</span> <span class="o">=</span> <span class="n">value</span>
@@ -836,7 +870,7 @@
<span class="sd">&quot;&quot;&quot;</span>
<span class="sd"> Retrieves whether or not the device is using SSL.</span>

<span class="sd"> :returns: Whether or not the device is using SSL.</span>
<span class="sd"> :returns: whether or not the device is using SSL</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">_use_ssl</span>

@@ -845,7 +879,7 @@
<span class="sd">&quot;&quot;&quot;</span>
<span class="sd"> Sets whether or not SSL communication is in use.</span>

<span class="sd"> :param value: Whether or not SSL communication is in use.</span>
<span class="sd"> :param value: Whether or not SSL communication is in use</span>
<span class="sd"> :type value: bool</span>
<span class="sd"> &quot;&quot;&quot;</span>
<span class="bp">self</span><span class="o">.</span><span class="n">_use_ssl</span> <span class="o">=</span> <span class="n">value</span>
@@ -855,7 +889,7 @@
<span class="sd">&quot;&quot;&quot;</span>
<span class="sd"> Retrieves the SSL client certificate path used for authentication.</span>

<span class="sd"> :returns: The certificate path</span>
<span class="sd"> :returns: path to the certificate path or :py:class:`OpenSSL.crypto.X509`</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">_ssl_certificate</span>

@@ -864,8 +898,8 @@
<span class="sd">&quot;&quot;&quot;</span>
<span class="sd"> Sets the SSL client certificate to use for authentication.</span>

<span class="sd"> :param value: The path to the SSL certificate.</span>
<span class="sd"> :type value: str</span>
<span class="sd"> :param value: path to the SSL certificate or :py:class:`OpenSSL.crypto.X509`</span>
<span class="sd"> :type value: string or :py:class:`OpenSSL.crypto.X509`</span>
<span class="sd"> &quot;&quot;&quot;</span>
<span class="bp">self</span><span class="o">.</span><span class="n">_ssl_certificate</span> <span class="o">=</span> <span class="n">value</span>
</div>
@@ -874,7 +908,7 @@
<span class="sd">&quot;&quot;&quot;</span>
<span class="sd"> Retrieves the SSL client certificate key used for authentication.</span>

<span class="sd"> :returns: The key path</span>
<span class="sd"> :returns: jpath to the SSL key or :py:class:`OpenSSL.crypto.PKey`</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">_ssl_key</span>

@@ -883,8 +917,8 @@
<span class="sd">&quot;&quot;&quot;</span>
<span class="sd"> Sets the SSL client certificate key to use for authentication.</span>

<span class="sd"> :param value: The path to the SSL key.</span>
<span class="sd"> :type value: str</span>
<span class="sd"> :param value: path to the SSL key or :py:class:`OpenSSL.crypto.PKey`</span>
<span class="sd"> :type value: string or :py:class:`OpenSSL.crypto.PKey`</span>
<span class="sd"> &quot;&quot;&quot;</span>
<span class="bp">self</span><span class="o">.</span><span class="n">_ssl_key</span> <span class="o">=</span> <span class="n">value</span>
</div>
@@ -894,7 +928,7 @@
<span class="sd"> Retrieves the SSL Certificate Authority certificate used for</span>
<span class="sd"> authentication.</span>

<span class="sd"> :returns: The CA path</span>
<span class="sd"> :returns: path to the CA certificate or :py:class:`OpenSSL.crypto.X509`</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">_ssl_ca</span>

@@ -903,8 +937,8 @@
<span class="sd">&quot;&quot;&quot;</span>
<span class="sd"> Sets the SSL Certificate Authority certificate used for authentication.</span>

<span class="sd"> :param value: The path to the SSL CA certificate.</span>
<span class="sd"> :type value: str</span>
<span class="sd"> :param value: path to the SSL CA certificate or :py:class:`OpenSSL.crypto.X509`</span>
<span class="sd"> :type value: string or :py:class:`OpenSSL.crypto.X509`</span>
<span class="sd"> &quot;&quot;&quot;</span>
<span class="bp">self</span><span class="o">.</span><span class="n">_ssl_ca</span> <span class="o">=</span> <span class="n">value</span>
</div>
@@ -912,7 +946,7 @@
<span class="sd">&quot;&quot;&quot;</span>
<span class="sd"> Constructor</span>

<span class="sd"> :param interface: Tuple containing the hostname and port of our target.</span>
<span class="sd"> :param interface: Tuple containing the hostname and port of our target</span>
<span class="sd"> :type interface: tuple</span>
<span class="sd"> &quot;&quot;&quot;</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>
@@ -927,13 +961,13 @@
<span class="sd">&quot;&quot;&quot;</span>
<span class="sd"> Opens the device.</span>

<span class="sd"> :param baudrate: The baudrate to use</span>
<span class="sd"> :param baudrate: baudrate to use</span>
<span class="sd"> :type baudrate: int</span>
<span class="sd"> :param no_reader_thread: Whether or not to automatically open the reader</span>
<span class="sd"> :param no_reader_thread: whether or not to automatically open the reader</span>
<span class="sd"> thread.</span>
<span class="sd"> :type no_reader_thread: bool</span>

<span class="sd"> :raises: NoDeviceError, CommError</span>
<span class="sd"> :raises: :py:class:`~alarmdecoder.util.NoDeviceError`, :py:class:`~alarmdecoder.util.CommError`</span>
<span class="sd"> &quot;&quot;&quot;</span>

<span class="k">try</span><span class="p">:</span>
@@ -943,9 +977,15 @@
<span class="bp">self</span><span class="o">.</span><span class="n">_init_ssl</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">connect</span><span class="p">((</span><span class="bp">self</span><span class="o">.</span><span class="n">_host</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">_port</span><span class="p">))</span>
<span class="c">#self._device.setblocking(1)</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>
<span class="bp">self</span><span class="o">.</span><span class="n">_device</span><span class="o">.</span><span class="n">do_handshake</span><span class="p">()</span>
<span class="k">while</span> <span class="bp">True</span><span class="p">:</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">do_handshake</span><span class="p">()</span>
<span class="k">break</span>
<span class="k">except</span> <span class="n">SSL</span><span class="o">.</span><span class="n">WantReadError</span><span class="p">:</span>
<span class="k">pass</span>

<span class="bp">self</span><span class="o">.</span><span class="n">_id</span> <span class="o">=</span> <span class="s">&#39;{0}:{1}&#39;</span><span class="o">.</span><span class="n">format</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_host</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">_port</span><span class="p">)</span>

@@ -974,20 +1014,23 @@
<span class="c"># Make sure that it closes immediately.</span>
<span class="bp">self</span><span class="o">.</span><span class="n">_device</span><span class="o">.</span><span class="n">shutdown</span><span class="p">(</span><span class="n">socket</span><span class="o">.</span><span class="n">SHUT_RDWR</span><span class="p">)</span>

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

<span class="k">except</span> <span class="ne">Exception</span><span class="p">:</span>
<span class="k">pass</span>

<span class="n">Device</span><span class="o">.</span><span class="n">close</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span>
</div>
<div class="viewcode-block" id="SocketDevice.fileno"><a class="viewcode-back" href="../../alarmdecoder.html#alarmdecoder.devices.SocketDevice.fileno">[docs]</a> <span class="k">def</span> <span class="nf">fileno</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
<span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_device</span><span class="o">.</span><span class="n">fileno</span><span class="p">()</span>
</div>
<div class="viewcode-block" id="SocketDevice.write"><a class="viewcode-back" href="../../alarmdecoder.html#alarmdecoder.devices.SocketDevice.write">[docs]</a> <span class="k">def</span> <span class="nf">write</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">data</span><span class="p">):</span>
<span class="sd">&quot;&quot;&quot;</span>
<span class="sd"> Writes data to the device.</span>

<span class="sd"> :param data: The data to write.</span>
<span class="sd"> :type data: str</span>
<span class="sd"> :param data: data to write</span>
<span class="sd"> :type data: string</span>

<span class="sd"> :returns: The number of bytes sent.</span>
<span class="sd"> :raises: CommError</span>
<span class="sd"> :returns: number of bytes sent</span>
<span class="sd"> :raises: :py:class:`~alarmdecoder.util.CommError`</span>
<span class="sd"> &quot;&quot;&quot;</span>
<span class="n">data_sent</span> <span class="o">=</span> <span class="bp">None</span>

@@ -1008,8 +1051,8 @@
<span class="sd">&quot;&quot;&quot;</span>
<span class="sd"> Reads a single character from the device.</span>

<span class="sd"> :returns: The character read from the device.</span>
<span class="sd"> :raises: CommError</span>
<span class="sd"> :returns: character read from the device</span>
<span class="sd"> :raises: :py:class:`~alarmdecoder.util.CommError`</span>
<span class="sd"> &quot;&quot;&quot;</span>
<span class="n">data</span> <span class="o">=</span> <span class="bp">None</span>

@@ -1025,14 +1068,14 @@
<span class="sd">&quot;&quot;&quot;</span>
<span class="sd"> Reads a line from the device.</span>

<span class="sd"> :param timeout: The read timeout.</span>
<span class="sd"> :param timeout: read timeout</span>
<span class="sd"> :type timeout: float</span>
<span class="sd"> :param purge_buffer: Indicates whether to purge the buffer prior to</span>
<span class="sd"> reading.</span>
<span class="sd"> :type purge_buffer: bool</span>

<span class="sd"> :returns: The line that was read.:</span>
<span class="sd"> :raises: CommError, TimeoutError</span>
<span class="sd"> :returns: line that was read</span>
<span class="sd"> :raises: :py:class:`~alarmdecoder.util.CommError`, :py:class:`~alarmdecoder.util.TimeoutError`</span>
<span class="sd"> &quot;&quot;&quot;</span>

<span class="k">def</span> <span class="nf">timeout_event</span><span class="p">():</span>
@@ -1062,10 +1105,19 @@
<span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_buffer</span><span class="p">)</span> <span class="o">&gt;</span> <span class="mi">0</span><span class="p">:</span>
<span class="n">got_line</span> <span class="o">=</span> <span class="bp">True</span>
<span class="k">break</span>
<span class="k">else</span><span class="p">:</span>
<span class="n">time</span><span class="o">.</span><span class="n">sleep</span><span class="p">(</span><span class="mf">0.01</span><span class="p">)</span>

<span class="k">except</span> <span class="n">socket</span><span class="o">.</span><span class="n">error</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 reading from 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="n">SSL</span><span class="o">.</span><span class="n">SysCallError</span><span class="p">,</span> <span class="n">err</span><span class="p">:</span>
<span class="n">errno</span><span class="p">,</span> <span class="n">msg</span> <span class="o">=</span> <span class="n">err</span>
<span class="k">raise</span> <span class="n">CommError</span><span class="p">(</span><span class="s">&#39;SSL error while reading from device: {0} ({1})&#39;</span><span class="o">.</span><span class="n">format</span><span class="p">(</span><span class="n">msg</span><span class="p">,</span> <span class="n">errno</span><span class="p">))</span>

<span class="k">except</span> <span class="ne">Exception</span><span class="p">:</span>
<span class="k">raise</span>

<span class="k">else</span><span class="p">:</span>
<span class="k">if</span> <span class="n">got_line</span><span class="p">:</span>
<span class="n">ret</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">_buffer</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_buffer</span><span class="p">,</span> <span class="s">&#39;&#39;</span>
@@ -1083,6 +1135,8 @@
<span class="k">def</span> <span class="nf">_init_ssl</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
<span class="sd">&quot;&quot;&quot;</span>
<span class="sd"> Initializes our device as an SSL connection.</span>

<span class="sd"> :raises: :py:class:`~alarmdecoder.util.CommError`</span>
<span class="sd"> &quot;&quot;&quot;</span>

<span class="k">try</span><span class="p">:</span>


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

@@ -80,6 +80,9 @@
<span class="bp">self</span><span class="o">.</span><span class="n">event</span> <span class="o">=</span> <span class="n">event</span>
<span class="bp">self</span><span class="o">.</span><span class="n">obj</span> <span class="o">=</span> <span class="n">obj</span>

<span class="k">def</span> <span class="nf">__iter__</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
<span class="k">return</span> <span class="nb">iter</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_getfunctionlist</span><span class="p">())</span>

<span class="k">def</span> <span class="nf">_getfunctionlist</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>

<span class="sd">&quot;&quot;&quot;(internal use) &quot;&quot;&quot;</span>


+ 152
- 75
docs/build/html/_modules/alarmdecoder/messages.html View File

@@ -48,13 +48,21 @@
<h1>Source code for alarmdecoder.messages</h1><div class="highlight"><pre>
<span class="sd">&quot;&quot;&quot;</span>
<span class="sd">Message representations received from the panel through the Alarm Decoder (AD2)</span>
<span class="sd">Message representations received from the panel through the `AlarmDecoder`_ (AD2)</span>
<span class="sd">devices.</span>

<span class="sd">* :py:class:`Message`: The standard and most common message received from a panel.</span>
<span class="sd">* :py:class:`ExpanderMessage`: Messages received from Relay or Zone expander modules.</span>
<span class="sd">* :py:class:`RFMessage`: Message received from an RF receiver module.</span>
<span class="sd">* :py:class:`LRRMessage`: Message received from a long-range radio module.</span>

<span class="sd">.. _AlarmDecoder: http://www.alarmdecoder.com</span>

<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">re</span>
<span class="kn">import</span> <span class="nn">datetime</span>

<span class="kn">from</span> <span class="nn">.util</span> <span class="kn">import</span> <span class="n">InvalidMessageError</span>

@@ -67,11 +75,14 @@
<span class="n">raw</span> <span class="o">=</span> <span class="bp">None</span>
<span class="sd">&quot;&quot;&quot;The raw message text&quot;&quot;&quot;</span>

<span class="n">timestamp</span> <span class="o">=</span> <span class="bp">None</span>
<span class="sd">&quot;&quot;&quot;The timestamp of the message&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="sd">&quot;&quot;&quot;</span>
<span class="sd"> Constructor</span>
<span class="sd"> &quot;&quot;&quot;</span>
<span class="k">pass</span>
<span class="bp">self</span><span class="o">.</span><span class="n">timestamp</span> <span class="o">=</span> <span class="n">datetime</span><span class="o">.</span><span class="n">datetime</span><span class="o">.</span><span class="n">now</span><span class="p">()</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>
@@ -79,6 +90,22 @@
<span class="sd"> &quot;&quot;&quot;</span>
<span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">raw</span>

<div class="viewcode-block" id="BaseMessage.dict"><a class="viewcode-back" href="../../alarmdecoder.html#alarmdecoder.messages.BaseMessage.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>
<span class="sd"> Dictionary representation.</span>
<span class="sd"> &quot;&quot;&quot;</span>
<span class="k">return</span> <span class="nb">dict</span><span class="p">(</span>
<span class="n">time</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">timestamp</span><span class="p">,</span>
<span class="n">mesg</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">raw</span><span class="p">,</span>
<span class="o">**</span><span class="n">kwargs</span>
<span class="p">)</span>
</div>
<span class="k">def</span> <span class="nf">__repr__</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
<span class="sd">&quot;&quot;&quot;</span>
<span class="sd"> String representation.</span>
<span class="sd"> &quot;&quot;&quot;</span>
<span class="k">return</span> <span class="nb">repr</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">dict</span><span class="p">())</span>

</div>
<div class="viewcode-block" id="Message"><a class="viewcode-back" href="../../alarmdecoder.html#alarmdecoder.messages.Message">[docs]</a><span class="k">class</span> <span class="nc">Message</span><span class="p">(</span><span class="n">BaseMessage</span><span class="p">):</span>
<span class="sd">&quot;&quot;&quot;</span>
@@ -86,78 +113,72 @@
<span class="sd"> &quot;&quot;&quot;</span>

<span class="n">ready</span> <span class="o">=</span> <span class="bp">False</span>
<span class="sd">&quot;&quot;&quot;Indicates whether or not the panel is in a ready state&quot;&quot;&quot;</span>
<span class="sd">&quot;&quot;&quot;Indicates whether or not the panel is in a ready state.&quot;&quot;&quot;</span>
<span class="n">armed_away</span> <span class="o">=</span> <span class="bp">False</span>
<span class="sd">&quot;&quot;&quot;Indicates whether or not the panel is armed away&quot;&quot;&quot;</span>
<span class="sd">&quot;&quot;&quot;Indicates whether or not the panel is armed away.&quot;&quot;&quot;</span>
<span class="n">armed_home</span> <span class="o">=</span> <span class="bp">False</span>
<span class="sd">&quot;&quot;&quot;Indicates whether or not the panel is armed home&quot;&quot;&quot;</span>
<span class="sd">&quot;&quot;&quot;Indicates whether or not the panel is armed home.&quot;&quot;&quot;</span>
<span class="n">backlight_on</span> <span class="o">=</span> <span class="bp">False</span>
<span class="sd">&quot;&quot;&quot;Indicates whether or not the keypad backlight is on&quot;&quot;&quot;</span>
<span class="sd">&quot;&quot;&quot;Indicates whether or not the keypad backlight is on.&quot;&quot;&quot;</span>
<span class="n">programming_mode</span> <span class="o">=</span> <span class="bp">False</span>
<span class="sd">&quot;&quot;&quot;Indicates whether or not we&#39;re in programming mode&quot;&quot;&quot;</span>
<span class="sd">&quot;&quot;&quot;Indicates whether or not we&#39;re in programming mode.&quot;&quot;&quot;</span>
<span class="n">beeps</span> <span class="o">=</span> <span class="o">-</span><span class="mi">1</span>
<span class="sd">&quot;&quot;&quot;Number of beeps associated with a message&quot;&quot;&quot;</span>
<span class="sd">&quot;&quot;&quot;Number of beeps associated with a message.&quot;&quot;&quot;</span>
<span class="n">zone_bypassed</span> <span class="o">=</span> <span class="bp">False</span>
<span class="sd">&quot;&quot;&quot;Indicates whether or not a zone is bypassed&quot;&quot;&quot;</span>
<span class="sd">&quot;&quot;&quot;Indicates whether or not a zone is bypassed.&quot;&quot;&quot;</span>
<span class="n">ac_power</span> <span class="o">=</span> <span class="bp">False</span>
<span class="sd">&quot;&quot;&quot;Indicates whether or not the panel is on AC power&quot;&quot;&quot;</span>
<span class="sd">&quot;&quot;&quot;Indicates whether or not the panel is on AC power.&quot;&quot;&quot;</span>
<span class="n">chime_on</span> <span class="o">=</span> <span class="bp">False</span>
<span class="sd">&quot;&quot;&quot;Indicates whether or not the chime is enabled&quot;&quot;&quot;</span>
<span class="sd">&quot;&quot;&quot;Indicates whether or not the chime is enabled.&quot;&quot;&quot;</span>
<span class="n">alarm_event_occurred</span> <span class="o">=</span> <span class="bp">False</span>
<span class="sd">&quot;&quot;&quot;Indicates whether or not an alarm event has occurred&quot;&quot;&quot;</span>
<span class="sd">&quot;&quot;&quot;Indicates whether or not an alarm event has occurred.&quot;&quot;&quot;</span>
<span class="n">alarm_sounding</span> <span class="o">=</span> <span class="bp">False</span>
<span class="sd">&quot;&quot;&quot;Indicates whether or not an alarm is sounding&quot;&quot;&quot;</span>
<span class="sd">&quot;&quot;&quot;Indicates whether or not an alarm is sounding.&quot;&quot;&quot;</span>
<span class="n">battery_low</span> <span class="o">=</span> <span class="bp">False</span>
<span class="sd">&quot;&quot;&quot;Indicates whether or not there is a low battery&quot;&quot;&quot;</span>
<span class="sd">&quot;&quot;&quot;Indicates whether or not there is a low battery.&quot;&quot;&quot;</span>
<span class="n">entry_delay_off</span> <span class="o">=</span> <span class="bp">False</span>
<span class="sd">&quot;&quot;&quot;Indicates whether or not the entry delay is enabled&quot;&quot;&quot;</span>
<span class="sd">&quot;&quot;&quot;Indicates whether or not the entry delay is enabled.&quot;&quot;&quot;</span>
<span class="n">fire_alarm</span> <span class="o">=</span> <span class="bp">False</span>
<span class="sd">&quot;&quot;&quot;Indicates whether or not a fire alarm is sounding&quot;&quot;&quot;</span>
<span class="sd">&quot;&quot;&quot;Indicates whether or not a fire alarm is sounding.&quot;&quot;&quot;</span>
<span class="n">check_zone</span> <span class="o">=</span> <span class="bp">False</span>
<span class="sd">&quot;&quot;&quot;Indicates whether or not there are zones that require attention.&quot;&quot;&quot;</span>
<span class="n">perimeter_only</span> <span class="o">=</span> <span class="bp">False</span>
<span class="sd">&quot;&quot;&quot;Indicates whether or not the perimeter is armed&quot;&quot;&quot;</span>
<span class="sd">&quot;&quot;&quot;Indicates whether or not the perimeter is armed.&quot;&quot;&quot;</span>
<span class="n">numeric_code</span> <span class="o">=</span> <span class="bp">None</span>
<span class="sd">&quot;&quot;&quot;The numeric code associated with the message&quot;&quot;&quot;</span>
<span class="sd">&quot;&quot;&quot;The numeric code associated with the message.&quot;&quot;&quot;</span>
<span class="n">text</span> <span class="o">=</span> <span class="bp">None</span>
<span class="sd">&quot;&quot;&quot;The human-readable text to be displayed on the panel LCD&quot;&quot;&quot;</span>
<span class="sd">&quot;&quot;&quot;The human-readable text to be displayed on the panel LCD.&quot;&quot;&quot;</span>
<span class="n">cursor_location</span> <span class="o">=</span> <span class="o">-</span><span class="mi">1</span>
<span class="sd">&quot;&quot;&quot;Current cursor location on the keypad&quot;&quot;&quot;</span>
<span class="sd">&quot;&quot;&quot;Current cursor location on the keypad.&quot;&quot;&quot;</span>
<span class="n">mask</span> <span class="o">=</span> <span class="bp">None</span>
<span class="sd">&quot;&quot;&quot;Address mask this message is intended for&quot;&quot;&quot;</span>
<span class="sd">&quot;&quot;&quot;Address mask this message is intended for.&quot;&quot;&quot;</span>
<span class="n">bitfield</span> <span class="o">=</span> <span class="bp">None</span>
<span class="sd">&quot;&quot;&quot;The bitfield associated with this message&quot;&quot;&quot;</span>
<span class="sd">&quot;&quot;&quot;The bitfield associated with this message.&quot;&quot;&quot;</span>
<span class="n">panel_data</span> <span class="o">=</span> <span class="bp">None</span>
<span class="sd">&quot;&quot;&quot;The panel data field associated with this message&quot;&quot;&quot;</span>
<span class="sd">&quot;&quot;&quot;The panel data field associated with this message.&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">data</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>

<span class="sd"> :param data: Message data to parse.</span>
<span class="sd"> :type data: str</span>
<span class="sd"> :param data: message data to parse</span>
<span class="sd"> :type data: string</span>
<span class="sd"> &quot;&quot;&quot;</span>
<span class="n">BaseMessage</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">_regex</span> <span class="o">=</span> <span class="n">re</span><span class="o">.</span><span class="n">compile</span><span class="p">(</span><span class="s">&#39;^(!KPE:){0,1}(\[[a-fA-F0-9\-]+\]),([a-fA-F0-9]+),(\[[a-fA-F0-9]+\]),(&quot;.+&quot;)$&#39;</span><span class="p">)</span>
<span class="bp">self</span><span class="o">.</span><span class="n">_regex</span> <span class="o">=</span> <span class="n">re</span><span class="o">.</span><span class="n">compile</span><span class="p">(</span><span class="s">&#39;^(!KPM:){0,1}(\[[a-fA-F0-9\-]+\]),([a-fA-F0-9]+),(\[[a-fA-F0-9]+\]),(&quot;.+&quot;)$&#39;</span><span class="p">)</span>

<span class="k">if</span> <span class="n">data</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">_parse_message</span><span class="p">(</span><span class="n">data</span><span class="p">)</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>
<span class="sd"> String conversion operator.</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">raw</span>

<span class="k">def</span> <span class="nf">_parse_message</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">data</span><span class="p">):</span>
<span class="sd">&quot;&quot;&quot;</span>
<span class="sd"> Parse the message from the device.</span>

<span class="sd"> :param data: The message data.</span>
<span class="sd"> :type data: str</span>
<span class="sd"> :param data: message data</span>
<span class="sd"> :type data: string</span>

<span class="sd"> :raises: InvalidMessageError</span>
<span class="sd"> :raises: :py:class:`~alarmdecoder.util.InvalidMessageError`</span>
<span class="sd"> &quot;&quot;&quot;</span>
<span class="n">match</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_regex</span><span class="o">.</span><span class="n">match</span><span class="p">(</span><span class="n">data</span><span class="p">)</span>

@@ -193,7 +214,38 @@
<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>

</div>
<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>
<span class="sd"> Dictionary representation.</span>
<span class="sd"> &quot;&quot;&quot;</span>
<span class="k">return</span> <span class="nb">dict</span><span class="p">(</span>
<span class="n">time</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">timestamp</span><span class="p">,</span>
<span class="n">bitfield</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">bitfield</span><span class="p">,</span>
<span class="n">numeric_code</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">numeric_code</span><span class="p">,</span>
<span class="n">panel_data</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">panel_data</span><span class="p">,</span>
<span class="n">mask</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">mask</span><span class="p">,</span>
<span class="n">ready</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">ready</span><span class="p">,</span>
<span class="n">armed_away</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">armed_away</span><span class="p">,</span>
<span class="n">armed_home</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">armed_home</span><span class="p">,</span>
<span class="n">backlight_on</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">backlight_on</span><span class="p">,</span>
<span class="n">programming_mode</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">programming_mode</span><span class="p">,</span>
<span class="n">beeps</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">beeps</span><span class="p">,</span>
<span class="n">zone_bypassed</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">zone_bypassed</span><span class="p">,</span>
<span class="n">ac_power</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">ac_power</span><span class="p">,</span>
<span class="n">chime_on</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">chime_on</span><span class="p">,</span>
<span class="n">alarm_event_occurred</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">alarm_event_occurred</span><span class="p">,</span>
<span class="n">alarm_sounding</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">alarm_sounding</span><span class="p">,</span>
<span class="n">battery_low</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">battery_low</span><span class="p">,</span>
<span class="n">entry_delay_off</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">entry_delay_off</span><span class="p">,</span>
<span class="n">fire_alarm</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">fire_alarm</span><span class="p">,</span>
<span class="n">check_zone</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">check_zone</span><span class="p">,</span>
<span class="n">perimeter_only</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">perimeter_only</span><span class="p">,</span>
<span class="n">text</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">text</span><span class="p">,</span>
<span class="n">cursor_location</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">cursor_location</span><span class="p">,</span>
<span class="o">**</span><span class="n">kwargs</span>
<span class="p">)</span>

</div></div>
<div class="viewcode-block" id="ExpanderMessage"><a class="viewcode-back" href="../../alarmdecoder.html#alarmdecoder.messages.ExpanderMessage">[docs]</a><span class="k">class</span> <span class="nc">ExpanderMessage</span><span class="p">(</span><span class="n">BaseMessage</span><span class="p">):</span>
<span class="sd">&quot;&quot;&quot;</span>
<span class="sd"> Represents a message from a zone or relay expansion module.</span>
@@ -217,26 +269,22 @@
<span class="sd">&quot;&quot;&quot;</span>
<span class="sd"> Constructor</span>

<span class="sd"> :param data: The message data to parse.</span>
<span class="sd"> :type data: str</span>
<span class="sd"> :param data: message data to parse</span>
<span class="sd"> :type data: string</span>
<span class="sd"> &quot;&quot;&quot;</span>
<span class="n">BaseMessage</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="k">if</span> <span class="n">data</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">_parse_message</span><span class="p">(</span><span class="n">data</span><span class="p">)</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>
<span class="sd"> String conversion operator.</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">raw</span>

<span class="k">def</span> <span class="nf">_parse_message</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">data</span><span class="p">):</span>
<span class="sd">&quot;&quot;&quot;</span>
<span class="sd"> Parse the raw message from the device.</span>

<span class="sd"> :param data: The message data</span>
<span class="sd"> :type data: str</span>
<span class="sd"> :param data: message data</span>
<span class="sd"> :type data: string</span>

<span class="sd"> :raises: :py:class:`~alarmdecoder.util.InvalidMessageError`</span>
<span class="sd"> &quot;&quot;&quot;</span>
<span class="k">try</span><span class="p">:</span>
<span class="n">header</span><span class="p">,</span> <span class="n">values</span> <span class="o">=</span> <span class="n">data</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="s">&#39;:&#39;</span><span class="p">)</span>
@@ -257,47 +305,55 @@
<span class="k">else</span><span class="p">:</span>
<span class="k">raise</span> <span class="n">InvalidMessageError</span><span class="p">(</span><span class="s">&#39;Unknown expander message header: {0}&#39;</span><span class="o">.</span><span class="n">format</span><span class="p">(</span><span class="n">data</span><span class="p">))</span>

</div>
<div class="viewcode-block" id="ExpanderMessage.dict"><a class="viewcode-back" href="../../alarmdecoder.html#alarmdecoder.messages.ExpanderMessage.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>
<span class="sd"> Dictionary representation.</span>
<span class="sd"> &quot;&quot;&quot;</span>
<span class="k">return</span> <span class="nb">dict</span><span class="p">(</span>
<span class="n">time</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">timestamp</span><span class="p">,</span>
<span class="n">address</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">address</span><span class="p">,</span>
<span class="n">channel</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">channel</span><span class="p">,</span>
<span class="n">value</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">value</span><span class="p">,</span>
<span class="o">**</span><span class="n">kwargs</span>
<span class="p">)</span>

</div></div>
<div class="viewcode-block" id="RFMessage"><a class="viewcode-back" href="../../alarmdecoder.html#alarmdecoder.messages.RFMessage">[docs]</a><span class="k">class</span> <span class="nc">RFMessage</span><span class="p">(</span><span class="n">BaseMessage</span><span class="p">):</span>
<span class="sd">&quot;&quot;&quot;</span>
<span class="sd"> Represents a message from an RF receiver.</span>
<span class="sd"> &quot;&quot;&quot;</span>

<span class="n">serial_number</span> <span class="o">=</span> <span class="bp">None</span>
<span class="sd">&quot;&quot;&quot;Serial number of the RF device&quot;&quot;&quot;</span>
<span class="sd">&quot;&quot;&quot;Serial number of the RF device.&quot;&quot;&quot;</span>
<span class="n">value</span> <span class="o">=</span> <span class="o">-</span><span class="mi">1</span>
<span class="sd">&quot;&quot;&quot;Value associated with this message&quot;&quot;&quot;</span>
<span class="sd">&quot;&quot;&quot;Value associated with this message.&quot;&quot;&quot;</span>
<span class="n">battery</span> <span class="o">=</span> <span class="bp">False</span>
<span class="sd">&quot;&quot;&quot;Battery low indication&quot;&quot;&quot;</span>
<span class="sd">&quot;&quot;&quot;Low battery indication&quot;&quot;&quot;</span>
<span class="n">supervision</span> <span class="o">=</span> <span class="bp">False</span>
<span class="sd">&quot;&quot;&quot;Supervision required indication&quot;&quot;&quot;</span>
<span class="n">loop</span> <span class="o">=</span> <span class="p">[</span><span class="bp">False</span> <span class="k">for</span> <span class="n">x</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="mi">4</span><span class="p">)]</span>
<span class="n">loop</span> <span class="o">=</span> <span class="p">[</span><span class="bp">False</span> <span class="k">for</span> <span class="n">_</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="mi">4</span><span class="p">)]</span>
<span class="sd">&quot;&quot;&quot;Loop indicators&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">data</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>

<span class="sd"> :param data: The message data to parse</span>
<span class="sd"> :type data: str</span>
<span class="sd"> :param data: message data to parse</span>
<span class="sd"> :type data: string</span>
<span class="sd"> &quot;&quot;&quot;</span>
<span class="n">BaseMessage</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="k">if</span> <span class="n">data</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">_parse_message</span><span class="p">(</span><span class="n">data</span><span class="p">)</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>
<span class="sd"> String conversion operator.</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">raw</span>

<span class="k">def</span> <span class="nf">_parse_message</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">data</span><span class="p">):</span>
<span class="sd">&quot;&quot;&quot;</span>
<span class="sd"> Parses the raw message from the device.</span>

<span class="sd"> :param data: The message data.</span>
<span class="sd"> :type data: str</span>
<span class="sd"> :param data: message data</span>
<span class="sd"> :type data: string</span>

<span class="sd"> :raises: :py:class:`~alarmdecoder.util.InvalidMessageError`</span>
<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">raw</span> <span class="o">=</span> <span class="n">data</span>
@@ -320,7 +376,20 @@
<span class="k">except</span> <span class="ne">ValueError</span><span class="p">:</span>
<span class="k">raise</span> <span class="n">InvalidMessageError</span><span class="p">(</span><span class="s">&#39;Received invalid message: {0}&#39;</span><span class="o">.</span><span class="n">format</span><span class="p">(</span><span class="n">data</span><span class="p">))</span>

</div>
<div class="viewcode-block" id="RFMessage.dict"><a class="viewcode-back" href="../../alarmdecoder.html#alarmdecoder.messages.RFMessage.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>
<span class="sd"> Dictionary representation.</span>
<span class="sd"> &quot;&quot;&quot;</span>
<span class="k">return</span> <span class="nb">dict</span><span class="p">(</span>
<span class="n">time</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">timestamp</span><span class="p">,</span>
<span class="n">serial_number</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">serial_number</span><span class="p">,</span>
<span class="n">value</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">value</span><span class="p">,</span>
<span class="n">battery</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">battery</span><span class="p">,</span>
<span class="n">supervision</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">supervision</span><span class="p">,</span>
<span class="o">**</span><span class="n">kwargs</span>
<span class="p">)</span>

</div></div>
<div class="viewcode-block" id="LRRMessage"><a class="viewcode-back" href="../../alarmdecoder.html#alarmdecoder.messages.LRRMessage">[docs]</a><span class="k">class</span> <span class="nc">LRRMessage</span><span class="p">(</span><span class="n">BaseMessage</span><span class="p">):</span>
<span class="sd">&quot;&quot;&quot;</span>
<span class="sd"> Represent a message from a Long Range Radio.</span>
@@ -329,34 +398,30 @@
<span class="n">event_data</span> <span class="o">=</span> <span class="bp">None</span>
<span class="sd">&quot;&quot;&quot;Data associated with the LRR message. Usually user ID or zone.&quot;&quot;&quot;</span>
<span class="n">partition</span> <span class="o">=</span> <span class="o">-</span><span class="mi">1</span>
<span class="sd">&quot;&quot;&quot;The partition that this message applies to&quot;&quot;&quot;</span>
<span class="sd">&quot;&quot;&quot;The partition that this message applies to.&quot;&quot;&quot;</span>
<span class="n">event_type</span> <span class="o">=</span> <span class="bp">None</span>
<span class="sd">&quot;&quot;&quot;The type of the event that occurred&quot;&quot;&quot;</span>
<span class="sd">&quot;&quot;&quot;The type of the event that occurred.&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">data</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>

<span class="sd"> :param data: The message data to parse.</span>
<span class="sd"> :type data: str</span>
<span class="sd"> :param data: message data to parse</span>
<span class="sd"> :type data: string</span>
<span class="sd"> &quot;&quot;&quot;</span>
<span class="n">BaseMessage</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="k">if</span> <span class="n">data</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">_parse_message</span><span class="p">(</span><span class="n">data</span><span class="p">)</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>
<span class="sd"> String conversion operator.</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">raw</span>

<span class="k">def</span> <span class="nf">_parse_message</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">data</span><span class="p">):</span>
<span class="sd">&quot;&quot;&quot;</span>
<span class="sd"> Parses the raw message from the device.</span>

<span class="sd"> :param data: The message data.</span>
<span class="sd"> :type data: str</span>
<span class="sd"> :param data: message data to parse</span>
<span class="sd"> :type data: string</span>

<span class="sd"> :raises: :py:class:`~alarmdecoder.util.InvalidMessageError`</span>
<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">raw</span> <span class="o">=</span> <span class="n">data</span>
@@ -365,7 +430,19 @@
<span class="bp">self</span><span class="o">.</span><span class="n">event_data</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">partition</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">event_type</span> <span class="o">=</span> <span class="n">values</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="s">&#39;,&#39;</span><span class="p">)</span>

<span class="k">except</span> <span class="ne">ValueError</span><span class="p">:</span>
<span class="k">raise</span> <span class="n">InvalidMessageError</span><span class="p">(</span><span class="s">&#39;Received invalid message: {0}&#39;</span><span class="o">.</span><span class="n">format</span><span class="p">(</span><span class="n">data</span><span class="p">))</span></div>
<span class="k">raise</span> <span class="n">InvalidMessageError</span><span class="p">(</span><span class="s">&#39;Received invalid message: {0}&#39;</span><span class="o">.</span><span class="n">format</span><span class="p">(</span><span class="n">data</span><span class="p">))</span>

<div class="viewcode-block" id="LRRMessage.dict"><a class="viewcode-back" href="../../alarmdecoder.html#alarmdecoder.messages.LRRMessage.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>
<span class="sd"> Dictionary representation.</span>
<span class="sd"> &quot;&quot;&quot;</span>
<span class="k">return</span> <span class="nb">dict</span><span class="p">(</span>
<span class="n">time</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">timestamp</span><span class="p">,</span>
<span class="n">event_data</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">event_data</span><span class="p">,</span>
<span class="n">event_type</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">event_type</span><span class="p">,</span>
<span class="n">partition</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">partition</span><span class="p">,</span>
<span class="o">**</span><span class="n">kwargs</span>
<span class="p">)</span></div></div>
</pre></div>

</div>


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

@@ -48,7 +48,9 @@
<h1>Source code for alarmdecoder.util</h1><div class="highlight"><pre>
<span class="sd">&quot;&quot;&quot;</span>
<span class="sd">Provides utility classes for the Alarm Decoder (AD2) devices.</span>
<span class="sd">Provides utility classes for the `AlarmDecoder`_ (AD2) devices.</span>

<span class="sd">.. _AlarmDecoder: http://www.alarmdecoder.com</span>

<span class="sd">.. moduleauthor:: Scott Petersen &lt;scott@nutech.com&gt;</span>
<span class="sd">&quot;&quot;&quot;</span>
@@ -87,7 +89,7 @@
</div>
<div class="viewcode-block" id="Firmware"><a class="viewcode-back" href="../../alarmdecoder.html#alarmdecoder.util.Firmware">[docs]</a><span class="k">class</span> <span class="nc">Firmware</span><span class="p">(</span><span class="nb">object</span><span class="p">):</span>
<span class="sd">&quot;&quot;&quot;</span>
<span class="sd"> Represents firmware for the Alarm Decoder devices.</span>
<span class="sd"> Represents firmware for the `AlarmDecoder`_ devices.</span>
<span class="sd"> &quot;&quot;&quot;</span>

<span class="c"># Constants</span>
@@ -102,14 +104,14 @@
<span class="nd">@staticmethod</span>
<div class="viewcode-block" id="Firmware.upload"><a class="viewcode-back" href="../../alarmdecoder.html#alarmdecoder.util.Firmware.upload">[docs]</a> <span class="k">def</span> <span class="nf">upload</span><span class="p">(</span><span class="n">dev</span><span class="p">,</span> <span class="n">filename</span><span class="p">,</span> <span class="n">progress_callback</span><span class="o">=</span><span class="bp">None</span><span class="p">):</span>
<span class="sd">&quot;&quot;&quot;</span>
<span class="sd"> Uploads firmware to an Alarm Decoder device.</span>
<span class="sd"> Uploads firmware to an `AlarmDecoder`_ device.</span>

<span class="sd"> :param filename: The firmware filename</span>
<span class="sd"> :type filename: str</span>
<span class="sd"> :param progress_callback: Callback function used to report progress.</span>
<span class="sd"> :param filename: firmware filename</span>
<span class="sd"> :type filename: string</span>
<span class="sd"> :param progress_callback: callback function used to report progress</span>
<span class="sd"> :type progress_callback: function</span>

<span class="sd"> :raises: NoDeviceError, TimeoutError</span>
<span class="sd"> :raises: :py:class:`~alarmdecoder.util.NoDeviceError`, :py:class:`~alarmdecoder.util.TimeoutError`</span>
<span class="sd"> &quot;&quot;&quot;</span>

<span class="k">def</span> <span class="nf">do_upload</span><span class="p">():</span>


+ 73
- 22
docs/build/html/_modules/alarmdecoder/zonetracking.html View File

@@ -48,7 +48,9 @@
<h1>Source code for alarmdecoder.zonetracking</h1><div class="highlight"><pre>
<span class="sd">&quot;&quot;&quot;</span>
<span class="sd">Provides zone tracking functionality for the Alarm Decoder (AD2) device family.</span>
<span class="sd">Provides zone tracking functionality for the `AlarmDecoder`_ (AD2) device family.</span>

<span class="sd">.. _AlarmDecoder: http://www.alarmdecoder.com</span>

<span class="sd">.. moduleauthor:: Scott Petersen &lt;scott@nutech.com&gt;</span>
<span class="sd">&quot;&quot;&quot;</span>
@@ -65,6 +67,7 @@
<span class="sd"> Representation of a panel zone.</span>
<span class="sd"> &quot;&quot;&quot;</span>

<span class="c"># Constants</span>
<span class="n">CLEAR</span> <span class="o">=</span> <span class="mi">0</span>
<span class="sd">&quot;&quot;&quot;Status indicating that the zone is cleared.&quot;&quot;&quot;</span>
<span class="n">FAULT</span> <span class="o">=</span> <span class="mi">1</span>
@@ -74,15 +77,25 @@

<span class="n">STATUS</span> <span class="o">=</span> <span class="p">{</span><span class="n">CLEAR</span><span class="p">:</span> <span class="s">&#39;CLEAR&#39;</span><span class="p">,</span> <span class="n">FAULT</span><span class="p">:</span> <span class="s">&#39;FAULT&#39;</span><span class="p">,</span> <span class="n">CHECK</span><span class="p">:</span> <span class="s">&#39;CHECK&#39;</span><span class="p">}</span>

<span class="c"># Attributes</span>
<span class="n">zone</span> <span class="o">=</span> <span class="mi">0</span>
<span class="sd">&quot;&quot;&quot;Zone ID&quot;&quot;&quot;</span>
<span class="n">name</span> <span class="o">=</span> <span class="s">&#39;&#39;</span>
<span class="sd">&quot;&quot;&quot;Zone name&quot;&quot;&quot;</span>
<span class="n">status</span> <span class="o">=</span> <span class="n">CLEAR</span>
<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="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="sd">&quot;&quot;&quot;</span>
<span class="sd"> Constructor</span>

<span class="sd"> :param zone: The zone number.</span>
<span class="sd"> :param zone: zone number</span>
<span class="sd"> :type zone: int</span>
<span class="sd"> :param name: Human readable zone name.</span>
<span class="sd"> :type name: str</span>
<span class="sd"> :param status: Initial zone state.</span>
<span class="sd"> :param name: Human readable zone name</span>
<span class="sd"> :type name: string</span>
<span class="sd"> :param status: Initial zone state</span>
<span class="sd"> :type status: int</span>
<span class="sd"> &quot;&quot;&quot;</span>
<span class="bp">self</span><span class="o">.</span><span class="n">zone</span> <span class="o">=</span> <span class="n">zone</span>
@@ -105,15 +118,53 @@
</div>
<div class="viewcode-block" id="Zonetracker"><a class="viewcode-back" href="../../alarmdecoder.html#alarmdecoder.zonetracking.Zonetracker">[docs]</a><span class="k">class</span> <span class="nc">Zonetracker</span><span class="p">(</span><span class="nb">object</span><span class="p">):</span>
<span class="sd">&quot;&quot;&quot;</span>
<span class="sd"> Handles tracking of zone and their statuses.</span>
<span class="sd"> Handles tracking of zones and their statuses.</span>
<span class="sd"> &quot;&quot;&quot;</span>

<span class="n">on_fault</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">&#39;Called when the device detects a zone fault.&#39;</span><span class="p">)</span>
<span class="n">on_restore</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">&#39;Called when the device detects that a fault is restored.&#39;</span><span class="p">)</span>
<span class="n">on_fault</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 detects a zone fault.</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_restore</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 detects that a fault is restored.</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">EXPIRE</span> <span class="o">=</span> <span class="mi">30</span>
<span class="sd">&quot;&quot;&quot;Zone expiration timeout.&quot;&quot;&quot;</span>

<span class="nd">@property</span>
<span class="k">def</span> <span class="nf">zones</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
<span class="sd">&quot;&quot;&quot;</span>
<span class="sd"> Returns the current list of zones being tracked.</span>

<span class="sd"> :returns: dictionary of :py:class:`Zone` being tracked</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">_zones</span>

<span class="nd">@zones.setter</span>
<div class="viewcode-block" id="Zonetracker.zones"><a class="viewcode-back" href="../../alarmdecoder.html#alarmdecoder.zonetracking.Zonetracker.zones">[docs]</a> <span class="k">def</span> <span class="nf">zones</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 current list of zones being tracked.</span>

<span class="sd"> :param value: new list of zones being tracked</span>
<span class="sd"> :type value: dictionary of :py:class:`Zone` being tracked</span>
<span class="sd"> &quot;&quot;&quot;</span>
<span class="bp">self</span><span class="o">.</span><span class="n">_zones</span> <span class="o">=</span> <span class="n">value</span>
</div>
<span class="nd">@property</span>
<span class="k">def</span> <span class="nf">faulted</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 current list of faulted zones.</span>

<span class="sd"> :returns: list of faulted zones</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">_zones_faulted</span>

<span class="nd">@faulted.setter</span>
<div class="viewcode-block" id="Zonetracker.faulted"><a class="viewcode-back" href="../../alarmdecoder.html#alarmdecoder.zonetracking.Zonetracker.faulted">[docs]</a> <span class="k">def</span> <span class="nf">faulted</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 current list of faulted zones.</span>

<span class="sd"> :param value: new list of faulted zones</span>
<span class="sd"> :type value: list of integers</span>
<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="sd">&quot;&quot;&quot;</span>
<span class="sd"> Constructor</span>
@@ -126,8 +177,8 @@
<span class="sd">&quot;&quot;&quot;</span>
<span class="sd"> Update zone statuses based on the current message.</span>

<span class="sd"> :param message: Message to use to update the zone tracking.</span>
<span class="sd"> :type message: Message or ExpanderMessage</span>
<span class="sd"> :param message: message to use to update the zone tracking</span>
<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="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>
@@ -208,12 +259,12 @@
<span class="sd">&quot;&quot;&quot;</span>
<span class="sd"> Convert an address and channel into a zone number.</span>

<span class="sd"> :param address: The expander address</span>
<span class="sd"> :param address: expander address</span>
<span class="sd"> :type address: int</span>
<span class="sd"> :param channel: The channel</span>
<span class="sd"> :param channel: channel</span>
<span class="sd"> :type channel: int</span>

<span class="sd"> :returns: The zone number associated with an address and channel.</span>
<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>
@@ -227,7 +278,7 @@
<span class="sd">&quot;&quot;&quot;</span>
<span class="sd"> Clear all expired zones from our status list.</span>

<span class="sd"> :param zone: current zone being processed.</span>
<span class="sd"> :param zone: current zone being processed</span>
<span class="sd"> :type zone: int</span>
<span class="sd"> &quot;&quot;&quot;</span>
<span class="n">cleared_zones</span> <span class="o">=</span> <span class="p">[]</span>
@@ -300,11 +351,11 @@
<span class="sd">&quot;&quot;&quot;</span>
<span class="sd"> Adds a zone to the internal zone list.</span>

<span class="sd"> :param zone: The zone number.</span>
<span class="sd"> :param zone: zone number</span>
<span class="sd"> :type zone: int</span>
<span class="sd"> :param name: Human readable zone name.</span>
<span class="sd"> :type name: str</span>
<span class="sd"> :param status: The zone status.</span>
<span class="sd"> :param name: human readable zone name</span>
<span class="sd"> :type name: string</span>
<span class="sd"> :param status: zone status</span>
<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>
@@ -317,9 +368,9 @@
<span class="sd">&quot;&quot;&quot;</span>
<span class="sd"> Updates a zones status.</span>

<span class="sd"> :param zone: The zone number.</span>
<span class="sd"> :param zone: zone number</span>
<span class="sd"> :type zone: int</span>
<span class="sd"> :param status: The zone status.</span>
<span class="sd"> :param status: zone status</span>
<span class="sd"> :type status: int</span>

<span class="sd"> :raises: IndexError</span>
@@ -342,10 +393,10 @@
<span class="sd">&quot;&quot;&quot;</span>
<span class="sd"> Determine if a zone is expired or not.</span>

<span class="sd"> :param zone: The zone number.</span>
<span class="sd"> :param zone: zone number</span>
<span class="sd"> :type zone: int</span>

<span class="sd"> :returns: Whether or not the zone is expired.</span>
<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>
</pre></div>


+ 67
- 3
docs/build/html/alarmdecoder.html View File

@@ -177,6 +177,13 @@
<p><strong>Callback definition:</strong> <em>def callback(device, message)</em></p>
</dd></dl>

<dl class="attribute">
<dt id="alarmdecoder.decoder.AlarmDecoder.on_sending_received">
<tt class="descname">on_sending_received</tt><a class="headerlink" href="#alarmdecoder.decoder.AlarmDecoder.on_sending_received" title="Permalink to this definition">¶</a></dt>
<dd><p>This event is called when a !Sending.done message is received from the AlarmDecoder.</p>
<p><strong>Callback definition:</strong> <em>def callback(device, status, message)</em></p>
</dd></dl>

<dl class="attribute">
<dt id="alarmdecoder.decoder.AlarmDecoder.on_open">
<tt class="descname">on_open</tt><a class="headerlink" href="#alarmdecoder.decoder.AlarmDecoder.on_open" title="Permalink to this definition">¶</a></dt>
@@ -229,6 +236,12 @@
<dd><p>Represents panel function key #4</p>
</dd></dl>

<dl class="attribute">
<dt id="alarmdecoder.decoder.AlarmDecoder.KEY_PANIC">
<tt class="descname">KEY_PANIC</tt><em class="property"> = u'\x05\x05\x05'</em><a class="headerlink" href="#alarmdecoder.decoder.AlarmDecoder.KEY_PANIC" title="Permalink to this definition">¶</a></dt>
<dd><p>Represents a panic keypress</p>
</dd></dl>

<dl class="attribute">
<dt id="alarmdecoder.decoder.AlarmDecoder.BATTERY_TIMEOUT">
<tt class="descname">BATTERY_TIMEOUT</tt><em class="property"> = 30</em><a class="headerlink" href="#alarmdecoder.decoder.AlarmDecoder.BATTERY_TIMEOUT" title="Permalink to this definition">¶</a></dt>
@@ -255,7 +268,7 @@

<dl class="attribute">
<dt id="alarmdecoder.decoder.AlarmDecoder.address_mask">
<tt class="descname">address_mask</tt><em class="property"> = 0</em><a class="headerlink" href="#alarmdecoder.decoder.AlarmDecoder.address_mask" title="Permalink to this definition">¶</a></dt>
<tt class="descname">address_mask</tt><em class="property"> = 4294967295</em><a class="headerlink" href="#alarmdecoder.decoder.AlarmDecoder.address_mask" title="Permalink to this definition">¶</a></dt>
<dd><p>The address mask configured on the device.</p>
</dd></dl>

@@ -693,6 +706,11 @@ reader thread.</li>
<dd><p>Closes the device.</p>
</dd></dl>

<dl class="method">
<dt id="alarmdecoder.devices.USBDevice.fileno">
<tt class="descname">fileno</tt><big>(</big><big>)</big><a class="reference internal" href="_modules/alarmdecoder/devices.html#USBDevice.fileno"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#alarmdecoder.devices.USBDevice.fileno" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<dl class="method">
<dt id="alarmdecoder.devices.USBDevice.write">
<tt class="descname">write</tt><big>(</big><em>data</em><big>)</big><a class="reference internal" href="_modules/alarmdecoder/devices.html#USBDevice.write"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#alarmdecoder.devices.USBDevice.write" title="Permalink to this definition">¶</a></dt>
@@ -856,6 +874,11 @@ reader thread.</li>
<dd><p>Closes the device.</p>
</dd></dl>

<dl class="method">
<dt id="alarmdecoder.devices.SerialDevice.fileno">
<tt class="descname">fileno</tt><big>(</big><big>)</big><a class="reference internal" href="_modules/alarmdecoder/devices.html#SerialDevice.fileno"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#alarmdecoder.devices.SerialDevice.fileno" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<dl class="method">
<dt id="alarmdecoder.devices.SerialDevice.write">
<tt class="descname">write</tt><big>(</big><em>data</em><big>)</big><a class="reference internal" href="_modules/alarmdecoder/devices.html#SerialDevice.write"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#alarmdecoder.devices.SerialDevice.write" title="Permalink to this definition">¶</a></dt>
@@ -1020,6 +1043,11 @@ thread.</li>
<dd><p>Closes the device.</p>
</dd></dl>

<dl class="method">
<dt id="alarmdecoder.devices.SocketDevice.fileno">
<tt class="descname">fileno</tt><big>(</big><big>)</big><a class="reference internal" href="_modules/alarmdecoder/devices.html#SocketDevice.fileno"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#alarmdecoder.devices.SocketDevice.fileno" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<dl class="method">
<dt id="alarmdecoder.devices.SocketDevice.write">
<tt class="descname">write</tt><big>(</big><em>data</em><big>)</big><a class="reference internal" href="_modules/alarmdecoder/devices.html#SocketDevice.write"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#alarmdecoder.devices.SocketDevice.write" title="Permalink to this definition">¶</a></dt>
@@ -1103,6 +1131,18 @@ devices.</p>
<dd><p>The raw message text</p>
</dd></dl>

<dl class="attribute">
<dt id="alarmdecoder.messages.BaseMessage.timestamp">
<tt class="descname">timestamp</tt><em class="property"> = None</em><a class="headerlink" href="#alarmdecoder.messages.BaseMessage.timestamp" title="Permalink to this definition">¶</a></dt>
<dd><p>The timestamp of the message</p>
</dd></dl>

<dl class="method">
<dt id="alarmdecoder.messages.BaseMessage.dict">
<tt class="descname">dict</tt><big>(</big><em>**kwargs</em><big>)</big><a class="reference internal" href="_modules/alarmdecoder/messages.html#BaseMessage.dict"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#alarmdecoder.messages.BaseMessage.dict" title="Permalink to this definition">¶</a></dt>
<dd><p>Dictionary representation.</p>
</dd></dl>

</dd></dl>

<dl class="class">
@@ -1242,6 +1282,12 @@ devices.</p>
<dd><p>The panel data field associated with this message.</p>
</dd></dl>

<dl class="method">
<dt id="alarmdecoder.messages.Message.dict">
<tt class="descname">dict</tt><big>(</big><em>**kwargs</em><big>)</big><a class="reference internal" href="_modules/alarmdecoder/messages.html#Message.dict"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#alarmdecoder.messages.Message.dict" title="Permalink to this definition">¶</a></dt>
<dd><p>Dictionary representation.</p>
</dd></dl>

</dd></dl>

<dl class="class">
@@ -1285,6 +1331,12 @@ devices.</p>
<dd><p>Value associated with the message</p>
</dd></dl>

<dl class="method">
<dt id="alarmdecoder.messages.ExpanderMessage.dict">
<tt class="descname">dict</tt><big>(</big><em>**kwargs</em><big>)</big><a class="reference internal" href="_modules/alarmdecoder/messages.html#ExpanderMessage.dict"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#alarmdecoder.messages.ExpanderMessage.dict" title="Permalink to this definition">¶</a></dt>
<dd><p>Dictionary representation.</p>
</dd></dl>

</dd></dl>

<dl class="class">
@@ -1322,6 +1374,12 @@ devices.</p>
<dd><p>Loop indicators</p>
</dd></dl>

<dl class="method">
<dt id="alarmdecoder.messages.RFMessage.dict">
<tt class="descname">dict</tt><big>(</big><em>**kwargs</em><big>)</big><a class="reference internal" href="_modules/alarmdecoder/messages.html#RFMessage.dict"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#alarmdecoder.messages.RFMessage.dict" title="Permalink to this definition">¶</a></dt>
<dd><p>Dictionary representation.</p>
</dd></dl>

</dd></dl>

<dl class="class">
@@ -1347,6 +1405,12 @@ devices.</p>
<dd><p>The type of the event that occurred.</p>
</dd></dl>

<dl class="method">
<dt id="alarmdecoder.messages.LRRMessage.dict">
<tt class="descname">dict</tt><big>(</big><em>**kwargs</em><big>)</big><a class="reference internal" href="_modules/alarmdecoder/messages.html#LRRMessage.dict"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#alarmdecoder.messages.LRRMessage.dict" title="Permalink to this definition">¶</a></dt>
<dd><p>Dictionary representation.</p>
</dd></dl>

</dd></dl>

</div>
@@ -1434,7 +1498,7 @@ devices.</p>

<dl class="attribute">
<dt id="alarmdecoder.zonetracking.Zonetracker.zones">
<tt class="descname">zones</tt><a class="headerlink" href="#alarmdecoder.zonetracking.Zonetracker.zones" title="Permalink to this definition">¶</a></dt>
<tt class="descname">zones</tt><a class="reference internal" href="_modules/alarmdecoder/zonetracking.html#Zonetracker.zones"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#alarmdecoder.zonetracking.Zonetracker.zones" title="Permalink to this definition">¶</a></dt>
<dd><p>Returns the current list of zones being tracked.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
@@ -1448,7 +1512,7 @@ devices.</p>

<dl class="attribute">
<dt id="alarmdecoder.zonetracking.Zonetracker.faulted">
<tt class="descname">faulted</tt><a class="headerlink" href="#alarmdecoder.zonetracking.Zonetracker.faulted" title="Permalink to this definition">¶</a></dt>
<tt class="descname">faulted</tt><a class="reference internal" href="_modules/alarmdecoder/zonetracking.html#Zonetracker.faulted"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#alarmdecoder.zonetracking.Zonetracker.faulted" title="Permalink to this definition">¶</a></dt>
<dd><p>Retrieves the current list of faulted zones.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />


+ 55
- 5
docs/build/html/genindex.html View File

@@ -295,6 +295,28 @@
<dt><a href="alarmdecoder.html#alarmdecoder.devices.USBDevice.devices">devices() (alarmdecoder.devices.USBDevice class method)</a>
</dt>

<dt><a href="alarmdecoder.html#alarmdecoder.messages.BaseMessage.dict">dict() (alarmdecoder.messages.BaseMessage method)</a>
</dt>

<dd><dl>
<dt><a href="alarmdecoder.html#alarmdecoder.messages.ExpanderMessage.dict">(alarmdecoder.messages.ExpanderMessage method)</a>
</dt>

<dt><a href="alarmdecoder.html#alarmdecoder.messages.LRRMessage.dict">(alarmdecoder.messages.LRRMessage method)</a>
</dt>

<dt><a href="alarmdecoder.html#alarmdecoder.messages.Message.dict">(alarmdecoder.messages.Message method)</a>
</dt>

<dt><a href="alarmdecoder.html#alarmdecoder.messages.RFMessage.dict">(alarmdecoder.messages.RFMessage method)</a>
</dt>

</dl></dd>
</dl></td>
</tr></table>

@@ -366,6 +388,20 @@
</dt>

<dt><a href="alarmdecoder.html#alarmdecoder.devices.SerialDevice.fileno">fileno() (alarmdecoder.devices.SerialDevice method)</a>
</dt>

<dd><dl>
<dt><a href="alarmdecoder.html#alarmdecoder.devices.SocketDevice.fileno">(alarmdecoder.devices.SocketDevice method)</a>
</dt>

<dt><a href="alarmdecoder.html#alarmdecoder.devices.USBDevice.fileno">(alarmdecoder.devices.USBDevice method)</a>
</dt>

</dl></dd>
<dt><a href="alarmdecoder.html#alarmdecoder.devices.USBDevice.find">find() (alarmdecoder.devices.USBDevice class method)</a>
</dt>

@@ -473,16 +509,20 @@
<dt><a href="alarmdecoder.html#alarmdecoder.decoder.AlarmDecoder.KEY_F2">KEY_F2 (alarmdecoder.decoder.AlarmDecoder attribute)</a>
</dt>

</dl></td>
<td style="width: 33%" valign="top"><dl>
<dt><a href="alarmdecoder.html#alarmdecoder.decoder.AlarmDecoder.KEY_F3">KEY_F3 (alarmdecoder.decoder.AlarmDecoder attribute)</a>
</dt>

</dl></td>
<td style="width: 33%" valign="top"><dl>
<dt><a href="alarmdecoder.html#alarmdecoder.decoder.AlarmDecoder.KEY_F4">KEY_F4 (alarmdecoder.decoder.AlarmDecoder attribute)</a>
</dt>

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

</dl></td>
</tr></table>

@@ -599,12 +639,12 @@
<dt><a href="alarmdecoder.html#alarmdecoder.decoder.AlarmDecoder.on_low_battery">on_low_battery (alarmdecoder.decoder.AlarmDecoder attribute)</a>
</dt>

</dl></td>
<td style="width: 33%" valign="top"><dl>
<dt><a href="alarmdecoder.html#alarmdecoder.decoder.AlarmDecoder.on_lrr_message">on_lrr_message (alarmdecoder.decoder.AlarmDecoder attribute)</a>
</dt>

</dl></td>
<td style="width: 33%" valign="top"><dl>
<dt><a href="alarmdecoder.html#alarmdecoder.decoder.AlarmDecoder.on_message">on_message (alarmdecoder.decoder.AlarmDecoder attribute)</a>
</dt>
@@ -650,6 +690,10 @@
</dt>

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

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

@@ -908,9 +952,15 @@
</dl></td>
<td style="width: 33%" valign="top"><dl>
<dt><a href="alarmdecoder.html#alarmdecoder.zonetracking.Zone.timestamp">timestamp (alarmdecoder.zonetracking.Zone attribute)</a>
<dt><a href="alarmdecoder.html#alarmdecoder.messages.BaseMessage.timestamp">timestamp (alarmdecoder.messages.BaseMessage attribute)</a>
</dt>

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

</dl></dd>
<dt><a href="alarmdecoder.html#alarmdecoder.messages.ExpanderMessage.type">type (alarmdecoder.messages.ExpanderMessage attribute)</a>
</dt>


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


+ 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.6',
version='0.7',
description='Python interface for the AlarmDecoder (AD2) family '
'of alarm devices which includes the AD2USB, AD2SERIAL and AD2PI.',
long_description=readme(),


Loading…
Cancel
Save