Browse Source

Moved instance variables into the classes for ease of documentation.

pyserial_fix
Scott Petersen 11 years ago
parent
commit
0d76104f2c
7 changed files with 496 additions and 62 deletions
  1. BIN
      docs/_build/doctrees/environment.pickle
  2. BIN
      docs/_build/doctrees/pyad2.doctree
  3. +181
    -11
      docs/_build/html/genindex.html
  4. BIN
      docs/_build/html/objects.inv
  5. +225
    -3
      docs/_build/html/pyad2.html
  6. +1
    -1
      docs/_build/html/searchindex.js
  7. +89
    -47
      pyad2/messages.py

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


BIN
docs/_build/doctrees/pyad2.doctree View File


+ 181
- 11
docs/_build/html/genindex.html View File

@@ -66,7 +66,9 @@
| <a href="#S"><strong>S</strong></a>
| <a href="#T"><strong>T</strong></a>
| <a href="#U"><strong>U</strong></a>
| <a href="#V"><strong>V</strong></a>
| <a href="#W"><strong>W</strong></a>
| <a href="#X"><strong>X</strong></a>
| <a href="#Z"><strong>Z</strong></a>
</div>
@@ -74,6 +76,10 @@
<table style="width: 100%" class="indextable genindextable"><tr>
<td style="width: 33%" valign="top"><dl>
<dt><a href="pyad2.html#pyad2.messages.Message.ac_power">ac_power (pyad2.messages.Message attribute)</a>
</dt>

<dt><a href="pyad2.html#pyad2.ad2.AD2">AD2 (class in pyad2.ad2)</a>
</dt>

@@ -81,8 +87,6 @@
<dt><a href="pyad2.html#pyad2.ad2.AD2Factory">AD2Factory (class in pyad2.ad2)</a>
</dt>

</dl></td>
<td style="width: 33%" valign="top"><dl>
<dt><a href="pyad2.html#pyad2.ad2.AD2Factory.DetectThread">AD2Factory.DetectThread (class in pyad2.ad2)</a>
</dt>
@@ -91,6 +95,28 @@
<dt><a href="pyad2.event.html#pyad2.event.event.EventHandler.add">add() (pyad2.event.event.EventHandler method)</a>
</dt>

</dl></td>
<td style="width: 33%" valign="top"><dl>
<dt><a href="pyad2.html#pyad2.messages.ExpanderMessage.address">address (pyad2.messages.ExpanderMessage attribute)</a>
</dt>

<dt><a href="pyad2.html#pyad2.messages.Message.alarm_event_occurred">alarm_event_occurred (pyad2.messages.Message attribute)</a>
</dt>

<dt><a href="pyad2.html#pyad2.messages.Message.alarm_sounding">alarm_sounding (pyad2.messages.Message attribute)</a>
</dt>

<dt><a href="pyad2.html#pyad2.messages.Message.armed_away">armed_away (pyad2.messages.Message attribute)</a>
</dt>

<dt><a href="pyad2.html#pyad2.messages.Message.armed_home">armed_home (pyad2.messages.Message attribute)</a>
</dt>

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

@@ -98,16 +124,28 @@
<table style="width: 100%" class="indextable genindextable"><tr>
<td style="width: 33%" valign="top"><dl>
<dt><a href="pyad2.html#pyad2.messages.Message.backlight_on">backlight_on (pyad2.messages.Message attribute)</a>
</dt>

<dt><a href="pyad2.html#pyad2.messages.BaseMessage">BaseMessage (class in pyad2.messages)</a>
</dt>

<dt><a href="pyad2.html#pyad2.ad2.AD2.BATTERY_TIMEOUT">BATTERY_TIMEOUT (pyad2.ad2.AD2 attribute)</a>
<dt><a href="pyad2.html#pyad2.messages.RFMessage.battery">battery (pyad2.messages.RFMessage attribute)</a>
</dt>

<dt><a href="pyad2.html#pyad2.messages.Message.battery_low">battery_low (pyad2.messages.Message attribute)</a>
</dt>

</dl></td>
<td style="width: 33%" valign="top"><dl>
<dt><a href="pyad2.html#pyad2.ad2.AD2.BATTERY_TIMEOUT">BATTERY_TIMEOUT (pyad2.ad2.AD2 attribute)</a>
</dt>

<dt><a href="pyad2.html#pyad2.devices.SerialDevice.BAUDRATE">BAUDRATE (pyad2.devices.SerialDevice attribute)</a>
</dt>

@@ -117,6 +155,14 @@
</dt>

</dl></dd>
<dt><a href="pyad2.html#pyad2.messages.Message.beeps">beeps (pyad2.messages.Message attribute)</a>
</dt>

