Пример #1
0
 def _parse_devices(self, parser_info):
     parser_info.enter("devices")
     for field in parser_info.iter_fields():
         device = LayoutDevice()
         device.parse_json(device_name=field, parser_info=parser_info)
         self.add_device(device)
     parser_info.exit()
Пример #2
0
    def build_settings_section(self, device_target):
        if device_target.is_virtual():
            device = LayoutDevice()
        else:
            device = self.get_device(device_target.device_id)

        settings = settings_t()

        settings_header = device.build_settings_header(device_target)
        settings_header.timestamp_raw = int(time.time())
        settings_header.default_report_mode = self.settings['report_mode']
        settings_header.crc = settings_header.compute_crc()

        settings.header = settings_header

        settings.layout = self.build_layout_settings()

        if self.rf_settings == None:
            settings.rf = rf_settings_t()
        else:
            settings.rf = self.rf_settings.generate_rf_settings()

        return settings.to_bytes()