diff --git a/docs/_build/doctrees/alarmdecoder.doctree b/docs/_build/doctrees/alarmdecoder.doctree new file mode 100644 index 0000000..ee19f08 Binary files /dev/null and b/docs/_build/doctrees/alarmdecoder.doctree differ diff --git a/docs/_build/doctrees/alarmdecoder.event.doctree b/docs/_build/doctrees/alarmdecoder.event.doctree new file mode 100644 index 0000000..20bb85f Binary files /dev/null and b/docs/_build/doctrees/alarmdecoder.event.doctree differ diff --git a/docs/_build/doctrees/environment.pickle b/docs/_build/doctrees/environment.pickle index c0f4361..2b5e17a 100644 Binary files a/docs/_build/doctrees/environment.pickle and b/docs/_build/doctrees/environment.pickle differ diff --git a/docs/_build/doctrees/index.doctree b/docs/_build/doctrees/index.doctree index b5ec21c..639d50c 100644 Binary files a/docs/_build/doctrees/index.doctree and b/docs/_build/doctrees/index.doctree differ diff --git a/docs/_build/doctrees/modules.doctree b/docs/_build/doctrees/modules.doctree index 1da7dfc..9f3af33 100644 Binary files a/docs/_build/doctrees/modules.doctree and b/docs/_build/doctrees/modules.doctree differ diff --git a/docs/_build/doctrees/pyad2.doctree b/docs/_build/doctrees/pyad2.doctree deleted file mode 100644 index 8114e42..0000000 Binary files a/docs/_build/doctrees/pyad2.doctree and /dev/null differ diff --git a/docs/_build/doctrees/pyad2.event.doctree b/docs/_build/doctrees/pyad2.event.doctree deleted file mode 100644 index 9d0e262..0000000 Binary files a/docs/_build/doctrees/pyad2.event.doctree and /dev/null differ diff --git a/docs/_build/html/.buildinfo b/docs/_build/html/.buildinfo index db9ab62..a32ac9b 100644 --- a/docs/_build/html/.buildinfo +++ b/docs/_build/html/.buildinfo @@ -1,4 +1,4 @@ # Sphinx build info version 1 # This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done. -config: bfabfef1f3b1f181eaa7d666d13e81ec +config: 7e4354096f7282bd97dc9d3ef3f60c52 tags: a205e9ed8462ae86fdd2f73488852ba9 diff --git a/docs/_build/html/_modules/pyad2/devices.html b/docs/_build/html/_modules/alarmdecoder/devices.html similarity index 73% rename from docs/_build/html/_modules/pyad2/devices.html rename to docs/_build/html/_modules/alarmdecoder/devices.html index f41fbf7..36eccc1 100644 --- a/docs/_build/html/_modules/pyad2/devices.html +++ b/docs/_build/html/_modules/alarmdecoder/devices.html @@ -6,7 +6,7 @@ - pyad2.devices — pyad2 documentation + alarmdecoder.devices — alarmdecoder documentation @@ -23,7 +23,7 @@ - + @@ -36,7 +36,7 @@
  • modules |
  • -
  • pyad2 documentation »
  • +
  • alarmdecoder documentation »
  • Module code »
  • @@ -46,9 +46,9 @@
    -

    Source code for pyad2.devices

    +  

    Source code for alarmdecoder.devices

     """
    -Contains different types of devices belonging to the AD2 family.
    +Contains different types of devices belonging to the Alarm Decoder (AD2) family.
     
     .. moduleauthor:: Scott Petersen <scott@nutech.com>
     """
    @@ -65,9 +65,9 @@
     from .util import CommError, TimeoutError, NoDeviceError
     from .event import event
     
    -
    [docs]class Device(object): +
    [docs]class Device(object): """ - Generic parent device to all AD2 products. + Generic parent device to all Alarm Decoder (AD2) products. """ # Generic device events @@ -86,6 +86,20 @@ self._running = False self._read_thread = Device.ReadThread(self) + def __enter__(self): + """ + Support for context manager __enter__. + """ + return self + + def __exit__(self, type, value, traceback): + """ + Support for context manager __exit__. + """ + self.close() + + return False + @property def id(self): """ @@ -96,7 +110,7 @@ return self._id @id.setter -
    [docs] def id(self, value): +
    [docs] def id(self, value): """ Sets the device ID. @@ -105,7 +119,7 @@ """ self._id = value
    -
    [docs] def is_reader_alive(self): +
    [docs] def is_reader_alive(self): """ Indicates whether or not the reader thread is alive. @@ -113,13 +127,13 @@ """ return self._read_thread.is_alive()
    -
    [docs] def stop_reader(self): +
    [docs] def stop_reader(self): """ Stops the reader thread. """ self._read_thread.stop()
    -
    [docs] def close(self): +
    [docs] def close(self): """ Closes the device. """ @@ -133,7 +147,7 @@ self.on_close()
    -
    [docs] class ReadThread(threading.Thread): +
    [docs] class ReadThread(threading.Thread): """ Reader thread which processes messages from the device. """ @@ -152,13 +166,13 @@ self._device = device self._running = False -
    [docs] def stop(self): +
    [docs] def stop(self): """ Stops the running thread. """ self._running = False
    -
    [docs] def run(self): +
    [docs] def run(self): """ The actual read process. """ @@ -178,7 +192,7 @@ time.sleep(0.01)
    -
    [docs]class USBDevice(Device): +
    [docs]class USBDevice(Device): """ AD2USB device exposed with PyFTDI's interface. """ @@ -191,23 +205,84 @@ BAUDRATE = 115200 """Default baudrate for AD2USB devices.""" - @staticmethod -
    [docs] def find_all(): + __devices = [] + + @classmethod +
    [docs] def find_all(cls, vid=FTDI_VENDOR_ID, pid=FTDI_PRODUCT_ID): """ Returns all FTDI devices matching our vendor and product IDs. :returns: list of devices :raises: CommError """ - devices = [] + cls.__devices = [] try: - devices = Ftdi.find_all([(USBDevice.FTDI_VENDOR_ID, USBDevice.FTDI_PRODUCT_ID)], nocache=True) + cls.__devices = Ftdi.find_all([(vid, pid)], nocache=True) except (usb.core.USBError, FtdiError), err: raise CommError('Error enumerating AD2USB devices: {0}'.format(str(err)), err) - return devices + return cls.__devices +
    + @classmethod +
    [docs] def devices(cls): + """ + Returns a cached list of AD2USB devices located on the system. + + :returns: cached list of devices found. + """ + return cls.__devices +
    + @classmethod +
    [docs] def find(cls, device=None): + """ + Factory method that returns the requested USBDevice device, or the first device. + + :param device: Tuple describing the USB device to open, as returned by find_all(). + :type device: tuple + + :returns: USBDevice object utilizing the specified device. + :raises: NoDeviceError + """ + cls.find_all() + + if len(cls.__devices) == 0: + raise NoDeviceError('No AD2USB devices present.') + + if device is None: + device = cls.__devices[0] + + vendor, product, sernum, ifcount, description = device + + return USBDevice(interface=sernum) +
    + @classmethod +
    [docs] def start_detection(cls, on_attached=None, on_detached=None): + """ + Starts the device detection thread. + + :param on_attached: function to be called when a device is attached. + :type on_attached: function + :param on_detached: function to be called when a device is detached. + :type on_detached: function + """ + cls.__detect_thread = USBDevice.DetectThread(on_attached, on_detached) + + cls.find_all() + + cls.__detect_thread.start() +
    + @classmethod +
    [docs] def stop_detection(cls): + """ + Stops the device detection thread. + """ + try: + cls.__detect_thread.stop() + + except: + pass
    @property def interface(self): @@ -216,18 +291,21 @@ :returns: the interface used to connect to the device. """ - return (self._serial_number, self._endpoint) + return self._interface @interface.setter -
    [docs] def interface(self, value): +
    [docs] def interface(self, value): """ Sets the interface used to connect to the device. - :param value: Tuple containing the serial number and endpoint number to use. - :type value: tuple + :param value: May specify either the serial number or the device index. + :type value: str or int """ - self._serial_number = value[0] - self._endpoint = value[1] + self._interface = value + if isinstance(value, int): + self._device_number = value + else: + self._serial_number = value
    @property def serial_number(self): @@ -240,7 +318,7 @@ return self._serial_number @serial_number.setter -
    [docs] def serial_number(self, value): +
    [docs] def serial_number(self, value): """ Sets the serial number of the device. @@ -259,7 +337,7 @@ return self._description @description.setter -
    [docs] def description(self, value): +
    [docs] def description(self, value): """ Sets the description of the device. @@ -268,24 +346,26 @@ """ self._description = value
    - def __init__(self, interface=(None, 0)): + def __init__(self, interface=0): """ Constructor - :param interface: Tuple containing the device number and endpoint number to use. - :type interface: tuple + :param interface: May specify either the serial number or the device index. + :type interface: str or int """ Device.__init__(self) self._device = Ftdi() - self._serial_number = interface[0] - self._endpoint = interface[1] + + self._device_number = 0 + self._serial_number = None + self.interface = interface self._vendor_id = USBDevice.FTDI_VENDOR_ID self._product_id = USBDevice.FTDI_PRODUCT_ID - self._device_number = None + self._endpoint = 0 self._description = None -
    [docs] def open(self, baudrate=BAUDRATE, no_reader_thread=False): +
    [docs] def open(self, baudrate=BAUDRATE, no_reader_thread=False): """ Opens the device. @@ -311,32 +391,37 @@ self._device.set_baudrate(baudrate) - self._id = 'USB {0}:{1}'.format(self._device.usb_dev.bus, self._device.usb_dev.address) + if not self._serial_number: + self._serial_number = self._get_serial_number() + + self._id = self._serial_number except (usb.core.USBError, FtdiError), err: raise NoDeviceError('Error opening device: {0}'.format(str(err)), err) else: self._running = True + self.on_open() + if not no_reader_thread: self._read_thread.start() - self.on_open() + return self
    -
    [docs] def close(self): +
    [docs] def close(self): """ Closes the device. """ try: + Device.close(self) + # HACK: Probably should fork pyftdi and make this call in .close(). self._device.usb_dev.attach_kernel_driver(self._device_number) - Device.close(self) - except: pass
    -
    [docs] def write(self, data): +
    [docs] def write(self, data): """ Writes data to the device. @@ -348,12 +433,12 @@ try: self._device.write_data(data) - self.on_write(data) + self.on_write(data=data) except FtdiError, err: raise CommError('Error writing to device: {0}'.format(str(err)), err)
    -
    [docs] def read(self): +
    [docs] def read(self): """ Reads a single character from the device. @@ -370,7 +455,7 @@ return ret
    -
    [docs] def read_line(self, timeout=0.0, purge_buffer=False): +
    [docs] def read_line(self, timeout=0.0, purge_buffer=False): """ Reads a line from the device. @@ -429,7 +514,7 @@ ret = self._buffer self._buffer = '' - self.on_read(ret) + self.on_read(data=ret) if timer: if timer.is_alive(): @@ -438,9 +523,76 @@ raise TimeoutError('Timeout while waiting for line terminator.') return ret +
    + def _get_serial_number(self): + """ + Retrieves the FTDI device serial number. -
    -
    [docs]class SerialDevice(Device): + :returns: string containing the device serial number. + """ + return usb.util.get_string(self._device.usb_dev, 64, self._device.usb_dev.iSerialNumber) + +
    [docs] class DetectThread(threading.Thread): + """ + Thread that handles detection of added/removed devices. + """ + on_attached = event.Event('Called when an AD2USB device has been detected.') + on_detached = event.Event('Called when an AD2USB device has been removed.') + + def __init__(self, on_attached=None, on_detached=None): + """ + Constructor + + :param on_attached: Function to call when a device is attached. + :type on_attached: function + :param on_detached: Function to call when a device is detached. + :type on_detached: function + """ + threading.Thread.__init__(self) + + if on_attached: + self.on_attached += on_attached + + if on_detached: + self.on_detached += on_detached + + self._running = False + +
    [docs] def stop(self): + """ + Stops the thread. + """ + self._running = False +
    +
    [docs] def run(self): + """ + The actual detection process. + """ + self._running = True + + last_devices = set() + + while self._running: + try: + current_devices = set(USBDevice.find_all()) + + new_devices = [d for d in current_devices if d not in last_devices] + removed_devices = [d for d in last_devices if d not in current_devices] + last_devices = current_devices + + for d in new_devices: + self.on_attached(device=d) + + for d in removed_devices: + self.on_detached(device=d) + + except CommError, err: + pass + + time.sleep(0.25) + +
    +
    [docs]class SerialDevice(Device): """ AD2USB or AD2SERIAL device exposed with the pyserial interface. """ @@ -450,7 +602,7 @@ """Default baudrate for Serial devices.""" @staticmethod -
    [docs] def find_all(pattern=None): +
    [docs] def find_all(pattern=None): """ Returns all serial ports present. @@ -483,7 +635,7 @@ return self._port @interface.setter -
    [docs] def interface(self, value): +
    [docs] def interface(self, value): """ Sets the interface used to connect to the device. @@ -505,7 +657,7 @@ self._id = interface self._device = serial.Serial(timeout=0, writeTimeout=0) # Timeout = non-blocking to match pyftdi. -
    [docs] def open(self, baudrate=BAUDRATE, no_reader_thread=False): +
    [docs] def open(self, baudrate=BAUDRATE, no_reader_thread=False): """ Opens the device. @@ -544,8 +696,10 @@ if not no_reader_thread: self._read_thread.start() + + return self
    -
    [docs] def close(self): +
    [docs] def close(self): """ Closes the device. """ @@ -555,7 +709,7 @@ except: pass
    -
    [docs] def write(self, data): +
    [docs] def write(self, data): """ Writes data to the device. @@ -574,9 +728,9 @@ raise CommError('Error writing to device.', err) else: - self.on_write(data) + self.on_write(data=data)
    -
    [docs] def read(self): +
    [docs] def read(self): """ Reads a single character from the device. @@ -593,7 +747,7 @@ return ret
    -
    [docs] def read_line(self, timeout=0.0, purge_buffer=False): +
    [docs] def read_line(self, timeout=0.0, purge_buffer=False): """ Reads a line from the device. @@ -648,7 +802,7 @@ ret = self._buffer self._buffer = '' - self.on_read(ret) + self.on_read(data=ret) if timer: if timer.is_alive(): @@ -658,10 +812,10 @@ return ret
    -
    [docs]class SocketDevice(Device): +
    [docs]class SocketDevice(Device): """ - Device that supports communication with an AD2 that is exposed via ser2sock or another - Serial to IP interface. + Device that supports communication with an Alarm Decoder (AD2) that is + exposed via ser2sock or another Serial to IP interface. """ @property @@ -674,11 +828,11 @@ return (self._host, self._port) @interface.setter -
    [docs] def interface(self, value): +
    [docs] def interface(self, value): """ Sets the interface used to connect to the device. - :param value: Tuple containing the device number and endpoint number to use. + :param value: Tuple containing the host and port to use. :type value: tuple """ self._host = value[0] @@ -694,7 +848,7 @@ return self._use_ssl @ssl.setter -
    [docs] def ssl(self, value): +
    [docs] def ssl(self, value): """ Sets whether or not SSL communication is in use. @@ -713,7 +867,7 @@ return self._ssl_certificate @ssl_certificate.setter -
    [docs] def ssl_certificate(self, value): +
    [docs] def ssl_certificate(self, value): """ Sets the SSL client certificate to use for authentication. @@ -732,7 +886,7 @@ return self._ssl_key @ssl_key.setter -
    [docs] def ssl_key(self, value): +
    [docs] def ssl_key(self, value): """ Sets the SSL client certificate key to use for authentication. @@ -751,7 +905,7 @@ return self._ssl_ca @ssl_ca.setter -
    [docs] def ssl_ca(self, value): +
    [docs] def ssl_ca(self, value): """ Sets the SSL Certificate Authority certificate used for authentication. @@ -775,7 +929,7 @@ self._ssl_key = None self._ssl_ca = None -
    [docs] def open(self, baudrate=None, no_reader_thread=False): +
    [docs] def open(self, baudrate=None, no_reader_thread=False): """ Opens the device. @@ -795,6 +949,9 @@ self._device.connect((self._host, self._port)) + if self._use_ssl: + self._device.do_handshake() + self._id = '{0}:{1}'.format(self._host, self._port) except socket.error, err: @@ -802,19 +959,22 @@ else: self._running = True - self.on_open() if not no_reader_thread: self._read_thread.start() + + return self
    -
    [docs] def close(self): +
    [docs] def close(self): """ Closes the device. """ try: + # TODO: Find a way to speed up this shutdown. if self.ssl: self._device.shutdown() + else: self._device.shutdown(socket.SHUT_RDWR) # Make sure that it closes immediately. @@ -823,7 +983,7 @@ except Exception, ex: pass
    -
    [docs] def write(self, data): +
    [docs] def write(self, data): """ Writes data to the device. @@ -841,14 +1001,14 @@ if data_sent == 0: raise CommError('Error writing to device.') - self.on_write(data) + self.on_write(data=data) except (SSL.Error, socket.error), err: raise CommError('Error writing to device.', err) return data_sent
    -
    [docs] def read(self): +
    [docs] def read(self): """ Reads a single character from the device. @@ -865,7 +1025,7 @@ return data
    -
    [docs] def read_line(self, timeout=0.0, purge_buffer=False): +
    [docs] def read_line(self, timeout=0.0, purge_buffer=False): """ Reads a line from the device. @@ -924,7 +1084,7 @@ ret = self._buffer self._buffer = '' - self.on_read(ret) + self.on_read(data=ret) if timer: if timer.is_alive(): @@ -996,12 +1156,12 @@
  • modules |
  • -
  • pyad2 documentation »
  • +
  • alarmdecoder documentation »
  • Module code »
  • diff --git a/docs/_build/html/_modules/pyad2/event/event.html b/docs/_build/html/_modules/alarmdecoder/event/event.html similarity index 78% rename from docs/_build/html/_modules/pyad2/event/event.html rename to docs/_build/html/_modules/alarmdecoder/event/event.html index 3427864..4cb5a8b 100644 --- a/docs/_build/html/_modules/pyad2/event/event.html +++ b/docs/_build/html/_modules/alarmdecoder/event/event.html @@ -6,7 +6,7 @@ - pyad2.event.event — pyad2 documentation + alarmdecoder.event.event — alarmdecoder documentation @@ -23,7 +23,7 @@ - + @@ -36,7 +36,7 @@
  • modules |
  • -
  • pyad2 documentation »
  • +
  • alarmdecoder documentation »
  • Module code »
  • @@ -46,18 +46,19 @@
    -

    Source code for pyad2.event.event

    +  

    Source code for alarmdecoder.event.event

     # event.py (improved)
     #
     
     # Based on pyevent originally found at http://www.emptypage.jp/notes/pyevent.en.html
    -# 
    +#
     # License: https://creativecommons.org/licenses/by/2.1/jp/deed.en
     #
     # Changes:
    -#    Added type check in fire()
    +#   * Added type check in fire()
    +#   * Removed earg from fire() and added support for args/kwargs.
     
    -
    [docs]class Event(object): +
    [docs]class Event(object): def __init__(self, doc=None): self.__doc__ = doc @@ -71,7 +72,7 @@ pass
    -
    [docs]class EventHandler(object): +
    [docs]class EventHandler(object): def __init__(self, event, obj): @@ -88,7 +89,7 @@ eventhandler = self.obj.__eventhandler__ = {} return eventhandler.setdefault(self.event, []) -
    [docs] def add(self, func): +
    [docs] def add(self, func): """Add new event handler function. @@ -99,7 +100,7 @@ self._getfunctionlist().append(func) return self
    -
    [docs] def remove(self, func): +
    [docs] def remove(self, func): """Remove existing event handler function. @@ -109,19 +110,19 @@ self._getfunctionlist().remove(func) return self
    -
    [docs] def fire(self, earg=None): +
    [docs] def fire(self, *args, **kwargs): """Fire event and call all handler functions - You can call EventHandler object itself like e(earg) instead of - e.fire(earg). + You can call EventHandler object itself like e(*args, **kwargs) instead of + e.fire(*args, **kwargs). """ for func in self._getfunctionlist(): if type(func) == EventHandler: - func.fire(earg) + func.fire(*args, **kwargs) else: - func(self.obj, earg) + func(self.obj, *args, **kwargs)
    __iadd__ = add __isub__ = remove @@ -159,12 +160,12 @@
  • modules |
  • -
  • pyad2 documentation »
  • +
  • alarmdecoder documentation »
  • Module code »
  • diff --git a/docs/_build/html/_modules/pyad2/messages.html b/docs/_build/html/_modules/alarmdecoder/messages.html similarity index 74% rename from docs/_build/html/_modules/pyad2/messages.html rename to docs/_build/html/_modules/alarmdecoder/messages.html index 58da4c4..6d2d509 100644 --- a/docs/_build/html/_modules/pyad2/messages.html +++ b/docs/_build/html/_modules/alarmdecoder/messages.html @@ -6,7 +6,7 @@ - pyad2.messages — pyad2 documentation + alarmdecoder.messages — alarmdecoder documentation @@ -23,7 +23,7 @@ - + @@ -36,7 +36,7 @@
  • modules |
  • -
  • pyad2 documentation »
  • +
  • alarmdecoder documentation »
  • Module code »
  • @@ -46,9 +46,10 @@
    -

    Source code for pyad2.messages

    +  

    Source code for alarmdecoder.messages

     """
    -Message representations received from the panel through the AD2 devices.
    +Message representations received from the panel through the Alarm Decoder (AD2)
    +devices.
     
     .. moduleauthor:: Scott Petersen <scott@nutech.com>
     """
    @@ -57,15 +58,19 @@
     
     from .util import InvalidMessageError
     
    -
    [docs]class BaseMessage(object): +
    [docs]class BaseMessage(object): """ Base class for messages. """ + + raw = None + """The raw message text""" + def __init__(self): """ Constructor """ - self.raw = None + pass def __str__(self): """ @@ -73,11 +78,56 @@ """ return self.raw
    -
    [docs]class Message(BaseMessage): +
    [docs]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 @@ -85,35 +135,19 @@ :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. @@ -155,14 +189,8 @@ 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
    -
    [docs]class ExpanderMessage(BaseMessage): +
    [docs]class ExpanderMessage(BaseMessage): """ Represents a message from a zone or relay expansion module. """ @@ -172,6 +200,16 @@ 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 @@ -179,11 +217,7 @@ :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) @@ -220,11 +254,22 @@ else: raise InvalidMessageError('Unknown expander message header: {0}'.format(data))
    -
    [docs]class RFMessage(BaseMessage): +
    [docs]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 @@ -232,12 +277,7 @@ :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) @@ -262,26 +302,32 @@ self.serial_number, self.value = values.split(',') self.value = int(self.value, 16) - is_bit_set = lambda b: self.value & (1 << b) > 0 + is_bit_set = lambda b: self.value & (1 << (b - 1)) > 0 # Bit 1 = unknown self.battery = is_bit_set(2) self.supervision = is_bit_set(3) - # Bit 8 = unknown - self.loop[0] = is_bit_set(5) + # Bit 4 = unknown + self.loop[2] = is_bit_set(5) self.loop[1] = is_bit_set(6) - self.loop[2] = is_bit_set(7) - self.loop[3] = is_bit_set(8) + self.loop[3] = is_bit_set(7) + self.loop[0] = is_bit_set(8) except ValueError: raise InvalidMessageError('Received invalid message: {0}'.format(data)) -
    -
    [docs]class LRRMessage(BaseMessage): +
    [docs]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 @@ -289,10 +335,7 @@ :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) @@ -351,12 +394,12 @@
  • modules |
  • -
  • pyad2 documentation »
  • +
  • alarmdecoder documentation »
  • Module code »
  • diff --git a/docs/_build/html/_modules/pyad2/util.html b/docs/_build/html/_modules/alarmdecoder/util.html similarity index 87% rename from docs/_build/html/_modules/pyad2/util.html rename to docs/_build/html/_modules/alarmdecoder/util.html index 0e16016..57eabec 100644 --- a/docs/_build/html/_modules/pyad2/util.html +++ b/docs/_build/html/_modules/alarmdecoder/util.html @@ -6,7 +6,7 @@ - pyad2.util — pyad2 documentation + alarmdecoder.util — alarmdecoder documentation @@ -23,7 +23,7 @@ - + @@ -36,7 +36,7 @@
  • modules |
  • -
  • pyad2 documentation »
  • +
  • alarmdecoder documentation »
  • Module code »
  • @@ -46,44 +46,43 @@
    -

    Source code for pyad2.util

    +  

    Source code for alarmdecoder.util

     """
    -Provides utility classes for the AD2 devices.
    +Provides utility classes for the Alarm Decoder (AD2) devices.
     
     .. moduleauthor:: Scott Petersen <scott@nutech.com>
     """
     
    -import ad2
     import time
     import threading
     
    -
    [docs]class NoDeviceError(Exception): +
    [docs]class NoDeviceError(Exception): """ No devices found. """ pass
    -
    [docs]class CommError(Exception): +
    [docs]class CommError(Exception): """ There was an error communicating with the device. """ pass
    -
    [docs]class TimeoutError(Exception): +
    [docs]class TimeoutError(Exception): """ There was a timeout while trying to communicate with the device. """ pass
    -
    [docs]class InvalidMessageError(Exception): +
    [docs]class InvalidMessageError(Exception): """ The format of the panel message was invalid. """ pass
    -
    [docs]class Firmware(object): +
    [docs]class Firmware(object): """ - Represents firmware for the AD2 devices. + Represents firmware for the Alarm Decoder devices. """ # Constants @@ -95,16 +94,16 @@ STAGE_DONE = 5 @staticmethod -
    [docs] def upload(dev, filename, progress_callback=None): +
    [docs] def upload(dev, filename, progress_callback=None): """ - Uploads firmware to an AD2 device. + Uploads firmware to an Alarm Decoder device. :param filename: The firmware filename :type filename: str :param progress_callback: Callback function used to report progress. :type progress_callback: function - :raises: util.NoDeviceError, util.TimeoutError + :raises: NoDeviceError, TimeoutError """ def do_upload(): @@ -228,12 +227,12 @@
  • modules |
  • -
  • pyad2 documentation »
  • +
  • alarmdecoder documentation »
  • Module code »
  • diff --git a/docs/_build/html/_modules/pyad2/zonetracking.html b/docs/_build/html/_modules/alarmdecoder/zonetracking.html similarity index 94% rename from docs/_build/html/_modules/pyad2/zonetracking.html rename to docs/_build/html/_modules/alarmdecoder/zonetracking.html index d3db801..3cd34b7 100644 --- a/docs/_build/html/_modules/pyad2/zonetracking.html +++ b/docs/_build/html/_modules/alarmdecoder/zonetracking.html @@ -6,7 +6,7 @@ - pyad2.zonetracking — pyad2 documentation + alarmdecoder.zonetracking — alarmdecoder documentation @@ -23,7 +23,7 @@ - + @@ -36,7 +36,7 @@
  • modules |
  • -
  • pyad2 documentation »
  • +
  • alarmdecoder documentation »
  • Module code »
  • @@ -46,9 +46,9 @@
    -

    Source code for pyad2.zonetracking

    +  

    Source code for alarmdecoder.zonetracking

     """
    -Provides zone tracking functionality for the AD2 device family.
    +Provides zone tracking functionality for the Alarm Decoder (AD2) device family.
     
     .. moduleauthor:: Scott Petersen <scott@nutech.com>
     """
    @@ -59,7 +59,7 @@
     from .event import event
     from .messages import ExpanderMessage
     
    -
    [docs]class Zone(object): +
    [docs]class Zone(object): """ Representation of a panel zone. """ @@ -101,7 +101,7 @@ """ return 'Zone({0}, {1}, ts {2})'.format(self.zone, Zone.STATUS[self.status], self.timestamp)
    -
    [docs]class Zonetracker(object): +
    [docs]class Zonetracker(object): """ Handles tracking of zone and their statuses. """ @@ -120,7 +120,7 @@ self._zones_faulted = [] self._last_zone_fault = 0 -
    [docs] def update(self, message): +
    [docs] def update(self, message): """ Update zone statuses based on the current message. @@ -148,6 +148,10 @@ else: # Panel is ready, restore all zones. + # + # NOTE: This will need to be updated to support panels with multiple partitions. + # In it's current state a ready on partition #1 will end up clearing all zones, even + # if they exist elsewhere and it shouldn't. if message.ready: for z in self._zones_faulted: self._update_zone(z, Zone.CLEAR) @@ -283,7 +287,7 @@ self._zones[zone] = Zone(zone=zone, name=name, status=status) if status != Zone.CLEAR: - self.on_fault(zone) + self.on_fault(zone=zone) def _update_zone(self, zone, status=None): """ @@ -308,7 +312,7 @@ if zone in self._zones_faulted: self._zones_faulted.remove(zone) - self.on_restore(zone) + self.on_restore(zone=zone) def _zone_expired(self, zone): """ @@ -372,12 +376,12 @@
  • modules |
  • -
  • pyad2 documentation »
  • +
  • alarmdecoder documentation »
  • Module code »
  • diff --git a/docs/_build/html/_modules/index.html b/docs/_build/html/_modules/index.html index 397b6c5..040c13c 100644 --- a/docs/_build/html/_modules/index.html +++ b/docs/_build/html/_modules/index.html @@ -6,7 +6,7 @@ - Overview: module code — pyad2 documentation + Overview: module code — alarmdecoder documentation @@ -23,7 +23,7 @@ - + @@ -45,12 +45,11 @@ @@ -84,11 +83,11 @@
  • modules |
  • -
  • pyad2 documentation »
  • +
  • alarmdecoder documentation »
  • diff --git a/docs/_build/html/_modules/pyad2/ad2.html b/docs/_build/html/_modules/pyad2/ad2.html deleted file mode 100644 index 95e5e44..0000000 --- a/docs/_build/html/_modules/pyad2/ad2.html +++ /dev/null @@ -1,671 +0,0 @@ - - - - - - - - pyad2.ad2 — pyad2 documentation - - - - - - - - - - - - - - -
    -
    -
    -
    - -

    Source code for pyad2.ad2

    -"""
    -Provides the full AD2 class and factory.
    -
    -.. moduleauthor:: Scott Petersen <scott@nutech.com>
    -"""
    -
    -import time
    -import threading
    -
    -from .event import event
    -from .devices import USBDevice
    -from .util import CommError, NoDeviceError
    -from .messages import Message, ExpanderMessage, RFMessage, LRRMessage
    -from .zonetracking import Zonetracker
    -
    -
    [docs]class AD2Factory(object): - """ - Factory for creation of AD2USB devices as well as provides attach/detach events." - """ - - # Factory events - on_attached = event.Event('Called when an AD2USB device has been detected.') - on_detached = event.Event('Called when an AD2USB device has been removed.') - - __devices = [] - - @classmethod -
    [docs] def find_all(cls): - """ - Returns all AD2USB devices located on the system. - - :returns: list of devices found - :raises: CommError - """ - cls.__devices = USBDevice.find_all() - - return cls.__devices -
    - @classmethod -
    [docs] def devices(cls): - """ - Returns a cached list of AD2USB devices located on the system. - - :returns: cached list of devices found. - """ - return cls.__devices -
    - @classmethod -
    [docs] def create(cls, device=None): - """ - Factory method that returns the requested AD2USB device, or the first device. - - :param device: Tuple describing the USB device to open, as returned by find_all(). - :type device: tuple - - :returns: AD2USB object utilizing the specified device. - :raises: NoDeviceError - """ - cls.find_all() - - if len(cls.__devices) == 0: - raise NoDeviceError('No AD2USB devices present.') - - if device is None: - device = cls.__devices[0] - - vendor, product, sernum, ifcount, description = device - device = USBDevice((sernum, ifcount - 1)) - - return AD2(device) -
    - def __init__(self, attached_event=None, detached_event=None): - """ - Constructor - - :param attached_event: Event to trigger when a device is attached. - :type attached_event: function - :param detached_event: Event to trigger when a device is detached. - :type detached_event: function - """ - self._detect_thread = AD2Factory.DetectThread(self) - - if attached_event: - self.on_attached += attached_event - - if detached_event: - self.on_detached += detached_event - - AD2Factory.find_all() - - self.start() - -
    [docs] def close(self): - """ - Clean up and shut down. - """ - self.stop() -
    -
    [docs] def start(self): - """ - Starts the detection thread, if not already running. - """ - if not self._detect_thread.is_alive(): - self._detect_thread.start() -
    -
    [docs] def stop(self): - """ - Stops the detection thread. - """ - self._detect_thread.stop() -
    -
    [docs] def get_device(self, device=None): - """ - Factory method that returns the requested AD2USB device, or the first device. - - :param device: Tuple describing the USB device to open, as returned by find_all(). - :type device: tuple - """ - return AD2Factory.create(device) -
    -
    [docs] class DetectThread(threading.Thread): - """ - Thread that handles detection of added/removed devices. - """ - def __init__(self, factory): - """ - Constructor - - :param factory: AD2Factory object to use with the thread. - :type factory: AD2Factory - """ - threading.Thread.__init__(self) - - self._factory = factory - self._running = False - -
    [docs] def stop(self): - """ - Stops the thread. - """ - self._running = False -
    -
    [docs] def run(self): - """ - The actual detection process. - """ - self._running = True - - last_devices = set() - - while self._running: - try: - AD2Factory.find_all() - - current_devices = set(AD2Factory.devices()) - new_devices = [d for d in current_devices if d not in last_devices] - removed_devices = [d for d in last_devices if d not in current_devices] - last_devices = current_devices - - for d in new_devices: - self._factory.on_attached(d) - - for d in removed_devices: - self._factory.on_detached(d) - - except CommError, err: - pass - - time.sleep(0.25) - -
    -
    [docs]class AD2(object): - """ - High-level wrapper around AD2 devices. - """ - - # High-level Events - on_arm = event.Event('Called when the panel is armed.') - on_disarm = event.Event('Called when the panel is disarmed.') - on_power_changed = event.Event('Called when panel power switches between AC and DC.') - on_alarm = event.Event('Called when the alarm is triggered.') - on_fire = event.Event('Called when a fire is detected.') - on_bypass = event.Event('Called when a zone is bypassed.') - on_boot = event.Event('Called when the device finishes bootings.') - on_config_received = event.Event('Called when the device receives its configuration.') - on_zone_fault = event.Event('Called when the device detects a zone fault.') - on_zone_restore = event.Event('Called when the device detects that a fault is restored.') - on_low_battery = event.Event('Called when the device detects a low battery.') - on_panic = event.Event('Called when the device detects a panic.') - on_relay_changed = event.Event('Called when a relay is opened or closed on an expander board.') - - # Mid-level Events - on_message = event.Event('Called when a message has been received from the device.') - on_lrr_message = event.Event('Called when an LRR message is received.') - on_rfx_message = event.Event('Called when an RFX message is received.') - - # Low-level Events - on_open = event.Event('Called when the device has been opened.') - on_close = event.Event('Called when the device has been closed.') - on_read = event.Event('Called when a line has been read from the device.') - on_write = event.Event('Called when data has been written to the device.') - - # Constants - F1 = unichr(1) + unichr(1) + unichr(1) - """Represents panel function key #1""" - F2 = unichr(2) + unichr(2) + unichr(2) - """Represents panel function key #2""" - F3 = unichr(3) + unichr(3) + unichr(3) - """Represents panel function key #3""" - F4 = unichr(4) + unichr(4) + unichr(4) - """Represents panel function key #4""" - - BATTERY_TIMEOUT = 30 - """Timeout before the battery status reverts.""" - FIRE_TIMEOUT = 30 - """Timeout before the fire status reverts.""" - - def __init__(self, device): - """ - Constructor - - :param device: The low-level device used for this AD2 interface. - :type device: Device - """ - self._device = device - self._zonetracker = Zonetracker() - - self._power_status = None - self._alarm_status = None - self._bypass_status = None - self._armed_status = None - self._fire_status = (False, 0) - self._battery_status = (False, 0) - self._panic_status = None - self._relay_status = {} - - self.address = 18 - self.configbits = 0xFF00 - self.address_mask = 0x00000000 - self.emulate_zone = [False for x in range(5)] - self.emulate_relay = [False for x in range(4)] - self.emulate_lrr = False - self.deduplicate = False - - @property -
    [docs] def id(self): - """ - The ID of the AD2 device. - - :returns: The identification string for the device. - """ - return self._device.id -
    -
    [docs] def open(self, baudrate=None, no_reader_thread=False): - """ - Opens the device. - - :param baudrate: The baudrate used for the device. - :type baudrate: int - :param interface: The interface used for the device. - :type interface: varies depends on device type.. FIXME - :param index: Interface index.. can probably remove. FIXME - :type index: int - :param no_reader_thread: Specifies whether or not the automatic reader thread should be started or not - :type no_reader_thread: bool - """ - self._wire_events() - self._device.open(baudrate=baudrate, no_reader_thread=no_reader_thread) -
    -
    [docs] def close(self): - """ - Closes the device. - """ - if self._device: - self._device.close() - - del self._device - self._device = None -
    -
    [docs] def send(self, data): - if self._device: - self._device.write(data) -
    -
    [docs] def get_config(self): - """ - Retrieves the configuration from the device. - """ - self.send("C\r") -
    -
    [docs] def save_config(self): - """ - Sets configuration entries on the device. - """ - config_string = '' - - # HACK: Both of these methods are ugly.. but I can't think of an elegant way of doing it. - - #config_string += 'ADDRESS={0}&'.format(self.address) - #config_string += 'CONFIGBITS={0:x}&'.format(self.configbits) - #config_string += 'MASK={0:x}&'.format(self.address_mask) - #config_string += 'EXP={0}&'.format(''.join(['Y' if z else 'N' for z in self.emulate_zone])) - #config_string += 'REL={0}&'.format(''.join(['Y' if r else 'N' for r in self.emulate_relay])) - #config_string += 'LRR={0}&'.format('Y' if self.emulate_lrr else 'N') - #config_string += 'DEDUPLICATE={0}'.format('Y' if self.deduplicate else 'N') - - config_entries = [] - config_entries.append(('ADDRESS', '{0}'.format(self.address))) - config_entries.append(('CONFIGBITS', '{0:x}'.format(self.configbits))) - config_entries.append(('MASK', '{0:x}'.format(self.address_mask))) - config_entries.append(('EXP', ''.join(['Y' if z else 'N' for z in self.emulate_zone]))) - config_entries.append(('REL', ''.join(['Y' if r else 'N' for r in self.emulate_relay]))) - config_entries.append(('LRR', 'Y' if self.emulate_lrr else 'N')) - config_entries.append(('DEDUPLICATE', 'Y' if self.deduplicate else 'N')) - - config_string = '&'.join(['='.join(t) for t in config_entries]) - - self.send("C{0}\r".format(config_string)) -
    -
    [docs] def reboot(self): - """ - Reboots the device. - """ - self.send('=') -
    -
    [docs] def fault_zone(self, zone, simulate_wire_problem=False): - """ - Faults a zone if we are emulating a zone expander. - - :param zone: The zone to fault. - :type zone: int - :param simulate_wire_problem: Whether or not to simulate a wire fault. - :type simulate_wire_problem: bool - """ - - # Allow ourselves to also be passed an address/channel combination - # for zone expanders. - # - # Format (expander index, channel) - if isinstance(zone, tuple): - zone = self._zonetracker._expander_to_zone(*zone) - - status = 2 if simulate_wire_problem else 1 - - self.send("L{0:02}{1}\r".format(zone, status)) -
    -
    [docs] def clear_zone(self, zone): - """ - Clears a zone if we are emulating a zone expander. - - :param zone: The zone to clear. - :type zone: int - """ - self.send("L{0:02}0\r".format(zone)) -
    - def _wire_events(self): - """ - Wires up the internal device events. - """ - self._device.on_open += self._on_open - self._device.on_close += self._on_close - self._device.on_read += self._on_read - self._device.on_write += self._on_write - self._zonetracker.on_fault += self._on_zone_fault - self._zonetracker.on_restore += self._on_zone_restore - - def _handle_message(self, data): - """ - Parses messages from the panel. - - :param data: Panel data to parse. - :type data: str - - :returns: An object representing the message. - """ - if data is None: - raise InvalidMessageError() - - msg = None - - header = data[0:4] - if header[0] != '!' or header == '!KPE': - msg = Message(data) - - if self.address_mask & msg.mask > 0: - self._update_internal_states(msg) - - elif header == '!EXP' or header == '!REL': - msg = ExpanderMessage(data) - - self._update_internal_states(msg) - - elif header == '!RFX': - msg = self._handle_rfx(data) - - elif header == '!LRR': - msg = self._handle_lrr(data) - - elif data.startswith('!Ready'): - self.on_boot() - - elif data.startswith('!CONFIG'): - self._handle_config(data) - - return msg - - def _handle_rfx(self, data): - msg = RFMessage(data) - - self.on_rfx_message(msg) - - return msg - - def _handle_lrr(self, data): - """ - Handle Long Range Radio messages. - - :param data: LRR message to parse. - :type data: str - - :returns: An object representing the LRR message. - """ - msg = LRRMessage(data) - - if msg.event_type == 'ALARM_PANIC': - self._panic_status = True - self.on_panic(True) - - elif msg.event_type == 'CANCEL': - if self._panic_status == True: - self._panic_status = False - self.on_panic(False) - - self.on_lrr_message(msg) - - return msg - - def _handle_config(self, data): - """ - Handles received configuration data. - - :param data: Configuration string to parse. - :type data: str - """ - _, config_string = data.split('>') - for setting in config_string.split('&'): - k, v = setting.split('=') - - if k == 'ADDRESS': - self.address = int(v) - elif k == 'CONFIGBITS': - self.configbits = int(v, 16) - elif k == 'MASK': - self.address_mask = int(v, 16) - elif k == 'EXP': - for z in range(5): - self.emulate_zone[z] = (v[z] == 'Y') - elif k == 'REL': - for r in range(4): - self.emulate_relay[r] = (v[r] == 'Y') - elif k == 'LRR': - self.emulate_lrr = (v == 'Y') - elif k == 'DEDUPLICATE': - self.deduplicate = (v == 'Y') - - self.on_config_received() - - def _update_internal_states(self, message): - """ - Updates internal device states. - - :param message: Message to update internal states with. - :type message: Message, ExpanderMessage, LRRMessage, or RFMessage - """ - if isinstance(message, Message): - if message.ac_power != self._power_status: - self._power_status, old_status = message.ac_power, self._power_status - - if old_status is not None: - self.on_power_changed(self._power_status) - - if message.alarm_sounding != self._alarm_status: - self._alarm_status, old_status = message.alarm_sounding, self._alarm_status - - if old_status is not None: - self.on_alarm(self._alarm_status) - - if message.zone_bypassed != self._bypass_status: - self._bypass_status, old_status = message.zone_bypassed, self._bypass_status - - if old_status is not None: - self.on_bypass(self._bypass_status) - - if (message.armed_away | message.armed_home) != self._armed_status: - self._armed_status, old_status = message.armed_away | message.armed_home, self._armed_status - - if old_status is not None: - if self._armed_status: - self.on_arm() - else: - self.on_disarm() - - if message.battery_low == self._battery_status[0]: - self._battery_status = (self._battery_status[0], time.time()) - else: - if message.battery_low == True or time.time() > self._battery_status[1] + AD2.BATTERY_TIMEOUT: - self._battery_status = (message.battery_low, time.time()) - self.on_low_battery(self._battery_status) - - if message.fire_alarm == self._fire_status[0]: - self._fire_status = (self._fire_status[0], time.time()) - else: - if message.fire_alarm == True or time.time() > self._fire_status[1] + AD2.FIRE_TIMEOUT: - self._fire_status = (message.fire_alarm, time.time()) - self.on_fire(self._fire_status) - - elif isinstance(message, ExpanderMessage): - if message.type == ExpanderMessage.RELAY: - self._relay_status[(message.address, message.channel)] = message.value - - self.on_relay_changed(message) - - self._update_zone_tracker(message) - - def _update_zone_tracker(self, message): - """ - Trigger an update of the zonetracker. - - :param message: The message to update the zonetracker with. - :type message: Message, ExpanderMessage, LRRMessage, or RFMessage - """ - - # Retrieve a list of faults. - # NOTE: This only happens on first boot or after exiting programming mode. - if isinstance(message, Message): - if not message.ready and "Hit * for faults" in message.text: - self.send('*') - return - - self._zonetracker.update(message) - - def _on_open(self, sender, args): - """ - Internal handler for opening the device. - """ - self.on_open(args) - - def _on_close(self, sender, args): - """ - Internal handler for closing the device. - """ - self.on_close(args) - - def _on_read(self, sender, args): - """ - Internal handler for reading from the device. - """ - self.on_read(args) - - msg = self._handle_message(args) - if msg: - self.on_message(msg) - - def _on_write(self, sender, args): - """ - Internal handler for writing to the device. - """ - self.on_write(args) - - def _on_zone_fault(self, sender, args): - """ - Internal handler for zone faults. - """ - self.on_zone_fault(args) - - def _on_zone_restore(self, sender, args): - """ - Internal handler for zone restoration. - """ - self.on_zone_restore(args)
    -
    - -
    -
    -
    -
    -
    - - -
    -
    -
    -
    - - - - \ No newline at end of file diff --git a/docs/pyad2.event.rst b/docs/_build/html/_sources/alarmdecoder.event.txt similarity index 100% rename from docs/pyad2.event.rst rename to docs/_build/html/_sources/alarmdecoder.event.txt diff --git a/docs/pyad2.rst b/docs/_build/html/_sources/alarmdecoder.txt similarity index 100% rename from docs/pyad2.rst rename to docs/_build/html/_sources/alarmdecoder.txt diff --git a/docs/_build/html/_sources/index.txt b/docs/_build/html/_sources/index.txt index 1acdb0d..41929e0 100644 --- a/docs/_build/html/_sources/index.txt +++ b/docs/_build/html/_sources/index.txt @@ -1,9 +1,9 @@ -.. pyad2 documentation master file, created by +.. alarmdecoder documentation master file, created by sphinx-quickstart on Sat Jun 8 14:38:46 2013. You can adapt this file completely to your liking, but it should at least contain the root `toctree` directive. -Welcome to pyad2's documentation! +Welcome to alarmdecoder's documentation! ==================================== Contents: @@ -11,7 +11,7 @@ Contents: .. toctree:: :maxdepth: 4 - pyad2 + alarmdecoder Indices and tables diff --git a/docs/_build/html/_sources/modules.txt b/docs/_build/html/_sources/modules.txt index 38606cd..9d3ec02 100644 --- a/docs/_build/html/_sources/modules.txt +++ b/docs/_build/html/_sources/modules.txt @@ -1,7 +1,7 @@ -pyad2 -======== +alarmdecoder +============ .. toctree:: :maxdepth: 4 - pyad2 + alarmdecoder diff --git a/docs/_build/html/pyad2.event.html b/docs/_build/html/alarmdecoder.event.html similarity index 54% rename from docs/_build/html/pyad2.event.html rename to docs/_build/html/alarmdecoder.event.html index 20eca0c..d42171e 100644 --- a/docs/_build/html/pyad2.event.html +++ b/docs/_build/html/alarmdecoder.event.html @@ -6,7 +6,7 @@ - event Package — pyad2 documentation + event Package — alarmdecoder documentation @@ -23,9 +23,9 @@ - - - + + + @@ -54,40 +54,40 @@

    event Package

    event Package

    -
    -
    -

    event Module

    +
    +
    +

    event Module

    -
    -class pyad2.event.event.Event(doc=None)[source]
    +
    +class alarmdecoder.event.event.Event(doc=None)[source]

    Bases: object

    -
    -class pyad2.event.event.EventHandler(event, obj)[source]
    +
    +class alarmdecoder.event.event.EventHandler(event, obj)[source]

    Bases: object

    -
    -add(func)[source]
    +
    +add(func)[source]

    Add new event handler function.

    Event handler function must be defined like func(sender, earg). You can add handler also by using ‘+=’ operator.

    -
    -remove(func)[source]
    +
    +remove(func)[source]

    Remove existing event handler function.

    You can remove handler also by using ‘-=’ operator.

    -
    -fire(earg=None)[source]
    +
    +fire(*args, **kwargs)[source]

    Fire event and call all handler functions

    -

    You can call EventHandler object itself like e(earg) instead of -e.fire(earg).

    +

    You can call EventHandler object itself like e(*args, **kwargs) instead of +e.fire(*args, **kwargs).

    @@ -105,17 +105,17 @@ e.fire(earg).

    Previous topic

    -

    pyad2 Package

    +

    alarmdecoder Package

    This Page

    diff --git a/docs/_build/html/alarmdecoder.html b/docs/_build/html/alarmdecoder.html new file mode 100644 index 0000000..6b8a672 --- /dev/null +++ b/docs/_build/html/alarmdecoder.html @@ -0,0 +1,1225 @@ + + + + + + + + alarmdecoder Package — alarmdecoder documentation + + + + + + + + + + + + + + + +
    +
    +
    +
    + +
    +

    alarmdecoder Package

    +
    +

    alarmdecoder Module

    +
    +
    +

    devices Module

    +

    Contains different types of devices belonging to the Alarm Decoder (AD2) family.

    +
    +
    +class alarmdecoder.devices.Device[source]
    +

    Bases: object

    +

    Generic parent device to all Alarm Decoder (AD2) products.

    +
    +
    +on_open
    +

    Called when the device has been opened

    +
    + +
    +
    +on_close
    +

    Called when the device has been closed

    +
    + +
    +
    +on_read
    +

    Called when a line has been read from the device

    +
    + +
    +
    +on_write
    +

    Called when data has been written to the device

    +
    + +
    +
    +id[source]
    +

    Retrieve the device ID.

    + +++ + + + +
    Returns:The identification string for the device.
    +
    + +
    +
    +is_reader_alive()[source]
    +

    Indicates whether or not the reader thread is alive.

    + +++ + + + +
    Returns:Whether or not the reader thread is alive.
    +
    + +
    +
    +stop_reader()[source]
    +

    Stops the reader thread.

    +
    + +
    +
    +close()[source]
    +

    Closes the device.

    +
    + +
    +
    +class ReadThread(device)[source]
    +

    Bases: threading.Thread

    +

    Reader thread which processes messages from the device.

    +
    +
    +READ_TIMEOUT = 10
    +

    Timeout for the reader thread.

    +
    + +
    +
    +stop()[source]
    +

    Stops the running thread.

    +
    + +
    +
    +run()[source]
    +

    The actual read process.

    +
    + +
    + +
    + +
    +
    +class alarmdecoder.devices.USBDevice(interface=0)[source]
    +

    Bases: alarmdecoder.devices.Device

    +

    AD2USB device exposed with PyFTDI’s interface.

    +
    +
    +FTDI_VENDOR_ID = 1027
    +

    Vendor ID used to recognize AD2USB devices.

    +
    + +
    +
    +FTDI_PRODUCT_ID = 24577
    +

    Product ID used to recognize AD2USB devices.

    +
    + +
    +
    +BAUDRATE = 115200
    +

    Default baudrate for AD2USB devices.

    +
    + +
    +
    +classmethod find_all(vid=1027, pid=24577)[source]
    +

    Returns all FTDI devices matching our vendor and product IDs.

    + +++ + + + + + +
    Returns:list of devices
    Raises :CommError
    +
    + +
    +
    +classmethod devices()[source]
    +

    Returns a cached list of AD2USB devices located on the system.

    + +++ + + + +
    Returns:cached list of devices found.
    +
    + +
    +
    +classmethod find(device=None)[source]
    +

    Factory method that returns the requested USBDevice device, or the first device.

    + +++ + + + + + + + +
    Parameters:device (tuple) – Tuple describing the USB device to open, as returned by find_all().
    Returns:USBDevice object utilizing the specified device.
    Raises :NoDeviceError
    +
    + +
    +
    +classmethod start_detection(on_attached=None, on_detached=None)[source]
    +

    Starts the device detection thread.

    + +++ + + + +
    Parameters:
      +
    • on_attached (function) – function to be called when a device is attached.
    • +
    • on_detached (function) – function to be called when a device is detached.
    • +
    +
    +
    + +
    +
    +classmethod stop_detection()[source]
    +

    Stops the device detection thread.

    +
    + +
    +
    +serial_number[source]
    +

    Retrieves the serial number of the device.

    + +++ + + + +
    Returns:The serial number of the device.
    +
    + +
    +
    +description[source]
    +

    Retrieves the description of the device.

    + +++ + + + +
    Returns:The description of the device.
    +
    + +
    +
    +interface[source]
    +

    Retrieves the interface used to connect to the device.

    + +++ + + + +
    Returns:the interface used to connect to the device.
    +
    + +
    +
    +open(baudrate=115200, no_reader_thread=False)[source]
    +

    Opens the device.

    + +++ + + + + + +
    Parameters:
      +
    • baudrate (int) – The baudrate to use.
    • +
    • no_reader_thread (bool) – Whether or not to automatically start the reader thread.
    • +
    +
    Raises :

    NoDeviceError

    +
    +
    + +
    +
    +close()[source]
    +

    Closes the device.

    +
    + +
    +
    +write(data)[source]
    +

    Writes data to the device.

    + +++ + + + + + +
    Parameters:data (str) – Data to write
    Raises :CommError
    +
    + +
    +
    +read()[source]
    +

    Reads a single character from the device.

    + +++ + + + + + +
    Returns:The character read from the device.
    Raises :CommError
    +
    + +
    +
    +read_line(timeout=0.0, purge_buffer=False)[source]
    +

    Reads a line from the device.

    + +++ + + + + + + + +
    Parameters:
      +
    • timeout (float) – Read timeout
    • +
    • purge_buffer (bool) – Indicates whether to purge the buffer prior to reading.
    • +
    +
    Returns:

    The line that was read.

    +
    Raises :

    CommError, TimeoutError

    +
    +
    + +
    +
    +class DetectThread(on_attached=None, on_detached=None)[source]
    +

    Bases: threading.Thread

    +

    Thread that handles detection of added/removed devices.

    +
    +
    +on_attached
    +

    Called when an AD2USB device has been detected.

    +
    + +
    +
    +on_detached
    +

    Called when an AD2USB device has been removed.

    +
    + +
    +
    +stop()[source]
    +

    Stops the thread.

    +
    + +
    +
    +run()[source]
    +

    The actual detection process.

    +
    + +
    + +
    + +
    +
    +class alarmdecoder.devices.SerialDevice(interface=None)[source]
    +

    Bases: alarmdecoder.devices.Device

    +

    AD2USB or AD2SERIAL device exposed with the pyserial interface.

    +
    +
    +BAUDRATE = 19200
    +

    Default baudrate for Serial devices.

    +
    + +
    +
    +static find_all(pattern=None)[source]
    +

    Returns all serial ports present.

    + +++ + + + + + + + +
    Parameters:pattern (str) – Pattern to search for when retrieving serial ports.
    Returns:list of devices
    Raises :CommError
    +
    + +
    +
    +interface[source]
    +

    Retrieves the interface used to connect to the device.

    + +++ + + + +
    Returns:the interface used to connect to the device.
    +
    + +
    +
    +open(baudrate=19200, no_reader_thread=False)[source]
    +

    Opens the device.

    + +++ + + + + + +
    Parameters:
      +
    • baudrate (int) – The baudrate to use with the device.
    • +
    • no_reader_thread (bool) – Whether or not to automatically start the reader thread.
    • +
    +
    Raises :

    NoDeviceError

    +
    +
    + +
    +
    +close()[source]
    +

    Closes the device.

    +
    + +
    +
    +write(data)[source]
    +

    Writes data to the device.

    + +++ + + + + + +
    Parameters:data (str) – The data to write.
    Raises :CommError
    +
    + +
    +
    +read()[source]
    +

    Reads a single character from the device.

    + +++ + + + + + +
    Returns:The character read from the device.
    Raises :CommError
    +
    + +
    +
    +read_line(timeout=0.0, purge_buffer=False)[source]
    +

    Reads a line from the device.

    + +++ + + + + + + + +
    Parameters:
      +
    • timeout (float) – The read timeout.
    • +
    • purge_buffer (bool) – Indicates whether to purge the buffer prior to reading.
    • +
    +
    Returns:

    The line read.

    +
    Raises :

    CommError, TimeoutError

    +
    +
    + +
    + +
    +
    +class alarmdecoder.devices.SocketDevice(interface=('localhost', 10000))[source]
    +

    Bases: alarmdecoder.devices.Device

    +

    Device that supports communication with an Alarm Decoder (AD2) that is +exposed via ser2sock or another Serial to IP interface.

    +
    +
    +interface[source]
    +

    Retrieves the interface used to connect to the device.

    + +++ + + + +
    Returns:the interface used to connect to the device.
    +
    + +
    +
    +ssl[source]
    +

    Retrieves whether or not the device is using SSL.

    + +++ + + + +
    Returns:Whether or not the device is using SSL.
    +
    + +
    +
    +ssl_certificate[source]
    +

    Retrieves the SSL client certificate path used for authentication.

    + +++ + + + +
    Returns:The certificate path
    +
    + +
    +
    +ssl_key[source]
    +

    Retrieves the SSL client certificate key used for authentication.

    + +++ + + + +
    Returns:The key path
    +
    + +
    +
    +ssl_ca[source]
    +

    Retrieves the SSL Certificate Authority certificate used for authentication.

    + +++ + + + +
    Returns:The CA path
    +
    + +
    +
    +open(baudrate=None, no_reader_thread=False)[source]
    +

    Opens the device.

    + +++ + + + + + +
    Parameters:
      +
    • baudrate (int) – The baudrate to use
    • +
    • no_reader_thread (bool) – Whether or not to automatically open the reader thread.
    • +
    +
    Raises :

    NoDeviceError, CommError

    +
    +
    + +
    +
    +close()[source]
    +

    Closes the device.

    +
    + +
    +
    +write(data)[source]
    +

    Writes data to the device.

    + +++ + + + + + + + +
    Parameters:data (str) – The data to write.
    Returns:The number of bytes sent.
    Raises :CommError
    +
    + +
    +
    +read()[source]
    +

    Reads a single character from the device.

    + +++ + + + + + +
    Returns:The character read from the device.
    Raises :CommError
    +
    + +
    +
    +read_line(timeout=0.0, purge_buffer=False)[source]
    +

    Reads a line from the device.

    + +++ + + + + + + + +
    Parameters:
      +
    • timeout (float) – The read timeout.
    • +
    • purge_buffer (bool) – Indicates whether to purge the buffer prior to reading.
    • +
    +
    Returns:

    The line read from the device.

    +
    Raises :

    CommError, TimeoutError

    +
    +
    + +
    + +
    +
    +

    util Module

    +

    Provides utility classes for the Alarm Decoder (AD2) devices.

    +
    +
    +exception alarmdecoder.util.NoDeviceError[source]
    +

    Bases: exceptions.Exception

    +

    No devices found.

    +
    + +
    +
    +exception alarmdecoder.util.CommError[source]
    +

    Bases: exceptions.Exception

    +

    There was an error communicating with the device.

    +
    + +
    +
    +exception alarmdecoder.util.TimeoutError[source]
    +

    Bases: exceptions.Exception

    +

    There was a timeout while trying to communicate with the device.

    +
    + +
    +
    +exception alarmdecoder.util.InvalidMessageError[source]
    +

    Bases: exceptions.Exception

    +

    The format of the panel message was invalid.

    +
    + +
    +
    +class alarmdecoder.util.Firmware[source]
    +

    Bases: object

    +

    Represents firmware for the Alarm Decoder devices.

    +
    +
    +STAGE_START = 0
    +
    + +
    +
    +STAGE_WAITING = 1
    +
    + +
    +
    +STAGE_BOOT = 2
    +
    + +
    +
    +STAGE_LOAD = 3
    +
    + +
    +
    +STAGE_UPLOADING = 4
    +
    + +
    +
    +STAGE_DONE = 5
    +
    + +
    +
    +static upload(dev, filename, progress_callback=None)[source]
    +

    Uploads firmware to an Alarm Decoder device.

    + +++ + + + + + +
    Parameters:
      +
    • filename (str) – The firmware filename
    • +
    • progress_callback (function) – Callback function used to report progress.
    • +
    +
    Raises :

    NoDeviceError, TimeoutError

    +
    +
    + +
    + +
    +
    +

    zonetracking Module

    +

    Provides zone tracking functionality for the Alarm Decoder (AD2) device family.

    +
    +
    +class alarmdecoder.zonetracking.Zone(zone=0, name='', status=0)[source]
    +

    Bases: object

    +

    Representation of a panel zone.

    +
    +
    +CLEAR = 0
    +

    Status indicating that the zone is cleared.

    +
    + +
    +
    +FAULT = 1
    +

    Status indicating that the zone is faulted.

    +
    + +
    +
    +CHECK = 2
    +

    Status indicating that there is a wiring issue with the zone.

    +
    + +
    +
    +STATUS = {0: 'CLEAR', 1: 'FAULT', 2: 'CHECK'}
    +
    + +
    + +
    +
    +class alarmdecoder.zonetracking.Zonetracker[source]
    +

    Bases: object

    +

    Handles tracking of zone and their statuses.

    +
    +
    +on_fault
    +

    Called when the device detects a zone fault.

    +
    + +
    +
    +on_restore
    +

    Called when the device detects that a fault is restored.

    +
    + +
    +
    +EXPIRE = 30
    +

    Zone expiration timeout.

    +
    + +
    +
    +update(message)[source]
    +

    Update zone statuses based on the current message.

    + +++ + + + +
    Parameters:message (Message or ExpanderMessage) – Message to use to update the zone tracking.
    +
    + +
    + +
    +
    +

    panels Module

    +

    Representations of Panels and their templates.

    +
    +
    +

    messages Module

    +

    Message representations received from the panel through the Alarm Decoder (AD2) +devices.

    +
    +
    +class alarmdecoder.messages.BaseMessage[source]
    +

    Bases: object

    +

    Base class for messages.

    +
    +
    +raw = None
    +

    The raw message text

    +
    + +
    + +
    +
    +class alarmdecoder.messages.Message(data=None)[source]
    +

    Bases: alarmdecoder.messages.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

    +
    + +
    + +
    +
    +class alarmdecoder.messages.ExpanderMessage(data=None)[source]
    +

    Bases: alarmdecoder.messages.BaseMessage

    +

    Represents a message from a zone or relay expansion module.

    +
    +
    +ZONE = 0
    +

    Flag indicating that the expander message relates to a Zone Expander.

    +
    + +
    +
    +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

    +
    + +
    + +
    +
    +class alarmdecoder.messages.RFMessage(data=None)[source]
    +

    Bases: alarmdecoder.messages.BaseMessage

    +

    Represents a message from an RF receiver.

    +
    +
    +x = 3
    +
    + +
    +
    +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, False, False, False]
    +

    Loop indicators

    +
    + +
    + +
    +
    +class alarmdecoder.messages.LRRMessage(data=None)[source]
    +

    Bases: alarmdecoder.messages.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

    +
    + +
    + +
    +
    +

    Subpackages

    + +
    +
    + + +
    +
    +
    +
    +
    +

    Table Of Contents

    + + +

    Previous topic

    +

    Welcome to alarmdecoder’s documentation!

    +

    Next topic

    +

    event Package

    +

    This Page

    + + + +
    +
    +
    +
    + + + + \ No newline at end of file diff --git a/docs/_build/html/genindex.html b/docs/_build/html/genindex.html index 8a40aff..111128e 100644 --- a/docs/_build/html/genindex.html +++ b/docs/_build/html/genindex.html @@ -7,7 +7,7 @@ - Index — pyad2 documentation + Index — alarmdecoder documentation @@ -24,7 +24,7 @@ - + @@ -55,7 +55,6 @@ | D | E | F - | G | I | L | M @@ -76,45 +75,61 @@ @@ -124,43 +139,39 @@
    -
    ac_power (pyad2.messages.Message attribute) +
    ac_power (alarmdecoder.messages.Message attribute)
    -
    AD2 (class in pyad2.ad2) +
    add() (alarmdecoder.event.event.EventHandler method)
    -
    AD2Factory (class in pyad2.ad2) +
    address (alarmdecoder.messages.ExpanderMessage attribute)
    -
    AD2Factory.DetectThread (class in pyad2.ad2) +
    alarm_event_occurred (alarmdecoder.messages.Message attribute)
    -
    add() (pyad2.event.event.EventHandler method) +
    alarm_sounding (alarmdecoder.messages.Message attribute) +
    + + +
    alarmdecoder.devices (module) +
    + + +
    alarmdecoder.event (module)
    -
    address (pyad2.messages.ExpanderMessage attribute) +
    alarmdecoder.event.event (module) +
    + + +
    alarmdecoder.messages (module) +
    + + +
    alarmdecoder.panels (module)
    -
    alarm_event_occurred (pyad2.messages.Message attribute) +
    alarmdecoder.util (module)
    -
    alarm_sounding (pyad2.messages.Message attribute) +
    alarmdecoder.zonetracking (module)
    -
    armed_away (pyad2.messages.Message attribute) +
    armed_away (alarmdecoder.messages.Message attribute)
    -
    armed_home (pyad2.messages.Message attribute) +
    armed_home (alarmdecoder.messages.Message attribute)
    @@ -170,67 +181,51 @@
    -
    backlight_on (pyad2.messages.Message attribute) +
    backlight_on (alarmdecoder.messages.Message attribute)
    -
    BaseMessage (class in pyad2.messages) +
    BaseMessage (class in alarmdecoder.messages)
    -
    battery (pyad2.messages.RFMessage attribute) +
    battery (alarmdecoder.messages.RFMessage attribute)
    -
    battery_low (pyad2.messages.Message attribute) +
    battery_low (alarmdecoder.messages.Message attribute)
    -
    BATTERY_TIMEOUT (pyad2.ad2.AD2 attribute) -
    - - -
    BAUDRATE (pyad2.devices.SerialDevice attribute) +
    BAUDRATE (alarmdecoder.devices.SerialDevice attribute)
    -
    (pyad2.devices.USBDevice attribute) +
    (alarmdecoder.devices.USBDevice attribute)
    -
    beeps (pyad2.messages.Message attribute) +
    beeps (alarmdecoder.messages.Message attribute)
    -
    bitfield (pyad2.messages.Message attribute) +
    bitfield (alarmdecoder.messages.Message attribute)
    @@ -240,21 +235,21 @@
    -
    channel (pyad2.messages.ExpanderMessage attribute) -
    - - -
    CHECK (pyad2.zonetracking.Zone attribute) +
    channel (alarmdecoder.messages.ExpanderMessage attribute)
    -
    check_zone (pyad2.messages.Message attribute) +
    CHECK (alarmdecoder.zonetracking.Zone attribute)
    -
    chime_on (pyad2.messages.Message attribute) +
    check_zone (alarmdecoder.messages.Message attribute)
    -
    CLEAR (pyad2.zonetracking.Zone attribute) +
    chime_on (alarmdecoder.messages.Message attribute)
    -
    clear_zone() (pyad2.ad2.AD2 method) +
    CLEAR (alarmdecoder.zonetracking.Zone attribute)
    -
    close() (pyad2.ad2.AD2 method) +
    close() (alarmdecoder.devices.Device method)
    -
    (pyad2.ad2.AD2Factory method) -
    - - -
    (pyad2.devices.Device method) -
    - - -
    (pyad2.devices.SerialDevice method) +
    (alarmdecoder.devices.SerialDevice method)
    -
    (pyad2.devices.SocketDevice method) +
    (alarmdecoder.devices.SocketDevice method)
    -
    (pyad2.devices.USBDevice method) +
    (alarmdecoder.devices.USBDevice method)
    -
    CommError -
    - - -
    create() (pyad2.ad2.AD2Factory class method) +
    CommError
    -
    cursor_location (pyad2.messages.Message attribute) +
    cursor_location (alarmdecoder.messages.Message attribute)
    @@ -264,33 +259,33 @@
    -
    description (pyad2.devices.USBDevice attribute) +
    description (alarmdecoder.devices.USBDevice attribute)
    -
    Device (class in pyad2.devices) +
    Device (class in alarmdecoder.devices)
    -
    Device.ReadThread (class in pyad2.devices) +
    Device.ReadThread (class in alarmdecoder.devices)
    -
    devices() (pyad2.ad2.AD2Factory class method) +
    devices() (alarmdecoder.devices.USBDevice class method)
    @@ -300,83 +295,43 @@
    -
    entry_delay_off (pyad2.messages.Message attribute) +
    entry_delay_off (alarmdecoder.messages.Message attribute)
    -
    Event (class in pyad2.event.event) +
    Event (class in alarmdecoder.event.event)
    -
    event_data (pyad2.messages.LRRMessage attribute) +
    event_data (alarmdecoder.messages.LRRMessage attribute)
    -
    event_type (pyad2.messages.LRRMessage attribute) +
    event_type (alarmdecoder.messages.LRRMessage attribute)
    -
    EventHandler (class in pyad2.event.event) +
    EventHandler (class in alarmdecoder.event.event)
    -
    ExpanderMessage (class in pyad2.messages) +
    ExpanderMessage (class in alarmdecoder.messages)
    -
    EXPIRE (pyad2.zonetracking.Zonetracker attribute) +
    EXPIRE (alarmdecoder.zonetracking.Zonetracker attribute)
    - + -
    -
    F1 (pyad2.ad2.AD2 attribute) -
    - - -
    F2 (pyad2.ad2.AD2 attribute) -
    - - -
    F3 (pyad2.ad2.AD2 attribute) +
    FAULT (alarmdecoder.zonetracking.Zone attribute)
    -
    F4 (pyad2.ad2.AD2 attribute) +
    find() (alarmdecoder.devices.USBDevice class method)
    -
    FAULT (pyad2.zonetracking.Zone attribute) -
    - - -
    fault_zone() (pyad2.ad2.AD2 method) -
    - - -
    find_all() (pyad2.ad2.AD2Factory class method) +
    find_all() (alarmdecoder.devices.SerialDevice static method)
    -
    (pyad2.devices.SerialDevice static method) -
    - - -
    (pyad2.devices.USBDevice static method) +
    (alarmdecoder.devices.USBDevice class method)
    -
    -
    fire() (pyad2.event.event.EventHandler method) -
    - - -
    fire_alarm (pyad2.messages.Message attribute) +
    fire() (alarmdecoder.event.event.EventHandler method)
    +
    -
    FIRE_TIMEOUT (pyad2.ad2.AD2 attribute) +
    fire_alarm (alarmdecoder.messages.Message attribute)
    -
    Firmware (class in pyad2.util) +
    Firmware (class in alarmdecoder.util)
    -
    FTDI_PRODUCT_ID (pyad2.devices.USBDevice attribute) +
    FTDI_PRODUCT_ID (alarmdecoder.devices.USBDevice attribute)
    -
    FTDI_VENDOR_ID (pyad2.devices.USBDevice attribute) -
    - -
    - -

    G

    - - - @@ -386,37 +341,31 @@
    - -
    get_config() (pyad2.ad2.AD2 method) -
    - -
    - -
    get_device() (pyad2.ad2.AD2Factory method) +
    FTDI_VENDOR_ID (alarmdecoder.devices.USBDevice attribute)
    @@ -426,13 +375,13 @@
    -
    id (pyad2.ad2.AD2 attribute) +
    id (alarmdecoder.devices.Device attribute)
    -
    - -
    (pyad2.devices.Device attribute) -
    - -
    -
    interface (pyad2.devices.SerialDevice attribute) +
    interface (alarmdecoder.devices.SerialDevice attribute)
    -
    (pyad2.devices.SocketDevice attribute) +
    (alarmdecoder.devices.SocketDevice attribute)
    -
    (pyad2.devices.USBDevice attribute) +
    (alarmdecoder.devices.USBDevice attribute)
    -
    InvalidMessageError +
    InvalidMessageError
    -
    is_reader_alive() (pyad2.devices.Device method) +
    is_reader_alive() (alarmdecoder.devices.Device method)
    @@ -442,13 +391,13 @@
    -
    loop (pyad2.messages.RFMessage attribute) +
    loop (alarmdecoder.messages.RFMessage attribute)
    -
    LRRMessage (class in pyad2.messages) +
    LRRMessage (class in alarmdecoder.messages)
    @@ -458,13 +407,13 @@
    -
    mask (pyad2.messages.Message attribute) +
    mask (alarmdecoder.messages.Message attribute)
    -
    Message (class in pyad2.messages) +
    Message (class in alarmdecoder.messages)
    @@ -474,142 +423,50 @@
    -
    NoDeviceError +
    NoDeviceError
    -
    numeric_code (pyad2.messages.Message attribute) +
    numeric_code (alarmdecoder.messages.Message attribute)
    -
    on_alarm (pyad2.ad2.AD2 attribute) -
    - - -
    on_arm (pyad2.ad2.AD2 attribute) -
    - - -
    on_attached (pyad2.ad2.AD2Factory attribute) -
    - - -
    on_boot (pyad2.ad2.AD2 attribute) -
    - - -
    on_bypass (pyad2.ad2.AD2 attribute) -
    - - -
    on_close (pyad2.ad2.AD2 attribute) -
    - -
    - -
    (pyad2.devices.Device attribute) -
    - -
    - -
    on_config_received (pyad2.ad2.AD2 attribute) -
    - - -
    on_detached (pyad2.ad2.AD2Factory attribute) -
    - - -
    on_disarm (pyad2.ad2.AD2 attribute) +
    on_attached (alarmdecoder.devices.USBDevice.DetectThread attribute)
    -
    on_fault (pyad2.zonetracking.Zonetracker attribute) +
    on_close (alarmdecoder.devices.Device attribute)
    -
    on_fire (pyad2.ad2.AD2 attribute) +
    on_detached (alarmdecoder.devices.USBDevice.DetectThread attribute)
    -
    on_low_battery (pyad2.ad2.AD2 attribute) +
    on_fault (alarmdecoder.zonetracking.Zonetracker attribute)
    -
    on_lrr_message (pyad2.ad2.AD2 attribute) +
    on_open (alarmdecoder.devices.Device attribute)
    -
    on_message (pyad2.ad2.AD2 attribute) +
    on_read (alarmdecoder.devices.Device attribute)
    -
    on_open (pyad2.ad2.AD2 attribute) -
    - -
    - -
    (pyad2.devices.Device attribute) +
    on_restore (alarmdecoder.zonetracking.Zonetracker attribute)
    -
    -
    on_panic (pyad2.ad2.AD2 attribute) +
    on_write (alarmdecoder.devices.Device attribute)
    -
    on_power_changed (pyad2.ad2.AD2 attribute) -
    - - -
    on_read (pyad2.ad2.AD2 attribute) +
    open() (alarmdecoder.devices.SerialDevice method)
    -
    (pyad2.devices.Device attribute) -
    - -
    - -
    on_relay_changed (pyad2.ad2.AD2 attribute) -
    - - -
    on_restore (pyad2.zonetracking.Zonetracker attribute) -
    - - -
    on_rfx_message (pyad2.ad2.AD2 attribute) +
    (alarmdecoder.devices.SocketDevice method)
    - -
    on_write (pyad2.ad2.AD2 attribute) -
    - -
    -
    (pyad2.devices.Device attribute) -
    - -
    - -
    on_zone_fault (pyad2.ad2.AD2 attribute) -
    - - -
    on_zone_restore (pyad2.ad2.AD2 attribute) -
    - - -
    open() (pyad2.ad2.AD2 method) -
    - -
    - -
    (pyad2.devices.SerialDevice method) -
    - - -
    (pyad2.devices.SocketDevice method) -
    - - -
    (pyad2.devices.USBDevice method) +
    (alarmdecoder.devices.USBDevice method)
    @@ -620,53 +477,21 @@ @@ -676,70 +501,66 @@
    -
    panel_data (pyad2.messages.Message attribute) -
    - - -
    partition (pyad2.messages.LRRMessage attribute) -
    - - -
    perimeter_only (pyad2.messages.Message attribute) -
    - - -
    programming_mode (pyad2.messages.Message attribute) +
    panel_data (alarmdecoder.messages.Message attribute)
    -
    pyad2.ad2 (module) -
    - - -
    pyad2.devices (module) +
    partition (alarmdecoder.messages.LRRMessage attribute)
    -
    pyad2.event (module) -
    - - -
    pyad2.event.event (module) +
    perimeter_only (alarmdecoder.messages.Message attribute)
    -
    pyad2.messages (module) -
    - - -
    pyad2.panels (module) -
    - - -
    pyad2.util (module) -
    - - -
    pyad2.zonetracking (module) +
    programming_mode (alarmdecoder.messages.Message attribute)
    -
    raw (pyad2.messages.BaseMessage attribute) +
    raw (alarmdecoder.messages.BaseMessage attribute)
    -
    read() (pyad2.devices.SerialDevice method) +
    read() (alarmdecoder.devices.SerialDevice method)
    -
    (pyad2.devices.SocketDevice method) +
    (alarmdecoder.devices.SocketDevice method)
    -
    (pyad2.devices.USBDevice method) +
    (alarmdecoder.devices.USBDevice method)
    -
    read_line() (pyad2.devices.SerialDevice method) +
    read_line() (alarmdecoder.devices.SerialDevice method)
    -
    (pyad2.devices.SocketDevice method) +
    (alarmdecoder.devices.SocketDevice method)
    -
    (pyad2.devices.USBDevice method) +
    (alarmdecoder.devices.USBDevice method)
    -
    READ_TIMEOUT (pyad2.devices.Device.ReadThread attribute) +
    READ_TIMEOUT (alarmdecoder.devices.Device.ReadThread attribute)
    -
    ready (pyad2.messages.Message attribute) +
    ready (alarmdecoder.messages.Message attribute)
    -
    reboot() (pyad2.ad2.AD2 method) -
    - - -
    RELAY (pyad2.messages.ExpanderMessage attribute) +
    RELAY (alarmdecoder.messages.ExpanderMessage attribute)
    -
    remove() (pyad2.event.event.EventHandler method) +
    remove() (alarmdecoder.event.event.EventHandler method)
    -
    RFMessage (class in pyad2.messages) +
    RFMessage (class in alarmdecoder.messages)
    -
    run() (pyad2.ad2.AD2Factory.DetectThread method) +
    run() (alarmdecoder.devices.Device.ReadThread method)
    -
    (pyad2.devices.Device.ReadThread method) +
    (alarmdecoder.devices.USBDevice.DetectThread method)
    @@ -750,101 +571,93 @@ - + @@ -854,17 +667,17 @@
    -
    save_config() (pyad2.ad2.AD2 method) -
    - - -
    send() (pyad2.ad2.AD2 method) -
    - - -
    serial_number (pyad2.devices.USBDevice attribute) +
    serial_number (alarmdecoder.devices.USBDevice attribute)
    -
    (pyad2.messages.RFMessage attribute) +
    (alarmdecoder.messages.RFMessage attribute)
    -
    SerialDevice (class in pyad2.devices) +
    SerialDevice (class in alarmdecoder.devices)
    -
    SocketDevice (class in pyad2.devices) +
    SocketDevice (class in alarmdecoder.devices)
    -
    ssl (pyad2.devices.SocketDevice attribute) +
    ssl (alarmdecoder.devices.SocketDevice attribute)
    -
    ssl_ca (pyad2.devices.SocketDevice attribute) +
    ssl_ca (alarmdecoder.devices.SocketDevice attribute)
    -
    ssl_certificate (pyad2.devices.SocketDevice attribute) +
    ssl_certificate (alarmdecoder.devices.SocketDevice attribute)
    -
    ssl_key (pyad2.devices.SocketDevice attribute) +
    ssl_key (alarmdecoder.devices.SocketDevice attribute)
    -
    STAGE_BOOT (pyad2.util.Firmware attribute) +
    STAGE_BOOT (alarmdecoder.util.Firmware attribute)
    -
    -
    STAGE_DONE (pyad2.util.Firmware attribute) +
    STAGE_DONE (alarmdecoder.util.Firmware attribute)
    -
    STAGE_LOAD (pyad2.util.Firmware attribute) +
    STAGE_LOAD (alarmdecoder.util.Firmware attribute)
    +
    -
    STAGE_START (pyad2.util.Firmware attribute) +
    STAGE_START (alarmdecoder.util.Firmware attribute)
    -
    STAGE_UPLOADING (pyad2.util.Firmware attribute) +
    STAGE_UPLOADING (alarmdecoder.util.Firmware attribute)
    -
    STAGE_WAITING (pyad2.util.Firmware attribute) +
    STAGE_WAITING (alarmdecoder.util.Firmware attribute)
    -
    start() (pyad2.ad2.AD2Factory method) +
    start_detection() (alarmdecoder.devices.USBDevice class method)
    -
    STATUS (pyad2.zonetracking.Zone attribute) +
    STATUS (alarmdecoder.zonetracking.Zone attribute)
    -
    stop() (pyad2.ad2.AD2Factory method) +
    stop() (alarmdecoder.devices.Device.ReadThread method)
    -
    (pyad2.ad2.AD2Factory.DetectThread method) +
    (alarmdecoder.devices.USBDevice.DetectThread method)
    - -
    (pyad2.devices.Device.ReadThread method) +
    + +
    stop_detection() (alarmdecoder.devices.USBDevice class method)
    -
    -
    stop_reader() (pyad2.devices.Device method) +
    stop_reader() (alarmdecoder.devices.Device method)
    -
    supervision (pyad2.messages.RFMessage attribute) +
    supervision (alarmdecoder.messages.RFMessage attribute)
    @@ -874,17 +687,21 @@
    -
    text (pyad2.messages.Message attribute) +
    text (alarmdecoder.messages.Message attribute)
    -
    TimeoutError +
    TimeoutError
    -
    type (pyad2.messages.ExpanderMessage attribute) +
    type (alarmdecoder.messages.ExpanderMessage attribute)
    @@ -894,12 +711,12 @@
    -
    update() (pyad2.zonetracking.Zonetracker method) +
    update() (alarmdecoder.zonetracking.Zonetracker method)
    -
    upload() (pyad2.util.Firmware static method) +
    upload() (alarmdecoder.util.Firmware static method)
    -
    USBDevice (class in pyad2.devices) +
    USBDevice (class in alarmdecoder.devices) +
    + + +
    USBDevice.DetectThread (class in alarmdecoder.devices)
    -
    value (pyad2.messages.ExpanderMessage attribute) +
    value (alarmdecoder.messages.ExpanderMessage attribute)
    -
    (pyad2.messages.RFMessage attribute) +
    (alarmdecoder.messages.RFMessage attribute)
    @@ -910,16 +727,16 @@
    -
    write() (pyad2.devices.SerialDevice method) +
    write() (alarmdecoder.devices.SerialDevice method)
    -
    (pyad2.devices.SocketDevice method) +
    (alarmdecoder.devices.SocketDevice method)
    -
    (pyad2.devices.USBDevice method) +
    (alarmdecoder.devices.USBDevice method)
    @@ -930,7 +747,7 @@ @@ -940,21 +757,21 @@
    -
    x (pyad2.messages.RFMessage attribute) +
    x (alarmdecoder.messages.RFMessage attribute)
    @@ -996,11 +813,11 @@
  • modules |
  • -
  • pyad2 documentation »
  • +
  • alarmdecoder documentation »
  • diff --git a/docs/_build/html/index.html b/docs/_build/html/index.html index 36fe407..2caf0e4 100644 --- a/docs/_build/html/index.html +++ b/docs/_build/html/index.html @@ -6,7 +6,7 @@ - Welcome to pyad2’s documentation! — pyad2 documentation + Welcome to alarmdecoder’s documentation! — alarmdecoder documentation @@ -23,8 +23,8 @@ - - + + @@ -48,22 +48,22 @@
    -
    -

    Welcome to pyad2’s documentation!

    +
    +

    Welcome to alarmdecoder’s documentation!

    Contents:

    @@ -44,21 +44,21 @@
    -
    -

    pyad2

    +
    +

    alarmdecoder

    diff --git a/docs/_build/html/objects.inv b/docs/_build/html/objects.inv index 9dcc5a5..1293b30 100644 Binary files a/docs/_build/html/objects.inv and b/docs/_build/html/objects.inv differ diff --git a/docs/_build/html/py-modindex.html b/docs/_build/html/py-modindex.html index a6b84f3..6064500 100644 --- a/docs/_build/html/py-modindex.html +++ b/docs/_build/html/py-modindex.html @@ -6,7 +6,7 @@ - Python Module Index — pyad2 documentation + Python Module Index — alarmdecoder documentation @@ -23,7 +23,7 @@ - + @@ -38,7 +38,7 @@
  • modules |
  • -
  • pyad2 documentation »
  • +
  • alarmdecoder documentation »
  • @@ -51,58 +51,53 @@

    Python Module Index

    - p + a
    -
    Zone (class in pyad2.zonetracking) +
    ZONE (alarmdecoder.messages.ExpanderMessage attribute)
    -
    ZONE (pyad2.messages.ExpanderMessage attribute) +
    Zone (class in alarmdecoder.zonetracking)
    -
    zone_bypassed (pyad2.messages.Message attribute) +
    zone_bypassed (alarmdecoder.messages.Message attribute)
    -
    Zonetracker (class in pyad2.zonetracking) +
    Zonetracker (class in alarmdecoder.zonetracking)
    - + - - -
     
    - p
    + a
    - pyad2 + alarmdecoder
        - pyad2.ad2 + alarmdecoder.devices
        - pyad2.devices + alarmdecoder.event
        - pyad2.event + alarmdecoder.event.event
        - pyad2.event.event + alarmdecoder.messages
        - pyad2.messages + alarmdecoder.panels
        - pyad2.panels + alarmdecoder.util
        - pyad2.util -
        - pyad2.zonetracking + alarmdecoder.zonetracking
    @@ -138,11 +133,11 @@
  • modules |
  • -
  • pyad2 documentation »
  • +
  • alarmdecoder documentation »
  • diff --git a/docs/_build/html/pyad2.html b/docs/_build/html/pyad2.html deleted file mode 100644 index d10174d..0000000 --- a/docs/_build/html/pyad2.html +++ /dev/null @@ -1,1521 +0,0 @@ - - - - - - - - pyad2 Package — pyad2 documentation - - - - - - - - - - - - - - - -
    -
    -
    -
    - -
    -

    pyad2 Package

    -
    -

    ad2 Module

    -

    Provides the full AD2 class and factory.

    -
    -
    -class pyad2.ad2.AD2Factory(attached_event=None, detached_event=None)[source]
    -

    Bases: object

    -

    Factory for creation of AD2USB devices as well as provides attach/detach events.”

    -
    -
    -on_attached
    -

    Called when an AD2USB device has been detected.

    -
    - -
    -
    -on_detached
    -

    Called when an AD2USB device has been removed.

    -
    - -
    -
    -classmethod find_all()[source]
    -

    Returns all AD2USB devices located on the system.

    - --- - - - - - -
    Returns:list of devices found
    Raises :CommError
    -
    - -
    -
    -classmethod devices()[source]
    -

    Returns a cached list of AD2USB devices located on the system.

    - --- - - - -
    Returns:cached list of devices found.
    -
    - -
    -
    -classmethod create(device=None)[source]
    -

    Factory method that returns the requested AD2USB device, or the first device.

    - --- - - - - - - - -
    Parameters:device (tuple) – Tuple describing the USB device to open, as returned by find_all().
    Returns:AD2USB object utilizing the specified device.
    Raises :NoDeviceError
    -
    - -
    -
    -close()[source]
    -

    Clean up and shut down.

    -
    - -
    -
    -start()[source]
    -

    Starts the detection thread, if not already running.

    -
    - -
    -
    -stop()[source]
    -

    Stops the detection thread.

    -
    - -
    -
    -get_device(device=None)[source]
    -

    Factory method that returns the requested AD2USB device, or the first device.

    - --- - - - -
    Parameters:device (tuple) – Tuple describing the USB device to open, as returned by find_all().
    -
    - -
    -
    -class DetectThread(factory)[source]
    -

    Bases: threading.Thread

    -

    Thread that handles detection of added/removed devices.

    -
    -
    -stop()[source]
    -

    Stops the thread.

    -
    - -
    -
    -run()[source]
    -

    The actual detection process.

    -
    - -
    - -
    - -
    -
    -class pyad2.ad2.AD2(device)[source]
    -

    Bases: object

    -

    High-level wrapper around AD2 devices.

    -
    -
    -on_arm
    -

    Called when the panel is armed.

    -
    - -
    -
    -on_disarm
    -

    Called when the panel is disarmed.

    -
    - -
    -
    -on_power_changed
    -

    Called when panel power switches between AC and DC.

    -
    - -
    -
    -on_alarm
    -

    Called when the alarm is triggered.

    -
    - -
    -
    -on_fire
    -

    Called when a fire is detected.

    -
    - -
    -
    -on_bypass
    -

    Called when a zone is bypassed.

    -
    - -
    -
    -on_boot
    -

    Called when the device finishes bootings.

    -
    - -
    -
    -on_config_received
    -

    Called when the device receives its configuration.

    -
    - -
    -
    -on_zone_fault
    -

    Called when the device detects a zone fault.

    -
    - -
    -
    -on_zone_restore
    -

    Called when the device detects that a fault is restored.

    -
    - -
    -
    -on_low_battery
    -

    Called when the device detects a low battery.

    -
    - -
    -
    -on_panic
    -

    Called when the device detects a panic.

    -
    - -
    -
    -on_relay_changed
    -

    Called when a relay is opened or closed on an expander board.

    -
    - -
    -
    -on_message
    -

    Called when a message has been received from the device.

    -
    - -
    -
    -on_lrr_message
    -

    Called when an LRR message is received.

    -
    - -
    -
    -on_rfx_message
    -

    Called when an RFX message is received.

    -
    - -
    -
    -on_open
    -

    Called when the device has been opened.

    -
    - -
    -
    -on_close
    -

    Called when the device has been closed.

    -
    - -
    -
    -on_read
    -

    Called when a line has been read from the device.

    -
    - -
    -
    -on_write
    -

    Called when data has been written to the device.

    -
    - -
    -
    -F1 = u'\x01\x01\x01'
    -

    Represents panel function key #1

    -
    - -
    -
    -F2 = u'\x02\x02\x02'
    -

    Represents panel function key #2

    -
    - -
    -
    -F3 = u'\x03\x03\x03'
    -

    Represents panel function key #3

    -
    - -
    -
    -F4 = u'\x04\x04\x04'
    -

    Represents panel function key #4

    -
    - -
    -
    -BATTERY_TIMEOUT = 30
    -

    Timeout before the battery status reverts.

    -
    - -
    -
    -FIRE_TIMEOUT = 30
    -

    Timeout before the fire status reverts.

    -
    - -
    -
    -id[source]
    -

    The ID of the AD2 device.

    - --- - - - -
    Returns:The identification string for the device.
    -
    - -
    -
    -open(baudrate=None, no_reader_thread=False)[source]
    -

    Opens the device.

    - --- - - - -
    Parameters:
      -
    • baudrate (int) – The baudrate used for the device.
    • -
    • no_reader_thread (bool) – Specifies whether or not the automatic reader thread should be started or not
    • -
    -
    -
    - -
    -
    -close()[source]
    -

    Closes the device.

    -
    - -
    -
    -send(data)[source]
    -

    Sends data to the AD2 device.

    - --- - - - -
    Parameters:data (str) – The data to send.
    -
    - -
    -
    -get_config()[source]
    -

    Retrieves the configuration from the device.

    -
    - -
    -
    -save_config()[source]
    -

    Sets configuration entries on the device.

    -
    - -
    -
    -reboot()[source]
    -

    Reboots the device.

    -
    - -
    -
    -fault_zone(zone, simulate_wire_problem=False)[source]
    -

    Faults a zone if we are emulating a zone expander.

    - --- - - - -
    Parameters:
      -
    • zone (int) – The zone to fault.
    • -
    • simulate_wire_problem (bool) – Whether or not to simulate a wire fault.
    • -
    -
    -
    - -
    -
    -clear_zone(zone)[source]
    -

    Clears a zone if we are emulating a zone expander.

    - --- - - - -
    Parameters:zone (int) – The zone to clear.
    -
    - -
    - -
    -
    -

    devices Module

    -

    Contains different types of devices belonging to the AD2 family.

    -
    -
    -class pyad2.devices.Device[source]
    -

    Bases: object

    -

    Generic parent device to all AD2 products.

    -
    -
    -on_open
    -

    Called when the device has been opened

    -
    - -
    -
    -on_close
    -

    Called when the device has been closed

    -
    - -
    -
    -on_read
    -

    Called when a line has been read from the device

    -
    - -
    -
    -on_write
    -

    Called when data has been written to the device

    -
    - -
    -
    -id[source]
    -

    Retrieve the device ID.

    - --- - - - -
    Returns:The identification string for the device.
    -
    - -
    -
    -is_reader_alive()[source]
    -

    Indicates whether or not the reader thread is alive.

    - --- - - - -
    Returns:Whether or not the reader thread is alive.
    -
    - -
    -
    -stop_reader()[source]
    -

    Stops the reader thread.

    -
    - -
    -
    -close()[source]
    -

    Closes the device.

    -
    - -
    -
    -class ReadThread(device)[source]
    -

    Bases: threading.Thread

    -

    Reader thread which processes messages from the device.

    -
    -
    -READ_TIMEOUT = 10
    -

    Timeout for the reader thread.

    -
    - -
    -
    -stop()[source]
    -

    Stops the running thread.

    -
    - -
    -
    -run()[source]
    -

    The actual read process.

    -
    - -
    - -
    - -
    -
    -class pyad2.devices.USBDevice(interface=(None, 0))[source]
    -

    Bases: pyad2.devices.Device

    -

    AD2USB device exposed with PyFTDI’s interface.

    -
    -
    -FTDI_VENDOR_ID = 1027
    -

    Vendor ID used to recognize AD2USB devices.

    -
    - -
    -
    -FTDI_PRODUCT_ID = 24577
    -

    Product ID used to recognize AD2USB devices.

    -
    - -
    -
    -BAUDRATE = 115200
    -

    Default baudrate for AD2USB devices.

    -
    - -
    -
    -static find_all()[source]
    -

    Returns all FTDI devices matching our vendor and product IDs.

    - --- - - - - - -
    Returns:list of devices
    Raises :CommError
    -
    - -
    -
    -interface[source]
    -

    Retrieves the interface used to connect to the device.

    - --- - - - -
    Returns:the interface used to connect to the device.
    -
    - -
    -
    -serial_number[source]
    -

    Retrieves the serial number of the device.

    - --- - - - -
    Returns:The serial number of the device.
    -
    - -
    -
    -description[source]
    -

    Retrieves the description of the device.

    - --- - - - -
    Returns:The description of the device.
    -
    - -
    -
    -open(baudrate=115200, no_reader_thread=False)[source]
    -

    Opens the device.

    - --- - - - - - -
    Parameters:
      -
    • baudrate (int) – The baudrate to use.
    • -
    • no_reader_thread (bool) – Whether or not to automatically start the reader thread.
    • -
    -
    Raises :

    NoDeviceError

    -
    -
    - -
    -
    -close()[source]
    -

    Closes the device.

    -
    - -
    -
    -write(data)[source]
    -

    Writes data to the device.

    - --- - - - - - -
    Parameters:data (str) – Data to write
    Raises :CommError
    -
    - -
    -
    -read()[source]
    -

    Reads a single character from the device.

    - --- - - - - - -
    Returns:The character read from the device.
    Raises :CommError
    -
    - -
    -
    -read_line(timeout=0.0, purge_buffer=False)[source]
    -

    Reads a line from the device.

    - --- - - - - - - - -
    Parameters:
      -
    • timeout (float) – Read timeout
    • -
    • purge_buffer (bool) – Indicates whether to purge the buffer prior to reading.
    • -
    -
    Returns:

    The line that was read.

    -
    Raises :

    CommError, TimeoutError

    -
    -
    - -
    - -
    -
    -class pyad2.devices.SerialDevice(interface=None)[source]
    -

    Bases: pyad2.devices.Device

    -

    AD2USB or AD2SERIAL device exposed with the pyserial interface.

    -
    -
    -BAUDRATE = 19200
    -

    Default baudrate for Serial devices.

    -
    - -
    -
    -static find_all(pattern=None)[source]
    -

    Returns all serial ports present.

    - --- - - - - - - - -
    Parameters:pattern (str) – Pattern to search for when retrieving serial ports.
    Returns:list of devices
    Raises :CommError
    -
    - -
    -
    -interface[source]
    -

    Retrieves the interface used to connect to the device.

    - --- - - - -
    Returns:the interface used to connect to the device.
    -
    - -
    -
    -open(baudrate=19200, no_reader_thread=False)[source]
    -

    Opens the device.

    - --- - - - - - -
    Parameters:
      -
    • baudrate (int) – The baudrate to use with the device.
    • -
    • no_reader_thread (bool) – Whether or not to automatically start the reader thread.
    • -
    -
    Raises :

    NoDeviceError

    -
    -
    - -
    -
    -close()[source]
    -

    Closes the device.

    -
    - -
    -
    -write(data)[source]
    -

    Writes data to the device.

    - --- - - - - - -
    Parameters:data (str) – The data to write.
    Raises :CommError
    -
    - -
    -
    -read()[source]
    -

    Reads a single character from the device.

    - --- - - - - - -
    Returns:The character read from the device.
    Raises :CommError
    -
    - -
    -
    -read_line(timeout=0.0, purge_buffer=False)[source]
    -

    Reads a line from the device.

    - --- - - - - - - - -
    Parameters:
      -
    • timeout (float) – The read timeout.
    • -
    • purge_buffer (bool) – Indicates whether to purge the buffer prior to reading.
    • -
    -
    Returns:

    The line read.

    -
    Raises :

    CommError, TimeoutError

    -
    -
    - -
    - -
    -
    -class pyad2.devices.SocketDevice(interface=('localhost', 10000))[source]
    -

    Bases: pyad2.devices.Device

    -

    Device that supports communication with an AD2 that is exposed via ser2sock or another -Serial to IP interface.

    -
    -
    -interface[source]
    -

    Retrieves the interface used to connect to the device.

    - --- - - - -
    Returns:the interface used to connect to the device.
    -
    - -
    -
    -ssl[source]
    -

    Retrieves whether or not the device is using SSL.

    - --- - - - -
    Returns:Whether or not the device is using SSL.
    -
    - -
    -
    -ssl_certificate[source]
    -

    Retrieves the SSL client certificate path used for authentication.

    - --- - - - -
    Returns:The certificate path
    -
    - -
    -
    -ssl_key[source]
    -

    Retrieves the SSL client certificate key used for authentication.

    - --- - - - -
    Returns:The key path
    -
    - -
    -
    -ssl_ca[source]
    -

    Retrieves the SSL Certificate Authority certificate used for authentication.

    - --- - - - -
    Returns:The CA path
    -
    - -
    -
    -open(baudrate=None, no_reader_thread=False)[source]
    -

    Opens the device.

    - --- - - - - - -
    Parameters:
      -
    • baudrate (int) – The baudrate to use
    • -
    • no_reader_thread (bool) – Whether or not to automatically open the reader thread.
    • -
    -
    Raises :

    NoDeviceError, CommError

    -
    -
    - -
    -
    -close()[source]
    -

    Closes the device.

    -
    - -
    -
    -write(data)[source]
    -

    Writes data to the device.

    - --- - - - - - - - -
    Parameters:data (str) – The data to write.
    Returns:The number of bytes sent.
    Raises :CommError
    -
    - -
    -
    -read()[source]
    -

    Reads a single character from the device.

    - --- - - - - - -
    Returns:The character read from the device.
    Raises :CommError
    -
    - -
    -
    -read_line(timeout=0.0, purge_buffer=False)[source]
    -

    Reads a line from the device.

    - --- - - - - - - - -
    Parameters:
      -
    • timeout (float) – The read timeout.
    • -
    • purge_buffer (bool) – Indicates whether to purge the buffer prior to reading.
    • -
    -
    Returns:

    The line read from the device.

    -
    Raises :

    CommError, TimeoutError

    -
    -
    - -
    - -
    -
    -

    util Module

    -

    Provides utility classes for the AD2 devices.

    -
    -
    -exception pyad2.util.NoDeviceError[source]
    -

    Bases: exceptions.Exception

    -

    No devices found.

    -
    - -
    -
    -exception pyad2.util.CommError[source]
    -

    Bases: exceptions.Exception

    -

    There was an error communicating with the device.

    -
    - -
    -
    -exception pyad2.util.TimeoutError[source]
    -

    Bases: exceptions.Exception

    -

    There was a timeout while trying to communicate with the device.

    -
    - -
    -
    -exception pyad2.util.InvalidMessageError[source]
    -

    Bases: exceptions.Exception

    -

    The format of the panel message was invalid.

    -
    - -
    -
    -class pyad2.util.Firmware[source]
    -

    Bases: object

    -

    Represents firmware for the AD2 devices.

    -
    -
    -STAGE_START = 0
    -
    - -
    -
    -STAGE_WAITING = 1
    -
    - -
    -
    -STAGE_BOOT = 2
    -
    - -
    -
    -STAGE_LOAD = 3
    -
    - -
    -
    -STAGE_UPLOADING = 4
    -
    - -
    -
    -STAGE_DONE = 5
    -
    - -
    -
    -static upload(dev, filename, progress_callback=None)[source]
    -

    Uploads firmware to an AD2 device.

    - --- - - - - - -
    Parameters:
      -
    • filename (str) – The firmware filename
    • -
    • progress_callback (function) – Callback function used to report progress.
    • -
    -
    Raises :

    util.NoDeviceError, util.TimeoutError

    -
    -
    - -
    - -
    -
    -

    zonetracking Module

    -

    Provides zone tracking functionality for the AD2 device family.

    -
    -
    -class pyad2.zonetracking.Zone(zone=0, name='', status=0)[source]
    -

    Bases: object

    -

    Representation of a panel zone.

    -
    -
    -CLEAR = 0
    -

    Status indicating that the zone is cleared.

    -
    - -
    -
    -FAULT = 1
    -

    Status indicating that the zone is faulted.

    -
    - -
    -
    -CHECK = 2
    -

    Status indicating that there is a wiring issue with the zone.

    -
    - -
    -
    -STATUS = {0: 'CLEAR', 1: 'FAULT', 2: 'CHECK'}
    -
    - -
    - -
    -
    -class pyad2.zonetracking.Zonetracker[source]
    -

    Bases: object

    -

    Handles tracking of zone and their statuses.

    -
    -
    -on_fault
    -

    Called when the device detects a zone fault.

    -
    - -
    -
    -on_restore
    -

    Called when the device detects that a fault is restored.

    -
    - -
    -
    -EXPIRE = 30
    -

    Zone expiration timeout.

    -
    - -
    -
    -update(message)[source]
    -

    Update zone statuses based on the current message.

    - --- - - - -
    Parameters:message (Message or ExpanderMessage) – Message to use to update the zone tracking.
    -
    - -
    - -
    -
    -

    panels Module

    -

    Representations of Panels and their templates.

    -
    -
    -

    messages Module

    -

    Message representations received from the panel through the AD2 devices.

    -
    -
    -class pyad2.messages.BaseMessage[source]
    -

    Bases: object

    -

    Base class for messages.

    -
    -
    -raw = None
    -

    The raw message text

    -
    - -
    - -
    -
    -class pyad2.messages.Message(data=None)[source]
    -

    Bases: pyad2.messages.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

    -
    - -
    - -
    -
    -class pyad2.messages.ExpanderMessage(data=None)[source]
    -

    Bases: pyad2.messages.BaseMessage

    -

    Represents a message from a zone or relay expansion module.

    -
    -
    -ZONE = 0
    -

    Flag indicating that the expander message relates to a Zone Expander.

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

    -
    - -
    - -
    -
    -class pyad2.messages.RFMessage(data=None)[source]
    -

    Bases: pyad2.messages.BaseMessage

    -

    Represents a message from an RF receiver.

    -
    -
    -x = 3
    -
    - -
    -
    -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, False, False, False]
    -

    Loop indicators

    -
    - -
    - -
    -
    -class pyad2.messages.LRRMessage(data=None)[source]
    -

    Bases: pyad2.messages.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

    -
    - -
    - -
    -
    -

    Subpackages

    - -
    -
    - - -
    -
    -
    -
    -
    -

    Table Of Contents

    - - -

    Previous topic

    -

    Welcome to pyad2’s documentation!

    -

    Next topic

    -

    event Package

    -

    This Page

    - - - -
    -
    -
    -
    - - - - \ No newline at end of file diff --git a/docs/_build/html/search.html b/docs/_build/html/search.html index 44fd20c..7fcf164 100644 --- a/docs/_build/html/search.html +++ b/docs/_build/html/search.html @@ -6,7 +6,7 @@ - Search — pyad2 documentation + Search — alarmdecoder documentation @@ -24,7 +24,7 @@ - + @@ -43,7 +43,7 @@
  • modules |
  • -
  • pyad2 documentation »
  • +
  • alarmdecoder documentation »
  • @@ -94,11 +94,11 @@
  • modules |
  • -
  • pyad2 documentation »
  • +
  • alarmdecoder documentation »
  • diff --git a/docs/_build/html/searchindex.js b/docs/_build/html/searchindex.js index 525e3c1..93bf40b 100644 --- a/docs/_build/html/searchindex.js +++ b/docs/_build/html/searchindex.js @@ -1 +1 @@ -Search.setIndex({envversion:42,terms:{represent:3,all:[3,2],code:3,on_boot:3,stage_don:3,backlight:3,depend:[],zone:3,readabl:3,send:3,program:3,x03:3,x02:3,x01:3,sent:3,x04:3,sourc:[3,2],string:3,clear_zon:3,fals:3,on_messag:3,perimeter_onli:3,util:[],lrr:3,level:3,list:3,upload:3,"try":3,emul:3,expandermessag:3,port:3,index:0,ad2seri:3,current:3,"new":2,method:3,ser2sock:3,full:3,timeouterror:3,detached_ev:3,gener:3,usbdevic:3,entry_delay_off:3,on_config_receiv:3,address:3,path:3,valu:3,fire_alarm:3,search:[0,3],sender:2,on_clos:3,prior:3,invalidmessageerror:3,via:3,appli:3,modul:[],zonetrack:[],filenam:3,famili:3,from:3,describ:3,commun:3,is_reader_al:3,handler:2,call:[3,2],type:3,relat:3,stage_boot:3,flag:3,relai:3,actual:3,cach:3,serialdevic:3,must:2,none:[3,2],retriev:3,on_restor:3,restor:3,dev:3,can:2,aliv:3,backlight_on:3,process:3,templat:3,high:3,cursor_loc:3,serial:3,occur:3,delai:3,progress_callback:3,anoth:3,simulate_wire_problem:3,write:3,purg:3,instead:2,panic:3,updat:3,product:3,recogn:3,ftdi:3,befor:3,attent:3,data:3,classmethod:3,ssl_ca:3,issu:3,callback:3,"switch":3,socketdevic:3,disarm:3,through:3,vari:[],paramet:3,raw:3,usb:3,bypass:3,on_read:3,"return":3,handl:3,on_bypass:3,detach:3,name:3,revert:3,on_pan:3,authent:3,stage_wait:3,mode:3,timeout:3,found:3,rfx:3,nodeviceerror:3,"static":3,connect:3,our:3,read_lin:3,event:[],reboot:3,content:0,reader:3,factori:3,shut:3,written:3,fixm:[],base:[3,2],"byte":3,armed_hom:3,on_detach:3,thread:3,readthread:3,get_config:3,on_rfx_messag:3,find_al:3,ad2usb:3,first:3,oper:2,rang:3,attached_ev:3,number:3,alreadi:3,messag:[],on_writ:3,open:3,on_power_chang:3,differ:3,associ:3,system:3,wrapper:3,attach:3,on_open:3,battery_low:3,specifi:3,rfmessag:3,on_fir:3,provid:3,remov:[3,2],charact:3,str:3,save_config:3,bitfield:3,packag:[],on_fault:3,expir:3,programming_mod:3,also:2,which:3,event_data:3,channel:3,thi:3,supervis:3,buffer:3,object:[3,2],detect:3,basemessag:3,"class":[3,2],armed_awai:3,doc:2,clear:3,request:3,on_low_batteri:3,clean:3,text:3,ssl_kei:3,radio:3,locat:3,configur:3,fault_zon:3,should:3,serial_numb:3,stop:3,ssl:3,report:3,requir:3,enabl:3,earg:2,whether:3,partit:3,contain:3,alarm_event_occur:3,certif:3,set:3,keypad:3,ac_pow:3,on_alarm:3,perimet:3,close:3,arm:3,stop_read:3,pyseri:3,statu:3,wire:3,parent:3,pattern:3,state:3,between:3,progress:3,awai:3,kei:3,numer:3,fault:3,batteri:3,on_attach:3,detectthread:3,devic:[],been:3,beep:3,get_devic:3,trigger:3,no_reader_thread:3,fire:[3,2],commerror:3,chime_on:3,func:2,present:3,sound:3,check_zon:3,cursor:3,defin:2,"while":3,stage_upload:3,error:3,loop:3,readi:3,itself:2,ftdi_vendor_id:3,on_zone_fault:3,alarm_sound:3,panel_data:3,author:3,receiv:3,belong:3,status:3,finish:3,ad2factori:3,expans:3,rais:3,user:3,expand:3,subpackag:[],entri:3,well:3,client:3,zone_bypass:3,usual:3,when:3,human:3,baudrat:3,expos:3,on_disarm:3,except:3,identif:3,add:2,board:3,match:3,vendor:3,around:3,format:3,read:3,numeric_cod:3,lcd:3,ad2:[],like:2,singl:3,page:0,creation:3,fire_timeout:3,home:3,pyftdi:3,localhost:3,run:3,power:3,event_typ:3,stage_load:3,ssl_certif:3,panel:[],obj:2,simul:3,stage_start:3,"float":3,automat:3,down:3,chime:3,support:3,on_relay_chang:3,"long":3,start:3,interfac:3,low:3,"function":[3,2],tupl:3,eventhandl:2,line:3,"default":3,displai:3,purge_buff:3,alarm:3,creat:3,"int":3,mask:3,repres:3,on_zone_restor:3,exist:2,read_timeout:3,ftdi_product_id:3,check:3,probabl:[],battery_timeout:3,boot:3,invalid:3,field:3,bool:3,you:2,intend:3,firmwar:3,track:3,on_arm:3,descript:3,lrrmessag:3,on_lrr_messag:3},objtypes:{"0":"py:module","1":"py:attribute","2":"py:method","3":"py:class","4":"py:staticmethod","5":"py:classmethod","6":"py:exception"},objnames:{"0":["py","module","Python module"],"1":["py","attribute","Python attribute"],"2":["py","method","Python method"],"3":["py","class","Python class"],"4":["py","staticmethod","Python static method"],"5":["py","classmethod","Python class method"],"6":["py","exception","Python exception"]},filenames:["index","modules","pyad2.event","pyad2"],titles:["Welcome to pyad2’s documentation!","pyad2","event Package","pyad2 Package"],objects:{"pyad2.messages":{Message:[3,3,1,""],BaseMessage:[3,3,1,""],RFMessage:[3,3,1,""],ExpanderMessage:[3,3,1,""],LRRMessage:[3,3,1,""]},"pyad2.messages.LRRMessage":{partition:[3,1,1,""],event_type:[3,1,1,""],event_data:[3,1,1,""]},"pyad2.util":{CommError:[3,6,1,""],Firmware:[3,3,1,""],TimeoutError:[3,6,1,""],NoDeviceError:[3,6,1,""],InvalidMessageError:[3,6,1,""]},pyad2:{ad2:[3,0,1,""],zonetracking:[3,0,1,""],messages:[3,0,1,""],devices:[3,0,1,""],util:[3,0,1,""],panels:[3,0,1,""],event:[2,0,1,""]},"pyad2.devices":{Device:[3,3,1,""],SocketDevice:[3,3,1,""],USBDevice:[3,3,1,""],SerialDevice:[3,3,1,""]},"pyad2.event.event.EventHandler":{fire:[2,2,1,""],add:[2,2,1,""],remove:[2,2,1,""]},"pyad2.devices.USBDevice":{read_line:[3,2,1,""],BAUDRATE:[3,1,1,""],description:[3,1,1,""],read:[3,2,1,""],write:[3,2,1,""],find_all:[3,4,1,""],FTDI_VENDOR_ID:[3,1,1,""],serial_number:[3,1,1,""],"interface":[3,1,1,""],close:[3,2,1,""],FTDI_PRODUCT_ID:[3,1,1,""],open:[3,2,1,""]},"pyad2.event.event":{EventHandler:[2,3,1,""],Event:[2,3,1,""]},"pyad2.devices.Device":{on_read:[3,1,1,""],on_open:[3,1,1,""],ReadThread:[3,3,1,""],on_close:[3,1,1,""],on_write:[3,1,1,""],close:[3,2,1,""],stop_reader:[3,2,1,""],is_reader_alive:[3,2,1,""],id:[3,1,1,""]},"pyad2.zonetracking":{Zonetracker:[3,3,1,""],Zone:[3,3,1,""]},"pyad2.zonetracking.Zonetracker":{on_restore:[3,1,1,""],EXPIRE:[3,1,1,""],on_fault:[3,1,1,""],update:[3,2,1,""]},"pyad2.zonetracking.Zone":{STATUS:[3,1,1,""],FAULT:[3,1,1,""],CLEAR:[3,1,1,""],CHECK:[3,1,1,""]},"pyad2.util.Firmware":{STAGE_LOAD:[3,1,1,""],upload:[3,4,1,""],STAGE_WAITING:[3,1,1,""],STAGE_START:[3,1,1,""],STAGE_UPLOADING:[3,1,1,""],STAGE_BOOT:[3,1,1,""],STAGE_DONE:[3,1,1,""]},"pyad2.messages.BaseMessage":{raw:[3,1,1,""]},"pyad2.event":{event:[2,0,1,""]},"pyad2.ad2.AD2Factory":{on_attached:[3,1,1,""],get_device:[3,2,1,""],DetectThread:[3,3,1,""],create:[3,5,1,""],stop:[3,2,1,""],devices:[3,5,1,""],on_detached:[3,1,1,""],start:[3,2,1,""],find_all:[3,5,1,""],close:[3,2,1,""]},"pyad2.devices.SerialDevice":{read_line:[3,2,1,""],BAUDRATE:[3,1,1,""],read:[3,2,1,""],write:[3,2,1,""],find_all:[3,4,1,""],"interface":[3,1,1,""],close:[3,2,1,""],open:[3,2,1,""]},"pyad2.messages.ExpanderMessage":{RELAY:[3,1,1,""],ZONE:[3,1,1,""],value:[3,1,1,""],address:[3,1,1,""],type:[3,1,1,""],channel:[3,1,1,""]},"pyad2.devices.SocketDevice":{ssl_key:[3,1,1,""],ssl_certificate:[3,1,1,""],read:[3,2,1,""],read_line:[3,2,1,""],ssl_ca:[3,1,1,""],write:[3,2,1,""],ssl:[3,1,1,""],"interface":[3,1,1,""],close:[3,2,1,""],open:[3,2,1,""]},"pyad2.ad2.AD2Factory.DetectThread":{stop:[3,2,1,""],run:[3,2,1,""]},"pyad2.devices.Device.ReadThread":{READ_TIMEOUT:[3,1,1,""],run:[3,2,1,""],stop:[3,2,1,""]},"pyad2.messages.Message":{backlight_on:[3,1,1,""],alarm_event_occurred:[3,1,1,""],programming_mode:[3,1,1,""],text:[3,1,1,""],bitfield:[3,1,1,""],armed_home:[3,1,1,""],alarm_sounding:[3,1,1,""],ready:[3,1,1,""],zone_bypassed:[3,1,1,""],panel_data:[3,1,1,""],check_zone:[3,1,1,""],numeric_code:[3,1,1,""],battery_low:[3,1,1,""],chime_on:[3,1,1,""],entry_delay_off:[3,1,1,""],perimeter_only:[3,1,1,""],fire_alarm:[3,1,1,""],ac_power:[3,1,1,""],beeps:[3,1,1,""],mask:[3,1,1,""],armed_away:[3,1,1,""],cursor_location:[3,1,1,""]},"pyad2.ad2":{AD2:[3,3,1,""],AD2Factory:[3,3,1,""]},"pyad2.ad2.AD2":{on_rfx_message:[3,1,1,""],fault_zone:[3,2,1,""],on_open:[3,1,1,""],save_config:[3,2,1,""],on_relay_changed:[3,1,1,""],on_boot:[3,1,1,""],close:[3,2,1,""],open:[3,2,1,""],id:[3,1,1,""],on_power_changed:[3,1,1,""],BATTERY_TIMEOUT:[3,1,1,""],on_message:[3,1,1,""],send:[3,2,1,""],reboot:[3,2,1,""],get_config:[3,2,1,""],on_zone_restore:[3,1,1,""],on_disarm:[3,1,1,""],on_fire:[3,1,1,""],on_write:[3,1,1,""],on_read:[3,1,1,""],on_lrr_message:[3,1,1,""],clear_zone:[3,2,1,""],on_zone_fault:[3,1,1,""],on_config_received:[3,1,1,""],on_close:[3,1,1,""],on_bypass:[3,1,1,""],on_low_battery:[3,1,1,""],on_arm:[3,1,1,""],F1:[3,1,1,""],F2:[3,1,1,""],F3:[3,1,1,""],F4:[3,1,1,""],on_alarm:[3,1,1,""],on_panic:[3,1,1,""],FIRE_TIMEOUT:[3,1,1,""]},"pyad2.messages.RFMessage":{battery:[3,1,1,""],supervision:[3,1,1,""],value:[3,1,1,""],serial_number:[3,1,1,""],x:[3,1,1,""],loop:[3,1,1,""]}},titleterms:{subpackag:3,ad2:3,welcom:0,pyad2:[0,1,3],modul:[3,2],devic:3,messag:3,util:3,packag:[3,2],zonetrack:3,indic:0,tabl:0,document:0,event:2,panel:3}}) \ No newline at end of file +Search.setIndex({envversion:42,terms:{represent:1,all:[1,0],code:1,entri:1,zone_bypass:1,text:1,sent:1,recogn:1,arm:1,ssl_kei:1,socketdevic:1,through:1,human:1,stage_don:1,data:1,find:1,backlight:1,paramet:1,raw:1,current:1,baudrat:1,locat:1,expos:1,also:0,readabl:1,except:1,identif:1,whether:1,add:0,program:1,serialdevic:1,bypass:1,on_read:1,match:1,sourc:[1,0],"return":1,string:1,serial_numb:1,format:1,read:1,numeric_cod:1,stop:1,ssl:1,lcd:1,lrr:1,progress:1,report:1,detach:1,requir:1,enabl:1,ad2:1,name:1,earg:0,list:1,upload:1,authent:1,factori:1,"try":1,provid:1,expand:1,stage_wait:1,mode:1,timeout:1,contain:1,found:1,alarm_event_occur:1,expandermessag:1,page:3,certif:1,nodeviceerror:1,on_open:1,request:1,"static":1,connect:1,usbdevic:1,on_writ:1,our:1,charact:1,read_lin:1,event:1,stop_read:1,pyseri:1,index:3,statu:1,detect:1,parent:1,purge_buff:1,pattern:1,ad2seri:1,callback:1,content:3,pyftdi:1,written:1,reader:1,"new":0,awai:1,method:1,localhost:1,ser2sock:1,process:1,perimet:1,run:1,timeouterror:1,kei:1,state:1,numer:1,gener:1,stage_load:1,cursor_loc:1,entry_delay_off:1,like:0,on_clos:1,base:[1,0],ssl_certif:1,address:1,path:1,"byte":1,armed_hom:1,valu:1,describ:1,fire_alarm:1,search:[1,3],actual:1,zone:1,thread:1,fault:1,readthread:1,stage_start:1,prior:1,rais:1,loop:1,fals:1,find_al:1,ad2usb:1,first:1,oper:0,rang:1,via:1,vid:1,appli:1,keypad:1,"float":1,number:1,automat:1,filenam:1,read_timeout:1,"long":1,famili:1,batteri:1,chime:1,open:1,on_attach:1,differ:1,from:1,usb:1,commun:1,detectthread:1,support:1,system:1,been:1,beep:1,attach:1,singl:1,handler:0,call:[1,0],on_detach:1,start_detect:1,ac_pow:1,interfac:1,stage_upload:1,type:1,start:1,low:1,"function":[1,0],no_reader_thread:1,fire:[1,0],tupl:1,commerror:1,chime_on:1,specifi:1,stage_boot:1,rfmessag:1,flag:1,indic:1,relai:1,obj:0,line:1,repres:1,cach:1,present:1,must:0,sound:1,none:[1,0],sender:0,retriev:1,on_restor:1,restor:1,"default":1,remov:[1,0],purg:1,displai:1,dev:1,stop_detect:1,cursor:1,defin:0,"while":1,kwarg:0,can:0,str:1,error:1,battery_low:1,alarm:1,radio:1,expir:1,backlight_on:1,"int":1,descript:1,arg:0,pid:1,templat:1,bitfield:1,check_zon:1,on_fault:1,itself:0,exist:0,aliv:1,ftdi_vendor_id:1,home:1,close:1,vendor:1,ftdi_product_id:1,alarm_sound:1,serial:1,delai:1,readi:1,panel_data:1,progress_callback:1,author:1,receiv:1,anoth:1,belong:1,when:1,invalid:1,port:1,write:1,field:1,client:1,bool:1,which:1,occur:1,instead:0,you:0,event_data:1,channel:1,updat:1,status:1,product:1,relat:1,intend:1,firmwar:1,supervis:1,buffer:1,expans:1,decod:1,event_typ:1,ftdi:1,partit:1,perimeter_onli:1,wire:1,power:1,user:1,attent:1,basemessag:1,eventhandl:0,associ:1,"class":[1,0],check:1,armed_awai:1,handl:1,classmethod:1,doc:0,clear:1,mask:1,object:[1,0],ssl_ca:1,issu:1,lrrmessag:1,is_reader_al:1,thi:1,programming_mod:1,track:1,func:0,invalidmessageerror:1,usual:1},objtypes:{"0":"py:module","1":"py:class","2":"py:method","3":"py:attribute","4":"py:classmethod","5":"py:exception","6":"py:staticmethod"},objnames:{"0":["py","module","Python module"],"1":["py","class","Python class"],"2":["py","method","Python method"],"3":["py","attribute","Python attribute"],"4":["py","classmethod","Python class method"],"5":["py","exception","Python exception"],"6":["py","staticmethod","Python static method"]},filenames:["alarmdecoder.event","alarmdecoder","modules","index"],titles:["event Package","alarmdecoder Package","alarmdecoder","Welcome to alarmdecoder’s documentation!"],objects:{"alarmdecoder.messages.LRRMessage":{partition:[1,3,1,""],event_data:[1,3,1,""],event_type:[1,3,1,""]},"alarmdecoder.messages.BaseMessage":{raw:[1,3,1,""]},"alarmdecoder.messages.ExpanderMessage":{RELAY:[1,3,1,""],ZONE:[1,3,1,""],value:[1,3,1,""],address:[1,3,1,""],type:[1,3,1,""],channel:[1,3,1,""]},"alarmdecoder.event.event":{EventHandler:[0,1,1,""],Event:[0,1,1,""]},"alarmdecoder.zonetracking.Zone":{STATUS:[1,3,1,""],FAULT:[1,3,1,""],CLEAR:[1,3,1,""],CHECK:[1,3,1,""]},"alarmdecoder.devices.SerialDevice":{write:[1,2,1,""],BAUDRATE:[1,3,1,""],read:[1,2,1,""],read_line:[1,2,1,""],find_all:[1,6,1,""],"interface":[1,3,1,""],close:[1,2,1,""],open:[1,2,1,""]},"alarmdecoder.zonetracking":{Zonetracker:[1,1,1,""],Zone:[1,1,1,""]},"alarmdecoder.zonetracking.Zonetracker":{on_restore:[1,3,1,""],EXPIRE:[1,3,1,""],update:[1,2,1,""],on_fault:[1,3,1,""]},"alarmdecoder.devices.Device.ReadThread":{READ_TIMEOUT:[1,3,1,""],stop:[1,2,1,""],run:[1,2,1,""]},"alarmdecoder.event":{event:[0,0,1,""]},"alarmdecoder.messages":{Message:[1,1,1,""],LRRMessage:[1,1,1,""],RFMessage:[1,1,1,""],ExpanderMessage:[1,1,1,""],BaseMessage:[1,1,1,""]},"alarmdecoder.devices":{Device:[1,1,1,""],SocketDevice:[1,1,1,""],USBDevice:[1,1,1,""],SerialDevice:[1,1,1,""]},"alarmdecoder.devices.USBDevice.DetectThread":{run:[1,2,1,""],stop:[1,2,1,""],on_attached:[1,3,1,""],on_detached:[1,3,1,""]},alarmdecoder:{zonetracking:[1,0,1,""],messages:[1,0,1,""],devices:[1,0,1,""],util:[1,0,1,""],panels:[1,0,1,""],event:[0,0,1,""]},"alarmdecoder.devices.SocketDevice":{ssl_certificate:[1,3,1,""],ssl_key:[1,3,1,""],read:[1,2,1,""],ssl_ca:[1,3,1,""],read_line:[1,2,1,""],ssl:[1,3,1,""],write:[1,2,1,""],"interface":[1,3,1,""],close:[1,2,1,""],open:[1,2,1,""]},"alarmdecoder.devices.USBDevice":{write:[1,2,1,""],BAUDRATE:[1,3,1,""],description:[1,3,1,""],read:[1,2,1,""],DetectThread:[1,1,1,""],stop_detection:[1,4,1,""],devices:[1,4,1,""],start_detection:[1,4,1,""],read_line:[1,2,1,""],find_all:[1,4,1,""],FTDI_VENDOR_ID:[1,3,1,""],serial_number:[1,3,1,""],"interface":[1,3,1,""],close:[1,2,1,""],FTDI_PRODUCT_ID:[1,3,1,""],open:[1,2,1,""],find:[1,4,1,""]},"alarmdecoder.messages.Message":{backlight_on:[1,3,1,""],alarm_event_occurred:[1,3,1,""],programming_mode:[1,3,1,""],text:[1,3,1,""],bitfield:[1,3,1,""],armed_home:[1,3,1,""],alarm_sounding:[1,3,1,""],ready:[1,3,1,""],zone_bypassed:[1,3,1,""],panel_data:[1,3,1,""],check_zone:[1,3,1,""],numeric_code:[1,3,1,""],battery_low:[1,3,1,""],chime_on:[1,3,1,""],entry_delay_off:[1,3,1,""],perimeter_only:[1,3,1,""],fire_alarm:[1,3,1,""],ac_power:[1,3,1,""],beeps:[1,3,1,""],mask:[1,3,1,""],armed_away:[1,3,1,""],cursor_location:[1,3,1,""]},"alarmdecoder.devices.Device":{stop_reader:[1,2,1,""],on_open:[1,3,1,""],on_write:[1,3,1,""],ReadThread:[1,1,1,""],on_close:[1,3,1,""],on_read:[1,3,1,""],close:[1,2,1,""],is_reader_alive:[1,2,1,""],id:[1,3,1,""]},"alarmdecoder.messages.RFMessage":{battery:[1,3,1,""],value:[1,3,1,""],supervision:[1,3,1,""],serial_number:[1,3,1,""],x:[1,3,1,""],loop:[1,3,1,""]},"alarmdecoder.event.event.EventHandler":{fire:[0,2,1,""],add:[0,2,1,""],remove:[0,2,1,""]},"alarmdecoder.util.Firmware":{STAGE_LOAD:[1,3,1,""],upload:[1,6,1,""],STAGE_BOOT:[1,3,1,""],STAGE_START:[1,3,1,""],STAGE_UPLOADING:[1,3,1,""],STAGE_WAITING:[1,3,1,""],STAGE_DONE:[1,3,1,""]},"alarmdecoder.util":{CommError:[1,5,1,""],Firmware:[1,1,1,""],TimeoutError:[1,5,1,""],NoDeviceError:[1,5,1,""],InvalidMessageError:[1,5,1,""]}},titleterms:{subpackag:1,alarmdecod:[1,2,3],welcom:3,modul:[1,0],devic:1,zonetrack:1,util:1,packag:[1,0],messag:1,indic:3,tabl:3,document:3,event:0,panel:1}}) \ No newline at end of file diff --git a/docs/_build/html/_sources/pyad2.event.txt b/docs/alarmdecoder.event.rst similarity index 75% rename from docs/_build/html/_sources/pyad2.event.txt rename to docs/alarmdecoder.event.rst index 9f2c38b..5d72fd9 100644 --- a/docs/_build/html/_sources/pyad2.event.txt +++ b/docs/alarmdecoder.event.rst @@ -4,7 +4,7 @@ event Package :mod:`event` Package -------------------- -.. automodule:: pyad2.event +.. automodule:: alarmdecoder.event :members: :undoc-members: :show-inheritance: @@ -12,7 +12,7 @@ event Package :mod:`event` Module ------------------- -.. automodule:: pyad2.event.event +.. automodule:: alarmdecoder.event.event :members: :undoc-members: :show-inheritance: diff --git a/docs/_build/html/_sources/pyad2.txt b/docs/alarmdecoder.rst similarity index 68% rename from docs/_build/html/_sources/pyad2.txt rename to docs/alarmdecoder.rst index 8bb0c11..36fe308 100644 --- a/docs/_build/html/_sources/pyad2.txt +++ b/docs/alarmdecoder.rst @@ -1,10 +1,10 @@ -pyad2 Package +alarmdecoder Package ================ -:mod:`ad2` Module +:mod:`alarmdecoder` Module -------------------- -.. automodule:: pyad2.ad2 +.. automodule:: alarmdecoder.alarmdecoder :members: :undoc-members: :show-inheritance: @@ -12,7 +12,7 @@ pyad2 Package :mod:`devices` Module --------------------- -.. automodule:: pyad2.devices +.. automodule:: alarmdecoder.devices :members: :undoc-members: :show-inheritance: @@ -20,7 +20,7 @@ pyad2 Package :mod:`util` Module ------------------ -.. automodule:: pyad2.util +.. automodule:: alarmdecoder.util :members: :undoc-members: :show-inheritance: @@ -28,7 +28,7 @@ pyad2 Package :mod:`zonetracking` Module -------------------------- -.. automodule:: pyad2.zonetracking +.. automodule:: alarmdecoder.zonetracking :members: :undoc-members: :show-inheritance: @@ -36,7 +36,7 @@ pyad2 Package :mod:`panels` Module -------------------- -.. automodule:: pyad2.panels +.. automodule:: alarmdecoder.panels :members: :undoc-members: :show-inheritance: @@ -44,7 +44,7 @@ pyad2 Package :mod:`messages` Module ---------------------- -.. automodule:: pyad2.messages +.. automodule:: alarmdecoder.messages :members: :undoc-members: :show-inheritance: @@ -54,5 +54,5 @@ Subpackages .. toctree:: - pyad2.event + alarmdecoder.event