<dt><a href="pyad2.html#pyad2.messages.Message.bitfield">bitfield (pyad2.messages.Message attribute)</a>
</dt>

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

@@ -124,20 +170,32 @@
<table style="width: 100%" class="indextable genindextable"><tr>
<td style="width: 33%" valign="top"><dl>
<dt><a href="pyad2.html#pyad2.messages.ExpanderMessage.channel">channel (pyad2.messages.ExpanderMessage attribute)</a>
</dt>

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

<dt><a href="pyad2.html#pyad2.zonetracking.Zone.CLEAR">CLEAR (pyad2.zonetracking.Zone attribute)</a>
<dt><a href="pyad2.html#pyad2.messages.Message.check_zone">check_zone (pyad2.messages.Message attribute)</a>
</dt>

<dt><a href="pyad2.html#pyad2.ad2.AD2.clear_zone">clear_zone() (pyad2.ad2.AD2 method)</a>
<dt><a href="pyad2.html#pyad2.messages.Message.chime_on">chime_on (pyad2.messages.Message attribute)</a>
</dt>

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

</dl></td>
<td style="width: 33%" valign="top"><dl>
<dt><a href="pyad2.html#pyad2.ad2.AD2.clear_zone">clear_zone() (pyad2.ad2.AD2 method)</a>
</dt>

<dt><a href="pyad2.html#pyad2.ad2.AD2.close">close() (pyad2.ad2.AD2 method)</a>
</dt>

@@ -171,6 +229,10 @@
<dt><a href="pyad2.html#pyad2.ad2.AD2Factory.create">create() (pyad2.ad2.AD2Factory class method)</a>
</dt>

<dt><a href="pyad2.html#pyad2.messages.Message.cursor_location">cursor_location (pyad2.messages.Message attribute)</a>
</dt>

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

@@ -202,16 +264,28 @@
<table style="width: 100%" class="indextable genindextable"><tr>
<td style="width: 33%" valign="top"><dl>
<dt><a href="pyad2.html#pyad2.messages.Message.entry_delay_off">entry_delay_off (pyad2.messages.Message attribute)</a>
</dt>

<dt><a href="pyad2.event.html#pyad2.event.event.Event">Event (class in pyad2.event.event)</a>
</dt>

<dt><a href="pyad2.event.html#pyad2.event.event.EventHandler">EventHandler (class in pyad2.event.event)</a>
<dt><a href="pyad2.html#pyad2.messages.LRRMessage.event_data">event_data (pyad2.messages.LRRMessage attribute)</a>
</dt>

<dt><a href="pyad2.html#pyad2.messages.LRRMessage.event_type">event_type (pyad2.messages.LRRMessage attribute)</a>
</dt>

</dl></td>
<td style="width: 33%" valign="top"><dl>
<dt><a href="pyad2.event.html#pyad2.event.event.EventHandler">EventHandler (class in pyad2.event.event)</a>
</dt>

<dt><a href="pyad2.html#pyad2.messages.ExpanderMessage">ExpanderMessage (class in pyad2.messages)</a>
</dt>

@@ -249,8 +323,6 @@
<dt><a href="pyad2.html#pyad2.ad2.AD2.fault_zone">fault_zone() (pyad2.ad2.AD2 method)</a>
</dt>

</dl></td>
<td style="width: 33%" valign="top"><dl>
<dt><a href="pyad2.html#pyad2.ad2.AD2Factory.find_all">find_all() (pyad2.ad2.AD2Factory class method)</a>
</dt>
@@ -265,11 +337,17 @@
</dt>

</dl></dd>
</dl></td>
<td style="width: 33%" valign="top"><dl>
<dt><a href="pyad2.event.html#pyad2.event.event.EventHandler.fire">fire() (pyad2.event.event.EventHandler method)</a>
</dt>

<dt><a href="pyad2.html#pyad2.messages.Message.fire_alarm">fire_alarm (pyad2.messages.Message attribute)</a>
</dt>

<dt><a href="pyad2.html#pyad2.ad2.AD2.FIRE_TIMEOUT">FIRE_TIMEOUT (pyad2.ad2.AD2 attribute)</a>
</dt>

@@ -348,6 +426,12 @@
<table style="width: 100%" class="indextable genindextable"><tr>
<td style="width: 33%" valign="top"><dl>
<dt><a href="pyad2.html#pyad2.messages.RFMessage.loop">loop (pyad2.messages.RFMessage attribute)</a>
</dt>

</dl></td>
<td style="width: 33%" valign="top"><dl>
<dt><a href="pyad2.html#pyad2.messages.LRRMessage">LRRMessage (class in pyad2.messages)</a>
</dt>

