ADD: added controlmessage
This commit is contained in:
46
include/SimCore/Messages/Control.hpp
Normal file
46
include/SimCore/Messages/Control.hpp
Normal 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_;
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
9
include/SimCore/Messages/Protos/Control.proto
Normal file
9
include/SimCore/Messages/Protos/Control.proto
Normal file
@@ -0,0 +1,9 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package messages.control;
|
||||
|
||||
message control{
|
||||
uint32 type = 1;
|
||||
string data = 2;
|
||||
optional uint64 timestamp = 3;
|
||||
}
|
||||
@@ -78,6 +78,16 @@ enum TrackKind : std::uint8_t {
|
||||
|
||||
};
|
||||
|
||||
enum ControlType : std::uint32_t
|
||||
{
|
||||
IDENTIFY,
|
||||
START,
|
||||
STOP,
|
||||
CREATE_ENTITY,
|
||||
DELETE_ENTITY,
|
||||
GET_CONTROL
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user