How do I send messages from one RSU to another?
I'm using version 5.2 of Veins with the default example, I just added one more RSU (one very close to the other). I can send messages from vehicles to vehicles, from vehicles to RSU, and from RSU to vehicles using the sendDown()
or sendDelayedDown()
methods.
However, when I try to send a message from one RSU to another, it simply does not work, as the destination RSU does not receive the message.
What should I do in my project to make it work? Or what is the correct method for sending messages between RSUs?
Thank you.
You must be forgetting to use the populateWSM() method:
populateWSM(wsm, ADDRESS);
In the initialize method you can put it like this:
void MyRSUClass::initialize(int stage) {
DemoBaseApplLayer::initialize(stage);
if (stage == 1) {
TraCIDemo11pMessage* wsm = new TraCIDemo11pMessage*();
populateWSM(wsm, OTHER_RSU_ADDRESS); // <------- here**
wsm->setSenderAddress(myId);
wsm->setDemoData("Message from RSU");
sendDown(wsm);
// OR, if you have problems with sendDown() method
// use send() ou sendDelayed() methods:
//// send(wsm, "lowerLayerOut");
//// sendDelayed(wsm, 2, "lowerLayerOut");
}
}