@@ -358,6 +442,12 @@
<table style="width: 100%" class="indextable genindextable"><tr>
<td style="width: 33%" valign="top"><dl>
<dt><a href="pyad2.html#pyad2.messages.Message.mask">mask (pyad2.messages.Message attribute)</a>
</dt>

</dl></td>
<td style="width: 33%" valign="top"><dl>
<dt><a href="pyad2.html#pyad2.messages.Message">Message (class in pyad2.messages)</a>
</dt>

@@ -371,6 +461,12 @@
<dt><a href="pyad2.html#pyad2.util.NoDeviceError">NoDeviceError</a>
</dt>

</dl></td>
<td style="width: 33%" valign="top"><dl>
<dt><a href="pyad2.html#pyad2.messages.Message.numeric_code">numeric_code (pyad2.messages.Message attribute)</a>
</dt>

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

@@ -524,6 +620,22 @@
<table style="width: 100%" class="indextable genindextable"><tr>
<td style="width: 33%" valign="top"><dl>
<dt><a href="pyad2.html#pyad2.messages.Message.panel_data">panel_data (pyad2.messages.Message attribute)</a>
</dt>

<dt><a href="pyad2.html#pyad2.messages.LRRMessage.partition">partition (pyad2.messages.LRRMessage attribute)</a>
</dt>

<dt><a href="pyad2.html#pyad2.messages.Message.perimeter_only">perimeter_only (pyad2.messages.Message attribute)</a>
</dt>

<dt><a href="pyad2.html#pyad2.messages.Message.programming_mode">programming_mode (pyad2.messages.Message attribute)</a>
</dt>

<dt><a href="pyad2.html#module-pyad2.ad2">pyad2.ad2 (module)</a>
</dt>

@@ -531,6 +643,8 @@
<dt><a href="pyad2.html#module-pyad2.devices">pyad2.devices (module)</a>
</dt>

</dl></td>
<td style="width: 33%" valign="top"><dl>
<dt><a href="pyad2.event.html#module-pyad2.event">pyad2.event (module)</a>
</dt>
@@ -539,8 +653,6 @@
<dt><a href="pyad2.event.html#module-pyad2.event.event">pyad2.event.event (module)</a>
</dt>

</dl></td>
<td style="width: 33%" valign="top"><dl>
<dt><a href="pyad2.html#module-pyad2.messages">pyad2.messages (module)</a>
</dt>
@@ -564,6 +676,10 @@
<table style="width: 100%" class="indextable genindextable"><tr>
<td style="width: 33%" valign="top"><dl>
<dt><a href="pyad2.html#pyad2.messages.BaseMessage.raw">raw (pyad2.messages.BaseMessage attribute)</a>
</dt>

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

@@ -596,12 +712,16 @@
</dt>

<dt><a href="pyad2.html#pyad2.ad2.AD2.reboot">reboot() (pyad2.ad2.AD2 method)</a>
<dt><a href="pyad2.html#pyad2.messages.Message.ready">ready (pyad2.messages.Message attribute)</a>
</dt>

</dl></td>
<td style="width: 33%" valign="top"><dl>
<dt><a href="pyad2.html#pyad2.ad2.AD2.reboot">reboot() (pyad2.ad2.AD2 method)</a>
</dt>

<dt><a href="pyad2.html#pyad2.messages.ExpanderMessage.RELAY">RELAY (pyad2.messages.ExpanderMessage attribute)</a>
</dt>

@@ -641,6 +761,12 @@
<dt><a href="pyad2.html#pyad2.devices.USBDevice.serial_number">serial_number (pyad2.devices.USBDevice attribute)</a>
</dt>

<dd><dl>
<dt><a href="pyad2.html#pyad2.messages.RFMessage.serial_number">(pyad2.messages.RFMessage attribute)</a>
</dt>

</dl></dd>
<dt><a href="pyad2.html#pyad2.devices.SerialDevice">SerialDevice (class in pyad2.devices)</a>
</dt>
@@ -717,6 +843,10 @@
<dt><a href="pyad2.html#pyad2.devices.Device.stop_reader">stop_reader() (pyad2.devices.Device method)</a>
</dt>

<dt><a href="pyad2.html#pyad2.messages.RFMessage.supervision">supervision (pyad2.messages.RFMessage attribute)</a>
</dt>

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

@@ -724,9 +854,19 @@
<table style="width: 100%" class="indextable genindextable"><tr>
<td style="width: 33%" valign="top"><dl>
<dt><a href="pyad2.html#pyad2.messages.Message.text">text (pyad2.messages.Message attribute)</a>
</dt>

