8#include "../com/someip/rpc/rpc_server.h"
9#include "../sm/trigger.h"
10#include "./exec_exception.h"
22 const uint16_t cServiceId{3};
23 const uint16_t cSetStateId{1};
24 const uint16_t cStateTransitionId{2};
27 const std::set<std::pair<std::string, std::string>> mFunctionGroupStates;
28 std::map<std::string, sm::Trigger<std::string> *> mNotifiers;
29 std::map<std::string, std::string> mCurrentStates;
30 std::atomic_bool mInitialized;
34 std::vector<uint8_t> &payload,
ExecErrc errorCode);
36 void notify(std::string functionGroup, std::string state);
39 const std::vector<uint8_t> &rpcRequestPayload,
40 std::vector<uint8_t> &rpcResponsePayload);
42 bool handleStateTransition(
43 const std::vector<uint8_t> &rpcRequestPayload,
44 std::vector<uint8_t> &rpcResponsePayload);
55 std::set<std::pair<std::string, std::string>> &&functionGroupStates,
56 std::map<std::string, std::string> &&initialStates);
64 std::string functionGroup, std::string &state);
71 std::string functionGroup, std::function<
void()> callback);
SOME/IP RPC server.
Definition: rpc_server.h:23
A class to handle the state client requests at the EM side.
Definition: state_server.h:20
StateServer(com::someip::rpc::RpcServer *rpcServer, std::set< std::pair< std::string, std::string > > &&functionGroupStates, std::map< std::string, std::string > &&initialStates)
Constructor.
Definition: state_server.cpp:7
bool Initialized() const noexcept
Indicate whether or not EM has been initialized.
Definition: state_server.cpp:231
void SetNotifier(std::string functionGroup, std::function< void()> callback)
Set a notifier at the state changed of a function group.
Definition: state_server.cpp:212
bool TryGetState(std::string functionGroup, std::string &state)
Try to get the state of a function group.
Definition: state_server.cpp:189
ExecErrc
Execution Management error codes.
Definition: exec_error_domain.h:13