-
Notifications
You must be signed in to change notification settings - Fork 90
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature/evsemanager persistent transactions #789
Merged
Merged
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
81b8b8b
Remove get_hardware_capablities() and 1ph3ph switching support
corneliusclaussen e12828d
Cleanup dangling transactions on startup
corneliusclaussen c8f6de7
* Added SessionEventEnum SessionResumed to allow the evse_manager to …
Pietfried 3fdf4c1
update dependency of libocpp
Pietfried 5e58c82
Fix LEM tests
florinmihut 5e391ee
Update dependencies.yaml
Pietfried e649af2
clang format
Pietfried 2018b4e
Fix lint error
florinmihut e15a571
fix issues during rebase
Pietfried 86ad055
update libevse-security dependency
Pietfried 3d1328e
moved to signal_session_resumed_event in Charger.hpp
Pietfried 50bab3f
clang format
Pietfried f28d68f
Update dependencies.yaml
Pietfried 2741ff4
Merge branch 'main' into feature/evsemanager_persistent_transactions
Pietfried File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
// SPDX-License-Identifier: Apache-2.0 | ||
// Copyright 2023 Pionix GmbH and Contributors to EVerest | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 2024 or leave the date out entirely |
||
|
||
#include "PersistentStore.hpp" | ||
|
||
namespace module { | ||
|
||
PersistentStore::PersistentStore(const std::vector<std::unique_ptr<kvsIntf>>& _r_store, const std::string module_id) : | ||
r_store(_r_store) { | ||
|
||
if (r_store.size() > 0) { | ||
active = true; | ||
} | ||
|
||
session_key = module_id + "_session"; | ||
} | ||
|
||
void PersistentStore::store_session(const std::string& session_uuid) { | ||
if (active) { | ||
r_store[0]->call_store(session_key, session_uuid); | ||
} | ||
} | ||
|
||
void PersistentStore::clear_session() { | ||
if (active) { | ||
r_store[0]->call_store(session_key, ""); | ||
} | ||
} | ||
|
||
std::string PersistentStore::get_session() { | ||
if (active) { | ||
auto r = r_store[0]->call_load(session_key); | ||
try { | ||
if (std::holds_alternative<std::string>(r)) { | ||
return std::get<std::string>(r); | ||
} | ||
} catch (...) { | ||
return {}; | ||
} | ||
} | ||
return {}; | ||
} | ||
|
||
} // namespace module |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
// SPDX-License-Identifier: Apache-2.0 | ||
// Copyright 2020 - 2021 Pionix GmbH and Contributors to EVerest | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 2024 or leave out entirely |
||
|
||
/* | ||
The Persistent Store class is an abstraction layer to store any persistent information | ||
(such as sessions) for the EvseManager. | ||
*/ | ||
|
||
#ifndef EVSE_MANAGER_PERSISTENT_STORE_H_ | ||
#define EVSE_MANAGER_PERSISTENT_STORE_H_ | ||
|
||
#include <generated/interfaces/kvs/Interface.hpp> | ||
|
||
namespace module { | ||
|
||
class PersistentStore { | ||
public: | ||
// We need the r_bsp reference to be able to talk to the bsp driver module | ||
explicit PersistentStore(const std::vector<std::unique_ptr<kvsIntf>>& r_store, const std::string module_id); | ||
|
||
void store_session(const std::string& session_uuid); | ||
void clear_session(); | ||
std::string get_session(); | ||
|
||
private: | ||
const std::vector<std::unique_ptr<kvsIntf>>& r_store; | ||
std::string session_key; | ||
bool active{false}; | ||
}; | ||
|
||
} // namespace module | ||
|
||
#endif // EVSE_MANAGER_PERSISTENT_STORE_H_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TODO: update dependencies