Browse Source

LRRMessage variables renamed. Cleanup.

pyserial_fix
Scott Petersen 11 years ago
parent
commit
e0ff73b386
2 changed files with 10 additions and 14 deletions
  1. +6
    -10
      pyad2usb/ad2usb.py
  2. +4
    -4
      pyad2usb/messages.py

+ 6
- 10
pyad2usb/ad2usb.py View File

@@ -1,16 +1,12 @@
"""

Provides the full AD2USB class and factory.

.. moduleauthor:: Scott Petersen <scott@nutech.com>

"""

import time
import threading
import re
import logging
from collections import OrderedDict
from .event import event
from . import devices
from . import util
@@ -19,7 +15,7 @@ from . import zonetracking

class Overseer(object):
"""
Factory for creation of AD2USB devices as well as provide4s attach/detach events."
Factory for creation of AD2USB devices as well as provides attach/detach events."
"""

# Factory events
@@ -422,7 +418,7 @@ class AD2USB(object):
"""
msg = messages.LRRMessage(data)

args = (msg._partition, msg._event_type, msg._event_data)
args = (msg.partition, msg.event_type, msg.event_data)
if msg._event_type == 'ALARM_PANIC':
self._panic_status = True
self.on_panic(args + (True,))
@@ -455,14 +451,14 @@ class AD2USB(object):
self.address_mask = int(v, 16)
elif k == 'EXP':
for z in range(5):
self.emulate_zone[z] = True if v[z] == 'Y' else False
self.emulate_zone[z] = (v[z] == 'Y')
elif k == 'REL':
for r in range(4):
self.emulate_relay[r] = True if v[r] == 'Y' else False
self.emulate_relay[r] = (v[r] == 'Y')
elif k == 'LRR':
self.emulate_lrr = True if v == 'Y' else False
self.emulate_lrr = (v == 'Y')
elif k == 'DEDUPLICATE':
self.deduplicate = True if v == 'Y' else False
self.deduplicate = (v == 'Y')

self.on_config_received()



+ 4
- 4
pyad2usb/messages.py View File

@@ -216,9 +216,9 @@ class LRRMessage(object):
:type data: str
"""
self.raw = None
self._event_data = None
self._partition = None
self._event_type = None
self.event_data = None
self.partition = None
self.event_type = None

if data is not None:
self._parse_message(data)
@@ -239,4 +239,4 @@ class LRRMessage(object):
self.raw = data

_, values = data.split(':')
self._event_data, self._partition, self._event_type = values.split(',')
self.event_data, self.partition, self.event_type = values.split(',')

Loading…
Cancel
Save