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

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

Issue 2826913002: [BattOr] Retry battor_agent commands when they fail. (Closed)
Patch Set: Addressed Charlie's comments Created 3 years, 7 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 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 // Actions required for returning firmware git hash. 119 // Actions required for returning firmware git hash.
120 SEND_GIT_HASH_REQUEST, 120 SEND_GIT_HASH_REQUEST,
121 READ_GIT_HASH, 121 READ_GIT_HASH,
122 }; 122 };
123 123
124 // Performs an action. 124 // Performs an action.
125 void PerformAction(Action action); 125 void PerformAction(Action action);
126 // Performs an action after a delay. 126 // Performs an action after a delay.
127 void PerformDelayedAction(Action action, base::TimeDelta delay); 127 void PerformDelayedAction(Action action, base::TimeDelta delay);
128 128
129
130
131 // Requests a connection to the BattOr. 129 // Requests a connection to the BattOr.
132 void BeginConnect(); 130 void BeginConnect();
133 131
134 // Sends a control message over the connection. 132 // Sends a control message over the connection.
135 void SendControlMessage(BattOrControlMessageType type, 133 void SendControlMessage(BattOrControlMessageType type,
136 uint16_t param1, 134 uint16_t param1,
137 uint16_t param2); 135 uint16_t param2);
138 136
137 // Retry the last command.
138 void RetryCommand();
139
139 // Completes the command with the specified error. 140 // Completes the command with the specified error.
140 void CompleteCommand(BattOrError error); 141 void CompleteCommand(BattOrError error);
141 142
142 // Returns a formatted version of samples_ with timestamps and real units. 143 // Returns a formatted version of samples_ with timestamps and real units.
143 std::string SamplesToString(); 144 std::string SamplesToString();
144 145
146 // Sets and restarts the action timeout timer.
147 void setActionTimeout(const uint16_t timeout_seconds);
charliea (OOO until 10-5) 2017/05/15 19:03:10 s/setActionTimeout/SetActionTimeout
charliea (OOO until 10-5) 2017/05/15 19:03:10 nit: for consistency, maybe just use uint16_t (see
aschulman 2017/05/15 22:26:25 Done.
aschulman 2017/05/15 22:26:25 Done.
148
145 // The listener that handles the commands' results. It must outlive the agent. 149 // The listener that handles the commands' results. It must outlive the agent.
146 Listener* listener_; 150 Listener* listener_;
147 151
148 // The last action executed by the agent. This should only be updated in 152 // The last action executed by the agent. This should only be updated in
149 // PerformAction(). 153 // PerformAction().
150 Action last_action_; 154 Action last_action_;
151 155
152 // The tracing command currently being executed by the agent. 156 // The tracing command currently being executed by the agent.
153 Command command_; 157 Command command_;
154 158
(...skipping 18 matching lines...) Expand all
173 // The first frame (required for calibration). 177 // The first frame (required for calibration).
174 std::vector<RawBattOrSample> calibration_frame_; 178 std::vector<RawBattOrSample> calibration_frame_;
175 179
176 // The actual data samples recorded. 180 // The actual data samples recorded.
177 std::vector<RawBattOrSample> samples_; 181 std::vector<RawBattOrSample> samples_;
178 182
179 // The expected sequence number of the next frame. We use this to ensure that 183 // The expected sequence number of the next frame. We use this to ensure that
180 // we receive frames in order. 184 // we receive frames in order.
181 uint32_t next_sequence_number_; 185 uint32_t next_sequence_number_;
182 186
183 // The number of times we've attempted to init the BattOr. 187 // The number of times we've attempted a command.
184 uint8_t num_init_attempts_; 188 uint8_t num_command_attempts_;
185
186 // The number of times we've attempted the BattOr StartTracing command.
187 uint8_t num_start_tracing_attempts_;
188
189 // The number of times that we've attempted to read the last message.
190 uint8_t num_read_attempts_;
191 189
192 // The timeout that's run when an action times out. 190 // The timeout that's run when an action times out.
193 base::CancelableClosure timeout_callback_; 191 base::CancelableClosure timeout_callback_;
194 192
195 // The git hash of the BattOr firmware. 193 // The git hash of the BattOr firmware.
196 std::string firmware_git_hash_; 194 std::string firmware_git_hash_;
197 195
198 DISALLOW_COPY_AND_ASSIGN(BattOrAgent); 196 DISALLOW_COPY_AND_ASSIGN(BattOrAgent);
199 }; 197 };
200 198
201 } // namespace battor 199 } // namespace battor
202 200
203 #endif // TOOLS_BATTOR_AGENT_BATTOR_AGENT_H_ 201 #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