'How come onWSM method does not get invoke when sending messages from RSU?
I'm trying to send messages from RSU to the cars, basically, I want to flood the network, but for some I can not seem to see any message that are received by the car module.
I did try cleaning the project. I tried following the veins example but even that does not work for me.
RSU class
void RSU11p::handleSelfMsg(cMessage* msg) {
EV << "handleselfmessage in RSU11p" << endl;
WaveShortMessage* rsu_msg = new WaveShortMessage();
populateWSM(rsu_msg);
sendDown(rsu_msg->dup());
//scheduleAt(simTime() + 1, rsu_msg->dup());
}
MyVeinsApp class
void MyThesisApp::onWSM(WaveShortMessage* wsm)
{
findHost()->getDisplayString().updateWith("r=16,green");
EV << "received here from car or RSU?" << endl;
EV << wsm << endl;
}
When I run the simulation, I do not see "received here ..." printed in the console. Which does not make sense to me at all. What I'm doing wrong?
Any help is greatly appreciated. Thank you.
Solution 1:[1]
Is this the last version of veins? also, it is preferably if you tried your idea on the demo model provided by veins first (the example) which I highly recommend. (as creating your own classes needs some consistency with the other files).
Best regards,
Solution 2:[2]
Seems you are not invoking handleSelfMessage (). You need to call scheduleAt() in some method to invoke it.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | MB_7 |
| Solution 2 | Pasha M. |
