123456789101112131415161718192021222324252627282930 |
- #!/usr/bin/env python
- # encoding: utf-8
- """
- @time: 2021/5/31 11:37
- @desc: sct003 和 moxae1210 的解析器
- """
- from converter import Converter
- from log import OutPutLog
- class ShucaiConverter(Converter):
- def __init__(self):
- self._log = OutPutLog()
- def convert(self, config, data):
- if data:
- try:
- format_data_dict = {}
- for index in config:
- name = 'c' + str(index['serial_number'])
- if data[index['address']] != None:
- format_data_dict[name] = data[index['address']]
- return format_data_dict
- except Exception as e:
- print(e)
- self._log.error(e)
- return "error"
|