<dt><a href="pyad2.html#pyad2.util.TimeoutError">TimeoutError</a>
</dt>

</dl></td>
<td style="width: 33%" valign="top"><dl>
<dt><a href="pyad2.html#pyad2.messages.ExpanderMessage.type">type (pyad2.messages.ExpanderMessage attribute)</a>
</dt>

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

@@ -750,6 +890,22 @@
</dl></td>
</tr></table>

<h2 id="V">V</h2>
<table style="width: 100%" class="indextable genindextable"><tr>
<td style="width: 33%" valign="top"><dl>
<dt><a href="pyad2.html#pyad2.messages.ExpanderMessage.value">value (pyad2.messages.ExpanderMessage attribute)</a>
</dt>

<dd><dl>
<dt><a href="pyad2.html#pyad2.messages.RFMessage.value">(pyad2.messages.RFMessage attribute)</a>
</dt>

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

<h2 id="W">W</h2>
<table style="width: 100%" class="indextable genindextable"><tr>
<td style="width: 33%" valign="top"><dl>
@@ -770,6 +926,16 @@
</dl></td>
</tr></table>

<h2 id="X">X</h2>
<table style="width: 100%" class="indextable genindextable"><tr>
<td style="width: 33%" valign="top"><dl>
<dt><a href="pyad2.html#pyad2.messages.RFMessage.x">x (pyad2.messages.RFMessage attribute)</a>
</dt>

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

<h2 id="Z">Z</h2>
<table style="width: 100%" class="indextable genindextable"><tr>
<td style="width: 33%" valign="top"><dl>
@@ -784,6 +950,10 @@
</dl></td>
<td style="width: 33%" valign="top"><dl>
<dt><a href="pyad2.html#pyad2.messages.Message.zone_bypassed">zone_bypassed (pyad2.messages.Message attribute)</a>
</dt>

<dt><a href="pyad2.html#pyad2.zonetracking.Zonetracker">Zonetracker (class in pyad2.zonetracking)</a>
</dt>



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


+ 225
- 3
docs/_build/html/pyad2.html View File

@@ -360,8 +360,6 @@
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
<li><strong>baudrate</strong> (<em>int</em>) &#8211; The baudrate used for the device.</li>
<li><strong>interface</strong> (<em>varies depends on device type.. FIXME</em>) &#8211; The interface used for the device.</li>
<li><strong>index</strong> (<em>int</em>) &#8211; Interface index.. can probably remove. FIXME</li>
<li><strong>no_reader_thread</strong> (<em>bool</em>) &#8211; Specifies whether or not the automatic reader thread should be started or not</li>
</ul>
</td>
@@ -379,7 +377,16 @@
<dl class="method">
<dt id="pyad2.ad2.AD2.send">
<tt class="descname">send</tt><big>(</big><em>data</em><big>)</big><a class="reference internal" href="_modules/pyad2/ad2.html#AD2.send"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pyad2.ad2.AD2.send" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dd><p>Sends data to the AD2 device.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>data</strong> (<em>str</em>) &#8211; The data to send.</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="method">
<dt id="pyad2.ad2.AD2.get_config">
@@ -1166,6 +1173,12 @@ Serial to IP interface.</p>
<em class="property">class </em><tt class="descclassname">pyad2.messages.</tt><tt class="descname">BaseMessage</tt><a class="reference internal" href="_modules/pyad2/messages.html#BaseMessage"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pyad2.messages.BaseMessage" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <tt class="xref py py-class docutils literal"><span class="pre">object</span></tt></p>
<p>Base class for messages.</p>
<dl class="attribute">
<dt id="pyad2.messages.BaseMessage.raw">
<tt class="descname">raw</tt><em class="property"> = None</em><a class="headerlink" href="#pyad2.messages.BaseMessage.raw" title="Permalink to this definition">¶</a></dt>
<dd><p>The raw message text</p>
</dd></dl>

</dd></dl>

<dl class="class">
@@ -1173,6 +1186,138 @@ Serial to IP interface.</p>
<em class="property">class </em><tt class="descclassname">pyad2.messages.</tt><tt class="descname">Message</tt><big>(</big><em>data=None</em><big>)</big><a class="reference internal" href="_modules/pyad2/messages.html#Message"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pyad2.messages.Message" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a class="reference internal" href="#pyad2.messages.BaseMessage" title="pyad2.messages.BaseMessage"><tt class="xref py py-class docutils literal"><span class="pre">pyad2.messages.BaseMessage</span></tt></a></p>
<p>Represents a message from the alarm panel.</p>
<dl class="attribute">
<dt id="pyad2.messages.Message.ready">
<tt class="descname">ready</tt><em class="property"> = False</em><a class="headerlink" href="#pyad2.messages.Message.ready" title="Permalink to this definition">¶</a></dt>
<dd><p>Indicates whether or not the panel is in a ready state</p>
</dd></dl>

