FIX: fixed some bugs

ADD: added raw_track message frame
This commit is contained in:
Henry Winkel
2022-11-15 15:55:24 +01:00
parent cf1800ffba
commit 8fcf4244b0
25 changed files with 1799 additions and 158 deletions

View File

@@ -0,0 +1,56 @@
#include "WHISPER/Messages/Message.hpp"
#include "WHISPER/Messages/Protos/raw_track.pb.h"
#include <WHISPER/Messages/Track.hpp>
#include <memory>
namespace WHISPER {
RawTrack::RawTrack(std::string receivedMessage){
msg = messages::header::Message();
try {
msg.ParseFromString(receivedMessage);
topic_ = msg.topic();
sourceType_ = msg.sourcetype();
msgType_ = msg.msgtype();
trackMessage = messages::raw_track::RawTrack();
if ( msg.payload_size()) {
if (msg.payload().begin()->Is<messages::raw_track::RawTrack>()) {
msg.payload().begin()->UnpackTo(&trackMessage);
}
}
trackNo = trackMessage.trackno();
} catch (const std::exception& e) {
LOG_S(ERROR)<<e.what();
}
}
RawTrack::RawTrack(std::uint32_t deviceID,WHISPER::MsgTopics topic, SourceType src,std::uint32_t trackNo):
Message(deviceID,WHISPER::MsgTopics::TRACK,WHISPER::RAW_TRACK,src),trackNo(trackNo)
{
trackMessage = messages::raw_track::RawTrack();
trackMessage.set_trackno(trackNo);
auto payloadMessage = std::make_shared<google::protobuf::Any>();
payloadMessage->PackFrom(trackMessage);
addPayLoad(payloadMessage);
}
}