added code comments

This commit is contained in:
Nigel Dokter 2017-01-21 10:42:17 +01:00
parent 45f5fe2c36
commit 7a4c204850
2 changed files with 13 additions and 2 deletions

View File

@ -43,5 +43,4 @@ class CosemObject(DSMRObject):
class ProfileGeneric(DSMRObject): class ProfileGeneric(DSMRObject):
pass pass # TODO implement
# TODO implement

View File

@ -91,6 +91,9 @@ class TelegramParser(object):
class DSMRObjectParser(object): class DSMRObjectParser(object):
"""
Parses an object (can also be see as a 'line') from a telegram.
"""
def __init__(self, *value_formats): def __init__(self, *value_formats):
self.value_formats = value_formats self.value_formats = value_formats
@ -181,6 +184,15 @@ class ProfileGenericParser(DSMRObjectParser):
class ValueParser(object): class ValueParser(object):
"""
Parses a single value from DSMRObject's.
Example with coerce_type being int:
(002*A) becomes {'value': 1, 'unit': 'A'}
Example with coerce_type being str:
(42) becomes {'value': '42', 'unit': None}
"""
def __init__(self, coerce_type): def __init__(self, coerce_type):
self.coerce_type = coerce_type self.coerce_type = coerce_type