blob: f3323a8b5e285cd3c89ea2a366ec20d03a02ab8f [file] [log] [blame]
George Liu073a6532021-10-25 14:40:03 +08001#pragma once
2
3#include <phosphor-logging/lg2.hpp>
4
5#include <filesystem>
6
7namespace phosphor
8{
9namespace usb
10{
11namespace fs = std::filesystem;
12
13class 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