George Liu | 073a653 | 2021-10-25 14:40:03 +0800 | [diff] [blame] | 1 | #pragma once |
| 2 | |
| 3 | #include <phosphor-logging/lg2.hpp> |
| 4 | |
| 5 | #include <filesystem> |
| 6 | |
| 7 | namespace phosphor |
| 8 | { |
| 9 | namespace usb |
| 10 | { |
| 11 | namespace fs = std::filesystem; |
| 12 | |
| 13 | class USBManager |
| 14 | { |
| 15 | public: |
| 16 | ~USBManager() = default; |
| 17 | USBManager() = delete; |
| 18 | USBManager(const USBManager&) = delete; |
| 19 | USBManager(USBManager&&) = default; |
| 20 | USBManager& operator=(const USBManager&) = delete; |
| 21 | USBManager& operator=(USBManager&&) = default; |
| 22 | |
| 23 | explicit USBManager(const fs::path& path) : usbPath(path) |
| 24 | {} |
| 25 | |
| 26 | /** @brief Find the first file with a .tar extension according to the USB |
| 27 | * file path. |
| 28 | * |
| 29 | * @return Success or Fail |
| 30 | */ |
| 31 | bool run(); |
| 32 | |
| 33 | private: |
| 34 | /** The USB path detected. */ |
| 35 | const fs::path& usbPath; |
| 36 | }; |
| 37 | |
| 38 | } // namespace usb |
| 39 | } // namespace phosphor |