Browse Source

Renamed MODES to PANEL_TYPES.

pyserial_fix
Scott Petersen 10 years ago
parent
commit
5ea201c05d
3 changed files with 7 additions and 7 deletions
  1. +3
    -3
      alarmdecoder/decoder.py
  2. +3
    -3
      alarmdecoder/messages.py
  3. +1
    -1
      alarmdecoder/panels.py

+ 3
- 3
alarmdecoder/decoder.py View File

@@ -13,7 +13,7 @@ from .event import event
from .util import InvalidMessageError
from .messages import Message, ExpanderMessage, RFMessage, LRRMessage
from .zonetracking import Zonetracker
from .panels import MODES, ADEMCO, DSC
from .panels import PANEL_TYPES, ADEMCO, DSC


class AlarmDecoder(object):
@@ -235,7 +235,7 @@ class AlarmDecoder(object):
''.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_entries.append(('MODE', MODES.keys()[MODES.values().index(self.mode)]))
config_entries.append(('MODE', PANEL_TYPES.keys()[PANEL_TYPES.values().index(self.mode)]))

config_string = '&'.join(['='.join(t) for t in config_entries])

@@ -431,7 +431,7 @@ class AlarmDecoder(object):
elif key == 'DEDUPLICATE':
self.deduplicate = (val == 'Y')
elif key == 'MODE':
self.mode = MODES[val]
self.mode = PANEL_TYPES[val]

self.on_config_received()



+ 3
- 3
alarmdecoder/messages.py View File

@@ -16,7 +16,7 @@ import re
import datetime

from .util import InvalidMessageError
from .panels import MODES, ADEMCO, DSC
from .panels import PANEL_TYPES, ADEMCO, DSC


class BaseMessage(object):
@@ -163,8 +163,8 @@ class Message(BaseMessage):
self.check_zone = is_bit_set(15)
self.perimeter_only = is_bit_set(16)
self.system_fault = is_bit_set(17)
if self.bitfield[18] in MODES.keys():
self.panel_type = MODES[self.bitfield[18]]
if self.bitfield[18] in PANEL_TYPES.keys():
self.panel_type = PANEL_TYPES[self.bitfield[18]]
# pos 20-21 - Unused.
self.text = alpha.strip('"')



+ 1
- 1
alarmdecoder/panels.py View File

@@ -7,7 +7,7 @@ Representations of Panels and their templates.
ADEMCO = 0
DSC = 1

MODES = {
PANEL_TYPES = {
'A': ADEMCO,
'D': DSC,
}


Loading…
Cancel
Save