<dl class="attribute">
<dt id="pyad2.messages.Message.armed_away">
<tt class="descname">armed_away</tt><em class="property"> = False</em><a class="headerlink" href="#pyad2.messages.Message.armed_away" title="Permalink to this definition">¶</a></dt>
<dd><p>Indicates whether or not the panel is armed away</p>
</dd></dl>

<dl class="attribute">
<dt id="pyad2.messages.Message.armed_home">
<tt class="descname">armed_home</tt><em class="property"> = False</em><a class="headerlink" href="#pyad2.messages.Message.armed_home" title="Permalink to this definition">¶</a></dt>
<dd><p>Indicates whether or not the panel is armed home</p>
</dd></dl>

<dl class="attribute">
<dt id="pyad2.messages.Message.backlight_on">
<tt class="descname">backlight_on</tt><em class="property"> = False</em><a class="headerlink" href="#pyad2.messages.Message.backlight_on" title="Permalink to this definition">¶</a></dt>
<dd><p>Indicates whether or not the keypad backlight is on</p>
</dd></dl>

<dl class="attribute">
<dt id="pyad2.messages.Message.programming_mode">
<tt class="descname">programming_mode</tt><em class="property"> = False</em><a class="headerlink" href="#pyad2.messages.Message.programming_mode" title="Permalink to this definition">¶</a></dt>
<dd><p>Indicates whether or not we&#8217;re in programming mode</p>
</dd></dl>

<dl class="attribute">
<dt id="pyad2.messages.Message.beeps">
<tt class="descname">beeps</tt><em class="property"> = -1</em><a class="headerlink" href="#pyad2.messages.Message.beeps" title="Permalink to this definition">¶</a></dt>
<dd><p>Number of beeps associated with a message</p>
</dd></dl>

<dl class="attribute">
<dt id="pyad2.messages.Message.zone_bypassed">
<tt class="descname">zone_bypassed</tt><em class="property"> = False</em><a class="headerlink" href="#pyad2.messages.Message.zone_bypassed" title="Permalink to this definition">¶</a></dt>
<dd><p>Indicates whether or not a zone is bypassed</p>
</dd></dl>

<dl class="attribute">
<dt id="pyad2.messages.Message.ac_power">
<tt class="descname">ac_power</tt><em class="property"> = False</em><a class="headerlink" href="#pyad2.messages.Message.ac_power" title="Permalink to this definition">¶</a></dt>
<dd><p>Indicates whether or not the panel is on AC power</p>
</dd></dl>

<dl class="attribute">
<dt id="pyad2.messages.Message.chime_on">
<tt class="descname">chime_on</tt><em class="property"> = False</em><a class="headerlink" href="#pyad2.messages.Message.chime_on" title="Permalink to this definition">¶</a></dt>
<dd><p>Indicates whether or not the chime is enabled</p>
</dd></dl>

<dl class="attribute">
<dt id="pyad2.messages.Message.alarm_event_occurred">
<tt class="descname">alarm_event_occurred</tt><em class="property"> = False</em><a class="headerlink" href="#pyad2.messages.Message.alarm_event_occurred" title="Permalink to this definition">¶</a></dt>
<dd><p>Indicates whether or not an alarm event has occurred</p>
</dd></dl>

<dl class="attribute">
<dt id="pyad2.messages.Message.alarm_sounding">
<tt class="descname">alarm_sounding</tt><em class="property"> = False</em><a class="headerlink" href="#pyad2.messages.Message.alarm_sounding" title="Permalink to this definition">¶</a></dt>
<dd><p>Indicates whether or not an alarm is sounding</p>
</dd></dl>

<dl class="attribute">
<dt id="pyad2.messages.Message.battery_low">
<tt class="descname">battery_low</tt><em class="property"> = False</em><a class="headerlink" href="#pyad2.messages.Message.battery_low" title="Permalink to this definition">¶</a></dt>
<dd><p>Indicates whether or not there is a low battery</p>
</dd></dl>

<dl class="attribute">
<dt id="pyad2.messages.Message.entry_delay_off">
<tt class="descname">entry_delay_off</tt><em class="property"> = False</em><a class="headerlink" href="#pyad2.messages.Message.entry_delay_off" title="Permalink to this definition">¶</a></dt>
<dd><p>Indicates whether or not the entry delay is enabled</p>
</dd></dl>

