Patrick Venture | af69625 | 2018-12-11 10:22:14 -0800 | [diff] [blame] | 1 | #pragma once |
| 2 | |
Patrick Venture | 84778b8 | 2019-06-26 20:11:09 -0700 | [diff] [blame] | 3 | #include "flags.hpp" |
Patrick Venture | cf9b219 | 2019-06-27 12:09:52 -0700 | [diff] [blame] | 4 | #include "progress.hpp" |
Patrick Venture | 8a55dcb | 2018-12-12 21:12:58 -0800 | [diff] [blame] | 5 | |
Willy Tu | 3f59628 | 2024-04-12 16:27:17 +0000 | [diff] [blame] | 6 | #include <chrono> |
Patrick Venture | af69625 | 2018-12-11 10:22:14 -0800 | [diff] [blame] | 7 | #include <cstdint> |
| 8 | #include <string> |
Willy Tu | 3f59628 | 2024-04-12 16:27:17 +0000 | [diff] [blame] | 9 | #include <thread> |
Patrick Venture | af69625 | 2018-12-11 10:22:14 -0800 | [diff] [blame] | 10 | |
Patrick Venture | 9b534f0 | 2018-12-13 16:10:02 -0800 | [diff] [blame] | 11 | namespace host_tool |
| 12 | { |
| 13 | |
Patrick Venture | af69625 | 2018-12-11 10:22:14 -0800 | [diff] [blame] | 14 | class DataInterface |
| 15 | { |
| 16 | public: |
| 17 | virtual ~DataInterface() = default; |
| 18 | |
| 19 | /** |
| 20 | * Given an open session to either /flash/image, /flash/tarball, or |
| 21 | * /flash/hash, this method will configure, and send the data, but not close |
| 22 | * the session. |
| 23 | * |
| 24 | * @param[in] input - path to file to send. |
| 25 | * @param[in] session - the session ID to use. |
| 26 | * @return bool on success. |
| 27 | */ |
| 28 | virtual bool sendContents(const std::string& input, |
| 29 | std::uint16_t session) = 0; |
Patrick Venture | 8a55dcb | 2018-12-12 21:12:58 -0800 | [diff] [blame] | 30 | |
Willy Tu | 3f59628 | 2024-04-12 16:27:17 +0000 | [diff] [blame] | 31 | virtual void waitForRetry() |
| 32 | { |
| 33 | std::this_thread::sleep_for(std::chrono::seconds(1)); |
| 34 | } |
| 35 | |
Patrick Venture | 8a55dcb | 2018-12-12 21:12:58 -0800 | [diff] [blame] | 36 | /** |
| 37 | * Return the supported data interface for this. |
| 38 | * |
| 39 | * @return the enum value corresponding to the supported type. |
| 40 | */ |
Patrick Venture | 84778b8 | 2019-06-26 20:11:09 -0700 | [diff] [blame] | 41 | virtual ipmi_flash::FirmwareFlags::UpdateFlags supportedType() const = 0; |
Patrick Venture | af69625 | 2018-12-11 10:22:14 -0800 | [diff] [blame] | 42 | }; |
Patrick Venture | 9b534f0 | 2018-12-13 16:10:02 -0800 | [diff] [blame] | 43 | |
| 44 | } // namespace host_tool |