0

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.

Abubakar Saad
  • 202
  • 1
  • 2
  • 13

2 Answers2

0

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,

MB_7
  • 103
  • 6
  • I did tried that, but that does not work either. All I want to see if I can EV a statement inside onWSM (for RSU class), so when the RSU receive message I can process that message. – Abubakar Saad Oct 07 '19 at 13:03
  • Unless you made all the necessary changes, "MyThesisApp::onWSM" method won't work without being invoked, but since you said that you already tried your code on an already working demo, I do not have a clue. I hope you find the anomaly soon... Best. – MB_7 Oct 09 '19 at 16:54
  • Did you solve it. – Pasha M. Feb 14 '22 at 07:23
0

Seems you are not invoking handleSelfMessage (). You need to call scheduleAt() in some method to invoke it.

Pasha M.
  • 340
  • 1
  • 12