Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(68)

Side by Side Diff: tools/battor_agent/battor_sample_converter.h

Issue 1586173002: tools/battor_agent: Prints real BattOr samples instead of raw ones (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@update_eeprom
Patch Set: Fixed size_t build error Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef TOOLS_BATTOR_AGENT_BATTOR_SAMPLE_CONVERTER_H_ 5 #ifndef TOOLS_BATTOR_AGENT_BATTOR_SAMPLE_CONVERTER_H_
6 #define TOOLS_BATTOR_AGENT_BATTOR_SAMPLE_CONVERTER_H_ 6 #define TOOLS_BATTOR_AGENT_BATTOR_SAMPLE_CONVERTER_H_
7 7
8 #include <stddef.h>
8 #include <vector> 9 #include <vector>
9 10
10 #include "tools/battor_agent/battor_protocol_types.h" 11 #include "tools/battor_agent/battor_protocol_types.h"
11 12
12 namespace battor { 13 namespace battor {
13 14
14 // Converter capable of taking raw samples from the BattOr and using 15 // Converter capable of taking raw samples from the BattOr and using
15 // configuration information to turn them into samples with real units. 16 // configuration information to turn them into samples with real units.
16 class BattOrSampleConverter { 17 class BattOrSampleConverter {
17 public: 18 public:
18 // Constructs a BattOrSampleConverter. 19 // Constructs a BattOrSampleConverter.
19 // 20 //
20 // - eeprom: The BattOr's EEPROM, which contains some required conversion 21 // - eeprom: The BattOr's EEPROM, which contains some required conversion
21 // parameters. 22 // parameters.
22 // - calibration_frame: The first frame sent back from the BattOr when 23 // - calibration_frame: The first frame sent back from the BattOr when
23 // streaming samples. This frame gives current and voltage measurements 24 // streaming samples. This frame gives current and voltage measurements
24 // that ignore whatever the BattOr's connected to, and therefore provide 25 // that ignore whatever the BattOr's connected to, and therefore provide
25 // a means for us to determine baseline current and voltage. 26 // a means for us to determine baseline current and voltage.
26 BattOrSampleConverter(const BattOrEEPROM& eeprom, 27 BattOrSampleConverter(const BattOrEEPROM& eeprom,
27 const std::vector<RawBattOrSample>& calibration_frame); 28 const std::vector<RawBattOrSample>& calibration_frame);
28 virtual ~BattOrSampleConverter(); 29 virtual ~BattOrSampleConverter();
29 30
30 // Converts a raw sample to a calibrated one. 31 // Converts a raw sample to a unitful one with a timestamp.
31 BattOrSample ToSample(const RawBattOrSample& sample) const; 32 BattOrSample ToSample(const RawBattOrSample& sample,
33 size_t sample_number) const;
32 34
33 private: 35 private:
34 // The BattOr's EEPROM, which stores some conversion parameters we need. 36 // The BattOr's EEPROM, which stores some conversion parameters we need.
35 BattOrEEPROM eeprom_; 37 BattOrEEPROM eeprom_;
36 38
37 // The baseline current and voltage calculated from the calibration frame. 39 // The baseline current and voltage calculated from the calibration frame.
38 double baseline_current_; 40 double baseline_current_;
39 double baseline_voltage_; 41 double baseline_voltage_;
40 }; 42 };
41 43
42 } // namespace battor 44 } // namespace battor
43 45
44 #endif // TOOLS_BATTOR_AGENT_BATTOR_SAMPLE_CONVERTER_H_ 46 #endif // TOOLS_BATTOR_AGENT_BATTOR_SAMPLE_CONVERTER_H_
OLDNEW
« no previous file with comments | « tools/battor_agent/battor_protocol_types.h ('k') | tools/battor_agent/battor_sample_converter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698