Woman, Life, Freedom


Adaptive AUTOSAR
ARA public interface header documentation
state_management.h
1#ifndef STATE_MANAGEMENT_H
2#define STATE_MANAGEMENT_H
3
4#include "../../ara/com/someip/rpc/socket_rpc_client.h"
5#include "../../ara/exec/helper/modelled_process.h"
6#include "../../ara/exec/deterministic_client.h"
7#include "../../ara/exec/state_client.h"
8#include "../helper/rpc_configuration.h"
9
10namespace application
11{
12 namespace platform
13 {
16 {
17 private:
18 static const std::string cAppId;
19
20 std::vector<ara::exec::FunctionGroup> mFunctionGroups;
21 std::vector<ara::exec::FunctionGroupState> mFunctionGroupStates;
22 ara::core::InstanceSpecifier mInstanceSpecifier;
23
24 static helper::RpcConfiguration getRpcConfiguration(
25 const std::string &configFilepath);
26
27 void configureStates(
28 const ara::exec::FunctionGroup &functionGroup,
29 std::string &&functionGroupContent);
30
31 void configureFunctionGroups(const std::string &configFilepath);
32
33 void onUndefinedState(const ara::exec::ExecutionErrorEvent &event);
34
35 void reportExecutionState(
37
38 std::shared_future<void> transitToStartUpState(
39 ara::exec::StateClient &stateClient);
40
41 template <class Future>
42 void checkFuture(Future &future, std::string &&message)
43 {
44 const std::chrono::seconds cDuration{0};
45
46 if (future.valid())
47 {
48 try
49 {
50 std::future_status _status{future.wait_for(cDuration)};
51
52 if (_status == std::future_status::ready)
53 {
54 future.get();
55 future = Future{};
56
57 ara::log::LogStream _logStream;
58 _logStream << message;
59 Log(cLogLevel, _logStream);
60 }
61 }
62 catch (const ara::exec::ExecException &ex)
63 {
64 throw std::runtime_error(ex.what());
65 }
66 }
67 }
68
69 protected:
70 int Main(
71 const std::atomic_bool *cancellationToken,
72 const std::map<std::string, std::string> &arguments) override;
73
74 public:
77 explicit StateManagement(AsyncBsdSocketLib::Poller *poller);
78 };
79 }
80}
81
82#endif
State managment modelled process.
Definition: state_management.h:16
int Main(const std::atomic_bool *cancellationToken, const std::map< std::string, std::string > &arguments) override
Main running block of the process.
Definition: state_management.cpp:142
StateManagement(AsyncBsdSocketLib::Poller *poller)
Constructor.
Definition: state_management.cpp:12
SOME/IP RPC abstract client.
Definition: rpc_client.h:20
AUTOSAR shortname-path wrapper.
Definition: instance_specifier.h:14
Execution Management exception.
Definition: exec_exception.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
A class that models an instance of an Adaptive (Platform) Application executable.
Definition: modelled_process.h:20
void Log(log::LogLevel logLevel, const log::LogStream &logStream)
Log a steam.
Definition: modelled_process.cpp:23
static const log::LogLevel cLogLevel
Information severity log level.
Definition: modelled_process.h:34
A stream pipeline to combine log entities.
Definition: log_stream.h:17
AUTOSAR application namespace.
Definition: diag_message_handler.cpp:5
Data model for a remote procedure call connection configuration.
Definition: rpc_configuration.h:22
Undefined Function Group State event argument.
Definition: execution_error_event.h:15