FIX: fixed some issues with the enumaration and updated the Message class

This commit is contained in:
Henry Winkel
2023-02-16 17:12:23 +01:00
parent 42f749be45
commit 0222903f46
2 changed files with 29 additions and 10 deletions

View File

@@ -29,13 +29,19 @@ namespace WHISPER {
/// owntrack informaton
OWN_TRACK,
/// raw track message
RAW_TRACK,
GROUND_TRUTH_TRACK,
/// radar track
RADAR_TRACK,
/// esm track
ESM_TRACK,
/// SENSOR Track message
SENSOR_TRACK,
/// simple data
SIMPLE,
///
STRINGDATA
///dummy string Data
STRINGDATA,
/// Command messages
COMMAND
}; // enum class EventType
@@ -56,7 +62,7 @@ namespace WHISPER {
};
enum SourceType : int32_t
enum SourceType : uint32_t
{
SIMCOMTROLER,
///
@@ -115,12 +121,15 @@ namespace WHISPER {
std::string serialize();
protected:
/**
* @brief adds the payload with type of shared_prt of protbuf::any
* @param std::shared_ptr<google::protobuf::Any>
*/
void addPayLoad(std::shared_ptr<google::protobuf::Any> any);
messages::header::Message getProtoMessage();
protected:
// void addPayLoad(std::string any);
/// protobuf message; our header message

View File

@@ -29,7 +29,8 @@ namespace WHISPER {
Message::Message(std::uint32_t parentId,std::uint32_t deviceId, MsgTopics topic, MsgType Type,SourceType src):
parentId_(parentId),deviceId_(deviceId),topic_(topic),sourceType_(src),msgType_(Type){
parentId_(parentId),deviceId_(deviceId),topic_(topic),sourceType_(src),msgType_(Type)
{
msg = messages::header::Message();
if(msg.IsInitialized())
@@ -46,12 +47,19 @@ namespace WHISPER {
std::string Message::getPayloadString(){
std::string Message::getPayloadString()
{
return payloadString_;
}
messages::header::Message Message::getProtoMessage()
{
return msg;
}
void Message::addPayLoad(std::shared_ptr<google::protobuf::Any> payload){
void Message::addPayLoad(std::shared_ptr<google::protobuf::Any> payload)
{
payload_ = payload;
payloadString_ = payload->SerializeAsString();
@@ -63,7 +71,9 @@ namespace WHISPER {
std::string Message::serialize(){
std::string Message::serialize()
{
std::string serializedMessage;
if (msg.IsInitialized()) {