Browse Source

Added check for ADEMCO panel before pulling out the mask and cursor location. Mask now defaults to 0xFFFFFFFF.

pyserial_fix
Scott Petersen 11 years ago
parent
commit
9de9e9f7c9
1 changed files with 7 additions and 5 deletions
  1. +7
    -5
      alarmdecoder/messages.py

+ 7
- 5
alarmdecoder/messages.py View File

@@ -106,7 +106,7 @@ class Message(BaseMessage):
"""The human-readable text to be displayed on the panel LCD.""" """The human-readable text to be displayed on the panel LCD."""
cursor_location = -1 cursor_location = -1
"""Current cursor location on the keypad.""" """Current cursor location on the keypad."""
mask = None mask = 0xFFFFFFFF
"""Address mask this message is intended for.""" """Address mask this message is intended for."""
bitfield = None bitfield = None
"""The bitfield associated with this message.""" """The bitfield associated with this message."""
@@ -142,7 +142,6 @@ class Message(BaseMessage):
raise InvalidMessageError('Received invalid message: {0}'.format(data)) raise InvalidMessageError('Received invalid message: {0}'.format(data))


header, self.bitfield, self.numeric_code, self.panel_data, alpha = match.group(1, 2, 3, 4, 5) header, self.bitfield, self.numeric_code, self.panel_data, alpha = match.group(1, 2, 3, 4, 5)
self.mask = int(self.panel_data[3:3+8], 16)


is_bit_set = lambda bit: not self.bitfield[bit] == "0" is_bit_set = lambda bit: not self.bitfield[bit] == "0"


@@ -169,9 +168,12 @@ class Message(BaseMessage):
# pos 20-21 - Unused. # pos 20-21 - Unused.
self.text = alpha.strip('"') self.text = alpha.strip('"')


if int(self.panel_data[19:21], 16) & 0x01 > 0: if self.panel_type == ADEMCO:
# Current cursor location on the alpha display. self.mask = int(self.panel_data[3:3+8], 16)
self.cursor_location = int(self.bitfield[21:23], 16) if int(self.panel_data[19:21], 16) & 0x01 > 0:
# Current cursor location on the alpha display.
self.cursor_location = int(self.bitfield[21:23], 16)


def dict(self, **kwargs): def dict(self, **kwargs):
""" """


||||||
x
 
000:0
Loading…
Cancel
Save