OLD | NEW |
---|---|
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 <vector> | 8 #include <vector> |
9 | 9 |
10 #include "tools/battor_agent/battor_protocol_types.h" | 10 #include "tools/battor_agent/battor_protocol_types.h" |
11 | 11 |
12 namespace battor { | 12 namespace battor { |
13 | 13 |
14 // Converter capable of taking raw samples from the BattOr and using | 14 // Converter capable of taking raw samples from the BattOr and using |
15 // configuration information to turn them into samples with real units. | 15 // configuration information to turn them into samples with real units. |
16 class BattOrSampleConverter { | 16 class BattOrSampleConverter { |
17 public: | 17 public: |
18 // Constructs a BattOrSampleConverter. | 18 // Constructs a BattOrSampleConverter. |
19 // | 19 // |
20 // - eeprom: The BattOr's EEPROM, which contains some required conversion | 20 // - eeprom: The BattOr's EEPROM, which contains some required conversion |
21 // parameters. | 21 // parameters. |
22 // - calibration_frame: The first frame sent back from the BattOr when | 22 // - calibration_frame: The first frame sent back from the BattOr when |
23 // streaming samples. This frame gives current and voltage measurements | 23 // streaming samples. This frame gives current and voltage measurements |
24 // that ignore whatever the BattOr's connected to, and therefore provide | 24 // that ignore whatever the BattOr's connected to, and therefore provide |
25 // a means for us to determine baseline current and voltage. | 25 // a means for us to determine baseline current and voltage. |
26 BattOrSampleConverter(const BattOrEEPROM& eeprom, | 26 BattOrSampleConverter(const BattOrEEPROM& eeprom, |
27 const std::vector<RawBattOrSample>& calibration_frame); | 27 const std::vector<RawBattOrSample>& calibration_frame); |
28 virtual ~BattOrSampleConverter(); | 28 virtual ~BattOrSampleConverter(); |
29 | 29 |
30 // Converts a raw sample to a calibrated one. | 30 // Converts a raw sample to a unitful one with a timestamp. |
nednguyen
2016/01/14 22:41:19
What does "unitful" mean?
charliea (OOO until 10-5)
2016/01/15 01:51:21
It's a math-y/physics-y word meaning a number with
| |
31 BattOrSample ToSample(const RawBattOrSample& sample) const; | 31 BattOrSample ToSample(const RawBattOrSample& sample, |
32 size_t sample_number) const; | |
32 | 33 |
33 private: | 34 private: |
34 // The BattOr's EEPROM, which stores some conversion parameters we need. | 35 // The BattOr's EEPROM, which stores some conversion parameters we need. |
35 BattOrEEPROM eeprom_; | 36 BattOrEEPROM eeprom_; |
36 | 37 |
37 // The baseline current and voltage calculated from the calibration frame. | 38 // The baseline current and voltage calculated from the calibration frame. |
38 double baseline_current_; | 39 double baseline_current_; |
39 double baseline_voltage_; | 40 double baseline_voltage_; |
40 }; | 41 }; |
41 | 42 |
42 } // namespace battor | 43 } // namespace battor |
43 | 44 |
44 #endif // TOOLS_BATTOR_AGENT_BATTOR_SAMPLE_CONVERTER_H_ | 45 #endif // TOOLS_BATTOR_AGENT_BATTOR_SAMPLE_CONVERTER_H_ |
OLD | NEW |