@@ -0,0 +1,1401 @@
+from dsmr_parser import telegram_specifications%0Afrom dsmr_parser.clients.telegram_buffer import TelegramBuffer%0Afrom dsmr_parser.exceptions import ParseError, InvalidChecksumError%0Afrom dsmr_parser.objects import CosemObject, MBusObject, Telegram%0Afrom dsmr_parser.parsers import TelegramParser%0Aimport os%0A%0Alogger = logging.getLogger(__name__)%0A%0Aclass FileReader(object):%0A%0A    def __init__(self, file, telegram_specification):%0A        self._file = file%0A        self.telegram_parser = TelegramParser(telegram_specification)%0A        self.telegram_buffer = TelegramBuffer()%0A        self.telegram_specification = telegram_specification%0A%0A    def read_as_object(self):%0A        %22%22%22%0A        Read complete DSMR telegram's from a file and return a Telegram object.%0A        :rtype: generator%0A        %22%22%22%0A        with open(self._file,%22rb%22) as file_handle:%0A            while True:%0A                data = file_handle.readline()%0A                str = data.decode()%0A                self.telegram_buffer.append(str)%0A%0A                for telegram in self.telegram_buffer.get_all():%0A                    try:%0A                        yield Telegram(telegram, self.telegram_parser, self.telegram_specification)%0A                    except InvalidChecksumError as e:%0A                        logger.warning(str(e))%0A                    except ParseError as e:%0A                        logger.error('Failed to parse telegram: %25s', e)%0A

add file reader