FIX: fixed bug with the usage of the id in control and fix a issue where the data class where invalid while creating with a data put in
This commit is contained in:
@@ -1,9 +1,11 @@
|
|||||||
syntax = "proto3";
|
syntax = "proto3";
|
||||||
|
import "Identifier.proto";
|
||||||
|
|
||||||
package messages.control;
|
package messages.control;
|
||||||
|
|
||||||
message control{
|
message control{
|
||||||
uint32 type = 1;
|
messages.track.Identifier Identifier = 1;
|
||||||
string data = 2;
|
uint32 type = 2;
|
||||||
optional uint64 timestamp = 3;
|
string data = 3;
|
||||||
|
optional uint64 timestamp = 4;
|
||||||
}
|
}
|
||||||
@@ -16,7 +16,7 @@ namespace SimCore
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Data(T val):mx(),data_(val),valid_(false),writeTime_(std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::system_clock::now().time_since_epoch()).count())
|
Data(T val):mx(),data_(val),valid_(true),writeTime_(std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::system_clock::now().time_since_epoch()).count())
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,6 +18,8 @@ namespace SimCore
|
|||||||
|
|
||||||
|
|
||||||
messages::control::control control;
|
messages::control::control control;
|
||||||
|
control.mutable_identifier()->set_uuid(ID_.getUUID());
|
||||||
|
control.mutable_identifier()->set_external(ID_.isExternal());
|
||||||
control.set_type(Type);
|
control.set_type(Type);
|
||||||
control.set_data(Data);
|
control.set_data(Data);
|
||||||
control.set_timestamp(Timestamp);
|
control.set_timestamp(Timestamp);
|
||||||
@@ -40,16 +42,16 @@ namespace SimCore
|
|||||||
{
|
{
|
||||||
m.payload().UnpackTo(&controlMsg);
|
m.payload().UnpackTo(&controlMsg);
|
||||||
|
|
||||||
SimCore::Identifier id(msg.senderUUID_);
|
SimCore::Identifier id(controlMsg.mutable_identifier());
|
||||||
|
|
||||||
ControlType kind = (SimCore::ControlType)controlMsg.type();
|
ControlType type = (SimCore::ControlType)controlMsg.type();
|
||||||
std::string data = controlMsg.data();
|
std::string data = controlMsg.data();
|
||||||
|
|
||||||
auto control = std::make_unique<Control>(id,kind,data);
|
auto control = std::make_unique<Control>(id,type,data);
|
||||||
if (controlMsg.has_timestamp()) control->Timestamp = controlMsg.timestamp();
|
if (controlMsg.has_timestamp()) control->Timestamp = controlMsg.timestamp();
|
||||||
|
LOG_S(INFO)<<control->Type;
|
||||||
// SimCore::Control control(id,kind,data);
|
// SimCore::Control control(id,kind,data);
|
||||||
return control;
|
return std::move(control);
|
||||||
|
|
||||||
}
|
}
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|||||||
Reference in New Issue
Block a user