| Hridya Valsaraju | dea91b4 | 2018-07-17 11:14:01 -0700 | [diff] [blame] | 1 | /* | 
|  | 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 |  | 
| JeiFeng Lee | ba11730 | 2019-10-23 13:20:41 +0800 | [diff] [blame] | 22 | constexpr unsigned int kMaxDownloadSizeDefault = 0x10000000; | 
| Hridya Valsaraju | aae84e8 | 2018-10-08 13:10:25 -0700 | [diff] [blame] | 23 |  | 
| Hridya Valsaraju | dea91b4 | 2018-07-17 11:14:01 -0700 | [diff] [blame] | 24 | class FastbootDevice; | 
|  | 25 |  | 
|  | 26 | enum class FastbootResult { | 
|  | 27 | OKAY, | 
|  | 28 | FAIL, | 
|  | 29 | INFO, | 
|  | 30 | DATA, | 
|  | 31 | }; | 
|  | 32 |  | 
|  | 33 | // Execute a command with the given arguments (possibly empty). | 
|  | 34 | using CommandHandler = std::function<bool(FastbootDevice*, const std::vector<std::string>&)>; | 
|  | 35 |  | 
|  | 36 | bool DownloadHandler(FastbootDevice* device, const std::vector<std::string>& args); | 
|  | 37 | bool SetActiveHandler(FastbootDevice* device, const std::vector<std::string>& args); | 
|  | 38 | bool ShutDownHandler(FastbootDevice* device, const std::vector<std::string>& args); | 
|  | 39 | bool RebootHandler(FastbootDevice* device, const std::vector<std::string>& args); | 
|  | 40 | bool RebootBootloaderHandler(FastbootDevice* device, const std::vector<std::string>& args); | 
|  | 41 | bool RebootFastbootHandler(FastbootDevice* device, const std::vector<std::string>& args); | 
|  | 42 | bool RebootRecoveryHandler(FastbootDevice* device, const std::vector<std::string>& args); | 
| Hridya Valsaraju | 31d2c26 | 2018-07-20 13:35:50 -0700 | [diff] [blame] | 43 | bool GetVarHandler(FastbootDevice* device, const std::vector<std::string>& args); | 
| David Anderson | 12211d1 | 2018-07-24 15:21:20 -0700 | [diff] [blame] | 44 | bool EraseHandler(FastbootDevice* device, const std::vector<std::string>& args); | 
|  | 45 | bool FlashHandler(FastbootDevice* device, const std::vector<std::string>& args); | 
| David Anderson | 0d4277d | 2018-07-31 13:27:37 -0700 | [diff] [blame] | 46 | bool CreatePartitionHandler(FastbootDevice* device, const std::vector<std::string>& args); | 
|  | 47 | bool DeletePartitionHandler(FastbootDevice* device, const std::vector<std::string>& args); | 
|  | 48 | bool ResizePartitionHandler(FastbootDevice* device, const std::vector<std::string>& args); | 
| David Anderson | 38b3c7a | 2018-08-15 16:27:42 -0700 | [diff] [blame] | 49 | bool UpdateSuperHandler(FastbootDevice* device, const std::vector<std::string>& args); | 
| Hridya Valsaraju | a15fe31 | 2018-09-14 13:58:21 -0700 | [diff] [blame] | 50 | bool OemCmdHandler(FastbootDevice* device, const std::vector<std::string>& args); | 
| David Anderson | 1d504e3 | 2019-01-15 14:38:20 -0800 | [diff] [blame] | 51 | bool GsiHandler(FastbootDevice* device, const std::vector<std::string>& args); | 
| David Anderson | ab8f466 | 2019-10-21 16:45:59 -0700 | [diff] [blame] | 52 | bool SnapshotUpdateHandler(FastbootDevice* device, const std::vector<std::string>& args); |