/src/hothd/host_command_interface.hpp
Line | Count | Source |
1 | | // Copyright 2024 Google LLC |
2 | | // |
3 | | // Licensed under the Apache License, Version 2.0 (the "License"); |
4 | | // you may not use this file except in compliance with the License. |
5 | | // You may obtain a copy of the License at |
6 | | // |
7 | | // http://www.apache.org/licenses/LICENSE-2.0 |
8 | | // |
9 | | // Unless required by applicable law or agreed to in writing, software |
10 | | // distributed under the License is distributed on an "AS IS" BASIS, |
11 | | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
12 | | // See the License for the specific language governing permissions and |
13 | | // limitations under the License. |
14 | | |
15 | | #pragma once |
16 | | |
17 | | #include <chrono> |
18 | | #include <cstdint> |
19 | | #include <future> |
20 | | #include <vector> |
21 | | |
22 | | namespace google |
23 | | { |
24 | | namespace hoth |
25 | | { |
26 | | namespace internal |
27 | | { |
28 | | |
29 | | /** @class HostCommand |
30 | | * @brief Overridable HostCommand methods |
31 | | */ |
32 | | class HostCommand |
33 | | { |
34 | | public: |
35 | 0 | virtual ~HostCommand() = default; |
36 | | virtual std::vector<uint8_t> sendCommand( |
37 | | const std::vector<uint8_t>& command) = 0; |
38 | | virtual std::vector<uint8_t> sendCommand( |
39 | | const std::vector<uint8_t>& command, |
40 | | std::chrono::milliseconds timeout) = 0; |
41 | | virtual std::vector<uint8_t> sendCommand( |
42 | | uint16_t command, uint8_t commandVersion, const void* request, |
43 | | size_t requestSize) = 0; |
44 | | virtual std::vector<uint8_t> sendCommand( |
45 | | uint16_t command, uint8_t commandVersion, const void* request, |
46 | | size_t requestSize, std::chrono::milliseconds timeout) = 0; |
47 | | virtual uint64_t sendCommandAsync(const std::vector<uint8_t>& command) = 0; |
48 | | virtual std::vector<uint8_t> getResponse(uint64_t callToken) = 0; |
49 | | virtual bool communicationFailure() const = 0; |
50 | | virtual int collectHothLogsAsync(bool cleanupPromiseAfterExecution) = 0; |
51 | | |
52 | | virtual void collectUartLogsAsync() = 0; |
53 | | |
54 | | virtual void stopUartLogs() = 0; |
55 | | }; |
56 | | |
57 | | } // namespace internal |
58 | | |
59 | | } // namespace hoth |
60 | | |
61 | | } // namespace google |