Woman, Life, Freedom


Adaptive AUTOSAR
ARA public interface header documentation
state_client.h
1#ifndef STATE_CLIENT_H
2#define STATE_CLIENT_H
3
4#include <future>
5#include "../com/someip/rpc/rpc_client.h"
6#include "./execution_error_event.h"
7#include "./function_group_state.h"
8#include "./exec_exception.h"
9
10namespace ara
11{
12 namespace exec
13 {
15 class StateClient final
16 {
17 private:
18 static const ExecErrorDomain cErrorDomain;
19 const uint16_t cServiceId{3};
20 const uint16_t cSetStateId{1};
21 const uint16_t cStateTransition{2};
22 const uint16_t cClientId{4};
23
24 std::function<void(const ExecutionErrorEvent &)> mUndefinedStateCallback;
25 com::someip::rpc::RpcClient *const mRpcClient;
26 std::promise<void> mSetStatePromise;
27 std::shared_future<void> mSetStateFuture;
28 std::promise<void> mStateTransitionPromise;
29 std::shared_future<void> mStateTransitionFuture;
30
31 static void setPromiseException(
32 std::promise<void> &promise, ExecErrc executionErrorCode);
33
34 static void genericHandler(
35 std::promise<void> &promise,
37
38 void setStateHandler(
40
41 void stateTransitionHandler(
43
44 std::shared_future<void> getFuture(
45 std::promise<void> &promise,
46 uint16_t methodId,
47 const std::vector<uint8_t> &rpcPayload);
48
49 public:
54 std::function<void(const ExecutionErrorEvent &)> undefinedStateCallback,
56
57 StateClient() = delete;
58 ~StateClient() noexcept = default;
59
63 std::shared_future<void> SetState(const FunctionGroupState &state);
64
67 std::shared_future<void> GetInitialMachineStateTransitionResult();
68
73 const FunctionGroup &functionGroup) noexcept;
74 };
75 }
76}
77
78#endif
SOME/IP RPC abstract client.
Definition: rpc_client.h:20
SOME/IP remote procedure call message.
Definition: someip_rpc_message.h:16
A wrapper around the callee's return value and its possible error.
Definition: result.h:16
Execution Management ErrorDomain.
Definition: exec_error_domain.h:31
Class that links a function group to a certain state.
Definition: function_group_state.h:13
A function group representative based on a manifest.
Definition: function_group.h:14
Class the enables State Management to interact with Execution Management.
Definition: state_client.h:16
std::shared_future< void > GetInitialMachineStateTransitionResult()
Push the EM to its start-up state.
Definition: state_client.cpp:132
core::Result< ExecutionErrorEvent > GetExecutionError(const FunctionGroup &functionGroup) noexcept
Get the execution error made the state of function group undefined.
Definition: state_client.cpp:156
std::shared_future< void > SetState(const FunctionGroupState &state)
Set a function group state.
Definition: state_client.cpp:106
ExecErrc
Execution Management error codes.
Definition: exec_error_domain.h:13
Undefined Function Group State event argument.
Definition: execution_error_event.h:15