<dl class="attribute">
<dt id="pyad2.messages.Message.fire_alarm">
<tt class="descname">fire_alarm</tt><em class="property"> = False</em><a class="headerlink" href="#pyad2.messages.Message.fire_alarm" title="Permalink to this definition">¶</a></dt>
<dd><p>Indicates whether or not a fire alarm is sounding</p>
</dd></dl>

<dl class="attribute">
<dt id="pyad2.messages.Message.check_zone">
<tt class="descname">check_zone</tt><em class="property"> = False</em><a class="headerlink" href="#pyad2.messages.Message.check_zone" title="Permalink to this definition">¶</a></dt>
<dd><p>Indicates whether or not there are zones that require attention.</p>
</dd></dl>

<dl class="attribute">
<dt id="pyad2.messages.Message.perimeter_only">
<tt class="descname">perimeter_only</tt><em class="property"> = False</em><a class="headerlink" href="#pyad2.messages.Message.perimeter_only" title="Permalink to this definition">¶</a></dt>
<dd><p>Indicates whether or not the perimeter is armed</p>
</dd></dl>

<dl class="attribute">
<dt id="pyad2.messages.Message.numeric_code">
<tt class="descname">numeric_code</tt><em class="property"> = None</em><a class="headerlink" href="#pyad2.messages.Message.numeric_code" title="Permalink to this definition">¶</a></dt>
<dd><p>The numeric code associated with the message</p>
</dd></dl>

<dl class="attribute">
<dt id="pyad2.messages.Message.text">
<tt class="descname">text</tt><em class="property"> = None</em><a class="headerlink" href="#pyad2.messages.Message.text" title="Permalink to this definition">¶</a></dt>
<dd><p>The human-readable text to be displayed on the panel LCD</p>
</dd></dl>

<dl class="attribute">
<dt id="pyad2.messages.Message.cursor_location">
<tt class="descname">cursor_location</tt><em class="property"> = -1</em><a class="headerlink" href="#pyad2.messages.Message.cursor_location" title="Permalink to this definition">¶</a></dt>
<dd><p>Current cursor location on the keypad</p>
</dd></dl>

<dl class="attribute">
<dt id="pyad2.messages.Message.mask">
<tt class="descname">mask</tt><em class="property"> = None</em><a class="headerlink" href="#pyad2.messages.Message.mask" title="Permalink to this definition">¶</a></dt>
<dd><p>Address mask this message is intended for</p>
</dd></dl>

<dl class="attribute">
<dt id="pyad2.messages.Message.bitfield">
<tt class="descname">bitfield</tt><em class="property"> = None</em><a class="headerlink" href="#pyad2.messages.Message.bitfield" title="Permalink to this definition">¶</a></dt>
<dd><p>The bitfield associated with this message</p>
</dd></dl>

<dl class="attribute">
<dt id="pyad2.messages.Message.panel_data">
<tt class="descname">panel_data</tt><em class="property"> = None</em><a class="headerlink" href="#pyad2.messages.Message.panel_data" title="Permalink to this definition">¶</a></dt>
<dd><p>The panel data field associated with this message</p>
</dd></dl>

</dd></dl>

<dl class="class">
@@ -1192,6 +1337,30 @@ Serial to IP interface.</p>
<dd><p>Flag indicating that the expander message relates to a Relay Expander.</p>
</dd></dl>

<dl class="attribute">
<dt id="pyad2.messages.ExpanderMessage.type">
<tt class="descname">type</tt><em class="property"> = None</em><a class="headerlink" href="#pyad2.messages.ExpanderMessage.type" title="Permalink to this definition">¶</a></dt>
<dd><p>Expander message type: ExpanderMessage.ZONE or ExpanderMessage.RELAY</p>
</dd></dl>

<dl class="attribute">
<dt id="pyad2.messages.ExpanderMessage.address">
<tt class="descname">address</tt><em class="property"> = -1</em><a class="headerlink" href="#pyad2.messages.ExpanderMessage.address" title="Permalink to this definition">¶</a></dt>
<dd><p>Address of expander</p>
</dd></dl>

<dl class="attribute">
<dt id="pyad2.messages.ExpanderMessage.channel">
<tt class="descname">channel</tt><em class="property"> = -1</em><a class="headerlink" href="#pyad2.messages.ExpanderMessage.channel" title="Permalink to this definition">¶</a></dt>
<dd><p>Channel on the expander</p>
</dd></dl>

