ADD: added controlmessage

This commit is contained in:
Henry Winkel
2023-08-15 15:03:11 +02:00
parent 03b6b79878
commit ff894bdfe4
5 changed files with 139 additions and 1 deletions

View File

@@ -0,0 +1,46 @@
#pragma once
#include <SimCore/Identifier.hpp>
#include <WHISPER/Messages/Message.hpp>
#include <cstdint>
#include <memory>
#include <string>
#include <SimCore/Messages/Protos/Control.pb.h>
namespace SimCore
{
class Control
{
public:
Control(const SimCore::Identifier SenderID,ControlType type,std::string data);
const ControlType Type;
std::string Data;
uint64_t Timestamp;
/// @brief return a WHISPER Message out of a simtrack object
/// @param parentID
/// @return WHISPER::Message
WHISPER::Message buildMessage();
/// @brief creates a SimTrack out of a whisper message
/// @param msg
/// @return SimTrack Oject
static std::unique_ptr<SimCore::Control> unpack(WHISPER::Message msg);
/// @brief creates a SimTrack out of a string message
/// @param msg
/// @return SimTrack Oject
static std::unique_ptr<SimCore::Control> unpack(std::string msgString);
private:
const SimCore::Identifier ID_;
};
}

View File

@@ -0,0 +1,9 @@
syntax = "proto3";
package messages.control;
message control{
uint32 type = 1;
string data = 2;
optional uint64 timestamp = 3;
}

View File

@@ -78,6 +78,16 @@ enum TrackKind : std::uint8_t {
};
enum ControlType : std::uint32_t
{
IDENTIFY,
START,
STOP,
CREATE_ENTITY,
DELETE_ENTITY,
GET_CONTROL
};