2018-04-03 15:11:06 +00:00
|
|
|
#pragma once
|
2018-04-20 00:35:05 +00:00
|
|
|
#include "Message.h"
|
2018-04-03 15:11:06 +00:00
|
|
|
#include "MessageTemplate.h"
|
|
|
|
#include <cstdint>
|
|
|
|
#include <string>
|
|
|
|
#include <vector>
|
|
|
|
#include <map>
|
|
|
|
|
|
|
|
namespace ki
|
|
|
|
{
|
|
|
|
namespace protocol
|
|
|
|
{
|
|
|
|
namespace dml
|
|
|
|
{
|
|
|
|
class MessageModule
|
|
|
|
{
|
|
|
|
public:
|
2018-04-05 16:36:26 +00:00
|
|
|
MessageModule(uint8_t service_id = 0, std::string protocol_type = "");
|
2018-04-03 15:11:06 +00:00
|
|
|
~MessageModule();
|
|
|
|
|
|
|
|
uint8_t get_service_id() const;
|
|
|
|
void set_service_id(uint8_t service_id);
|
|
|
|
|
|
|
|
std::string get_protocol_type() const;
|
|
|
|
void set_protocol_type(std::string protocol_type);
|
|
|
|
|
|
|
|
std::string get_protocol_desription() const;
|
|
|
|
void set_protocol_description(std::string protocol_description);
|
|
|
|
|
2020-12-16 06:36:51 +00:00
|
|
|
void add_message_template(MessageTemplate *message_template, bool auto_sort = false);
|
2018-04-06 03:14:37 +00:00
|
|
|
const MessageTemplate *add_message_template(std::string name,
|
|
|
|
ki::dml::Record *record, bool auto_sort = true);
|
2018-04-05 16:36:26 +00:00
|
|
|
const MessageTemplate *get_message_template(uint8_t type) const;
|
|
|
|
const MessageTemplate *get_message_template(std::string name) const;
|
2018-04-03 15:11:06 +00:00
|
|
|
|
2018-04-06 02:07:35 +00:00
|
|
|
void sort_lookup();
|
|
|
|
|
2020-12-07 00:09:51 +00:00
|
|
|
virtual Message *create_message(uint8_t message_type) const;
|
|
|
|
virtual Message *create_message(std::string message_name) const;
|
2018-04-03 15:11:06 +00:00
|
|
|
private:
|
|
|
|
uint8_t m_service_id;
|
|
|
|
std::string m_protocol_type;
|
|
|
|
std::string m_protocol_description;
|
2018-04-05 16:36:26 +00:00
|
|
|
uint8_t m_last_message_type;
|
2018-04-03 15:11:06 +00:00
|
|
|
|
2018-04-06 02:07:35 +00:00
|
|
|
std::vector<MessageTemplate *> m_templates;
|
|
|
|
std::map<uint8_t, MessageTemplate *> m_message_type_map;
|
2018-04-03 15:11:06 +00:00
|
|
|
std::map<std::string, MessageTemplate *> m_message_name_map;
|
|
|
|
};
|
|
|
|
|
|
|
|
typedef std::vector<MessageModule *> MessageModuleList;
|
|
|
|
typedef std::map<uint8_t, MessageModule *> MessageModuleServiceIdMap;
|
|
|
|
typedef std::map<std::string, MessageModule *> MessageModuleProtocolTypeMap;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|