-
Notifications
You must be signed in to change notification settings - Fork 55
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Added interface for message handling
* DataTransferInterface inherits from this MessageHandlerInterface Signed-off-by: Piet Gömpel <[email protected]>
- Loading branch information
Showing
6 changed files
with
214 additions
and
131 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
// SPDX-License-Identifier: Apache-2.0 | ||
// Copyright Pionix GmbH and Contributors to EVerest | ||
|
||
#pragma once | ||
|
||
#include <ocpp/common/message_queue.hpp> | ||
|
||
namespace ocpp { | ||
namespace v201 { | ||
|
||
/// \brief Interface for handling OCPP2.0.1 CALL messages from the CSMS. Classes implementing a functional block shall | ||
/// extend this interface. | ||
class MessageHandlerInterface { | ||
|
||
public: | ||
virtual ~MessageHandlerInterface() { | ||
} | ||
/// \brief Handles the given \p message from the CSMS. This includes dispatching a CALLRESULT as a response to the | ||
/// incoming \p message . | ||
/// @param message | ||
virtual void handle_message(const EnhancedMessage<MessageType>& message) = 0; | ||
}; | ||
|
||
class MessageTypeNotImplementedException : public std::exception { | ||
private: | ||
std::string message; | ||
|
||
public: | ||
MessageTypeNotImplementedException(MessageType message_type) : | ||
message("Message is not implemented: " + conversions::messagetype_to_string(message_type)) { | ||
} | ||
|
||
const char* what() const noexcept override { | ||
return message.c_str(); | ||
} | ||
}; | ||
|
||
} // namespace v201 | ||
} // namespace ocpp |
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.