blob: afd6d08060db729da26eb593a42b694ec54ab5e6 [file] [log] [blame]
Hridya Valsarajudea91b42018-07-17 11:14:01 -07001/*
2 * Copyright (C) 2018 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16#pragma once
17
18#include <functional>
19#include <string>
20#include <vector>
21
Hridya Valsarajuaae84e82018-10-08 13:10:25 -070022constexpr unsigned int kMaxDownloadSizeDefault = 0x20000000;
23
Hridya Valsarajudea91b42018-07-17 11:14:01 -070024class FastbootDevice;
25
26enum class FastbootResult {
27 OKAY,
28 FAIL,
29 INFO,
30 DATA,
31};
32
33// Execute a command with the given arguments (possibly empty).
34using CommandHandler = std::function<bool(FastbootDevice*, const std::vector<std::string>&)>;
35
36bool DownloadHandler(FastbootDevice* device, const std::vector<std::string>& args);
37bool SetActiveHandler(FastbootDevice* device, const std::vector<std::string>& args);
38bool ShutDownHandler(FastbootDevice* device, const std::vector<std::string>& args);
39bool RebootHandler(FastbootDevice* device, const std::vector<std::string>& args);
40bool RebootBootloaderHandler(FastbootDevice* device, const std::vector<std::string>& args);
41bool RebootFastbootHandler(FastbootDevice* device, const std::vector<std::string>& args);
42bool RebootRecoveryHandler(FastbootDevice* device, const std::vector<std::string>& args);
Hridya Valsaraju31d2c262018-07-20 13:35:50 -070043bool GetVarHandler(FastbootDevice* device, const std::vector<std::string>& args);
David Anderson12211d12018-07-24 15:21:20 -070044bool EraseHandler(FastbootDevice* device, const std::vector<std::string>& args);
45bool FlashHandler(FastbootDevice* device, const std::vector<std::string>& args);
David Anderson0d4277d2018-07-31 13:27:37 -070046bool CreatePartitionHandler(FastbootDevice* device, const std::vector<std::string>& args);
47bool DeletePartitionHandler(FastbootDevice* device, const std::vector<std::string>& args);
48bool ResizePartitionHandler(FastbootDevice* device, const std::vector<std::string>& args);
David Anderson38b3c7a2018-08-15 16:27:42 -070049bool UpdateSuperHandler(FastbootDevice* device, const std::vector<std::string>& args);
Hridya Valsarajua15fe312018-09-14 13:58:21 -070050bool OemCmdHandler(FastbootDevice* device, const std::vector<std::string>& args);
David Anderson1d504e32019-01-15 14:38:20 -080051bool GsiHandler(FastbootDevice* device, const std::vector<std::string>& args);