Commit 564b2e90 authored by Pierre NARVOR's avatar Pierre NARVOR
Browse files

[message] Made cmdId const and renamed it to msgId

parent 478d11b9
......@@ -13,9 +13,9 @@ namespace narval { namespace seatrac { namespace messages {
template <class T>
struct Message
{
CID_E cmdId;
const CID_E msgId;
Message() : cmdId(T::Identifier) {}
Message() : msgId(T::Identifier) {}
Message<T>& operator=(const std::vector<uint8_t>& other) {
......@@ -40,7 +40,7 @@ struct Message
template <typename T>
std::ostream& operator<<(std::ostream& os, const narval::seatrac::messages::Message<T>& msg)
{
os << "Message :\n- cmdId : " << msg.cmdId;
os << "Message :\n- msgId : " << msg.msgId;
return os;
}
......
......@@ -233,7 +233,6 @@ struct Status : public Message<Status>
<< CID_STATUS << ", got " << p[0] << ").";
throw std::runtime_error(oss.str());
}
this->cmdId = CID_STATUS;
p++;
// Copying fixed status content
......@@ -394,7 +393,7 @@ inline std::ostream& operator<<(std::ostream& os, const narval::seatrac::message
{
const char* prefix = "\n- ";
os << "Status : " << sizeof(msg)
<< prefix << "cmdId : " << msg.cmdId
<< prefix << "msgId : " << msg.msgId
<< prefix << "contentType : " << msg.contentType
<< prefix << "timestamp : " << msg.timestamp;
//<< prefix << "timestamp : " << msg.timestamp2;
......
......@@ -25,7 +25,7 @@ inline std::ostream& operator<<(std::ostream& os,
{
static const char* prefix = "\n- ";
os << "SysAlive :"
<< prefix << "cmdId : " << (uint32_t)msg.cmdId
<< prefix << "msgId : " << (uint32_t)msg.msgId
<< prefix << "alivedFor : " << (uint32_t)msg.alivedFor;
return os;
}
......
......@@ -31,7 +31,7 @@ inline std::ostream& operator<<(std::ostream& os,
{
static const char* prefix = "\n- ";
os << "SysInfo :"
<< prefix << "cmdId : " << (uint32_t)msg.cmdId
<< prefix << "msgId : " << (uint32_t)msg.msgId
<< prefix << "alivedFor : " << (uint32_t)msg.alivedFor
<< prefix << "currentApp : " << (uint32_t)msg.currentApp
<< prefix << "hardware : " << add_indentation(msg.hardware)
......
......@@ -32,7 +32,7 @@ inline std::ostream& operator<<(std::ostream& os,
{
static const char* prefix = "\n- ";
os << "SysReboot :"
<< prefix << "cmdId : " << (uint32_t)msg.cmdId
<< prefix << "msgId : " << (uint32_t)msg.msgId
<< prefix << "status : " << (uint32_t)msg.status;
return os;
}
......
......@@ -38,7 +38,7 @@ class SeatracNode : public SeatracSerial
{
std::cout << "Received : " << data.size() << " bytes." << std::endl;
seatrac_msgs::Status header = *reinterpret_cast<const seatrac_msgs::Status*>(data.data());
if(header.cmdId != CID_STATUS) {
if(header.msgId != CID_STATUS) {
return;
}
if(header.expected_size() != data.size()) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment