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

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

Issue 2390893002: [BattOr] Make BattOr able to return firmware version. (Closed)
Patch Set: Start Work On Getting Git Hash Created 4 years, 2 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
« no previous file with comments | « no previous file | tools/battor_agent/battor_agent.cc » ('j') | tools/battor_agent/battor_agent.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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_AGENT_H_ 5 #ifndef TOOLS_BATTOR_AGENT_BATTOR_AGENT_H_
6 #define TOOLS_BATTOR_AGENT_BATTOR_AGENT_H_ 6 #define TOOLS_BATTOR_AGENT_BATTOR_AGENT_H_
7 7
8 #include <map> 8 #include <map>
9 9
10 #include "base/cancelable_callback.h" 10 #include "base/cancelable_callback.h"
(...skipping 25 matching lines...) Expand all
36 public base::SupportsWeakPtr<BattOrAgent> { 36 public base::SupportsWeakPtr<BattOrAgent> {
37 public: 37 public:
38 // The listener interface that must be implemented in order to interact with 38 // The listener interface that must be implemented in order to interact with
39 // the BattOrAgent. 39 // the BattOrAgent.
40 class Listener { 40 class Listener {
41 public: 41 public:
42 virtual void OnStartTracingComplete(BattOrError error) = 0; 42 virtual void OnStartTracingComplete(BattOrError error) = 0;
43 virtual void OnStopTracingComplete(const std::string& trace, 43 virtual void OnStopTracingComplete(const std::string& trace,
44 BattOrError error) = 0; 44 BattOrError error) = 0;
45 virtual void OnRecordClockSyncMarkerComplete(BattOrError error) = 0; 45 virtual void OnRecordClockSyncMarkerComplete(BattOrError error) = 0;
46 virtual void OnGetVersionComplete(const int version, BattOrError error) = 0;
46 }; 47 };
47 48
48 BattOrAgent( 49 BattOrAgent(
49 const std::string& path, 50 const std::string& path,
50 Listener* listener, 51 Listener* listener,
51 scoped_refptr<base::SingleThreadTaskRunner> file_thread_task_runner, 52 scoped_refptr<base::SingleThreadTaskRunner> file_thread_task_runner,
52 scoped_refptr<base::SingleThreadTaskRunner> ui_thread_task_runner); 53 scoped_refptr<base::SingleThreadTaskRunner> ui_thread_task_runner);
53 virtual ~BattOrAgent(); 54 virtual ~BattOrAgent();
54 55
55 void StartTracing(); 56 void StartTracing();
56 void StopTracing(); 57 void StopTracing();
57 void RecordClockSyncMarker(const std::string& marker); 58 void RecordClockSyncMarker(const std::string& marker);
59 void GetVersion();
58 60
59 // Returns whether the BattOr is able to record clock sync markers in its own 61 // Returns whether the BattOr is able to record clock sync markers in its own
60 // trace log. 62 // trace log.
61 static bool SupportsExplicitClockSync() { return true; } 63 static bool SupportsExplicitClockSync() { return true; }
62 64
63 // BattOrConnection::Listener implementation. 65 // BattOrConnection::Listener implementation.
64 void OnConnectionOpened(bool success) override; 66 void OnConnectionOpened(bool success) override;
65 void OnBytesSent(bool success) override; 67 void OnBytesSent(bool success) override;
66 void OnMessageRead(bool success, 68 void OnMessageRead(bool success,
67 BattOrMessageType type, 69 BattOrMessageType type,
(...skipping 10 matching lines...) Expand all
78 // testing task runner that runs delayed tasks immediately deals poorly with 80 // testing task runner that runs delayed tasks immediately deals poorly with
79 // timeouts posted as future tasks. 81 // timeouts posted as future tasks.
80 virtual void OnActionTimeout(); 82 virtual void OnActionTimeout();
81 83
82 private: 84 private:
83 enum class Command { 85 enum class Command {
84 INVALID, 86 INVALID,
85 START_TRACING, 87 START_TRACING,
86 STOP_TRACING, 88 STOP_TRACING,
87 RECORD_CLOCK_SYNC_MARKER, 89 RECORD_CLOCK_SYNC_MARKER,
90 GET_VERSION,
88 }; 91 };
89 92
90 enum class Action { 93 enum class Action {
91 INVALID, 94 INVALID,
92 95
93 // Actions required to connect to a BattOr. 96 // Actions required to connect to a BattOr.
94 REQUEST_CONNECTION, 97 REQUEST_CONNECTION,
95 98
96 // Actions required for starting tracing. 99 // Actions required for starting tracing.
97 SEND_INIT, 100 SEND_INIT,
98 READ_INIT_ACK, 101 READ_INIT_ACK,
99 SEND_SET_GAIN, 102 SEND_SET_GAIN,
100 READ_SET_GAIN_ACK, 103 READ_SET_GAIN_ACK,
101 SEND_START_TRACING, 104 SEND_START_TRACING,
102 READ_START_TRACING_ACK, 105 READ_START_TRACING_ACK,
103 106
104 // Actions required for stopping tracing. 107 // Actions required for stopping tracing.
105 SEND_EEPROM_REQUEST, 108 SEND_EEPROM_REQUEST,
106 READ_EEPROM, 109 READ_EEPROM,
107 SEND_SAMPLES_REQUEST, 110 SEND_SAMPLES_REQUEST,
108 READ_CALIBRATION_FRAME, 111 READ_CALIBRATION_FRAME,
109 READ_DATA_FRAME, 112 READ_DATA_FRAME,
110 113
111 // Actions required for recording a clock sync marker. 114 // Actions required for recording a clock sync marker.
112 SEND_CURRENT_SAMPLE_REQUEST, 115 SEND_CURRENT_SAMPLE_REQUEST,
113 READ_CURRENT_SAMPLE, 116 READ_CURRENT_SAMPLE,
117
118 // Actions required for checking firmware version.
119 SEND_GIT_HASH_REQUEST,
120 READ_GIT_HASH,
114 }; 121 };
115 122
116 // Performs an action. 123 // Performs an action.
117 void PerformAction(Action action); 124 void PerformAction(Action action);
118 // Performs an action after a delay. 125 // Performs an action after a delay.
119 void PerformDelayedAction(Action action, base::TimeDelta delay); 126 void PerformDelayedAction(Action action, base::TimeDelta delay);
120 127
121 128
122 129
123 // Requests a connection to the BattOr. 130 // Requests a connection to the BattOr.
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 187
181 // The timeout that's run when an action times out. 188 // The timeout that's run when an action times out.
182 base::CancelableClosure timeout_callback_; 189 base::CancelableClosure timeout_callback_;
183 190
184 DISALLOW_COPY_AND_ASSIGN(BattOrAgent); 191 DISALLOW_COPY_AND_ASSIGN(BattOrAgent);
185 }; 192 };
186 193
187 } // namespace battor 194 } // namespace battor
188 195
189 #endif // TOOLS_BATTOR_AGENT_BATTOR_AGENT_H_ 196 #endif // TOOLS_BATTOR_AGENT_BATTOR_AGENT_H_
OLDNEW
« no previous file with comments | « no previous file | tools/battor_agent/battor_agent.cc » ('j') | tools/battor_agent/battor_agent.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698