I created a new safety messsage that is extended from the DemoSafetyMessage:
import veins.modules.messages.DemoSafetyMessage;
namespace veins;
packet NewSafetyMsg extends DemoSafetyMessage {
double senderAngle;
double PowRxdBmAvg;
}
I include this new message into the MyVeinsApp application and pass it to the onBSM function in both the .cc and .h files of MyVeinsApp.
#include "veins/modules/messages/NewSafetyMsg_m.h"
void onBSM(NewSafetyMsg* bsm) override; // in the .h file
#include "veins/modules/messages/NewSafetyMsg_m.h" //in the .cc file
However, I am getting this error in the .h file.
Description Resource Path Location Type ‘void veins::MyVeinsApp::onBSM(veins::NewSafetyMsg*)’ marked ‘override’, but does not override MyVeinsApp.h /veins/src/veins/modules/application/traci line 50 C/C++ Problem
I know that MyVeinsApp is extending the DemoBaseApplLayer which takes DemoSafetyMessage, So there should be no problem!! What I am doing wrong?
From TraciDemo11p example:
In .h file you need to keep the same method as that of parent class
void onBSM(DemoSafetyMessage* bsm) override;
In .cc file The extended message (i.e. NewSafetyMessage) should be dynamically casted to parent message type (i.e. DemoSafetyMessage)
void MyVeinsApp::onBSM(DemoSafetyMessage* bsm)
{
NewSafetyMessage* bsm1 = check_and_cast<NewSafetyMessage*>(bsm);
......
......