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

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

Issue 2826913002: [BattOr] Retry battor_agent commands when they fail. (Closed)
Patch Set: Doubled retry attempts (each StopTracing attempt requires two retries) Created 3 years, 8 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
145 // The listener that handles the commands' results. It must outlive the agent. 146 // The listener that handles the commands' results. It must outlive the agent.
146 Listener* listener_; 147 Listener* listener_;
147 148
148 // The last action executed by the agent. This should only be updated in 149 // The last action executed by the agent. This should only be updated in
(...skipping 24 matching lines...) Expand all
173 // The first frame (required for calibration). 174 // The first frame (required for calibration).
174 std::vector<RawBattOrSample> calibration_frame_; 175 std::vector<RawBattOrSample> calibration_frame_;
175 176
176 // The actual data samples recorded. 177 // The actual data samples recorded.
177 std::vector<RawBattOrSample> samples_; 178 std::vector<RawBattOrSample> samples_;
178 179
179 // The expected sequence number of the next frame. We use this to ensure that 180 // The expected sequence number of the next frame. We use this to ensure that
180 // we receive frames in order. 181 // we receive frames in order.
181 uint32_t next_sequence_number_; 182 uint32_t next_sequence_number_;
182 183
183 // The number of times we've attempted to init the BattOr. 184 // The number of times we've attempted a command.
184 uint8_t num_init_attempts_; 185 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 186
192 // The timeout that's run when an action times out. 187 // The timeout that's run when an action times out.
193 base::CancelableClosure timeout_callback_; 188 base::CancelableClosure timeout_callback_;
194 189
195 // The git hash of the BattOr firmware. 190 // The git hash of the BattOr firmware.
196 std::string firmware_git_hash_; 191 std::string firmware_git_hash_;
197 192
198 DISALLOW_COPY_AND_ASSIGN(BattOrAgent); 193 DISALLOW_COPY_AND_ASSIGN(BattOrAgent);
199 }; 194 };
200 195
201 } // namespace battor 196 } // namespace battor
202 197
203 #endif // TOOLS_BATTOR_AGENT_BATTOR_AGENT_H_ 198 #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