<dl class="attribute">
<dt id="pyad2.messages.ExpanderMessage.value">
<tt class="descname">value</tt><em class="property"> = -1</em><a class="headerlink" href="#pyad2.messages.ExpanderMessage.value" title="Permalink to this definition">¶</a></dt>
<dd><p>Value associated with the message</p>
</dd></dl>

</dd></dl>

<dl class="class">
@@ -1199,6 +1368,41 @@ Serial to IP interface.</p>
<em class="property">class </em><tt class="descclassname">pyad2.messages.</tt><tt class="descname">RFMessage</tt><big>(</big><em>data=None</em><big>)</big><a class="reference internal" href="_modules/pyad2/messages.html#RFMessage"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pyad2.messages.RFMessage" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a class="reference internal" href="#pyad2.messages.BaseMessage" title="pyad2.messages.BaseMessage"><tt class="xref py py-class docutils literal"><span class="pre">pyad2.messages.BaseMessage</span></tt></a></p>
<p>Represents a message from an RF receiver.</p>
<dl class="attribute">
<dt id="pyad2.messages.RFMessage.x">
<tt class="descname">x</tt><em class="property"> = 3</em><a class="headerlink" href="#pyad2.messages.RFMessage.x" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<dl class="attribute">
<dt id="pyad2.messages.RFMessage.serial_number">
<tt class="descname">serial_number</tt><em class="property"> = None</em><a class="headerlink" href="#pyad2.messages.RFMessage.serial_number" title="Permalink to this definition">¶</a></dt>
<dd><p>Serial number of the RF device</p>
</dd></dl>

<dl class="attribute">
<dt id="pyad2.messages.RFMessage.value">
<tt class="descname">value</tt><em class="property"> = -1</em><a class="headerlink" href="#pyad2.messages.RFMessage.value" title="Permalink to this definition">¶</a></dt>
<dd><p>Value associated with this message</p>
</dd></dl>

<dl class="attribute">
<dt id="pyad2.messages.RFMessage.battery">
<tt class="descname">battery</tt><em class="property"> = False</em><a class="headerlink" href="#pyad2.messages.RFMessage.battery" title="Permalink to this definition">¶</a></dt>
<dd><p>Battery low indication</p>
</dd></dl>

<dl class="attribute">
<dt id="pyad2.messages.RFMessage.supervision">
<tt class="descname">supervision</tt><em class="property"> = False</em><a class="headerlink" href="#pyad2.messages.RFMessage.supervision" title="Permalink to this definition">¶</a></dt>
<dd><p>Supervision required indication</p>
</dd></dl>

<dl class="attribute">
<dt id="pyad2.messages.RFMessage.loop">
<tt class="descname">loop</tt><em class="property"> = [False, False, False, False]</em><a class="headerlink" href="#pyad2.messages.RFMessage.loop" title="Permalink to this definition">¶</a></dt>
<dd><p>Loop indicators</p>
</dd></dl>

</dd></dl>

<dl class="class">
@@ -1206,6 +1410,24 @@ Serial to IP interface.</p>
<em class="property">class </em><tt class="descclassname">pyad2.messages.</tt><tt class="descname">LRRMessage</tt><big>(</big><em>data=None</em><big>)</big><a class="reference internal" href="_modules/pyad2/messages.html#LRRMessage"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pyad2.messages.LRRMessage" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a class="reference internal" href="#pyad2.messages.BaseMessage" title="pyad2.messages.BaseMessage"><tt class="xref py py-class docutils literal"><span class="pre">pyad2.messages.BaseMessage</span></tt></a></p>
<p>Represent a message from a Long Range Radio.</p>
<dl class="attribute">
<dt id="pyad2.messages.LRRMessage.event_data">
<tt class="descname">event_data</tt><em class="property"> = None</em><a class="headerlink" href="#pyad2.messages.LRRMessage.event_data" title="Permalink to this definition">¶</a></dt>
<dd><p>Data associated with the LRR message. Usually user ID or zone.</p>
</dd></dl>

<dl class="attribute">
<dt id="pyad2.messages.LRRMessage.partition">
<tt class="descname">partition</tt><em class="property"> = -1</em><a class="headerlink" href="#pyad2.messages.LRRMessage.partition" title="Permalink to this definition">¶</a></dt>
<dd><p>The partition that this message applies to</p>
</dd></dl>

<dl class="attribute">
<dt id="pyad2.messages.LRRMessage.event_type">
<tt class="descname">event_type</tt><em class="property"> = None</em><a class="headerlink" href="#pyad2.messages.LRRMessage.event_type" title="Permalink to this definition">¶</a></dt>
<dd><p>The type of the event that occurred</p>
</dd></dl>

</dd></dl>

</div>


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


+ 89
- 47
pyad2/messages.py View File

