Search code examples
omnet++veins

How can I perform unicast communication in Veins?


While looking for various information on Stackoverflow, I read that Veins 5.x and above support Unicast communication.

I understood that unicast communication is possible through populateWSM(). However, I don't understand which LAddress::L2Type rcvId should be in the ID value of the second parameter.

Should I pass the ID value obtained through

getParentModule() -> getIndex()

Or is it necessary to pass the ID value of the left node list when running the simulation? If it's the latter, how can I get the ID value?


Solution

  • The demo implementation of Veins 5.1 uses the OMNeT++ module ID. For more robustness, I would recommend querying the MAC layer. See, for example, https://github.com/sommer/veins/blob/veins-5.1/src/veins/modules/application/ieee80211p/DemoBaseApplLayer.cc#L83