def serialize(self): buf = bytearray() buf.append(self.charger_port_number) # noinspection PyTypeChecker buf.append(self.chemistry.value) buf.append(self.cells) # noinspection PyTypeChecker buf.append(self.operation.value) append_uint16(buf, self.cell_term_v * 1000) append_uint16(buf, self.rate) append_bool(buf, self.balanced) return buf
def serialize(self): buf = bytearray() buf.append(self.port_number) # noinspection PyTypeChecker buf.append(self.model_id.value) # noinspection PyTypeChecker buf.append(self.comm_state.value) append_uint32(buf, self.supply_volts) append_int32(buf, self.supply_amps) append_uint16(buf, self.cpu_temp) buf.append(self.operation_flags) append_uint16(buf, self.firmware_version) return buf
def serialize(self): buf = bytearray() buf.append(self.port_number) buf.append(self.schema_version) # noinspection PyTypeChecker buf.append(self.model_id.value) # noinspection PyTypeChecker buf.append(self.comm_state.value) # noinspection PyTypeChecker buf.append(self.mode_running.value) buf.append(self.error_code) # noinspection PyTypeChecker buf.append(self.chemistry.value) buf.append(self.cell_count) buf.append(self.estimated_fuel_level) append_uint16(buf, self.estimated_minutes) append_int32(buf, self.amps) append_uint32(buf, self.pack_volts) append_uint32(buf, self.capacity_added) append_uint32(buf, self.capacity_removed) append_uint32(buf, self.cycle_timer) append_uint16(buf, self.status_flags) append_uint16(buf, self.rx_status_flags) buf.append(self.operation_flags) # noinspection PyTypeChecker buf.append(self.power_reduced_reason.value) append_uint32(buf, self.supply_volts) append_int32(buf, self.supply_amps) append_uint16(buf, self.cpu_temp) for ii in range(self.cell_count): append_uint16(buf, self.cell_volts[ii]) append_uint16(buf, self.cell_ir[ii]) buf.append(self.cell_bypass[ii]) return buf
def serialize(self): buf = bytearray() buf.append(self.port_number) # noinspection PyTypeChecker buf.append(self.requested_operation.value) # noinspection PyTypeChecker buf.append(self.requested_chemistry.value) buf.append(self.requested_cell_count) append_uint16(buf, int(round(self.requested_ir * 100))) append_uint16(buf, self.requested_capacity) append_uint16(buf, int(round(self.requested_charge_c * 10))) append_uint16(buf, int(round(self.requested_discharge_c * 10))) append_uint16(buf, self.requested_charge_rate) append_uint16(buf, self.requested_discharge_rate) append_uint16( buf, int(round(self.requested_charge_cutoff_cell_volts * 1000))) append_uint16( buf, int(round(self.requested_discharge_cutoff_cell_volts * 1000))) fuel_curve = [ int(round(val * 1000)) for val in self.requested_fuel_curve ] append_array(buf, fuel_curve, append_uint16) buf.append(self.multi_charger_mode) # noinspection PyTypeChecker buf.append(self.power_supply_mode.value) append_bool(buf, self.use_balance_leads) return buf
def serialize(self): buf = bytearray() buf.append(self.volume_level) append_uint16(buf, self.touch_cal_dx) append_uint16(buf, self.touch_cal_dy) append_uint16(buf, self.touch_cal_cx) append_uint16(buf, self.touch_cal_cy) append_uint16(buf, self.custom_color_idle) append_uint16(buf, self.custom_color_active) append_uint16(buf, self.custom_color_complete) append_uint16(buf, self.custom_color_safety) append_uint16(buf, self.custom_color_setup) buf.append(self.selected_color_theme) buf.append(self.screen_layout) append_array(buf, self.last_bluetooth_uuid) buf.append(self.cell_ir_warning_threshold) buf.append(self.capacity_warning_threshold) append_bool(buf, self.presets_enabled) append_bool(buf, self.cycle_graph_caching_enabled) append_array(buf, self._charger_ports_disabled, append_bool) buf.append(0) buf.append(self.touch_calibration_redone) buf.append(0) append_array(buf, self._power_sources) append_array(buf, [0] * 4) append_array(buf, self._wiring_modes) append_array(buf, self.charger_upgrade_states) append_array(buf, self.charger_upgrade_models) append_bool(buf, self.power_source_defaults_created) append_array( buf, self._power_source_names, lambda buff, val: append_str(buff, val, self.MAX_NAME_LEN)) append_array(buf, self._power_source_types) append_array(buf, self._power_source_warn_dod, append_bool) append_array(buf, self._power_source_low_volts, append_uint16) append_array(buf, self._power_source_max_amps, append_uint16) append_array(buf, self._power_source_max_regen_amps, append_uint16) append_array(buf, self._power_source_max_regen_volts, append_uint16) append_array(buf, self._power_source_regen_dchg_enabled, append_bool) append_bool(buf, self.power_source_initial_setup_complete) append_str(buf, self.device_name, self.MAX_NAME_LEN) append_array(buf, [0] * 70) append_uint16(buf, self.checksum) return buf