@@ -12,11 +12,15 @@ class BaseMessage(object):
"""
Base class for messages.
"""

raw = None
"""The raw message text"""

def __init__(self):
"""
Constructor
"""
self.raw = None
pass

def __str__(self):
"""
@@ -29,6 +33,51 @@ class Message(BaseMessage):
Represents a message from the alarm panel.
"""

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

def __init__(self, data=None):
"""
Constructor
@@ -36,35 +85,19 @@ class Message(BaseMessage):
:param data: Message data to parse.
:type data: str
"""
self.ready = False
self.armed_away = False
self.armed_home = False
self.backlight_on = False
self.programming_mode = False
self.beeps = -1
self.zone_bypassed = False
self.ac_power = False
self.chime_on = False
self.alarm_event_occurred = False
self.alarm_sounding = False
self.battery_low = False
self.entry_delay_off = False
self.fire_alarm = False
self.check_zone = False
self.perimeter_only = False
self.numeric_code = ""
self.text = ""
self.cursor_location = -1
self.data = ""
self.mask = ""
self.bitfield = ""
self.panel_data = ""
BaseMessage.__init__(self)

self._regex = re.compile('("(?:[^"]|"")*"|[^,]*),("(?:[^"]|"")*"|[^,]*),("(?:[^"]|"")*"|[^,]*),("(?:[^"]|"")*"|[^,]*)')

if data is not None:
self._parse_message(data)

def __str__(self):
"""
String conversion operator.
"""
return self.raw

def _parse_message(self, data):
"""
Parse the message from the device.
@@ -107,12 +140,6 @@ class Message(BaseMessage):
if int(self.panel_data[19:21], 16) & 0x01 > 0:
self.cursor_location = int(self.bitfield[21:23], 16) # Alpha character index that the cursor is on.

def __str__(self):
"""
String conversion operator.
"""
return self.raw

class ExpanderMessage(BaseMessage):
"""
Represents a message from a zone or relay expansion module.
@@ -123,6 +150,16 @@ class ExpanderMessage(BaseMessage):
RELAY = 1
"""Flag indicating that the expander message relates to a Relay Expander."""


type = None
"""Expander message type: ExpanderMessage.ZONE or ExpanderMessage.RELAY"""
address = -1
"""Address of expander"""
channel = -1
"""Channel on the expander"""
value = -1
"""Value associated with the message"""

def __init__(self, data=None):
"""
Constructor
@@ -130,11 +167,7 @@ class ExpanderMessage(BaseMessage):
:param data: The message data to parse.
:type data: str
"""
self.type = None
self.address = None
self.channel = None
self.value = None
self.raw = None
BaseMessage.__init__(self)

if data is not None:
self._parse_message(data)
@@ -176,6 +209,17 @@ class RFMessage(BaseMessage):
Represents a message from an RF receiver.
"""

serial_number = None
"""Serial number of the RF device"""
value = -1
"""Value associated with this message"""
battery = False
"""Battery low indication"""
supervision = False
"""Supervision required indication"""
loop = [False for x in range(4)]
"""Loop indicators"""

def __init__(self, data=None):
"""
Constructor
@@ -183,12 +227,7 @@ class RFMessage(BaseMessage):
:param data: The message data to parse
:type data: str
"""
self.raw = None
self.serial_number = None
self.value = None
self.battery = None
self.supervision = None
self.loop = {}
BaseMessage.__init__(self)

if data is not None:
self._parse_message(data)
@@ -218,7 +257,7 @@ class RFMessage(BaseMessage):
# Bit 1 = unknown
self.battery = is_bit_set(2)
self.supervision = is_bit_set(3)
# Bit 8 = unknown
# Bit 4 = unknown
self.loop[0] = is_bit_set(5)
self.loop[1] = is_bit_set(6)
self.loop[2] = is_bit_set(7)
@@ -227,12 +266,18 @@ class RFMessage(BaseMessage):
except ValueError:
raise InvalidMessageError('Received invalid message: {0}'.format(data))


class LRRMessage(BaseMessage):
"""
Represent a message from a Long Range Radio.
"""

event_data = None
"""Data associated with the LRR message. Usually user ID or zone."""
partition = -1
"""The partition that this message applies to"""
event_type = None
"""The type of the event that occurred"""

def __init__(self, data=None):
"""
Constructor
@@ -240,10 +285,7 @@ class LRRMessage(BaseMessage):
:param data: The message data to parse.
:type data: str
"""
self.raw = None
self.event_data = None
self.partition = None
self.event_type = None
BaseMessage.__init__(self)

if data is not None:
self._parse_message(data)


Loading…
Cancel
Save